getServiceContainer(); $this->testParserOptions = ParserOptions::newFromUserAndLang( new User, $this->getServiceContainer()->getContentLanguage() ); $this->testParser = $services->getParserFactory()->create(); $this->testParser->setOptions( $this->testParserOptions ); $this->testParser->clearState(); $this->title = Title::newFromText( 'Preload Test' ); } public function testPreloadSimpleText() { $this->assertPreloaded( 'simple', 'simple' ); } public function testPreloadedPreIsUnstripped() { $this->assertPreloaded( '
monospaced', '
monospaced', '
in preloaded text must be unstripped (T29467)' ); } public function testPreloadedNowikiIsUnstripped() { $this->assertPreloaded( '[[Dummy title]] ', '[[Dummy title]] ', 'in preloaded text must be unstripped (T29467)' ); } protected function assertPreloaded( $expected, $text, $msg = '' ) { $this->assertEquals( $expected, $this->testParser->getPreloadText( $text, $this->title, $this->testParserOptions ), $msg ); } }