Import: Handle uploads with sha1 starting with 0 properly
[mediawiki.git] / tests / phpunit / includes / TemplateParserTest.php
blobddef24aae961fdbb5b8037a4a0dabb49d4c7a098
1 <?php
3 /**
4 * @group Templates
5 */
6 class TemplateParserTest extends MediaWikiTestCase {
8 protected $templateDir;
10 protected function setUp() {
11 parent::setUp();
13 $this->setMwGlobals( array(
14 'wgSecretKey' => 'foo',
15 ) );
17 $this->templateDir = dirname( __DIR__ ) . '/data/templates/';
20 /**
21 * @dataProvider provideProcessTemplate
22 * @covers TemplateParser::processTemplate
23 * @covers TemplateParser::getTemplate
24 * @covers TemplateParser::getTemplateFilename
26 public function testProcessTemplate( $name, $args, $result, $exception = false ) {
27 if ( $exception ) {
28 $this->setExpectedException( $exception );
30 $tp = new TemplateParser( $this->templateDir );
31 $this->assertEquals( $result, $tp->processTemplate( $name, $args ) );
34 public static function provideProcessTemplate() {
35 return array(
36 array(
37 'foobar',
38 array(),
39 "hello world!\n"
41 array(
42 'foobar_args',
43 array(
44 'planet' => 'world',
46 "hello world!\n",
48 array(
49 '../foobar',
50 array(),
51 false,
52 'UnexpectedValueException'
54 array(
55 'nonexistenttemplate',
56 array(),
57 false,
58 'RuntimeException',
60 array(
61 'has_partial',
62 array(
63 'planet' => 'world',
65 "Partial hello world!\n in here\n",
67 array(
68 'bad_partial',
69 array(),
70 false,
71 'Exception',