adding missing dots to some exception messages

This commit is contained in:
Fabien Potencier
2016-09-24 12:21:25 -07:00
parent 0980fe0871
commit 9ee6fe3380
11 changed files with 50 additions and 51 deletions
+2 -2
View File
@@ -38,7 +38,7 @@ class Twig_Tests_ErrorTest extends PHPUnit_Framework_TestCase
$this->fail();
} catch (Twig_Error_Runtime $e) {
$this->assertEquals('Variable "foo" does not exist in "index.html" at line 3', $e->getMessage());
$this->assertEquals('Variable "foo" does not exist in "index.html" at line 3.', $e->getMessage());
$this->assertEquals(3, $e->getTemplateLine());
$this->assertEquals('index.html', $e->getTemplateFile());
}
@@ -69,7 +69,7 @@ class Twig_Tests_ErrorTest extends PHPUnit_Framework_TestCase
$this->fail();
} catch (Twig_Error_Runtime $e) {
$this->assertEquals(sprintf('Variable "foo" does not exist in "%s" at line %d', $name, $line), $e->getMessage());
$this->assertEquals(sprintf('Variable "foo" does not exist in "%s" at line %d.', $name, $line), $e->getMessage());
$this->assertEquals($line, $e->getTemplateLine());
$this->assertEquals($name, $e->getTemplateFile());
}
@@ -15,4 +15,4 @@ Exception for multiline array with undefined variable
--DATA--
return array('foobar' => 'foobar')
--EXCEPTION--
Twig_Error_Runtime: Variable "foo2" does not exist in "index.twig" at line 11
Twig_Error_Runtime: Variable "foo2" does not exist in "index.twig" at line 11.
@@ -15,4 +15,4 @@ Exception for multiline array with undefined variable
--DATA--
return array()
--EXCEPTION--
Twig_Error_Runtime: Variable "foobar" does not exist in "index.twig" at line 7
Twig_Error_Runtime: Variable "foobar" does not exist in "index.twig" at line 7.
@@ -9,4 +9,4 @@ Foo
--DATA--
return array()
--EXCEPTION--
Twig_Error_Runtime: Variable "with_context" does not exist in "index.twig" at line 3
Twig_Error_Runtime: Variable "with_context" does not exist in "index.twig" at line 3.
@@ -9,4 +9,4 @@ Foo
--DATA--
return array()
--EXCEPTION--
Twig_Error_Runtime: Variable "vars" does not exist in "index.twig" at line 3
Twig_Error_Runtime: Variable "vars" does not exist in "index.twig" at line 3.
@@ -5,4 +5,3 @@ macro with varargs argument
{% endmacro %}
--EXCEPTION--
Twig_Error_Syntax: The argument "varargs" in macro "test" cannot be defined because the variable "varargs" is reserved for arbitrary arguments in "index.twig" at line 2.
@@ -12,4 +12,4 @@ foo
--DATA--
return array('foo' => 'foo');
--EXCEPTION--
Twig_Error_Runtime: Impossible to access an attribute ("bar") on a string variable ("foo") in "foo" at line 3
Twig_Error_Runtime: Impossible to access an attribute ("bar") on a string variable ("foo") in "foo" at line 3.
@@ -13,4 +13,4 @@ BAR
--DATA--
return array()
--EXCEPTION--
Twig_Error_Runtime: Variable "nothing" does not exist in "index.twig" at line 5
Twig_Error_Runtime: Variable "nothing" does not exist in "index.twig" at line 5.
+18 -18
View File
@@ -56,22 +56,22 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
public function getAttributeExceptions()
{
$tests = array(
array('{{ string["a"] }}', 'Impossible to access a key ("a") on a string variable ("foo") in "%s" at line 1', false),
array('{{ null["a"] }}', 'Impossible to access a key ("a") on a null variable in "%s" at line 1', false),
array('{{ empty_array["a"] }}', 'Key "a" does not exist as the array is empty in "%s" at line 1', false),
array('{{ array["a"] }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1', false),
array('{{ array_access["a"] }}', 'Key "a" in object with ArrayAccess of class "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1', false),
array('{{ string.a }}', 'Impossible to access an attribute ("a") on a string variable ("foo") in "%s" at line 1', false),
array('{{ string.a() }}', 'Impossible to invoke a method ("a") on a string variable ("foo") in "%s" at line 1', false),
array('{{ null.a }}', 'Impossible to access an attribute ("a") on a null variable in "%s" at line 1', false),
array('{{ null.a() }}', 'Impossible to invoke a method ("a") on a null variable in "%s" at line 1', false),
array('{{ empty_array.a }}', 'Key "a" does not exist as the array is empty in "%s" at line 1', false),
array('{{ array.a }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1', false),
array('{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1', false),
array('{{ array_access.a }}', 'Neither the property "a" nor one of the methods "a()", "geta()"/"isa()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1', false),
array('{% from _self import foo %}{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ foo(array_access) }}', 'Neither the property "missing_method" nor one of the methods "missing_method()", "getmissing_method()"/"ismissing_method()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1', false),
array('{{ string["a"] }}', 'Impossible to access a key ("a") on a string variable ("foo") in "%s" at line 1.', false),
array('{{ null["a"] }}', 'Impossible to access a key ("a") on a null variable in "%s" at line 1.', false),
array('{{ empty_array["a"] }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.', false),
array('{{ array["a"] }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.', false),
array('{{ array_access["a"] }}', 'Key "a" in object with ArrayAccess of class "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1.', false),
array('{{ string.a }}', 'Impossible to access an attribute ("a") on a string variable ("foo") in "%s" at line 1.', false),
array('{{ string.a() }}', 'Impossible to invoke a method ("a") on a string variable ("foo") in "%s" at line 1.', false),
array('{{ null.a }}', 'Impossible to access an attribute ("a") on a null variable in "%s" at line 1.', false),
array('{{ null.a() }}', 'Impossible to invoke a method ("a") on a null variable in "%s" at line 1.', false),
array('{{ empty_array.a }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.', false),
array('{{ array.a }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.', false),
array('{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1.', false),
array('{{ array_access.a }}', 'Neither the property "a" nor one of the methods "a()", "geta()"/"isa()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.', false),
array('{% from _self import foo %}{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ foo(array_access) }}', 'Neither the property "missing_method" nor one of the methods "missing_method()", "getmissing_method()"/"ismissing_method()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.', false),
array('{{ magic_exception.test }}', 'An exception has been thrown during the rendering of a template ("Hey! Don\'t try to isset me!") in "%s" at line 1.', false),
array('{{ object["a"] }}', 'Impossible to access a key "a" on an object of class "stdClass" that does not implement ArrayAccess interface in "%s" at line 1', false),
array('{{ object["a"] }}', 'Impossible to access a key "a" on an object of class "stdClass" that does not implement ArrayAccess interface in "%s" at line 1.', false),
);
if (function_exists('twig_template_get_attributes')) {
@@ -387,9 +387,9 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
// tests when input is not an array or object
$tests = array_merge($tests, array(
array(false, null, 42, 'a', array(), $anyType, false, 'Impossible to access an attribute ("a") on a integer variable ("42")'),
array(false, null, 'string', 'a', array(), $anyType, false, 'Impossible to access an attribute ("a") on a string variable ("string")'),
array(false, null, array(), 'a', array(), $anyType, false, 'Key "a" does not exist as the array is empty'),
array(false, null, 42, 'a', array(), $anyType, false, 'Impossible to access an attribute ("a") on a integer variable ("42").'),
array(false, null, 'string', 'a', array(), $anyType, false, 'Impossible to access an attribute ("a") on a string variable ("string").'),
array(false, null, array(), 'a', array(), $anyType, false, 'Key "a" does not exist as the array is empty.'),
));
// add twig_template_get_attributes tests