Merge "Use parseAsBlock() instead of parse() to show the error message in OutputPage...
[lhc/web/wiklou.git] / tests / phpunit / includes / ParserOptionsTest.php
1 <?php
2
3 class ParserOptionsTest extends MediaWikiTestCase {
4
5 private $popts;
6 private $pcache;
7
8 protected function setUp() {
9 global $wgLanguageCode, $wgUser;
10 parent::setUp();
11
12 $langObj = Language::factory( $wgLanguageCode );
13
14 $this->setMwGlobals( array(
15 'wgContLang' => $langObj,
16 'wgUseDynamicDates' => true,
17 ) );
18
19 $this->popts = ParserOptions::newFromUserAndLang( $wgUser, $langObj );
20 $this->pcache = ParserCache::singleton();
21 }
22
23 /**
24 * ParserOptions::optionsHash was not giving consistent results when $wgUseDynamicDates was set
25 * @group Database
26 */
27 function testGetParserCacheKeyWithDynamicDates() {
28 $title = Title::newFromText( "Some test article" );
29 $page = WikiPage::factory( $title );
30
31 $pcacheKeyBefore = $this->pcache->getKey( $page, $this->popts );
32 $this->assertNotNull( $this->popts->getDateFormat() );
33
34 $pcacheKeyAfter = $this->pcache->getKey( $page, $this->popts );
35 $this->assertEquals( $pcacheKeyBefore, $pcacheKeyAfter );
36 }
37 }