PropertyListTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 39
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSetAndGetElements() 0 21 1
A testElement() 0 13 1
1
<?php
2
3
namespace Tests\Queryr\Resources\Builders;
4
5
use Queryr\Resources\PropertyList;
6
use Queryr\Resources\PropertyListElement;
7
use Wikibase\DataModel\Entity\PropertyId;
8
9
/**
10
 * @covers Queryr\Resources\PropertyList
11
 * @covers Queryr\Resources\PropertyListElement
12
 *
13
 * @licence GNU GPL v2+
14
 * @author Jeroen De Dauw < [email protected] >
15
 */
16
class PropertyListTest extends \PHPUnit_Framework_TestCase {
17
18
	public function testSetAndGetElements() {
19
		$items = [
20
			new PropertyListElement(
21
				new PropertyId( 'P1' ),
22
				'number',
23
				'https://www.wikidata.org/wiki/Property:P1',
24
				'http://api.queryr.com/properties/P1'
25
			),
26
			new PropertyListElement(
27
				new PropertyId( 'P2' ),
28
				'string',
29
				'https://www.wikidata.org/wiki/Property:P2',
30
				'http://api.queryr.com/properties/P2'
31
			)
32
		];
33
34
		$list = new PropertyList( $items );
35
		$this->assertSame( $items, $list->getElements() );
36
37
38
	}
39
40
	public function testElement() {
41
		$item = new PropertyListElement(
42
			new PropertyId( 'P1' ),
43
			'number',
44
			'https://www.wikidata.org/wiki/Property:P1',
45
			'http://api.queryr.com/properties/P1'
46
		);
47
48
		$this->assertEquals( new PropertyId( 'P1' ), $item->getPropertyId() );
49
		$this->assertEquals( 'number', $item->getPropertyType() );
50
		$this->assertEquals( 'https://www.wikidata.org/wiki/Property:P1', $item->getWikidataUrl() );
51
		$this->assertEquals( 'http://api.queryr.com/properties/P1', $item->getApiUrl() );
52
	}
53
54
}
55