/** * @covers Core\Entity\Administrator::refreshTimeStamps */ public function testRefreshTimeStamps() { $administrator = new Administrator($this->mockEntityManager); $administrator->refreshTimeStamps(); $createdAt = $administrator->getCreatedAt(); $this->assertNotNull($createdAt); $this->assertNull($administrator->getUpdatedAt()); $administrator->refreshTimeStamps(); $updatedAt = $administrator->getUpdatedAt(); $this->assertNotNull($updatedAt); $this->assertEquals($createdAt, $administrator->getCreatedAt()); }
/** * Creates lisUser and associates to given Administrator * * @param \Core\Entity\Administrator $administrator * @param array|null $data * * @return \Core\Entity\LisUser */ protected function CreateAdministratorUser(\Core\Entity\Administrator $administrator, $data = null) { $d = $data; if (!$d) { //if $data was not given $d = ['personalCode' => $administrator->getPersonalCode(), 'password' => uniqid(), 'email' => uniqid() . '@asd.ee']; } $lisUser = $this->em->getRepository('Core\\Entity\\LisUser')->Create($d); $administrator->setLisUser($lisUser); //associate $this->em->persist($administrator); $this->em->flush($administrator); return $lisUser; }
/** * @covers Core\Entity\Administrator::setUpdatedAt * @covers Core\Entity\Administrator::getUpdatedAt */ public function testSetGetUpdatedAt() { $dt = new DateTime(); $this->administrator->setUpdatedAt($dt); $this->assertEquals($dt, $this->administrator->getUpdatedAt()); }