diff --git a/tests/Client.php b/tests/Client.php index 8115591..34fb720 100644 --- a/tests/Client.php +++ b/tests/Client.php @@ -3,6 +3,7 @@ namespace Tests; +use App\Database\Migrator; use GuzzleHttp\Psr7\ServerRequest; use Symfony\Component\BrowserKit\AbstractBrowser; use Symfony\Component\BrowserKit\Response; @@ -12,7 +13,11 @@ class Client extends AbstractBrowser protected function doRequest($request) { /** @var \Slim\App $app */ - $app = require_once BASE_DIR.'bootstrap/app.php'; + $app = require BASE_DIR.'bootstrap/app.php'; + + $migrator = new Migrator($app->getContainer()->get('database'), BASE_DIR.'resources/schemas'); + $migrator->migrate(); + $response = $app->handle(new ServerRequest($request->getMethod(), $request->getUri(), [], $request->getContent())); return new Response($response->getBody()->getContents(), $response->getStatusCode(), $response->getHeaders()); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 5edef49..08a2e94 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,6 +2,6 @@ define('BASE_DIR', realpath(__DIR__.'/../').DIRECTORY_SEPARATOR); define('PLATFORM_VERSION', json_decode(file_get_contents(BASE_DIR.'composer.json'))->version); -define('CONFIG_FILE', BASE_DIR.'tests/config_test.php'); +define('CONFIG_FILE', BASE_DIR.'tests/config.test.php'); ob_start(); diff --git a/tests/config.test.php b/tests/config.test.php new file mode 100644 index 0000000..ca87db8 --- /dev/null +++ b/tests/config.test.php @@ -0,0 +1,16 @@ + 'http://localhost', + 'debug' => true, + 'db' => + [ + 'connection' => 'sqlite', + 'dsn' => ':memory:', + ], + 'storage' => + [ + 'driver' => 'local', + 'path' => 'storage/test', + ], +]; \ No newline at end of file diff --git a/tests/config_test.php b/tests/config_test.php deleted file mode 100644 index 7687116..0000000 --- a/tests/config_test.php +++ /dev/null @@ -1,17 +0,0 @@ - true, -// 'db' => -// [ -// 'connection' => 'sqlite', -// 'dsn' => ':memory:', -// 'username' => null, -// 'password' => null, -// ], - 'storage' => - [ - 'driver' => 'local', - 'path' => 'storage/test', - ], -]; \ No newline at end of file