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: before_install:
- phpenv config-add data/infra/travis-php/memcached.ini - 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/apcu.ini
- phpenv config-add data/infra/travis-php/sqlite.ini
before_script: before_script:
- composer self-update - composer self-update

View File

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

View File

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

View File

@ -10,8 +10,20 @@ if (! file_exists('.env')) {
touch('.env'); touch('.env');
} }
$shlinkDbPath = realpath(sys_get_temp_dir()) . '/shlink-tests.db';
if (file_exists($shlinkDbPath)) {
unlink($shlinkDbPath);
}
/** @var ServiceManager $sm */ /** @var ServiceManager $sm */
$sm = require __DIR__ . '/config/container.php'; $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 // Create database
$process = new Process('vendor/bin/doctrine orm:schema-tool:create --no-interaction -q --test', __DIR__); $process = new Process('vendor/bin/doctrine orm:schema-tool:create --no-interaction -q --test', __DIR__);