Denny Vrandecic has submitted this change and it was merged.

Change subject: Implemented ValuelessSnakStore->removeSnaksOfSubject
......................................................................


Implemented ValuelessSnakStore->removeSnaksOfSubject

Change-Id: Ie6a7bd62fe67465c4794c07f1bc695a95749c89b
---
M QueryEngine/includes/SQLStore/SnakStore/ValuelessSnakStore.php
M QueryEngine/tests/phpunit/SQLStore/SnakStore/ValuelessSnakStoreTest.php
2 files changed, 25 insertions(+), 1 deletion(-)

Approvals:
  Denny Vrandecic: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/QueryEngine/includes/SQLStore/SnakStore/ValuelessSnakStore.php 
b/QueryEngine/includes/SQLStore/SnakStore/ValuelessSnakStore.php
index 0959559..8f57013 100644
--- a/QueryEngine/includes/SQLStore/SnakStore/ValuelessSnakStore.php
+++ b/QueryEngine/includes/SQLStore/SnakStore/ValuelessSnakStore.php
@@ -65,7 +65,10 @@
        }
 
        public function removeSnaksOfSubject( $internalSubjectId ) {
-
+               $this->queryInterface->delete(
+                       $this->tableName,
+                       array( 'subject_id' => $internalSubjectId )
+               );
        }
 
 }
diff --git 
a/QueryEngine/tests/phpunit/SQLStore/SnakStore/ValuelessSnakStoreTest.php 
b/QueryEngine/tests/phpunit/SQLStore/SnakStore/ValuelessSnakStoreTest.php
index 0c45706..9bdf06f 100644
--- a/QueryEngine/tests/phpunit/SQLStore/SnakStore/ValuelessSnakStoreTest.php
+++ b/QueryEngine/tests/phpunit/SQLStore/SnakStore/ValuelessSnakStoreTest.php
@@ -138,4 +138,25 @@
                $store->storeSnakRow( $snakRow );
        }
 
+       public function testRemoveSnaksOfSubject() {
+               $internalSubjectId = 4242;
+               $tableName = 'test_snaks_nyan';
+
+               $queryInterface = $this->getMock( 
'Wikibase\Database\QueryInterface' );
+
+               $queryInterface->expects( $this->once() )
+                       ->method( 'delete' )
+                       ->with(
+                               $this->equalTo( $tableName ),
+                               $this->equalTo( array( 'subject_id' => 
$internalSubjectId ) )
+                       );
+
+               $store = new ValuelessSnakStore(
+                       $queryInterface,
+                       $tableName
+               );
+
+               $store->removeSnaksOfSubject( $internalSubjectId );
+       }
+
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie6a7bd62fe67465c4794c07f1bc695a95749c89b
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com>
Gerrit-Reviewer: Anja Jentzsch <a...@anjeve.de>
Gerrit-Reviewer: Ataherivand <abraham.taheriv...@wikimedia.de>
Gerrit-Reviewer: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Daniel Werner <daniel.wer...@wikimedia.de>
Gerrit-Reviewer: Denny Vrandecic <denny.vrande...@wikimedia.de>
Gerrit-Reviewer: Henning Snater <henning.sna...@wikimedia.de>
Gerrit-Reviewer: Jens Ohlig <jens.oh...@wikimedia.de>
Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com>
Gerrit-Reviewer: John Erling Blad <jeb...@gmail.com>
Gerrit-Reviewer: Lydia Pintscher <lydia.pintsc...@wikimedia.de>
Gerrit-Reviewer: Markus Kroetzsch <mar...@semantic-mediawiki.org>
Gerrit-Reviewer: Nikola Smolenski <smole...@eunet.rs>
Gerrit-Reviewer: Silke Meyer <silke.me...@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