Mwjames has uploaded a new change for review.

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


Change subject: Some renaming
......................................................................

Some renaming

Change-Id: Ib080e8793d360186b5f017d882f001955e4a0edf
---
M SemanticMediaWiki.classes.php
R includes/FactboxCache.php
M includes/dic/SharedDependencyContainer.php
D includes/dic/objects/DiParserData.php
M includes/hooks/ArticlePurge.php
M includes/hooks/OutputPageParserOutput.php
M includes/hooks/ParserAfterTidy.php
M includes/hooks/SkinAfterContent.php
M includes/jobs/UpdateJob.php
M tests/phpunit/MockObjectRepository.php
R tests/phpunit/includes/FactboxCacheTest.php
M tests/phpunit/includes/dic/SharedDependencyContainerTest.php
M tests/phpunit/includes/hooks/ArticlePurgeTest.php
M tests/phpunit/includes/hooks/OutputPageParserOutputTest.php
M tests/phpunit/includes/hooks/ParserAfterTidyTest.php
M tests/phpunit/includes/hooks/SkinAfterContentTest.php
16 files changed, 174 insertions(+), 142 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki 
refs/changes/24/85524/1

diff --git a/SemanticMediaWiki.classes.php b/SemanticMediaWiki.classes.php
index d6bea72..02f6ce7 100644
--- a/SemanticMediaWiki.classes.php
+++ b/SemanticMediaWiki.classes.php
@@ -27,7 +27,7 @@
        'SMW\Highlighter'           => 'includes/Highlighter.php',
        'SMW\ParameterInput'        => 'includes/ParameterInput.php',
        'SMW\Factbox'               => 'includes/Factbox.php',
-       'SMW\FactboxPresenter'      => 'includes/FactboxPresenter.php',
+       'SMW\FactboxCache'          => 'includes/FactboxCache.php',
        'SMWInfolink'               => 'includes/SMW_Infolink.php',
        'SMWOutputs'                => 'includes/SMW_Outputs.php',
        'SMW\ParserTextProcessor'   => 'includes/ParserTextProcessor.php',
@@ -92,9 +92,6 @@
        // Dependency Injector
        'SMW\DependencyRequestor'             => 
'includes/dic/DependencyRequestor.php',
        'SMW\DependencyInjector'              => 
'includes/dic/DependencyInjector.php',
-
-       // Service objects
-       'SMW\DiParserData'                   => 
'includes/dic/objects/DiParserData.php',
 
        'SMW\Cacheable'                 => 'includes/Cacheable.php',
        'SMW\Configurable'              => 'includes/Configurable.php',
diff --git a/includes/FactboxPresenter.php b/includes/FactboxCache.php
similarity index 82%
rename from includes/FactboxPresenter.php
rename to includes/FactboxCache.php
index 7122d3e..b47acbf 100644
--- a/includes/FactboxPresenter.php
+++ b/includes/FactboxCache.php
@@ -2,6 +2,7 @@
 
 namespace SMW;
 
+use ParserOutput;
 use OutputPage;
 use Title;
 
@@ -25,9 +26,9 @@
  *
  * @ingroup SMW
  */
