Completed
Push — master ( 1650a0...29e43d )
by mw
06:30
created

AddressTest::testHasAddress()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace SRF\Tests\vCard;
4
5
use SRF\vCard\Address;
6
7
/**
8
 * @covers \SRF\vCard\Address
9
 * @group semantic-result-formats
10
 *
11
 * @license GNU GPL v2+
12
 * @since 3.0
13
 *
14
 * @author mwjames
15
 */
16
class AddressTest extends \PHPUnit_Framework_TestCase {
17
18
	public function testCanConstruct() {
19
20
		$this->assertInstanceOf(
21
			Address::class,
22
			new Address( '', [] )
23
		);
24
	}
25
26
	public function testHasAddress() {
27
28
		$instance = new Address( '', [] );
29
30
		$this->assertFalse(
31
			$instance->hasAddress()
32
		);
33
	}
34
35
	public function testText() {
36
37
		$adr = [
38
			'pobox' => '',
39
			'ext' => '',
40
			'street' => '2 Example Avenue',
41
			'locality' => 'Anytown',
42
			'region' => 'Foo',
43
			'code' => '01111',
44
			'country' => 'Bar'
45
		];
46
47
		$instance = new Address( '', $adr );
48
		$instance->set( 'region', 'Bar0042' );
49
50
		$this->assertSame(
51
			"ADR;TYPE=WORK;CHARSET=UTF-8:;;2 Example Avenue;Anytown;Bar0042;01111;Bar\r\n",
52
			$instance->text()
53
		);
54
	}
55
56
}
57