| @@ 113-131 (lines=19) @@ | ||
| 110 | $this->assertEquals(array(1 => $emailTwo, 2 => $emailThree), $actual->toArray());  | 
                                |
| 111 | }  | 
                                |
| 112 | ||
| 113 | public function testGetPrimaryEmail()  | 
                                |
| 114 |     { | 
                                |
| 115 | $contact = new Contact();  | 
                                |
| 116 | $this->assertNull($contact->getPrimaryEmail());  | 
                                |
| 117 | ||
| 118 |         $email = new ContactEmail('[email protected]'); | 
                                |
| 119 | $contact->addEmail($email);  | 
                                |
| 120 | $this->assertNull($contact->getPrimaryEmail());  | 
                                |
| 121 | ||
| 122 | $contact->setPrimaryEmail($email);  | 
                                |
| 123 | $this->assertSame($email, $contact->getPrimaryEmail());  | 
                                |
| 124 | ||
| 125 |         $email2 = new ContactEmail('[email protected]'); | 
                                |
| 126 | $contact->addEmail($email2);  | 
                                |
| 127 | $contact->setPrimaryEmail($email2);  | 
                                |
| 128 | ||
| 129 | $this->assertSame($email2, $contact->getPrimaryEmail());  | 
                                |
| 130 | $this->assertFalse($email->isPrimary());  | 
                                |
| 131 | }  | 
                                |
| 132 | ||
| 133 | public function testAddEmailShouldNotAllowMultiplePrimaries()  | 
                                |
| 134 |     { | 
                                |
| @@ 206-224 (lines=19) @@ | ||
| 203 | $this->assertEquals(array(1 => $phoneTwo, 2 => $phoneThree), $actual->toArray());  | 
                                |
| 204 | }  | 
                                |
| 205 | ||
| 206 | public function testGetPrimaryPhone()  | 
                                |
| 207 |     { | 
                                |
| 208 | $contact = new Contact();  | 
                                |
| 209 | $this->assertNull($contact->getPrimaryPhone());  | 
                                |
| 210 | ||
| 211 |         $phone = new ContactPhone('06001122334455'); | 
                                |
| 212 | $contact->addPhone($phone);  | 
                                |
| 213 | $this->assertNull($contact->getPrimaryPhone());  | 
                                |
| 214 | ||
| 215 | $contact->setPrimaryPhone($phone);  | 
                                |
| 216 | $this->assertSame($phone, $contact->getPrimaryPhone());  | 
                                |
| 217 | ||
| 218 |         $phone2 = new ContactPhone('22001122334455'); | 
                                |
| 219 | $contact->addPhone($phone2);  | 
                                |
| 220 | $contact->setPrimaryPhone($phone2);  | 
                                |
| 221 | ||
| 222 | $this->assertSame($phone2, $contact->getPrimaryPhone());  | 
                                |
| 223 | $this->assertFalse($phone->isPrimary());  | 
                                |
| 224 | }  | 
                                |
| 225 | ||
| 226 | public function testAddPhoneShouldNotAllowMultiplePrimaries()  | 
                                |
| 227 |     { | 
                                |
| @@ 302-321 (lines=20) @@ | ||
| 299 | $this->assertEquals(array(1 => $addressTwo, 2 => $addressThree), $actual->toArray());  | 
                                |
| 300 | }  | 
                                |
| 301 | ||
| 302 | public function testGetPrimaryAddress()  | 
                                |
| 303 |     { | 
                                |
| 304 | $contact = new Contact();  | 
                                |
| 305 | $this->assertNull($contact->getPrimaryAddress());  | 
                                |
| 306 | ||
| 307 | $address = new ContactAddress();  | 
                                |
| 308 | $contact->addAddress($address);  | 
                                |
| 309 | $this->assertNull($contact->getPrimaryAddress());  | 
                                |
| 310 | ||
| 311 | $address->setPrimary(true);  | 
                                |
| 312 | $this->assertSame($address, $contact->getPrimaryAddress());  | 
                                |
| 313 | ||
| 314 | $newPrimary = new ContactAddress();  | 
                                |
| 315 | $contact->addAddress($newPrimary);  | 
                                |
| 316 | ||
| 317 | $contact->setPrimaryAddress($newPrimary);  | 
                                |
| 318 | $this->assertSame($newPrimary, $contact->getPrimaryAddress());  | 
                                |
| 319 | ||
| 320 | $this->assertFalse($address->isPrimary());  | 
                                |
| 321 | }  | 
                                |
| 322 | ||
| 323 | public function testAddAddressShouldNotAllowMultiplePrimaries()  | 
                                |
| 324 |     { | 
                                |
| @@ 97-116 (lines=20) @@ | ||
| 94 | $this->assertEquals(array(1 => $addressTwo, 2 => $addressThree), $actual->toArray());  | 
                                |
| 95 | }  | 
                                |
| 96 | ||
| 97 | public function testGetPrimaryAddress()  | 
                                |
