2017-10-22 19:03:35 +03:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-01-21 00:08:32 +03:00
|
|
|
use Psr\Container\ContainerInterface;
|
2019-01-26 11:09:49 +03:00
|
|
|
use ShlinkioTest\Shlink\Common\DbTest\DatabaseTestCase;
|
2017-10-22 19:03:35 +03:00
|
|
|
use Symfony\Component\Process\Process;
|
|
|
|
|
|
|
|
// Create an empty .env file
|
|
|
|
if (! file_exists('.env')) {
|
|
|
|
touch('.env');
|
|
|
|
}
|
|
|
|
|
2017-10-23 13:19:28 +03:00
|
|
|
$shlinkDbPath = realpath(sys_get_temp_dir()) . '/shlink-tests.db';
|
|
|
|
if (file_exists($shlinkDbPath)) {
|
|
|
|
unlink($shlinkDbPath);
|
|
|
|
}
|
|
|
|
|
2019-01-21 00:08:32 +03:00
|
|
|
/** @var ContainerInterface $container */
|
2019-01-26 11:09:49 +03:00
|
|
|
$container = require __DIR__ . '/../test-container.php';
|
2017-10-22 19:03:35 +03:00
|
|
|
|
2017-10-23 12:20:55 +03:00
|
|
|
// Create database
|
2019-01-26 11:09:49 +03:00
|
|
|
$process = new Process(['vendor/bin/doctrine', 'orm:schema-tool:create', '--no-interaction', '-q', '--test']);
|
2017-10-22 19:03:35 +03:00
|
|
|
$process->inheritEnvironmentVariables()
|
|
|
|
->mustRun();
|
|
|
|
|
2019-01-21 00:08:32 +03:00
|
|
|
DatabaseTestCase::$em = $container->get('em');
|