Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/89714
Change subject: Update test after constraint in DataModel got changed ...................................................................... Update test after constraint in DataModel got changed Change-Id: Ibc8332e5acb09b2cc9d3776a00ecaba71467b018 --- M tests/phpunit/SQLStore/EntityInserterTest.php 1 file changed, 11 insertions(+), 17 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQueryEngine refs/changes/14/89714/1 diff --git a/tests/phpunit/SQLStore/EntityInserterTest.php b/tests/phpunit/SQLStore/EntityInserterTest.php index bcc5c56..46f9640 100644 --- a/tests/phpunit/SQLStore/EntityInserterTest.php +++ b/tests/phpunit/SQLStore/EntityInserterTest.php @@ -34,19 +34,6 @@ ->disableOriginalConstructor() ->getMock(); - $invocationMocker = $claimInserter->expects( $this->exactly( count( $entity->getClaims() ) ) ) - ->method( 'insertClaim' ); - - // The 'with' constraints fail if the method is not invoked, - // so we can only add them when there are claims. - if ( count( $entity->getClaims() ) > 0 ) { - // TODO -// $invocationMocker->with( -// $this->anything(), -// $this->equalTo( new PropertyId( 'P12' ) ) -// ); - } - $inserter = new EntityInserter( $claimInserter ); $inserter->insertEntity( $entity ); @@ -78,20 +65,27 @@ $property->setDataTypeId( 'string' ); $property->setId( new PropertyId( 'P1' ) ); $property->addAliases( 'en', array( 'foo', 'bar', 'baz' ) ); - $property->addClaim( new Claim( new PropertyNoValueSnak( 42 ) ) ); + $property->addClaim( $this->newClaim( 42 ) ); $argLists[] = array( $property ); $item = Item::newEmpty(); $item->setId( new ItemId( 'Q2' ) ); - $item->addClaim( new Claim( new PropertyNoValueSnak( 42 ) ) ); - $item->addClaim( new Claim( new PropertyNoValueSnak( 43 ) ) ); - $item->addClaim( new Claim( new PropertyNoValueSnak( 44 ) ) ); + + $item->addClaim( $this->newClaim( 42 ) ); + $item->addClaim( $this->newClaim( 43 ) ); + $item->addClaim( $this->newClaim( 44 ) ); $argLists[] = array( $item ); return $argLists; } + protected function newClaim( $propertyNumber ) { + $claim = new Claim( new PropertyNoValueSnak( 42 ) ); + $claim->setGuid( 'guid' . $propertyNumber ); + return $claim; + } + } -- To view, visit https://gerrit.wikimedia.org/r/89714 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibc8332e5acb09b2cc9d3776a00ecaba71467b018 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQueryEngine Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits