Completed
Push — master ( 5d818a...8bb185 )
by Katie
29s
created

PlainEntityIdFormatterTest::newEntityIdFormatter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Wikibase\DataModel\Services\Tests\EntityId;
4
5
use PHPUnit_Framework_TestCase;
6
use Wikibase\DataModel\Entity\EntityId;
7
use Wikibase\DataModel\Entity\ItemId;
8
use Wikibase\DataModel\Entity\PropertyId;
9
use Wikibase\DataModel\Services\EntityId\PlainEntityIdFormatter;
10
11
/**
12
 * @covers Wikibase\DataModel\Services\EntityId\PlainEntityIdFormatter
13
 *
14
 * @license GPL-2.0+
15
 * @author Jeroen De Dauw < [email protected] >
16
 */
17
class PlainEntityIdFormatterTest extends PHPUnit_Framework_TestCase {
18
19
	public function validProvider() {
20
		$argLists = [];
21
22
		$argLists[] = [ new ItemId( 'q42' ), 'Q42' ];
23
		$argLists[] = [ new ItemId( 'q9001' ), 'Q9001' ];
24
		$argLists[] = [ new ItemId( 'q1' ), 'Q1' ];
25
26
		$argLists[] = [ new PropertyId( 'p42' ), 'P42' ];
27
		$argLists[] = [ new PropertyId( 'p9001' ), 'P9001' ];
28
		$argLists[] = [ new PropertyId( 'p1' ), 'P1' ];
29
30
		return $argLists;
31
	}
32
33
	/**
34
	 * @dataProvider validProvider
35
	 *
36
	 * @param EntityId $entityId
37
	 * @param string $expectedString
38
	 */
39
	public function testParseWithValidArguments( EntityId $entityId, $expectedString ) {
40
		$formatter = new PlainEntityIdFormatter();
41
42
		$formattingResult = $formatter->formatEntityId( $entityId );
43
44
		$this->assertInternalType( 'string', $formattingResult );
45
		$this->assertEquals( $expectedString, $formattingResult );
46
	}
47
48
}
49