예제 #1
0
 public function testGetPrimaryAddress()
 {
     $contact = new Contact();
     $this->assertNull($contact->getPrimaryAddress());
     $address = new ContactAddress();
     $contact->addAddress($address);
     $this->assertNull($contact->getPrimaryAddress());
     $address->setPrimary(true);
     $this->assertSame($address, $contact->getPrimaryAddress());
     $newPrimary = new ContactAddress();
     $contact->addAddress($newPrimary);
     $contact->setPrimaryAddress($newPrimary);
     $this->assertSame($newPrimary, $contact->getPrimaryAddress());
     $this->assertFalse($address->isPrimary());
 }