summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticResultFormats/tests/phpunit/Unit/vCard/vCardTest.php
blob: 6d3d46df3decac4db7533bd06a375746ad5b627d (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\vCard;

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

	public function testCanConstruct() {

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

	public function testTextOnEmptyCard() {

		$instance = new vCard( 'http://example.org/Foo', 'Foo', [] );

		$this->assertSame(
			"BEGIN:VCARD\r\n" .
			"VERSION:3.0\r\n" .
			"N;CHARSET=UTF-8:Foo;;;;\r\n" .
			"FN;CHARSET=UTF-8:Foo\r\n" .
			"CLASS:PUBLIC\r\n" .
			"SOURCE;CHARSET=UTF-8:http://example.org/Foo\r\n" .
			"PRODID:-////Semantic MediaWiki\r\n" .
			"REV:\r\n" .
			"URL:http://example.org/Foo\r\n" .
			"UID:http://example.org/Foo\r\n" .
			"END:VCARD\r\n",
			$instance->text()
		);
	}

}