jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/399632 )

Change subject: Use trivial implementations instead of mock if possible
......................................................................


Use trivial implementations instead of mock if possible

Mocking everything can easily become an anti-pattern. In the cases
touched in this patch we do have very trivial (in-memory) implementations
that work just fine. This makes the test setup easier to read.

Change-Id: I3d55be5ae236f56261b3acda7f98920302ce98a7
---
M tests/phpunit/Helper/SparqlHelperTest.php
1 file changed, 6 insertions(+), 5 deletions(-)

Approvals:
  Lucas Werkmeister (WMDE): Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/phpunit/Helper/SparqlHelperTest.php 
b/tests/phpunit/Helper/SparqlHelperTest.php
index f929d2b..1d1c152 100644
--- a/tests/phpunit/Helper/SparqlHelperTest.php
+++ b/tests/phpunit/Helper/SparqlHelperTest.php
@@ -14,6 +14,7 @@
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\Entity\ItemIdParser;
 use Wikibase\DataModel\Entity\PropertyId;
+use Wikibase\DataModel\Services\Lookup\InMemoryDataTypeLookup;
 use Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup;
 use Wikibase\DataModel\Snak\PropertyValueSnak;
 use Wikibase\DataModel\Statement\Statement;
@@ -63,7 +64,7 @@
                                                          
'http://www.wikidata.org/wiki/Special:EntityData/'
                                                  ),
                                                  new ItemIdParser(),
-                                                 $this->getMock( 
PropertyDataTypeLookup::class ),
+                                                 new InMemoryDataTypeLookup(),
                                                  WANObjectCache::newEmpty()
                                          ] )
                                          ->setMethods( [ 'runQuery' ] )
@@ -102,7 +103,7 @@
                                                          
'http://www.wikidata.org/wiki/Special:EntityData/'
                                                  ),
                                                  new ItemIdParser(),
-                                                 $this->getMock( 
PropertyDataTypeLookup::class ),
+                                                 new InMemoryDataTypeLookup(),
                                                  WANObjectCache::newEmpty()
                                          ] )
                                          ->setMethods( [ 'runQuery' ] )
@@ -359,7 +360,7 @@
                        ),
 
                        new ItemIdParser(),
-                       $this->getMock( PropertyDataTypeLookup::class ),
+                       new InMemoryDataTypeLookup(),
                        WANObjectCache::newEmpty()
                );
 
@@ -382,7 +383,7 @@
                                
'http://www.wikidata.org/wiki/Special:EntityData/'
                        ),
                        new ItemIdParser(),
-                       $this->getMock( PropertyDataTypeLookup::class ),
+                       new InMemoryDataTypeLookup(),
                        WANObjectCache::newEmpty()
                );
                $content = '(x+x+)+y';
@@ -434,7 +435,7 @@
                                
'http://www.wikidata.org/wiki/Special:EntityData/'
                        ),
                        new ItemIdParser(),
-                       $this->getMock( PropertyDataTypeLookup::class ),
+                       new InMemoryDataTypeLookup(),
                        WANObjectCache::newEmpty()
                );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3d55be5ae236f56261b3acda7f98920302ce98a7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <[email protected]>
Gerrit-Reviewer: Lucas Werkmeister (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to