X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FTemplateParserTest.php;h=2bd9086d60e0d9d3d5d452ca7d489c8505764496;hb=baa9036839396fb3b3a12bc06f52291b083a226d;hp=3b37f4a46a33c4a1bf104d06e75d87cae969ed1e;hpb=8c087b9fd13d9302ec1be2176ef1ae344b3f8273;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/TemplateParserTest.php b/tests/phpunit/includes/TemplateParserTest.php index 3b37f4a46a..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,44 +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', - ), - array( + ], + [ 'has_partial', - array( + [ 'planet' => 'world', - ), + ], "Partial hello world!\n in here\n", - ), - array( + ], + [ 'bad_partial', - array(), + [], false, 'Exception', - ), - ); + ], + ]; } }