jenkins-bot has submitted this change and it was merged.

Change subject: Add success marker to claim API modules
......................................................................


Add success marker to claim API modules

Change-Id: I312a889ab62e337441915690f2a9b64e7c05fff1
---
M repo/includes/api/ModifyClaim.php
M repo/includes/api/RemoveClaims.php
M repo/includes/api/SetClaim.php
M repo/tests/phpunit/includes/api/CreateClaimTest.php
M repo/tests/phpunit/includes/api/RemoveClaimsTest.php
M repo/tests/phpunit/includes/api/SetClaimTest.php
M repo/tests/phpunit/includes/api/SetClaimValueTest.php
7 files changed, 11 insertions(+), 5 deletions(-)

Approvals:
  Tobias Gritschacher: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/includes/api/ModifyClaim.php 
b/repo/includes/api/ModifyClaim.php
index 13b3527..61d3f08 100644
--- a/repo/includes/api/ModifyClaim.php
+++ b/repo/includes/api/ModifyClaim.php
@@ -88,6 +88,12 @@
                );
 
                $this->addRevisionIdFromStatusToResult( 'pageinfo', 
'lastrevid', $status );
+
+               $this->getResult()->addValue(
+                       null,
+                       'success',
+                       1
+               );
        }
 
        /**
diff --git a/repo/includes/api/RemoveClaims.php 
b/repo/includes/api/RemoveClaims.php
index 49e868a..5233362 100644
--- a/repo/includes/api/RemoveClaims.php
+++ b/repo/includes/api/RemoveClaims.php
@@ -142,11 +142,6 @@
         * @param string[] $removedClaimGuids
         */
        protected function outputResult( $removedClaimGuids ) {
-               $this->getResult()->addValue(
-                       null,
-                       'success',
-                       1
-               );
 
                $this->getResult()->setIndexedTagName( $removedClaimGuids, 
'claim' );
 
diff --git a/repo/includes/api/SetClaim.php b/repo/includes/api/SetClaim.php
index faf4b9f..2901c58 100644
--- a/repo/includes/api/SetClaim.php
+++ b/repo/includes/api/SetClaim.php
@@ -117,6 +117,7 @@
                $newRevisionId = isset( $statusValue['revision'] ) ? 
$statusValue['revision']->getId() : null;
 
                if ( $newRevisionId !== null ) {
+                       $this->getResult()->addValue( null, 'success', 1 );
                        $this->getResult()->addValue(
                                'pageinfo',
                                'lastrevid',
diff --git a/repo/tests/phpunit/includes/api/CreateClaimTest.php 
b/repo/tests/phpunit/includes/api/CreateClaimTest.php
index dd2119a..a64f06f 100644
--- a/repo/tests/phpunit/includes/api/CreateClaimTest.php
+++ b/repo/tests/phpunit/includes/api/CreateClaimTest.php
@@ -56,6 +56,7 @@
        }
 
        protected function assertRequestValidity( $resultArray ) {
+               $this->assertResultSuccess( $resultArray );
                $this->assertInternalType( 'array', $resultArray, 'top level 
element is an array' );
                $this->assertArrayHasKey( 'claim', $resultArray, 'top level 
element has a claim key' );
                $this->assertArrayNotHasKey( 'lastrevid', 
$resultArray['claim'], 'claim has a lastrevid key' );
diff --git a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php 
b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php
index 4d99b41..bee70cb 100644
--- a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php
+++ b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php
@@ -137,6 +137,7 @@
 
                list( $resultArray, ) = $this->doApiRequestWithToken( $params );
 
+               $this->assertResultSuccess( $resultArray );
                $this->assertInternalType( 'array', $resultArray, 'top level 
element is an array' );
                $this->assertArrayHasKey( 'claims', $resultArray, 'top level 
element has a claims key' );
 
diff --git a/repo/tests/phpunit/includes/api/SetClaimTest.php 
b/repo/tests/phpunit/includes/api/SetClaimTest.php
index 28ab404..3b798bb 100644
--- a/repo/tests/phpunit/includes/api/SetClaimTest.php
+++ b/repo/tests/phpunit/includes/api/SetClaimTest.php
@@ -168,6 +168,7 @@
        protected function makeValidRequest( array $params ) {
                list( $resultArray, ) = $this->doApiRequestWithToken( $params );
 
+               $this->assertResultSuccess( $resultArray );
                $this->assertInternalType( 'array', $resultArray, 'top level 
element is an array' );
                $this->assertArrayHasKey( 'pageinfo', $resultArray, 'top level 
element has a pageinfo key' );
                $this->assertArrayHasKey( 'claim', $resultArray, 'top level 
element has a statement key' );
diff --git a/repo/tests/phpunit/includes/api/SetClaimValueTest.php 
b/repo/tests/phpunit/includes/api/SetClaimValueTest.php
index 539c802..6039dae 100644
--- a/repo/tests/phpunit/includes/api/SetClaimValueTest.php
+++ b/repo/tests/phpunit/includes/api/SetClaimValueTest.php
@@ -110,6 +110,7 @@
 
                list( $resultArray, ) = $this->doApiRequestWithToken( $params );
 
+               $this->assertResultSuccess( $resultArray );
                $this->assertInternalType( 'array', $resultArray, 'top level 
element is an array' );
                $this->assertArrayHasKey( 'claim', $resultArray, 'top level 
element has a claim key' );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I312a889ab62e337441915690f2a9b64e7c05fff1
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to