/** * 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::setLisUser * @covers Core\Entity\Administrator::getLisUser */ public function testSetGetLisUser() { $mockLisUser = $this->getMockBuilder('Core\\Entity\\LisUser')->getMock(); $this->administrator->setLisUser($mockLisUser); $this->assertEquals($mockLisUser, $this->administrator->getLisUser()); }