wiki.techinc.nl/tests/phpunit/includes/ParserOptionsTest.php
Chad Horohoe 95d52efc32 * Drop old parserTests.php way of running parser tests. You can run parser tests via --group Parser or specifying
the includes/parser/MediaWikiParserTest.php test case
* Drop now unused various test recorder options -- phpunit outputs its data in lots of machine-readable formats, use those if you need to work with
  test data
* There's still a lot of duplication between NewParserTest::setUp() and MediaWikiTestCase, but hey one step at a time ;-)
* All tests pass for me (make phpunit && make parser)
2012-01-08 17:28:13 +00:00

35 lines
952 B
PHP

<?php
class ParserOptionsTest extends MediaWikiTestCase {
private $popts;
private $pcache;
function setUp() {
global $wgContLang, $wgUser, $wgLanguageCode;
$wgContLang = Language::factory( $wgLanguageCode );
$this->popts = new ParserOptions( $wgUser );
$this->pcache = ParserCache::singleton();
}
function tearDown() {
parent::tearDown();
}
/**
* ParserOptions::optionsHash was not giving consistent results when $wgUseDynamicDates was set
* @group Database
*/
function testGetParserCacheKeyWithDynamicDates() {
global $wgUseDynamicDates;
$wgUseDynamicDates = true;
$title = Title::newFromText( "Some test article" );
$article = new Article( $title );
$pcacheKeyBefore = $this->pcache->getKey( $article, $this->popts );
$this->assertNotNull( $this->popts->getDateFormat() );
$pcacheKeyAfter = $this->pcache->getKey( $article, $this->popts );
$this->assertEquals( $pcacheKeyBefore, $pcacheKeyAfter );
}
}