]> BookStack Code Mirror - bookstack/blobdiff - tests/TestCase.php
Cleaned testing service provider usage
[bookstack] / tests / TestCase.php
index 0926b0dcc171d9367ead165995ace45fa779bf31..5941941681d75bca4a9fdfdc2fe5c5d84de4f795 100644 (file)
@@ -22,6 +22,7 @@ use GuzzleHttp\Client;
 use GuzzleHttp\Handler\MockHandler;
 use GuzzleHttp\HandlerStack;
 use GuzzleHttp\Middleware;
+use Illuminate\Contracts\Console\Kernel;
 use Illuminate\Foundation\Testing\DatabaseTransactions;
 use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
 use Illuminate\Http\JsonResponse;
@@ -48,6 +49,21 @@ abstract class TestCase extends BaseTestCase
      */
     protected string $baseUrl = 'http://localhost';
 
+    /**
+     * Creates the application.
+     *
+     * @return \Illuminate\Foundation\Application
+     */
+    public function createApplication()
+    {
+        /** @var \Illuminate\Foundation\Application  $app */
+        $app = require __DIR__ . '/../bootstrap/app.php';
+        $app->register(TestServiceProvider::class);
+        $app->make(Kernel::class)->bootstrap();
+
+        return $app;
+    }
+
     /**
      * Set the current user context to be an admin.
      */