0b11f1004f731bd319e9ac350a8695135aa00578
[lhc/web/wiklou.git] / maintenance / tests / phpunit / includes / ParserOptionsTest.php
1 <?php
2
3 class ParserOptionsTest extends PHPUnit_Framework_TestCase {
4
5 private $popts;
6 private $pcache;
7
8 function setUp() {
9 ParserTest::setUp(); //reuse setup from parser tests
10 global $wgContLang, $wgUser;
11 $wgContLang = new StubContLang;
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 */
23 function testGetParserCacheKeyWithDynamicDates() {
24 global $wgUseDynamicDates;
25 $wgUseDynamicDates = true;
26
27 $title = Title::newFromText( "Some test article" );
28 $article = new Article( $title );
29
30 $pcacheKeyBefore = $this->pcache->getKey( $article, $this->popts );
31 $this->assertNotNull( $this->popts->getDateFormat() );
32 $pcacheKeyAfter = $this->pcache->getKey( $article, $this->popts );
33 $this->assertEquals( $pcacheKeyBefore, $pcacheKeyAfter );
34 }
35 }