private $popts;
private $pcache;
- function setUp() {
- global $wgContLang, $wgUser, $wgLanguageCode;
- $wgContLang = Language::factory( $wgLanguageCode );
- $this->popts = new ParserOptions( $wgUser );
- $this->pcache = ParserCache::singleton();
- }
+ protected function setUp() {
+ global $wgLanguageCode, $wgUser;
+ parent::setUp();
+
+ $langObj = Language::factory( $wgLanguageCode );
+
+ $this->setMwGlobals( array(
+ 'wgContLang' => $langObj,
+ 'wgUseDynamicDates' => true,
+ ) );
- function tearDown() {
- parent::tearDown();
+ $this->popts = ParserOptions::newFromUserAndLang( $wgUser, $langObj );
+ $this->pcache = ParserCache::singleton();
}
/**
* @group Database
*/
function testGetParserCacheKeyWithDynamicDates() {
- global $wgUseDynamicDates;
- $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 );
}
}