1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Wikibase\EntityStore\MongoDB; |
4
|
|
|
|
5
|
|
|
use Wikibase\EntityStore\EntityStoreTest; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @covers Wikibase\EntityStore\MongoDB\MongoDBEntityStore |
9
|
|
|
* |
10
|
|
|
* @licence GPLv2+ |
11
|
|
|
* @author Thomas Pellissier Tanon |
12
|
|
|
*/ |
13
|
|
|
class MongoDBEntityStoreTest extends EntityStoreTest { |
14
|
|
|
|
15
|
|
|
public function testGetEntityLookup() { |
16
|
|
|
$collectionMock = $this->getMockBuilder( 'Doctrine\MongoDB\Database' ) |
17
|
|
|
->disableOriginalConstructor() |
18
|
|
|
->getMock(); |
19
|
|
|
$store = new MongoDBEntityStore( $collectionMock ); |
20
|
|
|
|
21
|
|
|
$this->assertInstanceOf( 'Wikibase\DataModel\Services\Lookup\EntityLookup', $store->getEntityLookup() ); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
public function testGetEntityDocumentLookup() { |
25
|
|
|
$collectionMock = $this->getMockBuilder( 'Doctrine\MongoDB\Database' ) |
26
|
|
|
->disableOriginalConstructor() |
27
|
|
|
->getMock(); |
28
|
|
|
$store = new MongoDBEntityStore( $collectionMock ); |
29
|
|
|
|
30
|
|
|
$this->assertInstanceOf( 'Wikibase\EntityStore\EntityDocumentLookup', $store->getEntityDocumentLookup() ); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function testGetItemLookup() { |
34
|
|
|
$collectionMock = $this->getMockBuilder( 'Doctrine\MongoDB\Database' ) |
35
|
|
|
->disableOriginalConstructor() |
36
|
|
|
->getMock(); |
37
|
|
|
$store = new MongoDBEntityStore( $collectionMock ); |
38
|
|
|
|
39
|
|
|
$this->assertInstanceOf( 'Wikibase\DataModel\Services\Lookup\ItemLookup', $store->getItemLookup() ); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function testGetPropertyLookup() { |
43
|
|
|
$collectionMock = $this->getMockBuilder( 'Doctrine\MongoDB\Database' ) |
44
|
|
|
->disableOriginalConstructor() |
45
|
|
|
->getMock(); |
46
|
|
|
$store = new MongoDBEntityStore( $collectionMock ); |
47
|
|
|
|
48
|
|
|
$this->assertInstanceOf( 'Wikibase\DataModel\Services\Lookup\PropertyLookup', $store->getPropertyLookup() ); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function testGetEntityDocumentSaver() { |
52
|
|
|
$collectionMock = $this->getMockBuilder( 'Doctrine\MongoDB\Database' ) |
53
|
|
|
->disableOriginalConstructor() |
54
|
|
|
->getMock(); |
55
|
|
|
$store = new MongoDBEntityStore( $collectionMock ); |
56
|
|
|
|
57
|
|
|
$this->assertInstanceOf( 'Wikibase\EntityStore\EntityDocumentSaver', $store->getEntityDocumentSaver() ); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function testGetItemIdForTermLookup() { |
61
|
|
|
$collectionMock = $this->getMockBuilder( 'Doctrine\MongoDB\Database' ) |
62
|
|
|
->disableOriginalConstructor() |
63
|
|
|
->getMock(); |
64
|
|
|
$store = new MongoDBEntityStore( $collectionMock ); |
65
|
|
|
|
66
|
|
|
$this->assertInstanceOf( 'Wikibase\EntityStore\ItemIdForTermLookup', $store->getItemIdForTermLookup() ); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function testGetPropertyIdForTermLookup() { |
70
|
|
|
$collectionMock = $this->getMockBuilder( 'Doctrine\MongoDB\Database' ) |
71
|
|
|
->disableOriginalConstructor() |
72
|
|
|
->getMock(); |
73
|
|
|
$store = new MongoDBEntityStore( $collectionMock ); |
74
|
|
|
|
75
|
|
|
$this->assertInstanceOf( 'Wikibase\EntityStore\PropertyIdForTermLookup', $store->getPropertyIdForTermLookup() ); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function testGetItemIdForQueryLookup() { |
79
|
|
|
$collectionMock = $this->getMockBuilder( 'Doctrine\MongoDB\Database' ) |
80
|
|
|
->disableOriginalConstructor() |
81
|
|
|
->getMock(); |
82
|
|
|
$store = new MongoDBEntityStore( $collectionMock ); |
83
|
|
|
|
84
|
|
|
$this->assertInstanceOf( 'Wikibase\EntityStore\ItemIdForQueryLookup', $store->getItemIdForQueryLookup() ); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function testGetPropertyIdForQueryLookup() { |
88
|
|
|
$collectionMock = $this->getMockBuilder( 'Doctrine\MongoDB\Database' ) |
89
|
|
|
->disableOriginalConstructor() |
90
|
|
|
->getMock(); |
91
|
|
|
$store = new MongoDBEntityStore( $collectionMock ); |
92
|
|
|
|
93
|
|
|
$this->assertInstanceOf( 'Wikibase\EntityStore\PropertyIdForQueryLookup', $store->getPropertyIdForQueryLookup() ); |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|