Phalcon\Test\Unit\Mvc\View\Engine\Volt\CompilerTest::testVoltExtendsError PHP Method

testVoltExtendsError() public method

    public function testVoltExtendsError()
    {
        $this->specify("Volt parser doesn't throw the proper extends error", function () {
            $volt = new Compiler();
            $volt->parse('{{ "hello"}}{% extends "some/file.volt" %}');
        }, ["throws" => [\Phalcon\Mvc\View\Exception::class, 'Extends statement must be placed at the first line in the template in eval code on line 1']]);
        $this->specify("Volt parser doesn't throw the proper extends error (2)", function () {
            $volt = new Compiler();
            $volt->parse('<div>{% extends "some/file.volt" %}{% set a = 1 %}</div>');
        }, ["throws" => [\Phalcon\Mvc\View\Exception::class, 'Extends statement must be placed at the first line in the template in eval code on line 1']]);
        $this->specify("Volt parser doesn't throw the proper extends error (3)", function () {
            $volt = new Compiler();
            $volt->parse('{% extends "some/file.volt" %}{{ "hello"}}');
        }, ["throws" => [\Phalcon\Mvc\View\Exception::class, 'Child templates only may contain blocks in eval code on line 1']]);
        $this->specify("Volt parser doesn't throw the proper extends error (4)", function () {
            $volt = new Compiler();
            $volt->parse('{% extends "some/file.volt" %}{{% if true %}} {%endif%}');
        }, ["throws" => [\Phalcon\Mvc\View\Exception::class, 'Child templates only may contain blocks in eval code on line 1']]);
        $this->specify("Volt parser doesn't throw the proper extends error (5)", function () {
            $volt = new Compiler();
            $volt->parse('{% extends "some/file.volt" %}{{% set a = 1 %}');
        }, ["throws" => [\Phalcon\Mvc\View\Exception::class, 'Child templates only may contain blocks in eval code on line 1']]);
        $this->specify("Volt parser doesn't throw the proper extends error (6)", function () {
            $volt = new Compiler();
            $volt->parse('{% extends "some/file.volt" %}{{% set a = 1 %}');
        }, ["throws" => [\Phalcon\Mvc\View\Exception::class, 'Child templates only may contain blocks in eval code on line 1']]);
    }