-class FactboxPresenter extends DependencyInjector {
+class FactboxCache extends DependencyInjector {
 
-       /** @var Factbox */
+       /** @var OutputPage */
        protected $outputPage = null;
 
        /** @var boolean */
@@ -38,14 +39,14 @@
         *
         * @param OutputPage &$outputPage
         *
-        * @return FactboxPresenter
+        * @return FactboxCache
         */
        public function __construct( OutputPage &$outputPage ) {
                $this->outputPage = $outputPage;
        }
 
        /**
-        * Prepare and update the OutputPage object
+        * Prepare and update the OutputPage property
         *
         * Factbox content is either retrived from CacheStore or re-parsed from
         * the invoked Factbox object
@@ -59,9 +60,9 @@
         *
         * @since 1.9
         *
-        * @param ParserData $parserData
+        * @param ParserOutput $parserOutput
         */
-       public function process( ParserData $parserData ) {
+       public function process( ParserOutput $parserOutput ) {
 
                Profiler::In( __METHOD__ );
 
@@ -77,7 +78,7 @@
                } else {
 
                        $this->isCached = false;
-                       $this->outputPage->mSMWFactboxText = $this->parse( 
$parserData );
+                       $this->outputPage->mSMWFactboxText = $this->rebuild( 
$parserOutput );
                        $resultMapper->recache( array(
                                'revId' => $title->getLatestRevID(),
                                'text'  => $this->outputPage->mSMWFactboxText
@@ -88,8 +89,8 @@
        }
 
        /**
-        * Returns parsed Factbox content from either the OutputPage
-        * or the CacheStore
+        * Returns parsed Factbox content from either the OutputPage property
+        * or from the CacheStore
         *
         * @since 1.9
         *
@@ -128,7 +129,7 @@
         *
         * @return CacheIdGenerator
         */
-       public static function newCacheIdGenerator( $pageId ) {
+       public static function newCacheId( $pageId ) {
                return new CacheIdGenerator( $pageId, 'factbox' );
        }
 
@@ -166,16 +167,21 @@
         *
         * @return string|null
         */
-       protected function parse( ParserData $parserData ) {
+       protected function rebuild( ParserOutput $parserOutput ) {
 
                $text = null;
+
+               /**
+                * @var RequestContext
+                */
+               $this->getDependencyBuilder()->getContainer()->registerObject( 
'RequestContext', $this->outputPage->getContext() );
 
                /**
                 * @var Factbox $factbox
                 */
                $factbox = $this->getDependencyBuilder()->newObject( 'Factbox', 
array(
-                       'ParserData'     => $parserData,
-                       'RequestContext' => $this->outputPage->getContext()
+                       'Title'          => $this->outputPage->getTitle(),
+                       'ParserOutput'   => $parserOutput
                ) );
 
                if ( $factbox->doBuild()->isVisible() ) {
diff --git a/includes/dic/SharedDependencyContainer.php 
b/includes/dic/SharedDependencyContainer.php
index 999c094..11d4995 100644
--- a/includes/dic/SharedDependencyContainer.php
+++ b/includes/dic/SharedDependencyContainer.php
@@ -75,17 +75,13 @@
         *
         * @see  DependencyContainer::loadObjects
         *
-        * It is proposed that the requested service object being available as
-        * individual object class is using the following SMW\Di + <requested 
service>
-        * naming pattern
-        *
         * @since  1.9
         *
         * @return array
         */
        public function loadObjects() {
                return array(
-                       'ParserData'            => '\SMW\DiParserData',
+                       'ParserData'            => $this->getParserData(),
                        'NamespaceExaminer'     => 
$this->getNamespaceExaminer(),
                        'UpdateObserver'        => $this->getUpdateObserver(),
                        'BasePropertyAnnotator' => 
$this->getBasePropertyAnnotator(),
@@ -108,26 +104,80 @@
                        'Factbox' => function ( DependencyBuilder $builder ) {
                                return new Factbox(
                                        $builder->newObject( 'Store' ),
-                                       $builder->getArgument( 'ParserData' ),
+                                       $builder->newObject( 'ParserData' ),
                                        $builder->newObject( 'Settings' ),
-                                       $builder->getArgument( 'RequestContext' 
)
+                                       $builder->newObject( 'RequestContext' )
                                );
                        },
 
-                       'FactboxPresenter' => function ( DependencyBuilder 
$builder ) {
+                       'FactboxCache' => function ( DependencyBuilder $builder 
) {
 
                                $outputPage = $builder->getArgument( 
'OutputPage' );
 
-                               $instance = new FactboxPresenter( $outputPage );
+                               $instance = new FactboxCache( $outputPage );
                                $instance->setDependencyBuilder( $builder );
 
                                return $instance;
+                       },
+
+                       /**
+                        * IContextSource object definition
+                        *
+                        * @since  1.9
+                        *
+                        * @return IContextSource
+                        */
+                       'RequestContext' => function ( DependencyBuilder 
$builder ) {
+
+                               $instance = new \RequestContext();
+
+                               if ( $builder->hasArgument( 'Title' ) ) {
+                                       $instance->setTitle( 
$builder->getArgument( 'Title' ) );
+                               }
+
+                               if ( $builder->hasArgument( 'Language' ) ) {
+                                       $instance->setLanguage( 
$builder->getArgument( 'Language' ) );
+                               }
+
+                               return $instance;
+                       },
+
+                       /**
+                        * WikiPage object definition
+                        *
+                        * @since  1.9
+                        *
+                        * @return WikiPage
+                        */
+                       'WikiPage' => function ( DependencyBuilder $builder ) {
+                               return \WikiPage::factory( 
$builder->getArgument( 'Title' ) );
                        }
 
                );
        }
 
        /**
+        * ParserData object definition
+        *
+        * @since  1.9
+        *
+        * @return ParserData
+        */
+       protected function getParserData() {
+               return function ( DependencyBuilder $builder ) {
+
+                       $instance = new ParserData(
+                               $builder->getArgument( 'Title' ),
+                               $builder->getArgument( 'ParserOutput' )
+                       );
+
+                       $instance->setObservableDispatcher( 
$builder->newObject( 'ObservableUpdateDispatcher' ) );
+
+                       return $instance;
+               };
+       }
+
+       /**
         * NamespaceExaminer object definition
         *
         * @since  1.9
diff --git a/includes/dic/objects/DiParserData.php 
b/includes/dic/objects/DiParserData.php
deleted file mode 100644
index d6009bb..0000000
--- a/includes/dic/objects/DiParserData.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-namespace SMW;
-
-/**
- * ParserData dependency object specification
- *
- * @file
- *
- * @license GNU GPL v2+
- * @since   1.9
- *
- * @author mwjames
- */
-
-/**
- * ParserData dependency object specification
- *
- * @ingroup DependencyContainer
- * @ingroup DependencyObject
- */
-class DiParserData implements DependencyObject {
-
-       /**
-        * @see DependencyObject::defineObject
-        *
-        * @since  1.9
-        *
-        * @param DependencyBuilder $builder
-        */
-       public function defineObject( DependencyBuilder $builder ) {
-
-               $parserData = new ParserData(
-                       $builder->getArgument( 'Title' ),
-                       $builder->getArgument( 'ParserOutput' )
-               );
-
-               $parserData->setObservableDispatcher( $builder->newObject( 
'ObservableUpdateDispatcher' ) );
-
-               return $parserData;
-
-       }
-
-}
diff --git a/includes/hooks/ArticlePurge.php b/includes/hooks/ArticlePurge.php
index 935652c..1ffd984 100644
--- a/includes/hooks/ArticlePurge.php
+++ b/includes/hooks/ArticlePurge.php
@@ -46,7 +46,7 @@
         *
         * @return CacheIdGenerator
         */
-       public static function newIdGenerator( $pageId ) {
+       public static function newCacheId( $pageId ) {
                return new CacheIdGenerator( $pageId, 'autorefresh' );
        }
 
@@ -72,11 +72,11 @@
                $cache = $this->getDependencyBuilder()->newObject( 
'CacheHandler' );
 
                $cache->setCacheEnabled( $pageId > 0 )
-                       ->setKey( $this->newIdGenerator( $pageId ) )
+                       ->setKey( $this->newCacheId( $pageId ) )
                        ->set( $settings->get( 'smwgAutoRefreshOnPurge' ) );
 
                $cache->setCacheEnabled( $settings->get( 
'smwgFactboxCacheRefreshOnPurge' ) )
-                       ->setKey( FactboxPresenter::newCacheIdGenerator( 
$pageId ) )
+                       ->setKey( FactboxCache::newCacheId( $pageId ) )
                        ->delete();
 
                return true;
diff --git a/includes/hooks/OutputPageParserOutput.php 
b/includes/hooks/OutputPageParserOutput.php
index b3f2b9e..5147a96 100644
--- a/includes/hooks/OutputPageParserOutput.php
+++ b/includes/hooks/OutputPageParserOutput.php
@@ -58,7 +58,7 @@
         * @return true
         */
        public function process() {
-               return $this->isValid( $this->outputPage->getTitle() ) ? 
$this->performUpdate( $this->outputPage->getTitle() ) : true;
+               return $this->isValid( $this->outputPage->getTitle() ) ? 
$this->performUpdate() : true;
        }
 
        /**
@@ -79,27 +79,16 @@
         *
         * @return true
         */
-       protected function performUpdate( Title $title ) {
+       protected function performUpdate() {
 
                /**
-                * @var ParserData $parserData
+                * @var FactboxCache $factboxCache
                 */
-               $parserData = $this->getDependencyBuilder()->newObject( 
'ParserData', array(
-                       'Title'        => $title,
-                       'ParserOutput' => $this->parserOutput
-               ) );
-
-               /**
-                * @var FactboxPresenter $presenter
-                */
-               $presenter = $this->getDependencyBuilder()->newObject( 
'FactboxPresenter', array(
+               $factboxCache = $this->getDependencyBuilder()->newObject( 
'FactboxCache', array(
                        'OutputPage' => $this->outputPage
                ) );
 
-               // Instead of inject the ParserData object here, we could just 
use
-               // parserOutput and let the DependencyBuilder handle the object 
build
-               // in the background if needed
-               $presenter->process( $parserData );
+               $factboxCache->process( $this->parserOutput );
 
                // @Legacy code
                // Not sure why this was ever needed but to monitor any
diff --git a/includes/hooks/ParserAfterTidy.php 
b/includes/hooks/ParserAfterTidy.php
index c8598b1..a93aec6 100644
--- a/includes/hooks/ParserAfterTidy.php
+++ b/includes/hooks/ParserAfterTidy.php
@@ -44,6 +44,17 @@
        }
 
        /**
+        * @see FunctionHook::process
+        *
+        * @since 1.9
+        *
+        * @return true
+        */
+       public function process() {
+               return !$this->parser->getTitle()->isSpecialPage() ? 
$this->performUpdate( $this->parser->getTitle() ) : true;
+       }
+
+       /**
         * @note Article purge: In case an article was manually purged/moved
         * the store is updated as well and for all other cases 
LinksUpdateConstructed
         * will handle the store update
@@ -83,7 +94,7 @@
                 */
                $cache = $this->getDependencyBuilder()->newObject( 
'CacheHandler' );
 
-               $cache->setKey( ArticlePurge::newIdGenerator( 
$title->getArticleID() ) );
+               $cache->setKey( ArticlePurge::newCacheId( 
$title->getArticleID() ) );
 
                if( $cache->get() && !$title->inNamespace( NS_FILE ) ) {
                        $cache->delete();
@@ -91,17 +102,6 @@
                }
 
                return true;
-       }
-
-       /**
-        * @see FunctionHook::process
-        *
-        * @since 1.9
-        *
-        * @return true
-        */
-       public function process() {
-               return !$this->parser->getTitle()->isSpecialPage() ? 
$this->performUpdate( $this->parser->getTitle() ) : true;
        }
 
 }
diff --git a/includes/hooks/SkinAfterContent.php 
b/includes/hooks/SkinAfterContent.php
index d304098..e418e3e 100644
--- a/includes/hooks/SkinAfterContent.php
+++ b/includes/hooks/SkinAfterContent.php
@@ -50,16 +50,12 @@
        /**
         * @see FunctionHook::process
         *
-        * @note Check invoked action to avoid having the factbox being 
displayed
-        * in "edit" mode where facts are likly being outdated due to the 
editing
-        * process
-        *
         * @since 1.9
         *
         * @return true
         */
        public function process() {
-               return $this->skin->getContext()->getRequest()->getVal( 
'action' ) !== 'edit' ? $this->performUpdate( $this->skin->getOutput() ) : true;
+               return $this->performUpdate( $this->skin->getOutput() );
        }
 
        /**
@@ -70,13 +66,13 @@
        protected function performUpdate( OutputPage $outputPage ) {
 
                /**
-                * @var FactboxPresenter $presenter
+                * @var FactboxCache $factboxCache
                 */
-               $presenter = $this->getDependencyBuilder()->newObject( 
'FactboxPresenter', array(
+               $factboxCache = $this->getDependencyBuilder()->newObject( 
'FactboxCache', array(
                        'OutputPage' => $outputPage
                ) );
 
-               $this->data .= $presenter->retrieveContent();
+               $this->data .= $factboxCache->retrieveContent();
 
                return true;
        }
diff --git a/includes/jobs/UpdateJob.php b/includes/jobs/UpdateJob.php
index ed7efc7..46bd7cb 100644
--- a/includes/jobs/UpdateJob.php
+++ b/includes/jobs/UpdateJob.php
@@ -121,6 +121,12 @@
                Profiler::In( __METHOD__ . '-update' );
 
                /**
+                * @var CacheHandler $cache
+                */
+               $cache = $this->getDependencyBuilder()->newObject( 
'CacheHandler' );
+               $cache->setKey( FactboxCache::newCacheId( 
$this->getTitle()->getArticleID() ) )->delete();
+
+               /**
                 * @var ParserData $parserData
                 */
                $parserData = $this->getDependencyBuilder()->newObject( 
'ParserData', array(
diff --git a/tests/phpunit/MockObjectRepository.php 
b/tests/phpunit/MockObjectRepository.php
index f412aba..f79429e 100644
--- a/tests/phpunit/MockObjectRepository.php
+++ b/tests/phpunit/MockObjectRepository.php
@@ -1114,4 +1114,20 @@
                return $requestContext;
        }
 
+       /**
+        * Returns a Language object
+        *
+        * @since 1.9
+        *
+        * @return Language
+        */
+       public function Language() {
+
+               $language = $this->getMockBuilder( 'Language' )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+
+               return $language;
+       }
+
 }
diff --git a/tests/phpunit/includes/FactboxPresenterTest.php 
b/tests/phpunit/includes/FactboxCacheTest.php
similarity index 90%
rename from tests/phpunit/includes/FactboxPresenterTest.php
rename to tests/phpunit/includes/FactboxCacheTest.php
index 9e06ec1..64846ae 100644
--- a/tests/phpunit/includes/FactboxPresenterTest.php
+++ b/tests/phpunit/includes/FactboxCacheTest.php
@@ -3,10 +3,10 @@
 namespace SMW\Test;
 
 use SMW\SharedDependencyContainer;
-use SMW\FactboxPresenter;
+use SMW\FactboxCache;
 
 /**
- * Tests for the FactboxPresenter class
+ * Tests for the FactboxCache class
  *
  * @file
  *
@@ -17,14 +17,14 @@
  */
 
 /**
- * @covers \SMW\FactboxPresenter
+ * @covers \SMW\FactboxCache
  *
  * @ingroup Test
  *
  * @group SMW
  * @group SMWExtension
  */
-class FactboxPresenterTest extends ParserTestCase {
+class FactboxCacheTest extends ParserTestCase {
 
        /**
         * Returns the name of the class to be tested
@@ -32,15 +32,15 @@
         * @return string|false
         */
        public function getClass() {
-               return '\SMW\FactboxPresenter';
+               return '\SMW\FactboxCache';
        }
 
        /**
-        * Helper method that returns a FactboxPresenter object
+        * Helper method that returns a FactboxCache object
         *
         * @since 1.9
         *
-        * @return FactboxPresenter
+        * @return FactboxCache
         */
        private function newInstance( &$outputPage = null ) {
 
@@ -52,14 +52,14 @@
                $container->registerObject( 'Settings', $this->newSettings() );
                $container->registerObject( 'Store', 
$this->newMockBuilder()->newObject( 'Store' ) );
 
-               $instance = new FactboxPresenter( $outputPage );
+               $instance = new FactboxCache( $outputPage );
                $instance->setDependencyBuilder( $this->newDependencyBuilder( 
$container ) );
 
                return $instance;
        }
 
        /**
-        * @test FactboxPresenter::__construct
+        * @test FactboxCache::__construct
         *
         * @since 1.9
         */
@@ -68,8 +68,8 @@
        }
 
        /**
-        * @test FactboxPresenter::process
-        * @test FactboxPresenter::retrieveContent
+        * @test FactboxCache::process
+        * @test FactboxCache::retrieveContent
         * @dataProvider outputDataProvider
         *
         * @since 1.9
@@ -92,12 +92,10 @@
                $container = $instance->getDependencyBuilder()->getContainer();
                $container->registerObject( 'Settings', $this->newSettings( 
$settings ) );
 
-               $parserData = $this->newParserData( $outputPage->getTitle(), 
$setup['parserOutput'] );
-
                // Verifies that no previous content is cached
                $this->assertEmpty( $instance->retrieveContent() );
 
-               $instance->process( $parserData );
+               $instance->process( $setup['parserOutput'] );
                $result = $outputPage->mSMWFactboxText;
 
                if ( $expected['text'] ) {
@@ -124,7 +122,7 @@
                }
 
                // Re-run on the same instance
-               $instance->process( $parserData );
+               $instance->process( $setup['parserOutput'] );
 
                $this->assertEquals(
                        $result,
diff --git a/tests/phpunit/includes/dic/SharedDependencyContainerTest.php 
b/tests/phpunit/includes/dic/SharedDependencyContainerTest.php
index 5d5abf0..5bdf977 100644
--- a/tests/phpunit/includes/dic/SharedDependencyContainerTest.php
+++ b/tests/phpunit/includes/dic/SharedDependencyContainerTest.php
@@ -124,6 +124,20 @@
                $provider[] = array( 'NamespaceExaminer',          array( 
'\SMW\NamespaceExaminer'           => array() ) );
                $provider[] = array( 'UpdateObserver',             array( 
'\SMW\UpdateObserver'              => array() ) );
                $provider[] = array( 'ObservableUpdateDispatcher', array( 
'\SMW\ObservableSubjectDispatcher' => array() ) );
+               $provider[] = array( 'RequestContext',             array( 
'\IContextSource'                  => array() ) );
+
+               $provider[] = array( 'RequestContext', array( '\IContextSource' 
=> array(
+                               'Title'    => 
$this->newMockBuilder()->newObject( 'Title' ),
+                               'Language' => 
$this->newMockBuilder()->newObject( 'Language' )
+                               )
+                       )
+               );
+
+               $provider[] = array( 'WikiPage', array( '\WikiPage' => array(
+                               'Title' => $this->newMockBuilder()->newObject( 
'Title' )
+                               )
+                       )
+               );
 
                $provider[] = array( 'ContentParser', array( 
'\SMW\ContentParser' => array(
                                'Title'        => 
$this->newMockBuilder()->newObject( 'Title' )
@@ -138,13 +152,13 @@
                );
 
                $provider[] = array( 'Factbox', array( '\SMW\Factbox' => array(
-                               'ParserData'     => 
$this->newMockBuilder()->newObject( 'ParserData' ),
-                               'RequestContext' => 
$this->newMockBuilder()->newObject( 'RequestContext' )
+                               'Title'          => 
$this->newMockBuilder()->newObject( 'Title' ),
+                               'ParserOutput'   => 
$this->newMockBuilder()->newObject( 'ParserOutput' ),
                                )
                        )
                );
 
-               $provider[] = array( 'FactboxPresenter', array( 
'\SMW\FactboxPresenter' => array(
+               $provider[] = array( 'FactboxCache', array( '\SMW\FactboxCache' 
=> array(
                                'OutputPage'  => 
$this->newMockBuilder()->newObject( 'OutputPage' )
                                )
                        )
diff --git a/tests/phpunit/includes/hooks/ArticlePurgeTest.php 
b/tests/phpunit/includes/hooks/ArticlePurgeTest.php
index 1ec7f31..e6d7339 100644
--- a/tests/phpunit/includes/hooks/ArticlePurgeTest.php
+++ b/tests/phpunit/includes/hooks/ArticlePurgeTest.php
@@ -91,13 +91,13 @@
                $instance = $this->newInstance( $wikiPage, $settings );
                $cache = $instance->getDependencyBuilder()->newObject( 
'CacheHandler' );
 
-               $id = \SMW\FactboxPresenter::newCacheIdGenerator( $pageId );
+               $id = \SMW\FactboxCache::newCacheId( $pageId );
        //      $cache->setKey( $id )->set( true );
 
                // Pre-process check
                $this->assertEquals(
                        $expected['autorefreshPreProcess'],
-                       $cache->setKey( $instance->newIdGenerator( $pageId ) 
)->get(),
+                       $cache->setKey( $instance->newCacheId( $pageId ) 
)->get(),
                        'Asserts the autorefresh cache status before processing'
                );
 
@@ -109,7 +109,7 @@
                );
 
                $this->assertFalse(
-                       $cache->setKey( $instance->newIdGenerator( $pageId ) 
)->get(),
+                       $cache->setKey( $instance->newCacheId( $pageId ) 
)->get(),
                        'Asserts that before processing ...'
                );
 
@@ -123,7 +123,7 @@
 
                $this->assertEquals(
                        $expected['autorefreshPostProcess'],
-                       $cache->setKey( $instance->newIdGenerator( $pageId ) 
)->get(),
+                       $cache->setKey( $instance->newCacheId( $pageId ) 
)->get(),
                        'Asserts the autorefresh cache status after processing'
                );
 
diff --git a/tests/phpunit/includes/hooks/OutputPageParserOutputTest.php 
b/tests/phpunit/includes/hooks/OutputPageParserOutputTest.php
index 9ce329c..9ce8e9a 100644
--- a/tests/phpunit/includes/hooks/OutputPageParserOutputTest.php
+++ b/tests/phpunit/includes/hooks/OutputPageParserOutputTest.php
@@ -96,12 +96,12 @@
                
$instance->getDependencyBuilder()->getContainer()->registerObject( 'Settings', 
$settings );
 
                // Verify that for the invoked objects no previsous content is 
cached
-               $presenter = $instance->getDependencyBuilder()->newObject( 
'FactboxPresenter', array(
+               $factboxCache = $instance->getDependencyBuilder()->newObject( 
'FactboxCache', array(
                        'OutputPage' => $outputPage
                ) );
 
                $this->assertEmpty(
-                       $presenter->retrieveContent(),
+                       $factboxCache->retrieveContent(),
                        'Asserts that retrieveContent() returns an empty result 
before process()'
                );
 
@@ -117,7 +117,7 @@
                        $this->assertContains( $expected['text'], $text );
                        $this->assertEquals(
                                $text,
-                               $presenter->retrieveContent(),
+                               $factboxCache->retrieveContent(),
                                'Asserts that retrieveContent() returns an 
expected text'
                        );
 
@@ -126,7 +126,7 @@
                        unset( $outputPage->mSMWFactboxText );
                        $this->assertEquals(
                                $text,
-                               $presenter->retrieveContent(),
+                               $factboxCache->retrieveContent(),
                                'Asserts that retrieveContent() is returning 
text from cache'
                        );
 
diff --git a/tests/phpunit/includes/hooks/ParserAfterTidyTest.php 
b/tests/phpunit/includes/hooks/ParserAfterTidyTest.php
index 5630e5b..d3deac9 100644
--- a/tests/phpunit/includes/hooks/ParserAfterTidyTest.php
+++ b/tests/phpunit/includes/hooks/ParserAfterTidyTest.php
@@ -50,7 +50,7 @@
 
                $cacheHandler->expects( $this->any() )
                        ->method( 'setKey' )
-                       ->with( $this->equalTo( 
\SMW\ArticlePurge::newIdGenerator( $id ) ) );
+                       ->with( $this->equalTo( \SMW\ArticlePurge::newCacheId( 
$id ) ) );
 
                $cacheHandler->expects( $this->any() )
                        ->method( 'get' )
diff --git a/tests/phpunit/includes/hooks/SkinAfterContentTest.php 
b/tests/phpunit/includes/hooks/SkinAfterContentTest.php
index 31455ab..0538eca 100644
--- a/tests/phpunit/includes/hooks/SkinAfterContentTest.php
+++ b/tests/phpunit/includes/hooks/SkinAfterContentTest.php
@@ -90,11 +90,11 @@
                // Inject fake content into the FactboxPresenter
                if ( isset( $setup['title'] ) ) {
 
-                       $presenter = 
$instance->getDependencyBuilder()->newObject( 'FactboxPresenter', array(
+                       $factboxCache = 
$instance->getDependencyBuilder()->newObject( 'FactboxCache', array(
                                'OutputPage' => $setup['skin']->getOutput()
                        ) );
 
-                       $resultMapper = $presenter->getResultMapper( 
$setup['title']->getArticleID() );
+                       $resultMapper = $factboxCache->getResultMapper( 
$setup['title']->getArticleID() );
                        $resultMapper->recache( array(
                                'revId' => null,
                                'text'  => $setup['text']
@@ -160,7 +160,7 @@
                        array( 'text' => $text )
                );
 
-               // #2 Special page, empty return
+               // #2 Special page
                $text  = __METHOD__ . 'text-2';
 
                $title = $this->newMockBuilder()->newObject( 'Title', array(
@@ -171,6 +171,8 @@
                        'getTitle' => $title
                ) );
 
+               $outputPage->mSMWFactboxText = $text;
+
                $skin = $this->newMockBuilder()->newObject( 'Skin', array(
                        'getTitle'   => $outputPage->getTitle(),
                        'getOutput'  => $outputPage,
@@ -179,15 +181,17 @@
 
                $provider[] = array(
                        array( 'skin' => $skin, 'text' => $text ),
-                       array( 'text' => '' )
+                       array( 'text' => $text )
                );
 
-               // #3 "edit" request, empty return
+               // #3 "edit" request
                $text   = __METHOD__ . 'text-3';
 
                $outputPage = $this->newMockBuilder()->newObject( 'OutputPage', 
array(
                        'getTitle' => $this->newMockBuilder()->newObject( 
'Title' )
                ) );
+
+               $outputPage->mSMWFactboxText = $text;
 
                $skin = $this->newMockBuilder()->newObject( 'Skin', array(
                        'getTitle'   => $outputPage->getTitle(),
@@ -197,7 +201,7 @@
 
                $provider[] = array(
                        array( 'skin' => $skin, 'text' => $text ),
-                       array( 'text' => '' )
+                       array( 'text' => $text )
                );
 
                return $provider;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib080e8793d360186b5f017d882f001955e4a0edf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Mwjames <[email protected]>

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

Reply via email to