Definition at line 12 of file ErrorTest.php.
◆ getErroredTemplates()
Twig_Tests_ErrorTest::getErroredTemplates |
( |
| ) |
|
Definition at line 155 of file ErrorTest.php.
161 'index' =>
"\n\n{{ foo.bar }}\n\n\n{{ 'foo' }}",
169 'index' =>
"{% include 'partial' %}",
170 'partial' =>
'{{ foo.bar }}',
178 'index' =>
"{% extends 'base' %} 182 'base' =>
'{% block content %}{{ foo.bar }}{% endblock %}',
190 'index' =>
"{% extends 'base' %} 197 'base' =>
'{% block content %}{% endblock %}',
◆ testErrorWithArrayFilename()
Twig_Tests_ErrorTest::testErrorWithArrayFilename |
( |
| ) |
|
Definition at line 22 of file ErrorTest.php.
25 $error->setSourceContext(
new Twig_Source(
'', array(
'foo' =>
'bar')));
27 $this->assertEquals(
'foo in {"foo":"bar"}', $error->getMessage());
Holds information about a non-compiled Twig template.
◆ testErrorWithObjectFilename()
Twig_Tests_ErrorTest::testErrorWithObjectFilename |
( |
| ) |
|
Definition at line 14 of file ErrorTest.php.
19 $this->assertContains(
'test'.DIRECTORY_SEPARATOR.
'Twig'.DIRECTORY_SEPARATOR.
'Tests'.DIRECTORY_SEPARATOR.
'ErrorTest.php', $error->getMessage());
Holds information about a non-compiled Twig template.
◆ testTwigExceptionAddsFileAndLine()
Twig_Tests_ErrorTest::testTwigExceptionAddsFileAndLine |
( |
|
$templates, |
|
|
|
$name, |
|
|
|
$line |
|
) |
| |
getErroredTemplates
Definition at line 127 of file ErrorTest.php.
References $name, $template, Twig_Error\getSourceContext(), and Twig_Error\getTemplateLine().
130 $twig =
new Twig_Environment($loader, array(
'strict_variables' =>
true,
'debug' =>
true,
'cache' =>
false));
132 $template = $twig->loadTemplate(
'index');
139 $this->assertEquals(sprintf(
'Variable "foo" does not exist in "%s" at line %d.',
$name, $line), $e->getMessage());
149 $this->assertEquals(sprintf(
'An exception has been thrown during the rendering of a template ("Runtime error...") in "%s" at line %d.',
$name, $line), $e->getMessage());
getSourceContext()
Gets the source context of the Twig template where the error occurred.
getTemplateLine()
Gets the template line where the error occurred.
Exception thrown when an error occurs at runtime.
Stores the Twig configuration.
Loads a template from an array.
◆ testTwigExceptionGuessWithExceptionAndArrayLoader()
Twig_Tests_ErrorTest::testTwigExceptionGuessWithExceptionAndArrayLoader |
( |
| ) |
|
Definition at line 58 of file ErrorTest.php.
References $template, Twig_Error\getSourceContext(), and Twig_Error\getTemplateLine().
61 'base.html' =>
'{% block content %}{% endblock %}',
62 'index.html' => <<<EOHTML
63 {% extends
'base.html' %}
72 $twig =
new Twig_Environment($loader, array(
'strict_variables' =>
true,
'debug' =>
true,
'cache' =>
false));
74 $template = $twig->loadTemplate(
'index.html');
80 $this->assertEquals(
'An exception has been thrown during the rendering of a template ("Runtime error...") in "index.html" at line 3.', $e->getMessage());
getSourceContext()
Gets the source context of the Twig template where the error occurred.
getTemplateLine()
Gets the template line where the error occurred.
Exception thrown when an error occurs at runtime.
Stores the Twig configuration.
Loads a template from an array.
◆ testTwigExceptionGuessWithExceptionAndFilesystemLoader()
Twig_Tests_ErrorTest::testTwigExceptionGuessWithExceptionAndFilesystemLoader |
( |
| ) |
|
Definition at line 105 of file ErrorTest.php.
References $template, Twig_Error\getSourceContext(), and Twig_Error\getTemplateLine().
108 $twig =
new Twig_Environment($loader, array(
'strict_variables' =>
true,
'debug' =>
true,
'cache' =>
false));
110 $template = $twig->loadTemplate(
'index.html');
116 $this->assertEquals(
'An exception has been thrown during the rendering of a template ("Runtime error...").', $e->getMessage());
119 $this->assertEquals(3, $e->getLine());
120 $this->assertEquals(strtr(dirname(__FILE__).
'/Fixtures/errors/index.html',
'/', DIRECTORY_SEPARATOR), $e->getFile());
getSourceContext()
Gets the source context of the Twig template where the error occurred.
getTemplateLine()
Gets the template line where the error occurred.
Exception thrown when an error occurs at runtime.
Loads template from the filesystem.
Stores the Twig configuration.
◆ testTwigExceptionGuessWithMissingVarAndArrayLoader()
Twig_Tests_ErrorTest::testTwigExceptionGuessWithMissingVarAndArrayLoader |
( |
| ) |
|
Definition at line 30 of file ErrorTest.php.
References $template, Twig_Error\getSourceContext(), and Twig_Error\getTemplateLine().
33 'base.html' =>
'{% block content %}{% endblock %}',
34 'index.html' => <<<EOHTML
35 {% extends
'base.html' %}
44 $twig =
new Twig_Environment($loader, array(
'strict_variables' =>
true,
'debug' =>
true,
'cache' =>
false));
46 $template = $twig->loadTemplate(
'index.html');
52 $this->assertEquals(
'Variable "foo" does not exist in "index.html" at line 3.', $e->getMessage());
getSourceContext()
Gets the source context of the Twig template where the error occurred.
getTemplateLine()
Gets the template line where the error occurred.
Exception thrown when an error occurs at runtime.
Stores the Twig configuration.
Loads a template from an array.
◆ testTwigExceptionGuessWithMissingVarAndFilesystemLoader()
Twig_Tests_ErrorTest::testTwigExceptionGuessWithMissingVarAndFilesystemLoader |
( |
| ) |
|
Definition at line 86 of file ErrorTest.php.
References $template, Twig_Error\getSourceContext(), and Twig_Error\getTemplateLine().
89 $twig =
new Twig_Environment($loader, array(
'strict_variables' =>
true,
'debug' =>
true,
'cache' =>
false));
91 $template = $twig->loadTemplate(
'index.html');
97 $this->assertEquals(
'Variable "foo" does not exist.', $e->getMessage());
100 $this->assertEquals(3, $e->getLine());
101 $this->assertEquals(strtr(dirname(__FILE__).
'/Fixtures/errors/index.html',
'/', DIRECTORY_SEPARATOR), $e->getFile());
getSourceContext()
Gets the source context of the Twig template where the error occurred.
getTemplateLine()
Gets the template line where the error occurred.
Exception thrown when an error occurs at runtime.
Loads template from the filesystem.
Stores the Twig configuration.
The documentation for this class was generated from the following file: