public function testProxyFactorySetsProxyMetadata() { $proxy = $this->dm->getReference($this->type, 1); $proxyClass = get_class($proxy); $this->assertTrue($this->dm->getClassMetadataFactory()->hasMetadataFor($proxyClass), "Proxy class '" . $proxyClass . "' should be registered as metadata."); $this->assertSame($this->dm->getClassMetadata($proxyClass), $this->dm->getClassMetadata($this->type), "Metadata instances of proxy class and real instance have to be the same."); }
public function testDeleteProxy() { $user = $this->dm->getReference($this->type, 1); $this->dm->remove($user); $this->dm->flush(); $this->dm->clear(); $userRemoved = $this->dm->find($this->type, 1); $this->assertNull($userRemoved, "Have to delete user object!"); }
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"); }