Ensured same testing database is used to generate with entities and to run functional tests

This commit is contained in:
Alejandro Celaya 2017-10-23 12:19:28 +02:00
parent 0bd9f1e19f
commit 91442a3379
4 changed files with 13 additions and 3 deletions

View file

@ -13,7 +13,6 @@ php:
before_install:
- phpenv config-add data/infra/travis-php/memcached.ini
- phpenv config-add data/infra/travis-php/apcu.ini
- phpenv config-add data/infra/travis-php/sqlite.ini
before_script:
- composer self-update

View file

@ -24,7 +24,7 @@ if ($isTest) {
$config = $container->get('config');
$config['entity_manager']['connection'] = [
'driver' => 'pdo_sqlite',
'memory' => true,
'path' => realpath(sys_get_temp_dir()) . '/shlink-tests.db',
];
$container->setService('config', $config);
}

View file

@ -1 +0,0 @@
extension="sqlite.so"

View file

@ -10,8 +10,20 @@ if (! file_exists('.env')) {
touch('.env');
}
$shlinkDbPath = realpath(sys_get_temp_dir()) . '/shlink-tests.db';
if (file_exists($shlinkDbPath)) {
unlink($shlinkDbPath);
}
/** @var ServiceManager $sm */
$sm = require __DIR__ . '/config/container.php';
$sm->setAllowOverride(true);
$config = $sm->get('config');
$config['entity_manager']['connection'] = [
'driver' => 'pdo_sqlite',
'path' => $shlinkDbPath,
];
$sm->setService('config', $config);
// Create database
$process = new Process('vendor/bin/doctrine orm:schema-tool:create --no-interaction -q --test', __DIR__);