jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/396401 )
Change subject: Enable skipped SetClaimTest with Forms
......................................................................
Enable skipped SetClaimTest with Forms
Bug: T163724
Bug: T180471
Depends-On: I84661212a65f20d20aa0c85c27f705a94b0c3ee7
Change-Id: I7699240623a7dfaf2fb45546d1e37791efec9c92
---
M tests/phpunit/mediawiki/Api/SetClaimTest.php
1 file changed, 17 insertions(+), 23 deletions(-)
Approvals:
WMDE-leszek: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/phpunit/mediawiki/Api/SetClaimTest.php
b/tests/phpunit/mediawiki/Api/SetClaimTest.php
index 5d8ff2e..65b2091 100644
--- a/tests/phpunit/mediawiki/Api/SetClaimTest.php
+++ b/tests/phpunit/mediawiki/Api/SetClaimTest.php
@@ -3,7 +3,7 @@
namespace Wikibase\Lexeme\Tests\MediaWiki\Api;
use DataValues\StringValue;
-use Revision;
+use MediaWiki\MediaWikiServices;
use Wikibase\DataModel\Entity\Property;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\Services\Lookup\EntityLookup;
@@ -27,8 +27,6 @@
class SetClaimTest extends WikibaseApiTestCase {
public function testGivenFormId_setClaimAddsStatementOnTheForm() {
- $this->markTestSkipped( 'wbsetclaim does not work with L1-F1
kind of ids yet' );
-
$propertyId = new PropertyId( 'P1' );
$this->saveTestProperty( $propertyId );
@@ -55,13 +53,11 @@
$statements = $form->getStatements()->getByPropertyId(
$propertyId )->toArray();
$statement = $statements[0];
- $this->assertEquals( $value,
$statement->getMainSnak()->getDataValue()->getValue() );
- $this->assertEquals( $guid, $statement->getGuid() );
+ $this->assertSame( $value,
$statement->getMainSnak()->getDataValue()->getValue() );
+ $this->assertSame( $guid, $statement->getGuid() );
}
public function
testGivenFormIdAndGuidOfExistingStatement_setClaimEditsTheStatement() {
- $this->markTestSkipped( 'wbsetclaim does not work with L1-F1
kind of ids yet' );
-
$propertyId = new PropertyId( 'P1' );
$this->saveTestProperty( $propertyId );
@@ -89,13 +85,11 @@
$statements = $form->getStatements()->getByPropertyId(
$propertyId )->toArray();
$statement = $statements[0];
- $this->assertEquals( 'test',
$statement->getMainSnak()->getDataValue()->getValue() );
- $this->assertEquals( $guid, $statement->getGuid() );
+ $this->assertSame( 'goat',
$statement->getMainSnak()->getDataValue()->getValue() );
+ $this->assertSame( $guid, $statement->getGuid() );
}
public function
testGivenFormIdAndIndex_setClaimReordersStatementsAccordingly() {
- $this->markTestSkipped( 'wbsetclaim does not work with L1-F1
kind of ids yet' );
-
$propertyId = new PropertyId( 'P1' );
$this->saveTestProperty( $propertyId );
@@ -129,13 +123,11 @@
$statements = $form->getStatements()->getByPropertyId(
$propertyId )->toArray();
$statement = $statements[0];
- $this->assertEquals( 'goat',
$statement->getMainSnak()->getDataValue()->getValue() );
- $this->assertEquals( $guidGoat, $statement->getGuid() );
+ $this->assertSame( 'goat',
$statement->getMainSnak()->getDataValue()->getValue() );
+ $this->assertSame( $guidGoat, $statement->getGuid() );
}
public function testGivenFormId_setClaimResponseSetsSuccess() {
- $this->markTestSkipped( 'wbsetclaim does not work with L1-F1
kind of ids yet' );
-
$propertyId = new PropertyId( 'P1' );
$this->saveTestProperty( $propertyId );
@@ -157,14 +149,12 @@
list ( $result, ) = $this->doApiRequestWithToken( $params );
- $this->assertEquals( 1, $result['success'] );
+ $this->assertSame( 1, $result['success'] );
}
// TODO: test statement data in response?
public function testGivenFormId_setClaimSetsEditSummaryAccordingly() {
- $this->markTestSkipped( 'wbsetclaim does not work with L1-F1
kind of ids yet' );
-
$propertyId = new PropertyId( 'P1' );
$this->saveTestProperty( $propertyId );
@@ -188,12 +178,13 @@
$revision = $this->loadPageRevision( $lexemeId );
- $this->assertEquals( 'CHANGE ME WHEN DEFINED HOW SUMMARY LOOKS
LIKE', $revision->getComment() );
+ $this->assertSame(
+ '/* wbsetclaim-create:2||1 */ [[Property:P1]]: test',
+ $revision->getComment()->text
+ );
}
public function
testGivenFormIdAndCustomSummary_setClaimSetsEditSummaryAccordingly() {
- $this->markTestSkipped( 'wbsetclaim does not work with L1-F1
kind of ids yet' );
-
$propertyId = new PropertyId( 'P1' );
$this->saveTestProperty( $propertyId );
@@ -218,7 +209,10 @@
$revision = $this->loadPageRevision( $lexemeId );
- $this->assertEquals( 'CHANGE ME WHEN DEFINED HOW SUMMARY LOOKS
LIKE', $revision->getComment() );
+ $this->assertSame(
+ '/* wbsetclaim-create:2||1 */ [[Property:P1]]: test,
The best edit ever',
+ $revision->getComment()->text
+ );
}
private function saveTestProperty( PropertyId $propertyId ) {
@@ -287,7 +281,7 @@
$lookup =
WikibaseRepo::getDefaultInstance()->getEntityRevisionLookup();
$revisionId = $lookup->getEntityRevision( $lexemeId
)->getRevisionId();
- return Revision::loadFromId( wfGetDB( DB_MASTER ), $revisionId
);
+ return
MediaWikiServices::getInstance()->getRevisionStore()->getRevisionById(
$revisionId );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/396401
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7699240623a7dfaf2fb45546d1e37791efec9c92
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/WikibaseLexeme
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <[email protected]>
Gerrit-Reviewer: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Thiemo Kreuz (WMDE) <[email protected]>
Gerrit-Reviewer: WMDE-leszek <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits