Mailing List Archive

[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Use InMemoryEntityLookup instead of JsonFileEntityLookup
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404715 )

Change subject: Use InMemoryEntityLookup instead of JsonFileEntityLookup
......................................................................

Use InMemoryEntityLookup instead of JsonFileEntityLookup

Bug: T168240
Change-Id: I649302db640f3ba55d013d5391b6048e1647e3d1
---
D tests/phpunit/Job/P2.json
M tests/phpunit/Job/UpdateConstraintsTableJobTest.php
2 files changed, 18 insertions(+), 36 deletions(-)


git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/15/404715/1

diff --git a/tests/phpunit/Job/P2.json b/tests/phpunit/Job/P2.json
deleted file mode 100644
index 22ee7e0..0000000
--- a/tests/phpunit/Job/P2.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "id": "P2",
- "type": "property",
- "datatype": "wikibase-item",
- "aliases": {},
- "labels": {
- "en": {
- "language": "en",
- "value": "my property"
- }
- },
- "claims": {
- "P2302": [.
- {
- "id": "P2$484b7eaf-e86c-4f25-91dc-7ae19f8be8de",
- "mainsnak": {
- "snaktype": "value",
- "property": "P2302",
- "datatype": "wikibase-item",
- "datavalue": {
- "value": {
- "entity-type": "item",
- "numeric-id": 19474404,
- "id": "Q19474404"
- },
- "type": "wikibase-entityid"
- }
- },
- "type": "statement",
- "rank": "normal"
- }
- ]
- }
-}
diff --git a/tests/phpunit/Job/UpdateConstraintsTableJobTest.php b/tests/phpunit/Job/UpdateConstraintsTableJobTest.php
index 054d3c3..2ad3a3d 100644
--- a/tests/phpunit/Job/UpdateConstraintsTableJobTest.php
+++ b/tests/phpunit/Job/UpdateConstraintsTableJobTest.php
@@ -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;

/**
@@ -312,13 +311,30 @@
}

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()
);


--
To view, visit https://gerrit.wikimedia.org/r/404715
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I649302db640f3ba55d013d5391b6048e1647e3d1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <lucas.werkmeister@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Use InMemoryEntityLookup instead of JsonFileEntityLookup [ In reply to ]
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/404715 )

Change subject: Use InMemoryEntityLookup instead of JsonFileEntityLookup
......................................................................


Use InMemoryEntityLookup instead of JsonFileEntityLookup

Bug: T168240
Change-Id: I649302db640f3ba55d013d5391b6048e1647e3d1
---
D tests/phpunit/Job/P2.json
M tests/phpunit/Job/UpdateConstraintsTableJobTest.php
2 files changed, 18 insertions(+), 36 deletions(-)

Approvals:
jenkins-bot: Verified
Thiemo Kreuz (WMDE): Looks good to me, approved



diff --git a/tests/phpunit/Job/P2.json b/tests/phpunit/Job/P2.json
deleted file mode 100644
index 22ee7e0..0000000
--- a/tests/phpunit/Job/P2.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "id": "P2",
- "type": "property",
- "datatype": "wikibase-item",
- "aliases": {},
- "labels": {
- "en": {
- "language": "en",
- "value": "my property"
- }
- },
- "claims": {
- "P2302": [.
- {
- "id": "P2$484b7eaf-e86c-4f25-91dc-7ae19f8be8de",
- "mainsnak": {
- "snaktype": "value",
- "property": "P2302",
- "datatype": "wikibase-item",
- "datavalue": {
- "value": {
- "entity-type": "item",
- "numeric-id": 19474404,
- "id": "Q19474404"
- },
- "type": "wikibase-entityid"
- }
- },
- "type": "statement",
- "rank": "normal"
- }
- ]
- }
-}
diff --git a/tests/phpunit/Job/UpdateConstraintsTableJobTest.php b/tests/phpunit/Job/UpdateConstraintsTableJobTest.php
index 054d3c3..2ad3a3d 100644
--- a/tests/phpunit/Job/UpdateConstraintsTableJobTest.php
+++ b/tests/phpunit/Job/UpdateConstraintsTableJobTest.php
@@ -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;

/**
@@ -312,13 +311,30 @@
}

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()
);


--
To view, visit https://gerrit.wikimedia.org/r/404715
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I649302db640f3ba55d013d5391b6048e1647e3d1
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <lucas.werkmeister@wikimedia.de>
Gerrit-Reviewer: Thiemo Kreuz (WMDE) <thiemo.kreuz@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits