X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FTemplateParserTest.php;h=2bd9086d60e0d9d3d5d452ca7d489c8505764496;hb=a0947c9507065a83afe52b078f0f6d1c6163875e;hp=81854ff3228186f0b2c5b85c4832c4df360e6730;hpb=fbcb3d5f980a9be0611424764d6f18e749e4c1c9;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/TemplateParserTest.php b/tests/phpunit/includes/TemplateParserTest.php index 81854ff322..2bd9086d60 100644 --- a/tests/phpunit/includes/TemplateParserTest.php +++ b/tests/phpunit/includes/TemplateParserTest.php @@ -10,10 +10,9 @@ class TemplateParserTest extends MediaWikiTestCase { protected function setUp() { parent::setUp(); - $this->setMwGlobals( array( + $this->setMwGlobals( [ 'wgSecretKey' => 'foo', - 'wgMemc' => new EmptyBagOStuff(), - ) ); + ] ); $this->templateDir = dirname( __DIR__ ) . '/data/templates/'; } @@ -33,31 +32,81 @@ class TemplateParserTest extends MediaWikiTestCase { } public static function provideProcessTemplate() { - return array( - array( + return [ + [ 'foobar', - array(), + [], "hello world!\n" - ), - array( + ], + [ 'foobar_args', - array( + [ 'planet' => 'world', - ), + ], "hello world!\n", - ), - array( + ], + [ '../foobar', - array(), + [], false, 'UnexpectedValueException' - ), - array( + ], + [ + "\000../foobar", + [], + false, + 'UnexpectedValueException' + ], + [ + '/', + [], + false, + 'UnexpectedValueException' + ], + [ + // Allegedly this can strip ext in windows. + 'baz<', + [], + false, + 'UnexpectedValueException' + ], + [ + '\\foo', + [], + false, + 'UnexpectedValueException' + ], + [ + 'C:\bar', + [], + false, + 'UnexpectedValueException' + ], + [ + "foo\000bar", + [], + false, + 'UnexpectedValueException' + ], + [ 'nonexistenttemplate', - array(), + [], false, 'RuntimeException', - ) - ); + ], + [ + 'has_partial', + [ + 'planet' => 'world', + ], + "Partial hello world!\n in here\n", + ], + [ + 'bad_partial', + [], + false, + 'Exception', + ], + ]; } }