setMetadataCacheImpl(self::getSharedMetadataCacheImpl()); $config->setQueryCacheImpl(self::getSharedQueryCacheImpl()); $eventManager = new \Doctrine\Common\EventManager(); if ($conn === null) { $conn = array( 'driverClass' => 'Doctrine\Tests\Mocks\DriverMock', 'wrapperClass' => 'Doctrine\Tests\Mocks\ConnectionMock', 'user' => 'john', 'password' => 'wayne' ); } if (is_array($conn)) { $conn = \Doctrine\DBAL\DriverManager::getConnection($conn, $config, $eventManager); } return \Doctrine\Tests\Mocks\EntityManagerMock::create($conn, $config, $eventManager); } private static function getSharedMetadataCacheImpl() { if (self::$_metadataCacheImpl === null) { self::$_metadataCacheImpl = new \Doctrine\Common\Cache\ArrayCache; } return self::$_metadataCacheImpl; } private static function getSharedQueryCacheImpl() { if (self::$_queryCacheImpl === null) { self::$_queryCacheImpl = new \Doctrine\Common\Cache\ArrayCache; } return self::$_queryCacheImpl; } }