-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathContactAddressTest.php
More file actions
52 lines (43 loc) · 1.36 KB
/
ContactAddressTest.php
File metadata and controls
52 lines (43 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace CMText\RichContent\Common;
use CMText\Exceptions\ContactAddressException;
use PHPUnit\Framework\TestCase;
class ContactAddressTest extends TestCase
{
public function testJsonSerialize()
{
$this->assertJson(
json_encode(new ContactAddress('Breda', 'Netherlands', 'NL'))
);
}
public function test__construct()
{
//empty
$this->assertInstanceOf(
ContactAddress::class,
new ContactAddress()
);
// partial
$this->assertInstanceOf(
ContactAddress::class,
new ContactAddress('Breda', 'Netherlands', 'NL')
);
// full
$this->assertInstanceOf(
ContactAddress::class,
new ContactAddress('Breda', 'Netherlands', 'NL','Noord Brabant', 'Konijnenberg 24', ContactAddressTypes::WORK, '4825BD')
);
}
public function testCountryCodeException()
{
// invalid country code
$this->expectException(ContactAddressException::class);
new ContactAddress('Breda', 'Netherlands', 'EXCEPTIONAL');
}
public function testAddressTypeException()
{
// unknown type
$this->expectException(ContactAddressException::class);
new ContactAddress('Breda', 'Netherlands', 'NL', 'Noord Brabant', 'Konijnenberg 24', 'EXCEPTIONAL', '4825BD');
}
}