Skip to content

Commit 0cdf20d

Browse files
authored
Merge pull request #13 from filbertkm/entity-importer-factory
Don't access (now) private WikibaseRepo::getDataValueDeserializer method
2 parents bd71979 + 982c889 commit 0cdf20d

File tree

2 files changed

+48
-4
lines changed

2 files changed

+48
-4
lines changed

src/EntityImporterFactory.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,7 @@ private function getImportedEntityMappingStore() {
117117
private function newEntityDeserializer() {
118118
$wikibaseRepo = WikibaseRepo::getDefaultInstance();
119119

120-
$deserializerFactory = new DeserializerFactory(
121-
$wikibaseRepo->getDataValueDeserializer(),
122-
$wikibaseRepo->getEntityIdParser()
123-
);
120+
$deserializerFactory = $wikibaseRepo->getExternalFormatDeserializerFactory();
124121

125122
return $deserializerFactory->newEntityDeserializer();
126123
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
namespace Wikibase\Import\Tests;
4+
5+
use Monolog\Logger;
6+
use Monolog\Handler\NullHandler;
7+
use Wikibase\Import\EntityImporter;
8+
use Wikibase\Import\EntityImporterFactory;
9+
use Wikibase\Repo\WikibaseRepo;
10+
11+
/**
12+
* @group WikibaseImport
13+
*/
14+
class EntityImporterFactoryTest extends \PHPUnit_Framework_TestCase {
15+
16+
public function testNewEntityImporter() {
17+
$entityImporterFactory = $this->newEntityImporterFactory();
18+
19+
$entityImporter = $entityImporterFactory->newEntityImporter();
20+
21+
$this->assertInstanceOf( 'Wikibase\Import\EntityImporter', $entityImporter );
22+
}
23+
24+
public function testGetApiEntityLookup() {
25+
$entityImporterFactory = $this->newEntityImporterFactory();
26+
27+
$apiEntityLookup = $entityImporterFactory->getApiEntityLookup();
28+
29+
$this->assertInstanceOf( 'Wikibase\Import\ApiEntityLookup', $apiEntityLookup );
30+
}
31+
32+
private function newEntityImporterFactory() {
33+
return new EntityImporterFactory(
34+
WikibaseRepo::getDefaultInstance()->getStore()->getEntityStore(),
35+
wfGetLB(),
36+
$this->newLogger(),
37+
'https://www.wikidata.org/w/api.php'
38+
);
39+
}
40+
41+
private function newLogger() {
42+
$logger = new Logger( 'wikibase-import' );
43+
$logger->pushHandler( new NullHandler() );
44+
45+
return $logger;
46+
}
47+
}

0 commit comments

Comments
 (0)