1
0
mirror of synced 2025-01-31 20:41:44 +03:00

Merge branch 'hotfix/DDC-3123-test-assertion-simplification'

This commit is contained in:
Marco Pivetta 2014-05-15 17:37:55 +02:00
commit 91df8f5649

View File

@ -28,17 +28,13 @@ class DDC3123Test extends \Doctrine\Tests\OrmFunctionalTestCase
$this->_em->persist($user); $this->_em->persist($user);
$uow->scheduleExtraUpdate($user, array('name' => 'changed name')); $uow->scheduleExtraUpdate($user, array('name' => 'changed name'));
$listener = $this->getMock('stdClass', array('postFlush')); $listener = $this->getMock('stdClass', array(Events::postFlush));
$listener $listener
->expects($this->once()) ->expects($this->once())
->method('postFlush') ->method(Events::postFlush)
->will($this->returnCallback(function () use ($uow, $test) { ->will($this->returnCallback(function () use ($uow, $test) {
$extraUpdatesReflection = new \ReflectionProperty($uow, 'extraUpdates'); $test->assertAttributeEmpty('extraUpdates', $uow, 'ExtraUpdates are reset before postFlush');
$extraUpdatesReflection->setAccessible(true);
$test->assertEmpty($extraUpdatesReflection->getValue($uow));
})); }));
$this->_em->getEventManager()->addEventListener(Events::postFlush, $listener); $this->_em->getEventManager()->addEventListener(Events::postFlush, $listener);