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

testLifecycleCallbacks() public method

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