| 98 |     { | 
                                |
| 99 | $lead = new Lead();  | 
                                |
| 100 | $this->assertNull($lead->getPrimaryAddress());  | 
                                |
| 101 | ||
| 102 | $address = new LeadAddress();  | 
                                |
| 103 | $lead->addAddress($address);  | 
                                |
| 104 | $this->assertNull($lead->getPrimaryAddress());  | 
                                |
| 105 | ||
| 106 | $address->setPrimary(true);  | 
                                |
| 107 | $this->assertSame($address, $lead->getPrimaryAddress());  | 
                                |
| 108 | ||
| 109 | $newPrimary = new LeadAddress();  | 
                                |
| 110 | $lead->addAddress($newPrimary);  | 
                                |
| 111 | ||
| 112 | $lead->setPrimaryAddress($newPrimary);  | 
                                |
| 113 | $this->assertSame($newPrimary, $lead->getPrimaryAddress());  | 
                                |
| 114 | ||
| 115 | $this->assertFalse($address->isPrimary());  | 
                                |
| 116 | }  | 
                                |
| 117 | ||
| 118 | public function testPhones()  | 
                                |
| 119 |     { | 
                                |
| @@ 152-170 (lines=19) @@ | ||
| 149 | $this->assertEquals(array(1 => $phoneTwo, 2 => $phoneThree), $actual->toArray());  | 
                                |
| 150 | }  | 
                                |
| 151 | ||
| 152 | public function testGetPrimaryPhone()  | 
                                |
| 153 |     { | 
                                |
| 154 | $lead = new Lead();  | 
                                |
| 155 | $this->assertNull($lead->getPrimaryPhone());  | 
                                |
| 156 | ||
| 157 |         $phone = new LeadPhone('06001122334455'); | 
                                |
| 158 | $lead->addPhone($phone);  | 
                                |
| 159 | $this->assertNull($lead->getPrimaryPhone());  | 
                                |
| 160 | ||
| 161 | $lead->setPrimaryPhone($phone);  | 
                                |
| 162 | $this->assertSame($phone, $lead->getPrimaryPhone());  | 
                                |
| 163 | ||
| 164 |         $phone2 = new LeadPhone('22001122334455'); | 
                                |
| 165 | $lead->addPhone($phone2);  | 
                                |
| 166 | $lead->setPrimaryPhone($phone2);  | 
                                |
| 167 | ||
| 168 | $this->assertSame($phone2, $lead->getPrimaryPhone());  | 
                                |
| 169 | $this->assertFalse($phone->isPrimary());  | 
                                |
| 170 | }  | 
                                |
| 171 | ||
| 172 | public function testEmails()  | 
                                |
| 173 |     { | 
                                |
| @@ 199-213 (lines=15) @@ | ||
| 196 | $this->assertEquals([$firstPhone, $secondPhone], $actual->toArray());  | 
                                |
| 197 | }  | 
                                |
| 198 | ||
| 199 | public function testGetPrimaryPhone()  | 
                                |
| 200 |     { | 
                                |
| 201 |         $firstPhone = new B2bCustomerPhone('06001122334455'); | 
                                |
| 202 |         $secondPhone = new B2bCustomerPhone('07001122334455'); | 
                                |
| 203 | $customer = new B2bCustomer();  | 
                                |
| 204 | $this->assertNull($customer->getPrimaryPhone());  | 
                                |
| 205 | $customer->addPhone($firstPhone);  | 
                                |
| 206 | $this->assertNull($customer->getPrimaryPhone());  | 
                                |
| 207 | $customer->setPrimaryPhone($firstPhone);  | 
                                |
| 208 | $this->assertSame($firstPhone, $customer->getPrimaryPhone());  | 
                                |
| 209 | $customer->addPhone($secondPhone);  | 
                                |
| 210 | $customer->setPrimaryPhone($secondPhone);  | 
                                |
| 211 | $this->assertSame($secondPhone, $customer->getPrimaryPhone());  | 
                                |
| 212 | $this->assertFalse($firstPhone->isPrimary());  | 
                                |
| 213 | }  | 
                                |
| 214 | ||
| 215 | public function testAddDuplicateEmail()  | 
                                |
| 216 |     { | 
                                |
| @@ 274-288 (lines=15) @@ | ||
| 271 | $this->assertEquals([$firstEmail, $secondEmail], $actual->toArray());  | 
                                |
| 272 | }  | 
                                |
| 273 | ||
| 274 | public function testGetPrimaryEmail()  | 
                                |
| 275 |     { | 
                                |
| 276 | $customer = new B2bCustomer();  | 
                                |
| 277 | $this->assertNull($customer->getPrimaryEmail());  | 
                                |
| 278 |         $email = new B2bCustomerEmail('[email protected]'); | 
                                |
| 279 | $customer->addEmail($email);  | 
                                |
| 280 | $this->assertNull($customer->getPrimaryEmail());  | 
                                |
| 281 | $customer->setPrimaryEmail($email);  | 
                                |
| 282 | $this->assertSame($email, $customer->getPrimaryEmail());  | 
                                |
| 283 |         $email2 = new B2bCustomerEmail('[email protected]'); | 
                                |
| 284 | $customer->addEmail($email2);  | 
                                |
| 285 | $customer->setPrimaryEmail($email2);  | 
                                |
| 286 | $this->assertSame($email2, $customer->getPrimaryEmail());  | 
                                |
| 287 | $this->assertFalse($email->isPrimary());  | 
                                |
| 288 | }  | 
                                |
| 289 | }  | 
                                |
| 290 | ||