summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticResultFormats/tests/phpunit/Unit/vCard/AddressTest.php
blob: 52c8b5a19495c47b078e09e527644410a243f983 (plain)
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
<?php

namespace SRF\Tests\vCard;

use SRF\vCard\Address;

/**
 * @covers \SRF\vCard\Address
 * @group semantic-result-formats
 *
 * @license GNU GPL v2+
 * @since 3.0
 *
 * @author mwjames
 */
class AddressTest extends \PHPUnit_Framework_TestCase {

	public function testCanConstruct() {

		$this->assertInstanceOf(
			Address::class,
			new Address( '', [] )
		);
	}

	public function testText() {

		$adr = [
			'pobox' => '',
			'ext' => '',
			'street' => '2 Example Avenue',
			'locality' => 'Anytown',
			'region' => 'Foo',
			'code' => '01111',
			'country' => 'Bar'
		];

		$instance = new Address( '', $adr );

		$this->assertSame(
			"ADR;TYPE=WORK;CHARSET=UTF-8:;;2 Example Avenue;Anytown;Foo;01111;Bar\r\n",
			$instance->text()
		);
	}

}