Completed
Push — master ( 388143...889690 )
by Thomas
05:32 queued 02:57
created

testGetEntityDocumentWithoutDocument()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4286
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Wikibase\EntityStore\InMemory;
4
5
use Wikibase\DataModel\Entity\Item;
6
use Wikibase\DataModel\Entity\ItemId;
7
8
/**
9
 * @covers Wikibase\EntityStore\InMemory\InMemoryEntityLookup
10
 *
11
 * @licence GPLv2+
12
 * @author Thomas Pellissier Tanon
13
 */
14
class InMemoryEntityLookupTest extends \PHPUnit_Framework_TestCase {
15
16
	public function testGetEntityDocumentsForIds() {
17
		$item = new Item( new ItemId( 'Q42' ) );
18
19
		$lookup = new InMemoryEntityLookup( [ $item ] );
20
21
		$this->assertEquals(
22
			[ $item ],
23
			$lookup->getEntityDocumentsForIds( [ new ItemId( 'Q42' ), new ItemId( 'Q43' ) ] )
24
		);
25
	}
26
27
	public function testGetEntityDocumentForId() {
28
		$item = new Item( new ItemId( 'Q42' ) );
29
30
		$lookup = new InMemoryEntityLookup( [ $item ] );
31
32
		$this->assertEquals( $item, $lookup->getEntityDocumentForId( new ItemId( 'Q42' ) ) );
33
	}
34
35
	public function testGetEntityDocumentWithoutDocument() {
36
		$lookup = new InMemoryEntityLookup( [] );
37
38
		$this->assertNull( $lookup->getEntityDocumentForId( new ItemId( 'Q42' ) ) );
39
	}
40
}
41