1
0
mirror of synced 2024-12-13 06:46:03 +03:00

test @PostLoad

This commit is contained in:
Fabio B. Silva 2012-07-30 22:35:41 -03:00 committed by fabio.silva
parent 315f7ba43b
commit dbd0697c2c

View File

@ -47,7 +47,32 @@ class EntityListenersDispatcherTest extends \Doctrine\Tests\OrmFunctionalTestCas
public function testPostLoadListeners()
{
$this->markTestIncomplete();
$fix = new CompanyFixContract();
$fix->setFixPrice(2000);
$this->_em->persist($fix);
$this->_em->flush();
$this->_em->clear();
ContractSubscriber::$postLoadCalls = array();
$dql = "SELECT f FROM Doctrine\Tests\Models\Company\CompanyFixContract f WHERE f.id = ?1";
$fix = $this->_em->createQuery($dql)->setParameter(1, $fix->getId())->getSingleResult();
$this->assertCount(1,ContractSubscriber::$instances);
$this->assertCount(1,ContractSubscriber::$postLoadCalls);
$this->assertSame($fix, ContractSubscriber::$postLoadCalls[0][0]);
$this->assertInstanceOf(
'Doctrine\Tests\Models\Company\CompanyFixContract',
ContractSubscriber::$postLoadCalls[0][0]
);
$this->assertInstanceOf(
'Doctrine\ORM\Event\LifecycleEventArgs',
ContractSubscriber::$postLoadCalls[0][1]
);
}
public function testPrePersistListeners()