Doctrine\SkeletonMapper\Tests\Functional\BaseImplementationTest::testEvents PHP Method

testEvents() public method

public testEvents ( )
    public function testEvents()
    {
        $user = $this->createTestObject();
        $user->setId(3);
        $this->objectManager->persist($user);
        $this->objectManager->flush();
        $expected = array(Events::prePersist, Events::preFlush, Events::onFlush, Events::postPersist, Events::postFlush);
        $this->assertEquals($expected, $this->eventTester->called);
        $this->eventTester->called = array();
        $user->setUsername('jmikola');
        $this->objectManager->flush();
        $expected = array(Events::preUpdate, Events::preFlush, Events::onFlush, Events::postUpdate, Events::postFlush);
        $this->assertEquals($expected, $this->eventTester->called);
        $this->eventTester->called = array();
        $this->objectManager->clear();
        $expected = array(Events::onClear);
        $this->assertEquals($expected, $this->eventTester->called);
        $this->eventTester->called = array();
        $this->objectManager->remove($user);
        $this->objectManager->flush();
        $expected = array(Events::preRemove, Events::preFlush, Events::onFlush, Events::postRemove, Events::postFlush);
        $this->assertEquals($expected, $this->eventTester->called);
        $this->eventTester->called = array();
        $user = $this->objectManager->find($this->userClassName, 1);
        $expected = array(Events::preLoad, Events::postLoad);
        $this->assertEquals($expected, $this->eventTester->called);
    }