Skip to content

Commit

Permalink
Merge "Use InMemoryEntityLookup instead of JsonFileEntityLookup"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Jan 24, 2018
2 parents 31b499b + f65e786 commit 48d6c6a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 36 deletions.
34 changes: 0 additions & 34 deletions tests/phpunit/Job/P2.json

This file was deleted.

20 changes: 18 additions & 2 deletions tests/phpunit/Job/UpdateConstraintsTableJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use WikibaseQuality\ConstraintReport\ConstraintRepository;
use WikibaseQuality\ConstraintReport\Tests\DefaultConfig;
use WikibaseQuality\ConstraintReport\UpdateConstraintsTableJob;
use WikibaseQuality\Tests\Helper\JsonFileEntityLookup;
use Wikibase\Repo\WikibaseRepo;

/**
Expand Down Expand Up @@ -312,13 +311,30 @@ function( array $constraints ) use ( $usedForValuesOnlyId, $usedAsQualifierId )
}

public function testRun() {
$config = $this->getDefaultConfig();
$propertyConstraintId = $config->get( 'WBQualityConstraintsPropertyConstraintId' );
$singleValueConstraintId = $config->get( 'WBQualityConstraintsSingleValueConstraintId' );
$property = new Property(
new PropertyId( 'P2' ),
null,
'wikibase-item',
new StatementList(
NewStatement::forProperty( $propertyConstraintId )
->withValue( new ItemId( $singleValueConstraintId ) )
->withGuid( 'P2$484b7eaf-e86c-4f25-91dc-7ae19f8be8de' )
->build()
)
);
$entityLookup = new InMemoryEntityLookup();
$entityLookup->addEntity( $property );

$job = new UpdateConstraintsTableJob(
Title::newFromText( 'constraintsTableUpdate' ),
[],
'P2',
$this->getDefaultConfig(),
new ConstraintRepository(),
new JsonFileEntityLookup( __DIR__ ),
$entityLookup,
WikibaseRepo::getDefaultInstance()->getBaseDataModelSerializerFactory()->newSnakSerializer()
);

Expand Down

0 comments on commit 48d6c6a

Please sign in to comment.