* Use WikiPage instead of Article for ParserCache stuff
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 5 Feb 2012 16:45:41 +0000 (16:45 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 5 Feb 2012 16:45:41 +0000 (16:45 +0000)
* Use ParserOptions::newFromUserAndLang() instead of 'new ParserOptions' to not rely on global variables

tests/phpunit/includes/ParserOptionsTest.php

index 9c50cc4..59c955f 100644 (file)
@@ -8,7 +8,7 @@ class ParserOptionsTest extends MediaWikiTestCase {
        function setUp() {
                global $wgContLang, $wgUser, $wgLanguageCode;
                $wgContLang = Language::factory( $wgLanguageCode );
-               $this->popts = new ParserOptions( $wgUser );
+               $this->popts = ParserOptions::newFromUserAndLang( $wgUser, $wgContLang );
                $this->pcache = ParserCache::singleton();
        }
 
@@ -25,11 +25,11 @@ class ParserOptionsTest extends MediaWikiTestCase {
                $wgUseDynamicDates = true;
 
                $title = Title::newFromText( "Some test article" );
-               $article = new Article( $title );
+               $page = WikiPage::factory( $title );
 
-               $pcacheKeyBefore = $this->pcache->getKey( $article, $this->popts );
+               $pcacheKeyBefore = $this->pcache->getKey( $page, $this->popts );
                $this->assertNotNull( $this->popts->getDateFormat() );
-               $pcacheKeyAfter = $this->pcache->getKey( $article, $this->popts );
+               $pcacheKeyAfter = $this->pcache->getKey( $page, $this->popts );
                $this->assertEquals( $pcacheKeyBefore, $pcacheKeyAfter );
        }
 }