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

vCardTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCanConstruct() 0 7 1
A testEmptyCard() 0 20 1
1
<?php
2
3
namespace SRF\Tests\vCard;
4
5
use SRF\vCard\vCard;
6
7
/**
8
 * @covers \SRF\vCard\vCard
9
 * @group semantic-result-formats
10
 *
11
 * @license GNU GPL v2"
12
 * @since 3.0
13
 *
14
 * @author mwjames
15
 */
16
class vCardTest extends \PHPUnit_Framework_TestCase {
17
18
	public function testCanConstruct() {
19
20
		$this->assertInstanceOf(
21
			vCard::class,
22
			new vCard( '', '', [] )
23
		);
24
	}
25
26
	public function testEmptyCard() {
27
28
		$instance = new vCard( 'http://example.org/Foo', 'Foo', [] );
29
		$instance->set( 'url', 'http://example.org/Bar' );
30
31
		$this->assertSame(
32
			"BEGIN:VCARD\r\n" .
33
			"VERSION:3.0\r\n" .
34
			"N;CHARSET=UTF-8:Foo;;;;\r\n" .
35
			"FN;CHARSET=UTF-8:Foo\r\n" .
36
			"CLASS:PUBLIC\r\n" .
37
			"SOURCE;CHARSET=UTF-8:http://example.org/Foo\r\n" .
38
			"PRODID:-////Semantic MediaWiki\r\n" .
39
			"REV:\r\n" .
40
			"URL:http://example.org/Bar\r\n" .
41
			"UID:http://example.org/Foo\r\n" .
42
			"END:VCARD\r\n",
43
			$instance->text()
44
		);
45
	}
46
47
}
48