Exemplo n.º 1
0
 /**
  * Test User getters and setters.
  */
 public function testGettersAndSetters()
 {
     // Setup.
     $data = $this->userData;
     $user = new User();
     // Set.
     $user->setId($data['id']);
     $user->setName($data['name']);
     $user->setRole($data['role']);
     $user->setEmail($data['email']);
     $user->setPhone($data['phone']);
     $user->setCreatedAt($data['created_at']);
     $user->setUpdatedAt($data['updated_at']);
     // Test get.
     $this->assertEquals($data['id'], $user->getId());
     $this->assertEquals($data['name'], $user->getName());
     $this->assertEquals($data['role'], $user->getRole());
     $this->assertEquals($data['email'], $user->getEmail());
     $this->assertEquals($data['phone'], $user->getPhone());
     $this->assertInstanceOf('DateTime', $user->getCreatedAt());
     $this->assertEquals($data['created_at'], $user->getCreatedAt());
     $this->assertInstanceOf('DateTime', $user->getUpdatedAt());
     $this->assertEquals($data['updated_at'], $user->getUpdatedAt());
 }