6 class TemplateParserTest
extends MediaWikiTestCase
{
8 protected $templateDir;
10 protected function setUp() {
13 $this->setMwGlobals( [
14 'wgSecretKey' => 'foo',
17 $this->templateDir
= dirname( __DIR__
) . '/data/templates/';
21 * @dataProvider provideProcessTemplate
22 * @covers TemplateParser::processTemplate
23 * @covers TemplateParser::getTemplate
24 * @covers TemplateParser::getTemplateFilename
26 public function testProcessTemplate( $name, $args, $result, $exception = false ) {
28 $this->setExpectedException( $exception );
30 $tp = new TemplateParser( $this->templateDir
);
31 $this->assertEquals( $result, $tp->processTemplate( $name, $args ) );
34 public static function provideProcessTemplate() {
52 'UnexpectedValueException'
58 'UnexpectedValueException'
64 'UnexpectedValueException'
67 // Allegedly this can strip ext in windows.
71 'UnexpectedValueException'
77 'UnexpectedValueException'
83 'UnexpectedValueException'
89 'UnexpectedValueException'
92 'nonexistenttemplate',
102 "Partial hello world!\n in here\n",