Example #1
0
 /**
  * Tests the fromArray method.
  */
 public function testFromArray()
 {
     $contact = new Contact();
     $contact->fromArray(array('title' => 'mr', 'firstName' => 'Rémi', 'lastName' => 'Marseille', 'email' => '*****@*****.**', 'subject' => 'subject', 'message' => 'message', 'createdAt' => '2013-07-11T10:07:00+02:00'));
     $this->assertSame('mr', $contact->getTitle());
     $this->assertSame('Rémi', $contact->getFirstName());
     $this->assertSame('Marseille', $contact->getLastName());
     $this->assertSame('*****@*****.**', $contact->getEmail());
     $this->assertSame('subject', $contact->getSubject());
     $this->assertSame('message', $contact->getMessage());
     $this->assertSame('2013-07-11T10:07:00+02:00', $contact->getCreatedAt()->format('c'));
     $contact = new Contact();
     $contact->fromArray(array('title' => null));
     $this->assertNull($contact->getTitle());
 }