Completed
Push — master ( d52f9e...94eed6 )
by Stephan
04:21 queued 02:45
created

testInspectForEmptyData()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 17
nc 1
nop 1
1
<?php
2
3
namespace SG\Tests;
4
5
use SG\SemanticDataComparator;
6
7
/**
8
 * @covers \SG\SemanticDataComparator
9
 * @group extension-semantic-glossary
10
 *
11
 * @license GNU GPL v2+
12
 * @since 1.0
13
 *
14
 * @author mwjames
15
 */
16
class SemanticDataComparatorTest extends \PHPUnit_Framework_TestCase {
17
18
	public function testCanConstruct() {
19
20
		$store = $this->getMockBuilder( '\SMW\Store' )
21
			->disableOriginalConstructor()
22
			->getMockForAbstractClass();
23
24
		$semanticData = $this->getMockBuilder( '\SMW\SemanticData' )
25
			->disableOriginalConstructor()
26
			->getMock();
27
28
		$instance = new SemanticDataComparator(
29
			$store,
30
			$semanticData
31
		);
32
33
		$this->assertInstanceOf(
34
			'\SG\SemanticDataComparator',
35
			$instance
36
		);
37
	}
38
39
	/**
40
	 * @dataProvider propertyIdProvider
41
	 */
42
	public function testInspectForEmptyData( $propertyId ) {
43
44
		$store = $this->getMockBuilder( '\SMW\Store' )
45
			->disableOriginalConstructor()
46
			->getMockForAbstractClass();
47
48
		$store->method( 'getPropertyValues' )
49
			->willReturn( [] );
50
51
		$semanticData = $this->getMockBuilder( '\SMW\SemanticData' )
52
			->disableOriginalConstructor()
53
			->getMock();
54
55
		$semanticData->expects( $this->once() )
56
			->method( 'getProperties' )
57
			->will( $this->returnValue( array() ) );
58
59
		$instance = new SemanticDataComparator(
60
			$store,
61
			$semanticData
62
		);
63
64
		$this->assertFalse(
65
			$instance->compareForProperty( $propertyId )
66
		);
67
	}
68
69
	public function propertyIdProvider() {
70
71
		$provider = array(
72
			array( 'Foo' ),
73
			array( '__Foo' )
74
		);
75
76
		return $provider;
77
	}
78
79
}
80