1
0
mirror of synced 2025-01-08 10:07:10 +03:00
doctrine2/tests/Orm/EntityManagerFactoryTest.php

41 lines
1.1 KiB
PHP

<?php
require_once 'lib/DoctrineTestInit.php';
#namespace Doctrine::Tests::ORM;
/**
* EntityManagerFactory tests.
*/
class Orm_EntityManagerFactoryTest extends Doctrine_OrmTestCase
{
private $_emf;
private $_mockOptions = array('driver' => 'mock', 'user' => '', 'password' => '');
protected function setUp() {
parent::setUp();
$this->_emf = $this->sharedFixture['emf'];
}
protected function tearDown() {
parent::tearDown();
}
private function _createNamedManager($name)
{
return $this->_emf->createEntityManager($this->_mockOptions, $name);
}
public function testBindingEntityToNamedManager()
{
$myEM = $this->_createNamedManager('myEM');
$this->_emf->bindEntityToManager('SomeEntity', 'myEM');
$this->assertSame($myEM, $this->_emf->getEntityManager('SomeEntity'));
$this->_emf->releaseEntityManager('myEM');
}
public function testStaticLookup()
{
$this->assertTrue(Doctrine_EntityManagerFactory::getManager() instanceof Doctrine_EntityManager);
}
}