Dev flags

This commit is contained in:
Ivan Shalganov
2014-04-09 18:03:49 +04:00
parent 61816e76bc
commit 777e315dce
9 changed files with 191 additions and 34 deletions

View File

@@ -18,6 +18,17 @@ class ExtendsTest extends TestCase
exit;
}
public static function providerExtendsInvalid()
{
return array(
array('{extends "extends/dynamic/child.3.tpl"} {extends "extends/dynamic/child.3.tpl"}', 'Fenom\Error\CompileException', "Only one {extends} allowed"),
array('{if true}{extends "extends/dynamic/child.3.tpl"}{/if}', 'Fenom\Error\CompileException', "Tag {extends} can not be nested"),
array('{if true}{use "extends/dynamic/use.tpl"}{/if}', 'Fenom\Error\CompileException', "Tag {use} can not be nested"),
array('{use $use_this}', 'Fenom\Error\CompileException', "Invalid template name for tag {use}"),
array('{block $use_this}{/block}', 'Fenom\Error\CompileException', "Invalid block name"),
);
}
public function testAutoExtendsManual()
{
$child = $this->fenom->getRawTemplate()->load('extends/auto/child.1.tpl', false);
@@ -132,5 +143,14 @@ Before footer
Footer from use";
$this->assertSame($result, $this->fenom->fetch('extends/dynamic/child.4.tpl', array()));
}
/**
* @group static-invalid
* @dataProvider providerExtendsInvalid
*/
public function testExtendsInvalid($code, $exception, $message, $options = 0)
{
$this->execError($code, $exception, $message, $options);
}
}