Speed up phpunit tests by using dama/doctrine-test-bundle

This commit is contained in:
David Maicher 2017-02-13 21:25:28 +01:00
parent 8800f741a2
commit 2fdd00a0bc
7 changed files with 210 additions and 213 deletions

View file

@ -78,4 +78,12 @@ class TestAppKernel extends AppKernel
{
return MockerContainer::class;
}
/**
* {@inheritdoc}
*/
public function registerBundles()
{
return array_merge(parent::registerBundles(), [new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle()]);
}
}

View file

@ -15,7 +15,6 @@ framework:
doctrine:
dbal:
dbname: "%database_name%_test"
driver_class: Sylius\Tests\Driver\MySqlDriver
monolog:
handlers:

View file

@ -89,7 +89,8 @@
"phpspec/phpspec": "^3.2",
"phpunit/phpunit": "^5.6",
"se/selenium-server-standalone": "^2.52",
"stripe/stripe-php": "^4.1"
"stripe/stripe-php": "^4.1",
"dama/doctrine-test-bundle": "^1.0"
},
"replace": {
"sylius/addressing": "self.version",

339
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -15,4 +15,8 @@
<server name="KERNEL_CLASS_PATH" value="/app/TestAppKernel.php" />
<server name="IS_DOCTRINE_ORM_SUPPORTED" value="true" />
</php>
<listeners>
<listener class="\DAMA\DoctrineTestBundle\PHPUnit\PHPUnitStaticDbConnectionListener" />
</listeners>
</phpunit>

View file

@ -1,34 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Tests\Driver;
use Doctrine\DBAL\Driver\PDOMySql\Driver;
final class MySqlDriver extends Driver
{
/**
* @var Driver
*/
private static $connection;
/**
* {@inheritdoc}
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{
if (null === self::$connection) {
self::$connection = parent::connect($params, $username, $password, $driverOptions);
}
return self::$connection;
}
}

View file

@ -1,34 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Tests\Driver;
use Doctrine\DBAL\Driver\PDOPgSql\Driver;
final class PgSqlDriver extends Driver
{
/**
* @var Driver
*/
private static $connection;
/**
* {@inheritdoc}
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{
if (null === self::$connection) {
self::$connection = parent::connect($params, $username, $password, $driverOptions);
}
return self::$connection;
}
}