Lucas Werkmeister (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385387 )

Change subject: Use new API output format by default
......................................................................

Use new API output format by default

Bug: T168532
Change-Id: I1e1057622cb53ab64e68114be1b7c7df91b5a5c8
---
M extension.json
M tests/phpunit/Api/CheckConstraintsTest.php
2 files changed, 11 insertions(+), 5 deletions(-)


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

diff --git a/extension.json b/extension.json
index d24e514..7dbb153 100644
--- a/extension.json
+++ b/extension.json
@@ -125,7 +125,7 @@
                        "public": true
                },
                "WBQualityConstraintsNewApiOutputFormat": {
-                       "value": false,
+                       "value": true,
                        "description": "Whether to use the new API output 
format, based on the Wikibase entity JSON format, which can accommodate 
constraint results on qualifiers and references.",
                        "public": true
                },
diff --git a/tests/phpunit/Api/CheckConstraintsTest.php 
b/tests/phpunit/Api/CheckConstraintsTest.php
index 9cc8490..280760b 100644
--- a/tests/phpunit/Api/CheckConstraintsTest.php
+++ b/tests/phpunit/Api/CheckConstraintsTest.php
@@ -129,7 +129,7 @@
                                        LoggerFactory::getInstance( 
'WikibaseQualityConstraints' ),
                                        $config
                                ),
-                               false,
+                               true,
                                false,
                                false
                        );
@@ -191,7 +191,9 @@
                $result = $this->doRequest( [ CheckConstraints::PARAM_ID => 
'Q1' ] );
 
                $this->assertCount( 1, $result['wbcheckconstraints'] );
-               $resultsForItem = 
$result['wbcheckconstraints']['Q1']['P1']['Q1$46fc8ec9-4903-4592-9a0e-afdd1fa03183'];
+               $resultStatement = 
$result['wbcheckconstraints']['Q1']['claims']['P1'][0];
+               $this->assertSame( 'Q1$46fc8ec9-4903-4592-9a0e-afdd1fa03183', 
$resultStatement['id'] );
+               $resultsForItem = $resultStatement['mainsnak']['results'];
                $this->assertCount( 1, $resultsForItem );
                $this->assertEquals( CheckResult::STATUS_WARNING, 
$resultsForItem[0]['status'] );
                $this->assertEquals( 'P1', $resultsForItem[0]['property'] );
@@ -208,7 +210,9 @@
                $result = $this->doRequest( [ CheckConstraints::PARAM_CLAIM_ID 
=> 'Q1$46fc8ec9-4903-4592-9a0e-afdd1fa03183' ] );
 
                $this->assertCount( 1, $result['wbcheckconstraints'] );
-               $resultsForItem = 
$result['wbcheckconstraints']['Q1']['P1']['Q1$46fc8ec9-4903-4592-9a0e-afdd1fa03183'];
+               $resultStatement = 
$result['wbcheckconstraints']['Q1']['claims']['P1'][0];
+               $this->assertSame( 'Q1$46fc8ec9-4903-4592-9a0e-afdd1fa03183', 
$resultStatement['id'] );
+               $resultsForItem = $resultStatement['mainsnak']['results'];
                $this->assertCount( 1, $resultsForItem );
                $this->assertEquals( CheckResult::STATUS_WARNING, 
$resultsForItem[0]['status'] );
                $this->assertEquals( 'P1', $resultsForItem[0]['property'] );
@@ -228,7 +232,9 @@
                $result = $this->doRequest( [ CheckConstraints::PARAM_CLAIM_ID 
=> $guid ] );
 
                $this->assertCount( 1, $result['wbcheckconstraints'] );
-               $resultsForItem = 
$result['wbcheckconstraints'][$itemId][$propertyId][$guid];
+               $resultStatement = 
$result['wbcheckconstraints']['Q1']['claims']['P1'][0];
+               $this->assertSame( $guid, $resultStatement['id'] );
+               $resultsForItem = $resultStatement['mainsnak']['results'];
                $this->assertCount( 1, $resultsForItem );
                $this->assertEquals( CheckResult::STATUS_WARNING, 
$resultsForItem[0]['status'] );
                $this->assertEquals( $propertyId, 
$resultsForItem[0]['property'] );

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

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

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

Reply via email to