QuantityQueryTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 28
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetPropertyId() 0 4 1
A testGetType() 0 4 1
A testGetLowerValue() 0 7 1
A testGetUpperValue() 0 7 1
1
<?php
2
3
namespace WikidataQueryApi\Query;
4
5
use DataValues\DecimalValue;
6
use Wikibase\DataModel\Entity\PropertyId;
7
8
/**
9
 * @covers WikidataQueryApi\Query\QuantityQuery
10
 *
11
 * @licence GPLv2+
12
 * @author Thomas Pellissier Tanon
13
 */
14
class QuantityQueryTest extends \PHPUnit_Framework_TestCase {
15
16
	public function testGetPropertyId() {
17
		$query = new QuantityQuery( new PropertyId( 'P42' ), new DecimalValue( '+42' ) );
18
		$this->assertEquals( new PropertyId( 'P42' ), $query->getPropertyId() );
19
	}
20
21
	public function testGetLowerValue() {
22
		$query = new QuantityQuery( new PropertyId( 'P42' ), new DecimalValue( '+41' ), new DecimalValue( '+43' ) );
23
		$this->assertEquals(
24
			new DecimalValue( '+41' ),
25
			$query->getLowerValue()
26
		);
27
	}
28
29
	public function testGetUpperValue() {
30
		$query = new QuantityQuery( new PropertyId( 'P42' ), new DecimalValue( '+41' ), new DecimalValue( '+43' ) );
31
		$this->assertEquals(
32
			new DecimalValue( '+43' ),
33
			$query->getUpperValue()
34
		);
35
	}
36
37
	public function testGetType() {
38
		$query = new QuantityQuery( new PropertyId( 'P42' ), new DecimalValue( '+42' ) );
39
		$this->assertEquals( 'quantity', $query->getType() );
40
	}
41
}
42