From 094df799be30a977ccf3bfac54b9dd2d97cdb6fa Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 12 Apr 2019 10:30:51 +0200 Subject: [PATCH] added more tests --- CHANGELOG | 2 ++ .../exceptions/exception_in_extension_extends.test | 12 ++++++++++++ .../exceptions/exception_in_extension_include.test | 12 ++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 test/Twig/Tests/Fixtures/exceptions/exception_in_extension_extends.test create mode 100644 test/Twig/Tests/Fixtures/exceptions/exception_in_extension_include.test diff --git a/CHANGELOG b/CHANGELOG index 9fd7bf1a1..c7248c3fb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ * 1.39.0 (2019-XX-XX) + * fixed some wrong location in error messages + * made exception creation faster * made escaping on ternary expressions (?: and ??) more fine-grained * added the possibility to give a nice name to string templates (template_from_string function) * fixed the "with" behavior to always include the globals (for consistency with the "include" and "embed" tags) diff --git a/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_extends.test b/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_extends.test new file mode 100644 index 000000000..2ab298059 --- /dev/null +++ b/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_extends.test @@ -0,0 +1,12 @@ +--TEST-- +Exception thrown from a child for an extension error +--TEMPLATE-- +{% extends 'base.twig' %} +--TEMPLATE(base.twig)-- + + +{{ random([]) }} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\RuntimeError: The random function cannot pick from an empty array in "base.twig" at line 4. diff --git a/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_include.test b/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_include.test new file mode 100644 index 000000000..e2281b290 --- /dev/null +++ b/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_include.test @@ -0,0 +1,12 @@ +--TEST-- +Exception thrown from an include for an extension error +--TEMPLATE-- +{% include 'content.twig' %} +--TEMPLATE(content.twig)-- + + +{{ random([]) }} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\RuntimeError: The random function cannot pick from an empty array in "content.twig" at line 4.