jenkins-bot has submitted this change and it was merged.

Change subject: Travis#185.2
......................................................................


Travis#185.2

We mock the CacheHandler since Travis sporadically reported a failing test.
 
Change-Id: I251ff28d0188ad84462ac2ed06d867bfdfa16e38
---
M includes/cache/CacheHandler.php
M tests/phpunit/includes/hooks/ParserAfterTidyTest.php
2 files changed, 27 insertions(+), 8 deletions(-)

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



diff --git a/includes/cache/CacheHandler.php b/includes/cache/CacheHandler.php
index 3e0ed55..ae6e346 100644
--- a/includes/cache/CacheHandler.php
+++ b/includes/cache/CacheHandler.php
@@ -21,7 +21,7 @@
  *
  * @ingroup Handler
  */
-final class CacheHandler {
+class CacheHandler {
 
        /** @var BagOStuff */
        protected $cache = null;
diff --git a/tests/phpunit/includes/hooks/ParserAfterTidyTest.php 
b/tests/phpunit/includes/hooks/ParserAfterTidyTest.php
index da77047..29aba20 100644
--- a/tests/phpunit/includes/hooks/ParserAfterTidyTest.php
+++ b/tests/phpunit/includes/hooks/ParserAfterTidyTest.php
@@ -36,6 +36,31 @@
        }
 
        /**
+        * Helper method that returns a CacheHandler object
+        *
+        * @since 1.9
+        *
+        * @return CacheHandler
+        */
+       private function newMockCacheHandler( $id, $status ) {
+
+               $cacheHandler = $this->getMockBuilder( 'SMW\CacheHandler' )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+
+               $cacheHandler->expects( $this->any() )
+                       ->method( 'setKey' )
+                       ->with( $this->equalTo( 
\SMW\ArticlePurge::newIdGenerator( $id ) ) );
+
+               $cacheHandler->expects( $this->any() )
+                       ->method( 'get' )
+                       ->will( $this->returnValue( $status ) );
+
+               return $cacheHandler;
+
+       }
+
+       /**
         * Helper method that returns a ParserAfterTidy object
         *
         * @since 1.9
@@ -84,14 +109,8 @@
                ) );
 
                $updateObserver = new MockUpdateObserver();
-               $cacheHandler   = $instance->getDependencyBuilder()->newObject( 
'CacheHandler' );
 
-               // Simulates a previous state change did cause a cache entry
-               if ( $setup['cache'] ) {
-                       $cacheHandler->setKey(
-                               \SMW\ArticlePurge::newIdGenerator( 
$setup['title']->getArticleID() )
-                       )->set( __METHOD__ );
-               }
+               $cacheHandler = $this->newMockCacheHandler( 
$setup['title']->getArticleID(), $setup['cache']  );
 
                $container = $instance->getDependencyBuilder()->getContainer();
                $container->registerObject( 'Settings', $settings );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I251ff28d0188ad84462ac2ed06d867bfdfa16e38
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Mwjames <[email protected]>
Gerrit-Reviewer: Mwjames <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to