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

testReferences() public method

public testReferences ( )
    public function testReferences()
    {
        $user = $this->objectManager->find($this->userClassName, 1);
        $profile = new Profile();
        $profile->setName('Jonathan H. Wage');
        $user->setProfile($profile);
        $this->objectManager->persist($profile);
        $this->objectManager->flush();
        $this->objectManager->clear();
        $profile = $this->objectManager->find($this->profileClassName, 1);
        $this->assertEquals('Jonathan H. Wage', $profile->getName());
        $user = $this->objectManager->find($this->userClassName, 1);
        $this->assertSame($profile, $user->getProfile());
        $profile = new Profile();
        $profile->setName('John Caplan');
        $user = $this->createTestObject();
        $user->setProfile($profile);
        $this->objectManager->persist($profile);
        $this->objectManager->persist($user);
        $this->objectManager->flush();
        $this->objectManager->clear();
        $user = $this->objectManager->find($this->userClassName, $user->getId());
        $this->assertEquals('John Caplan', $user->getProfile()->getName());
    }