Index: trunk/phase3/maintenance/tests/phpunit/includes/ParserOptionsTest.php |
— | — | @@ -0,0 +1,35 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class ParserOptionsTest extends PHPUnit_Framework_TestCase { |
| 5 | + |
| 6 | + private $popts; |
| 7 | + private $pcache; |
| 8 | + |
| 9 | + function setUp() { |
| 10 | + ParserTest::setUp(); //reuse setup from parser tests |
| 11 | + global $wgContLang, $wgUser; |
| 12 | + $wgContLang = new StubContLang; |
| 13 | + $this->popts = new ParserOptions( $wgUser ); |
| 14 | + $this->pcache = ParserCache::singleton(); |
| 15 | + } |
| 16 | + |
| 17 | + function tearDown() { |
| 18 | + parent::tearDown(); |
| 19 | + } |
| 20 | + |
| 21 | + /* |
| 22 | + * ParserOptions::optionsHash was not giving consistent results when $wgUseDynamicDates was set |
| 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 | +} |
Index: trunk/phase3/includes/parser/ParserOptions.php |
— | — | @@ -284,7 +284,7 @@ |
285 | 285 | $confstr .= '!*' ; |
286 | 286 | |
287 | 287 | if ( in_array( 'dateformat', $forOptions ) ) |
288 | | - $confstr .= '!' . $this->mDateFormat; |
| 288 | + $confstr .= '!' . $this->getDateFormat(); |
289 | 289 | |
290 | 290 | if ( in_array( 'numberheadings', $forOptions ) ) |
291 | 291 | $confstr .= '!' . ( $this->mNumberHeadings ? '1' : '' ); |