Example #1
0
 public function testCreate()
 {
     $user = new User();
     $user->setId(1);
     $user->setEmail('*****@*****.**');
     $user->setPassword('xxxx');
     $user->setFirstName('John');
     $user->setLastName('Doe');
     $user->addRole(new UserRole());
     $user->addVehicle(new Vehicle());
     $this->assertSame(null, $user->getUpdated());
     $user->setUpdated();
     $user->preUpdate();
     $this->assertSame(1, $user->getId());
     $this->assertTrue($user->getCreated() instanceof \DateTime);
     $this->assertTrue($user->getUpdated() instanceof \DateTime);
     $this->assertSame('*****@*****.**', $user->getEmail());
     $this->assertSame('John', $user->getFirstName());
     $this->assertSame('Doe', $user->getLastName());
     $this->assertTrue($user->getRoles()[0] instanceof UserRole);
     $this->assertTrue($user->getVehicles()[0] instanceof Vehicle);
 }