Allow passing a connection while creating an entity manager
Also removing unsed arguments.
This commit is contained in:
parent
1bf884970f
commit
99df158fc8
@ -3,6 +3,7 @@
|
||||
namespace Doctrine\Tests;
|
||||
|
||||
use Doctrine\Common\Cache\ArrayCache;
|
||||
use Doctrine\DBAL\Driver\Connection;
|
||||
use Doctrine\DBAL\Driver\PDOSqlite\Driver as SqliteDriver;
|
||||
use Doctrine\DBAL\Logging\DebugStack;
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
@ -674,12 +675,11 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
|
||||
/**
|
||||
* Gets an EntityManager for testing purposes.
|
||||
*
|
||||
* @param \Doctrine\ORM\Configuration $config The Configuration to pass to the EntityManager.
|
||||
* @param \Doctrine\Common\EventManager $eventManager The EventManager to pass to the EntityManager.
|
||||
* @return EntityManager
|
||||
*
|
||||
* @return \Doctrine\ORM\EntityManager
|
||||
* @throws \Doctrine\ORM\ORMException
|
||||
*/
|
||||
protected function _getEntityManager($config = null, $eventManager = null) {
|
||||
protected function _getEntityManager(Connection $connection = null) {
|
||||
// NOTE: Functional tests use their own shared metadata cache, because
|
||||
// the actual database platform used during execution has effect on some
|
||||
// metadata mapping behaviors (like the choice of the ID generation).
|
||||
@ -732,13 +732,17 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
|
||||
$this->isSecondLevelCacheEnabled = true;
|
||||
}
|
||||
|
||||
$config->setMetadataDriverImpl($config->newDefaultAnnotationDriver(
|
||||
[
|
||||
realpath(__DIR__ . '/Models/Cache'),
|
||||
realpath(__DIR__ . '/Models/GeoNames')
|
||||
], true));
|
||||
$config->setMetadataDriverImpl(
|
||||
$config->newDefaultAnnotationDriver(
|
||||
[
|
||||
realpath(__DIR__ . '/Models/Cache'),
|
||||
realpath(__DIR__ . '/Models/GeoNames')
|
||||
],
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$conn = static::$_sharedConn;
|
||||
$conn = $connection ?: static::$_sharedConn;
|
||||
$conn->getConfiguration()->setSQLLogger($this->_sqlLoggerStack);
|
||||
|
||||
// get rid of more global state
|
||||
|
Loading…
x
Reference in New Issue
Block a user