1
0
mirror of synced 2025-03-21 07:23:55 +03:00

Corrected test: metadata should be retrieved from a specific entity manager

Metadata is subject to modification depending on the active database platform (generator strategies, usually),
therefore it is not safe to pull it from an entity manager and sharing metadata across multiple entity managers.
This commit is contained in:
Marco Pivetta 2015-01-18 02:32:02 +01:00
parent 39766e645c
commit 7cba76082e

View File

@ -215,21 +215,23 @@ class MergeProxiesTest extends OrmFunctionalTestCase
array(realpath(__DIR__ . '/../../Models/Cache')),
true
));
$config->setSQLLogger($logger);
// always runs on sqlite to prevent multi-connection race-conditions with the test suite
// multi-connection is not relevant for the purpose of checking locking here, but merely
// to stub out DB-level access and intercept it
$connection = DriverManager::getConnection(array(
'driver' => 'pdo_sqlite',
'memory' => true
));
$connection = DriverManager::getConnection(
array(
'driver' => 'pdo_sqlite',
'memory' => true
),
$config
);
$connection->getConfiguration()->setSQLLogger($logger);
$entityManager = EntityManager::create($connection, $config);
(new SchemaTool($entityManager))
->createSchema([$this->_em->getClassMetadata(DateTimeModel::CLASSNAME)]);
(new SchemaTool($entityManager))->createSchema([$entityManager->getClassMetadata(DateTimeModel::CLASSNAME)]);
return $entityManager;
}