/** * @depends testProxyProperty */ public function testProxyUniqueness() { $user = new CmsUser(); $user->name = 'Dominik'; $user->username = '******'; $user->status = 'developer'; $this->dm->persist($user); $this->dm->flush(); $this->dm->clear(); $user = $this->dm->getReference(get_class($user), $user->id); $this->assertEquals('Dominik', $user->name, "User is not loaded on demand"); $this->assertSame($this->dm->getReference(get_class($user), $user->id), $user, 'Getting the proxy twice results in a copy'); }
public function testProxyIsIgnored() { $user = new CmsUser(); $user->name = 'Dominik'; $user->username = '******'; $user->status = 'developer'; $this->dm->persist($user); $this->dm->flush(); $this->dm->clear(); $user = $this->dm->getReference(get_class($user), $user->id); $otherUser = new CmsUser(); $otherUser->name = 'Dominik2'; $otherUser->username = '******'; $otherUser->status = 'developer'; $this->dm->persist($otherUser); $this->dm->flush($user); $this->assertTrue($this->dm->contains($otherUser), "Other user is contained in DocumentManager"); $this->assertTrue($otherUser->id != null, "other user has no id"); }