Jeroen De Dauw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/65578


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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/78/65578/1

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 6a76c4f..a2f5751 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: newchange
Gerrit-Change-Id: Ie6a7bd62fe67465c4794c07f1bc695a95749c89b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
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

Reply via email to