forked from filbertkm/WikibaseImport
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDBImportedEntityMappingStoreTest.php
More file actions
54 lines (39 loc) · 1.29 KB
/
DBImportedEntityMappingStoreTest.php
File metadata and controls
54 lines (39 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace Wikibase\Import\Tests\Store;
use Wikibase\DataModel\Entity\BasicEntityIdParser;
use Wikibase\DataModel\Entity\ItemId;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\Import\Store\DBImportedEntityMappingStore;
use MediaWiki\MediaWikiServices;
/**
* @group WikibaseImport
* @group Database
*
* @covers Wikibase\Import\Store\DBImportedEntityMappingStore
*/
class DBImportedEntityMappingStoreTest extends \MediaWikiTestCase {
protected function setUp() {
parent::setUp();
$this->tablesUsed[] = 'wbs_entity_mapping';
}
public function testGetLocalId() {
$store = $this->newDBImportedEntityMappingStore();
$originalId = new ItemId( 'Q1' );
$localId = new ItemId( 'Q100' );
$store->add( $originalId, $localId );
$this->assertEquals( $localId, $store->getLocalId( $originalId ) );
}
public function testGetOriginalId() {
$store = $this->newDBImportedEntityMappingStore();
$originalId = new PropertyId( 'P9' );
$localId = new PropertyId( 'P900' );
$store->add( $originalId, $localId );
$this->assertEquals( $originalId, $store->getOriginalId( $localId ) );
}
private function newDBImportedEntityMappingStore() {
return new DBImportedEntityMappingStore(
MediaWikiServices::getInstance()->getDBLoadBalancer(),
new BasicEntityIdParser()
);
}
}