First version of functional tests working

This commit is contained in:
Alejandro Celaya
2017-10-23 11:20:55 +02:00
parent e282521040
commit c2feffa50c
5 changed files with 96 additions and 14 deletions

View File

@@ -1,7 +1,6 @@
<?php
declare(strict_types=1);
use Doctrine\ORM\EntityManagerInterface;
use ShlinkioTest\Shlink\Common\DbUnit\DatabaseTestCase;
use Symfony\Component\Process\Process;
use Zend\ServiceManager\ServiceManager;
@@ -13,17 +12,10 @@ if (! file_exists('.env')) {
/** @var ServiceManager $sm */
$sm = require __DIR__ . '/config/container.php';
$sm->setAllowOverride(true);
$config = $sm->get('config');
$config['entity_manager']['connection'] = [
'driver' => 'pdo_sqlite',
'memory' => true,
];
$sm->setService('config', $config);
$process = new Process('vendor/bin/doctrine-migrations migrations:migrate --no-interaction -q', __DIR__);
// Create database
$process = new Process('vendor/bin/doctrine orm:schema-tool:create --no-interaction -q --test', __DIR__);
$process->inheritEnvironmentVariables()
->setTimeout(60 * 5) // 5 minutes
->mustRun();
DatabaseTestCase::$em = $sm->get(EntityManagerInterface::class);
DatabaseTestCase::$em = $sm->get('em');