Revert r108358. It's a good fellow and we like to keep it.
[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 function setUp() {
9 ParserTest::setUp(); //reuse setup from parser tests
10 global $wgContLang, $wgUser, $wgLanguageCode;
11 $wgContLang = Language::factory( $wgLanguageCode );
12 $this->popts = new ParserOptions( $wgUser );
13 $this->pcache = ParserCache::singleton();
14 }
15
16 function tearDown() {
17 parent::tearDown();
18 }
19
20 /**
21 * ParserOptions::optionsHash was not giving consistent results when $wgUseDynamicDates was set
22 * @group Database
23 */
24 function testGetParserCacheKeyWithDynamicDates() {
25 global $wgUseDynamicDates;
26 $wgUseDynamicDates = true;
27
28 $title = Title::newFromText( "Some test article" );
29 $article = new Article( $title );
30
31 $pcacheKeyBefore = $this->pcache->getKey( $article, $this->popts );
32 $this->assertNotNull( $this->popts->getDateFormat() );
33 $pcacheKeyAfter = $this->pcache->getKey( $article, $this->popts );
34 $this->assertEquals( $pcacheKeyBefore, $pcacheKeyAfter );
35 }
36 }