예제 #1
0
 public function testFind()
 {
     $user = new UserAudit("beberlei");
     $this->em->persist($user);
     $this->em->flush();
     $reader = $this->auditManager->createAuditReader($this->em);
     $auditUser = $reader->find(get_class($user), $user->getId(), 1);
     $this->assertInstanceOf(get_class($user), $auditUser, "Audited User is also a User instance.");
     $this->assertEquals($user->getId(), $auditUser->getId(), "Ids of audited user and real user should be the same.");
     $this->assertEquals($user->getName(), $auditUser->getName(), "Name of audited user and real user should be the same.");
     $this->assertFalse($this->em->contains($auditUser), "Audited User should not be in the identity map.");
     $this->assertNotSame($user, $auditUser, "User and Audited User instances are not the same.");
 }