QuantityQueryTest::testGetUpperValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 9.4285
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