mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Speed up phpunit tests by using dama/doctrine-test-bundle
This commit is contained in:
parent
8800f741a2
commit
2fdd00a0bc
7 changed files with 210 additions and 213 deletions
|
|
@ -78,4 +78,12 @@ class TestAppKernel extends AppKernel
|
|||
{
|
||||
return MockerContainer::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function registerBundles()
|
||||
{
|
||||
return array_merge(parent::registerBundles(), [new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle()]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ framework:
|
|||
doctrine:
|
||||
dbal:
|
||||
dbname: "%database_name%_test"
|
||||
driver_class: Sylius\Tests\Driver\MySqlDriver
|
||||
|
||||
monolog:
|
||||
handlers:
|
||||
|
|
|
|||
|
|
@ -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
339
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue