setMetadataCacheImpl(self::getSharedMetadataCacheImpl()); $eventManager = new \Doctrine\Common\EventManager(); $connectionOptions = array( 'driverClass' => 'Doctrine\Tests\Mocks\DriverMock', 'wrapperClass' => 'Doctrine\Tests\Mocks\ConnectionMock', 'user' => 'john', 'password' => 'wayne' ); return \Doctrine\ORM\EntityManager::create($connectionOptions, 'mockEM', $config, $eventManager); } private static function getSharedMetadataCacheImpl() { if (is_null(self::$_metadataCacheImpl)) { self::$_metadataCacheImpl = new \Doctrine\ORM\Cache\ArrayCache; } return self::$_metadataCacheImpl; } }