- * @deprecated since 1.12 (to be removed in 2.0)
+ *
+ * @deprecated since 1.12 (to be removed in 3.0)
*/
interface Twig_TemplateInterface
{
diff --git a/core/vendor/twig/twig/lib/Twig/Token.php b/core/vendor/twig/twig/lib/Twig/Token.php
index 4411d7b..599f9f5 100644
--- a/core/vendor/twig/twig/lib/Twig/Token.php
+++ b/core/vendor/twig/twig/lib/Twig/Token.php
@@ -38,9 +38,9 @@ class Twig_Token
/**
* Constructor.
*
- * @param integer $type The type of the token
+ * @param int $type The type of the token
* @param string $value The token value
- * @param integer $lineno The line position in the source
+ * @param int $lineno The line position in the source
*/
public function __construct($type, $value, $lineno)
{
@@ -67,10 +67,10 @@ public function __toString()
* * type and value (or array of possible values)
* * just value (or array of possible values) (NAME_TYPE is used as type)
*
- * @param array|integer $type The type to test
+ * @param array|int $type The type to test
* @param array|string|null $values The token value
*
- * @return Boolean
+ * @return bool
*/
public function test($type, $values = null)
{
@@ -89,7 +89,7 @@ public function test($type, $values = null)
/**
* Gets the line.
*
- * @return integer The source line
+ * @return int The source line
*/
public function getLine()
{
@@ -99,7 +99,7 @@ public function getLine()
/**
* Gets the token type.
*
- * @return integer The token type
+ * @return int The token type
*/
public function getType()
{
@@ -119,8 +119,8 @@ public function getValue()
/**
* Returns the constant representation (internal) of a given type.
*
- * @param integer $type The type as an integer
- * @param Boolean $short Whether to return a short representation or not
+ * @param int $type The type as an integer
+ * @param bool $short Whether to return a short representation or not
*
* @return string The string representation
*/
@@ -176,7 +176,7 @@ public static function typeToString($type, $short = false)
/**
* Returns the english representation of a given type.
*
- * @param integer $type The type as an integer
+ * @param int $type The type as an integer
*
* @return string The string representation
*/
diff --git a/core/vendor/twig/twig/lib/Twig/TokenStream.php b/core/vendor/twig/twig/lib/Twig/TokenStream.php
index 22f0428..44440da 100644
--- a/core/vendor/twig/twig/lib/Twig/TokenStream.php
+++ b/core/vendor/twig/twig/lib/Twig/TokenStream.php
@@ -101,7 +101,7 @@ public function expect($type, $value = null, $message = null)
/**
* Looks at the next token.
*
- * @param integer $number
+ * @param int $number
*
* @return Twig_Token
*/
@@ -117,7 +117,7 @@ public function look($number = 1)
/**
* Tests the current token
*
- * @return Boolean
+ * @return bool
*/
public function test($primary, $secondary = null)
{
@@ -127,7 +127,7 @@ public function test($primary, $secondary = null)
/**
* Checks if end of stream was reached
*
- * @return Boolean
+ * @return bool
*/
public function isEOF()
{
diff --git a/core/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php b/core/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php
index a5fc878..b791e57 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php
@@ -48,7 +48,7 @@ public function testGlobals()
// globals can be added after calling getGlobals
$twig = new Twig_Environment(new Twig_Loader_String());
$twig->addGlobal('foo', 'foo');
- $globals = $twig->getGlobals();
+ $twig->getGlobals();
$twig->addGlobal('foo', 'bar');
$globals = $twig->getGlobals();
$this->assertEquals('bar', $globals['foo']);
@@ -65,7 +65,7 @@ public function testGlobals()
// globals can be modified after extensions init
$twig = new Twig_Environment(new Twig_Loader_String());
$twig->addGlobal('foo', 'foo');
- $globals = $twig->getGlobals();
+ $twig->getGlobals();
$twig->getFunctions();
$twig->addGlobal('foo', 'bar');
$globals = $twig->getGlobals();
@@ -74,7 +74,7 @@ public function testGlobals()
// globals can be modified after extensions and runtime init
$twig = new Twig_Environment(new Twig_Loader_String());
$twig->addGlobal('foo', 'foo');
- $globals = $twig->getGlobals();
+ $twig->getGlobals();
$twig->getFunctions();
$twig->initRuntime();
$twig->addGlobal('foo', 'bar');
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php b/core/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php
index 5f3da18..b3b1cb0 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php
@@ -130,6 +130,24 @@ public function testUnknownCustomEscaper()
{
twig_escape_filter(new Twig_Environment(), 'foo', 'bar');
}
+
+ public function testTwigFirst()
+ {
+ $twig = new Twig_Environment();
+ $this->assertEquals('a', twig_first($twig, 'abc'));
+ $this->assertEquals(1, twig_first($twig, array(1, 2, 3)));
+ $this->assertSame('', twig_first($twig, null));
+ $this->assertSame('', twig_first($twig, ''));
+ }
+
+ public function testTwigLast()
+ {
+ $twig = new Twig_Environment();
+ $this->assertEquals('c', twig_last($twig, 'abc'));
+ $this->assertEquals(3, twig_last($twig, array(1, 2, 3)));
+ $this->assertSame('', twig_last($twig, null));
+ $this->assertSame('', twig_last($twig, ''));
+ }
}
function foo_escaper_for_test(Twig_Environment $env, $string, $charset)
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php b/core/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php
index e4746cb..fee35a0 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php
@@ -33,13 +33,13 @@ public function setUp()
'1_basic9' => '{{ obj.foobar }}{{ obj.fooBar }}',
'1_basic' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}',
'1_layout' => '{% block content %}{% endblock %}',
- '1_child' => '{% extends "1_layout" %}{% block content %}{{ "a"|json_encode }}{% endblock %}',
+ '1_child' => "{% extends \"1_layout\" %}\n{% block content %}\n{{ \"a\"|json_encode }}\n{% endblock %}",
);
}
/**
* @expectedException Twig_Sandbox_SecurityError
- * @expectedExceptionMessage Filter "json_encode" is not allowed in "1_child".
+ * @expectedExceptionMessage Filter "json_encode" is not allowed in "1_child" at line 3.
*/
public function testSandboxWithInheritance()
{
@@ -111,6 +111,11 @@ public function testSandboxGloballySet()
$this->assertEquals('foo', $twig->loadTemplate('1_basic5')->render(self::$params), 'Sandbox allow some methods');
$this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once');
+ $twig = $this->getEnvironment(false, array(), self::$templates);
+ FooObject::reset();
+ $this->assertEquals('foo', $twig->loadTemplate('1_basic5')->render(self::$params), 'Sandbox allows __toString when sandbox disabled');
+ $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once');
+
$twig = $this->getEnvironment(true, array(), self::$templates, array(), array('upper'));
$this->assertEquals('FABIEN', $twig->loadTemplate('1_basic2')->render(self::$params), 'Sandbox allow some filters');
diff --git a/core/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php b/core/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php
index 8efc948..36cdd33 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php
@@ -32,7 +32,7 @@ public function tearDown()
public function testWritingCacheFiles()
{
$name = 'This is just text.';
- $template = $this->env->loadTemplate($name);
+ $this->env->loadTemplate($name);
$cacheFileName = $this->env->getCacheFilename($name);
$this->assertTrue(file_exists($cacheFileName), 'Cache file does not exist.');
@@ -42,7 +42,7 @@ public function testWritingCacheFiles()
public function testClearingCacheFiles()
{
$name = 'I will be deleted.';
- $template = $this->env->loadTemplate($name);
+ $this->env->loadTemplate($name);
$cacheFileName = $this->env->getCacheFilename($name);
$this->assertTrue(file_exists($cacheFileName), 'Cache file does not exist.');
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test
index 026bd52..6679fbe 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test
@@ -6,4 +6,4 @@
{% block bar %}
{% endblock %}
--EXCEPTION--
-Twig_Error_Runtime: Block "foobar" is not defined in trait "foo" in "index.twig".
+Twig_Error_Runtime: Block "foobar" is not defined in trait "foo" in "index.twig" at line 2.
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test
index 7b56b76..74fe6ca 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test
@@ -4,7 +4,7 @@
{{ 1 b-and 5 }}
{{ 1 b-or 5 }}
{{ 1 b-xor 5 }}
-{{ (1 and 0 b-or 0) is sameas(1 and (0 b-or 0)) ? 'ok' : 'ko' }}
+{{ (1 and 0 b-or 0) is same as(1 and (0 b-or 0)) ? 'ok' : 'ko' }}
--DATA--
return array()
--EXPECT--
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test
index 14ee5e4..238dd27 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test
@@ -1,8 +1,6 @@
--TEST--
Twig supports the "divisible by" operator
--TEMPLATE--
-{{ 8 is divisibleby(2) ? 'OK' }}
-{{ 8 is not divisibleby(3) ? 'OK' }}
{{ 8 is divisible by(2) ? 'OK' }}
{{ 8 is not divisible by(3) ? 'OK' }}
{{ 8 is divisible by (2) ? 'OK' }}
@@ -17,5 +15,3 @@
OK
OK
OK
-OK
-OK
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test
index d259d11..9ad5e5e 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test
@@ -4,9 +4,23 @@
{{ 'foo' ends with 'o' ? 'OK' : 'KO' }}
{{ not ('foo' ends with 'f') ? 'OK' : 'KO' }}
{{ not ('foo' ends with 'foowaytoolong') ? 'OK' : 'KO' }}
+{{ 'foo' ends with '' ? 'OK' : 'KO' }}
+{{ '1' ends with true ? 'OK' : 'KO' }}
+{{ 1 ends with true ? 'OK' : 'KO' }}
+{{ 0 ends with false ? 'OK' : 'KO' }}
+{{ '' ends with false ? 'OK' : 'KO' }}
+{{ false ends with false ? 'OK' : 'KO' }}
+{{ false ends with '' ? 'OK' : 'KO' }}
--DATA--
return array()
--EXPECT--
OK
OK
OK
+OK
+KO
+KO
+KO
+KO
+KO
+KO
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test
index 9e8514f..601201d 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test
@@ -1,8 +1,8 @@
--TEST--
Twig supports the "same as" operator
--TEMPLATE--
-{{ 1 is sameas(1) ? 'OK' }}
-{{ 1 is not sameas(true) ? 'OK' }}
+{{ 1 is same as(1) ? 'OK' }}
+{{ 1 is not same as(true) ? 'OK' }}
{{ 1 is same as(1) ? 'OK' }}
{{ 1 is not same as(true) ? 'OK' }}
{{ 1 is same as (1) ? 'OK' }}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test
index 1ae4f86..75d331e 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test
@@ -7,6 +7,11 @@
{{ 'foo' starts with 'f' ? 'OK' : 'KO' }}
{{ 'foo' starts
with 'f' ? 'OK' : 'KO' }}
+{{ 'foo' starts with '' ? 'OK' : 'KO' }}
+{{ '1' starts with true ? 'OK' : 'KO' }}
+{{ '' starts with false ? 'OK' : 'KO' }}
+{{ 'a' starts with false ? 'OK' : 'KO' }}
+{{ false starts with '' ? 'OK' : 'KO' }}
--DATA--
return array()
--EXPECT--
@@ -15,3 +20,8 @@
OK
OK
OK
+OK
+KO
+KO
+KO
+KO
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.php b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.php
deleted file mode 100644
index 52de39c..0000000
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.php
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-"batch" filter
---TEMPLATE--
-{% for row in items|batch(3.1) %}
-
- {% for column in row %}
-
{{ column }}
- {% endfor %}
-
-{% endfor %}
---DATA--
-return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'))
---EXPECT--
-
-
-
-
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test
new file mode 100644
index 0000000..e2ec4be
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test
@@ -0,0 +1,29 @@
+--TEST--
+"batch" filter
+--TEMPLATE--
+{% for row in items|batch(3.1) %}
+
+ {% for column in row %}
+
{{ column }}
+ {% endfor %}
+
+{% endfor %}
+--DATA--
+return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'))
+--EXPECT--
+
+
+
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test
index d40bb04..d17e5e2 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test
@@ -31,6 +31,13 @@
{{ date6|date('e', false) }}
{{ date7|date }}
+{{ date7|date(timezone='Europe/Paris') }}
+{{ date7|date(timezone='Asia/Hong_Kong') }}
+{{ date7|date(timezone=false) }}
+{{ date7|date(timezone='Indian/Mauritius') }}
+
+{{ '2010-01-28 15:00:00'|date(timezone="Europe/Paris") }}
+{{ '2010-01-28 15:00:00'|date(timezone="Asia/Hong_Kong") }}
--DATA--
date_default_timezone_set('Europe/Paris');
return array(
@@ -40,7 +47,7 @@
'date4' => 1286199900, // DateTime::createFromFormat('Y-m-d H:i', '2010-10-04 13:45', new DateTimeZone('UTC'))->getTimestamp() -- A unixtimestamp is always GMT
'date5' => -189291360, // DateTime::createFromFormat('Y-m-d H:i', '1964-01-02 03:04', new DateTimeZone('UTC'))->getTimestamp(),
'date6' => new DateTime('2010-10-04 13:45', new DateTimeZone('America/New_York')),
- 'date7' => '2010-01-28T15:00:00+05:00',
+ 'date7' => '2010-01-28T15:00:00+04:00',
'timezone1' => new DateTimeZone('America/New_York'),
)
--EXPECT--
@@ -73,4 +80,11 @@
Europe/Paris
America/New_York
-January 28, 2010 11:00
+January 28, 2010 12:00
+January 28, 2010 12:00
+January 28, 2010 19:00
+January 28, 2010 15:00
+January 28, 2010 15:00
+
+January 28, 2010 15:00
+January 28, 2010 22:00
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test
index b89ceb3..4e18325 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test
@@ -8,6 +8,7 @@
{{ date1|date('d/m/Y H:i:s', 'Asia/Hong_Kong') }}
{{ date1|date('d/m/Y H:i:s', timezone1) }}
{{ date1|date('d/m/Y H:i:s') }}
+{{ date1|date_modify('+1 hour')|date('d/m/Y H:i:s') }}
{{ date2|date('d/m/Y H:i:s P', 'Europe/Paris') }}
{{ date2|date('d/m/Y H:i:s P', 'Asia/Hong_Kong') }}
@@ -27,6 +28,7 @@
04/10/2010 19:45:00
04/10/2010 07:45:00
04/10/2010 13:45:00
+04/10/2010 14:45:00
04/10/2010 19:45:00 +02:00
05/10/2010 01:45:00 +08:00
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test
index 0e4404b..b8d1d66 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test
@@ -2,42 +2,42 @@
"default" filter
--TEMPLATE--
Variable:
-{{ definedVar |default('default') is sameas('default') ? 'ko' : 'ok' }}
-{{ zeroVar |default('default') is sameas('default') ? 'ko' : 'ok' }}
-{{ emptyVar |default('default') is sameas('default') ? 'ok' : 'ko' }}
-{{ nullVar |default('default') is sameas('default') ? 'ok' : 'ko' }}
-{{ undefinedVar |default('default') is sameas('default') ? 'ok' : 'ko' }}
+{{ definedVar |default('default') is same as('default') ? 'ko' : 'ok' }}
+{{ zeroVar |default('default') is same as('default') ? 'ko' : 'ok' }}
+{{ emptyVar |default('default') is same as('default') ? 'ok' : 'ko' }}
+{{ nullVar |default('default') is same as('default') ? 'ok' : 'ko' }}
+{{ undefinedVar |default('default') is same as('default') ? 'ok' : 'ko' }}
Array access:
-{{ nested.definedVar |default('default') is sameas('default') ? 'ko' : 'ok' }}
-{{ nested['definedVar'] |default('default') is sameas('default') ? 'ko' : 'ok' }}
-{{ nested.zeroVar |default('default') is sameas('default') ? 'ko' : 'ok' }}
-{{ nested.emptyVar |default('default') is sameas('default') ? 'ok' : 'ko' }}
-{{ nested.nullVar |default('default') is sameas('default') ? 'ok' : 'ko' }}
-{{ nested.undefinedVar |default('default') is sameas('default') ? 'ok' : 'ko' }}
-{{ nested['undefinedVar'] |default('default') is sameas('default') ? 'ok' : 'ko' }}
-{{ undefinedVar.foo |default('default') is sameas('default') ? 'ok' : 'ko' }}
+{{ nested.definedVar |default('default') is same as('default') ? 'ko' : 'ok' }}
+{{ nested['definedVar'] |default('default') is same as('default') ? 'ko' : 'ok' }}
+{{ nested.zeroVar |default('default') is same as('default') ? 'ko' : 'ok' }}
+{{ nested.emptyVar |default('default') is same as('default') ? 'ok' : 'ko' }}
+{{ nested.nullVar |default('default') is same as('default') ? 'ok' : 'ko' }}
+{{ nested.undefinedVar |default('default') is same as('default') ? 'ok' : 'ko' }}
+{{ nested['undefinedVar'] |default('default') is same as('default') ? 'ok' : 'ko' }}
+{{ undefinedVar.foo |default('default') is same as('default') ? 'ok' : 'ko' }}
Plain values:
-{{ 'defined' |default('default') is sameas('default') ? 'ko' : 'ok' }}
-{{ 0 |default('default') is sameas('default') ? 'ko' : 'ok' }}
-{{ '' |default('default') is sameas('default') ? 'ok' : 'ko' }}
-{{ null |default('default') is sameas('default') ? 'ok' : 'ko' }}
+{{ 'defined' |default('default') is same as('default') ? 'ko' : 'ok' }}
+{{ 0 |default('default') is same as('default') ? 'ko' : 'ok' }}
+{{ '' |default('default') is same as('default') ? 'ok' : 'ko' }}
+{{ null |default('default') is same as('default') ? 'ok' : 'ko' }}
Precedence:
{{ 'o' ~ nullVar |default('k') }}
{{ 'o' ~ nested.nullVar |default('k') }}
Object methods:
-{{ object.foo |default('default') is sameas('default') ? 'ko' : 'ok' }}
-{{ object.undefinedMethod |default('default') is sameas('default') ? 'ok' : 'ko' }}
-{{ object.getFoo() |default('default') is sameas('default') ? 'ko' : 'ok' }}
-{{ object.getFoo('a') |default('default') is sameas('default') ? 'ko' : 'ok' }}
-{{ object.undefinedMethod() |default('default') is sameas('default') ? 'ok' : 'ko' }}
-{{ object.undefinedMethod('a') |default('default') is sameas('default') ? 'ok' : 'ko' }}
+{{ object.foo |default('default') is same as('default') ? 'ko' : 'ok' }}
+{{ object.undefinedMethod |default('default') is same as('default') ? 'ok' : 'ko' }}
+{{ object.getFoo() |default('default') is same as('default') ? 'ko' : 'ok' }}
+{{ object.getFoo('a') |default('default') is same as('default') ? 'ko' : 'ok' }}
+{{ object.undefinedMethod() |default('default') is same as('default') ? 'ok' : 'ko' }}
+{{ object.undefinedMethod('a') |default('default') is same as('default') ? 'ok' : 'ko' }}
Deep nested:
-{{ nested.undefinedVar.foo.bar |default('default') is sameas('default') ? 'ok' : 'ko' }}
-{{ nested.definedArray.0 |default('default') is sameas('default') ? 'ko' : 'ok' }}
-{{ nested['definedArray'][0] |default('default') is sameas('default') ? 'ko' : 'ok' }}
-{{ object.self.foo |default('default') is sameas('default') ? 'ko' : 'ok' }}
-{{ object.self.undefinedMethod |default('default') is sameas('default') ? 'ok' : 'ko' }}
-{{ object.undefinedMethod.self |default('default') is sameas('default') ? 'ok' : 'ko' }}
+{{ nested.undefinedVar.foo.bar |default('default') is same as('default') ? 'ok' : 'ko' }}
+{{ nested.definedArray.0 |default('default') is same as('default') ? 'ko' : 'ok' }}
+{{ nested['definedArray'][0] |default('default') is same as('default') ? 'ko' : 'ok' }}
+{{ object.self.foo |default('default') is same as('default') ? 'ko' : 'ok' }}
+{{ object.self.undefinedMethod |default('default') is same as('default') ? 'ok' : 'ko' }}
+{{ object.undefinedMethod.self |default('default') is same as('default') ? 'ok' : 'ko' }}
--DATA--
return array(
'definedVar' => 'defined',
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test
index 90f4927..aa54645 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test
@@ -6,6 +6,7 @@
{{ '1234'|first }}
{{ arr|first }}
{{ 'Ä€é'|first }}
+{{ ''|first }}
--DATA--
return array('arr' => new ArrayObject(array(1, 2, 3, 4)))
--EXPECT--
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test
index 018fdad..1b8031e 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test
@@ -6,6 +6,7 @@
{{ '1234'|last }}
{{ arr|last }}
{{ 'Ä€é'|last }}
+{{ ''|last }}
--DATA--
return array('arr' => new ArrayObject(array(1, 2, 3, 4)))
--EXPECT--
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test
index b37ad65..fb36a4e 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test
@@ -19,6 +19,9 @@
{{ '1234'|slice(1) }}
{{ '1234'[1:] }}
{{ '1234'[:1] }}
+
+{{ arr|slice(3)|join('') }}
+{{ arr[2:]|join('') }}
--DATA--
return array('start' => 1, 'length' => 2, 'arr' => new ArrayObject(array(1, 2, 3, 4)))
--EXPECT--
@@ -40,3 +43,6 @@
234
234
1
+
+4
+34
\ No newline at end of file
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test
index ce8ec9c..a093ed7 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test
@@ -5,6 +5,7 @@
{{ foo|split(',')|join('-') }}
{{ foo|split(',', 3)|join('-') }}
{{ baz|split('')|join('-') }}
+{{ baz|split('', 1)|join('-') }}
{{ baz|split('', 2)|join('-') }}
{{ foo|split(',', -2)|join('-') }}
--DATA--
@@ -14,5 +15,6 @@
one-two-three-four-five
one-two-three,four,five
1-2-3-4-5
+1-2-3-4-5
12-34-5
one-two-three
\ No newline at end of file
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test
new file mode 100644
index 0000000..305e162
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test
@@ -0,0 +1,24 @@
+--TEST--
+"split" filter
+--CONDITION--
+function_exists('mb_get_info')
+--TEMPLATE--
+{{ "é"|split('', 10)|join('-') }}
+{{ foo|split(',')|join('-') }}
+{{ foo|split(',', 1)|join('-') }}
+{{ foo|split(',', 2)|join('-') }}
+{{ foo|split(',', 3)|join('-') }}
+{{ baz|split('')|join('-') }}
+{{ baz|split('', 1)|join('-') }}
+{{ baz|split('', 2)|join('-') }}
+--DATA--
+return array('foo' => 'Ä,é,Äほ', 'baz' => 'éÄßごa',)
+--EXPECT--
+é
+Ä-é-Äほ
+Ä,é,Äほ
+Ä-é,Äほ
+Ä-é-Äほ
+é-Ä-ß-ご-a
+é-Ä-ß-ご-a
+éÄ-ßご-a
\ No newline at end of file
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test
index de956e7..8726159 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test
@@ -1,12 +1,16 @@
--TEST--
"url_encode" filter
+--CONDITION--
+defined('PHP_QUERY_RFC3986')
--TEMPLATE--
{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode }}
{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode|raw }}
{{ {}|url_encode|default("default") }}
+{{ 'spéßi%le%c0d@dspa ce'|url_encode }}
--DATA--
return array()
--EXPECT--
-foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa+ce=
-foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa+ce=
+foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce=
+foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce=
default
+sp%C3%A9%C3%9Fi%25le%25c0d%40dspa%20ce
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test
new file mode 100644
index 0000000..11800e9
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test
@@ -0,0 +1,16 @@
+--TEST--
+"url_encode" filter for PHP < 5.4 and HHVM
+--CONDITION--
+defined('PHP_QUERY_RFC3986')
+--TEMPLATE--
+{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode }}
+{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode|raw }}
+{{ {}|url_encode|default("default") }}
+{{ 'spéßi%le%c0d@dspa ce'|url_encode }}
+--DATA--
+return array()
+--EXPECT--
+foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce=
+foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce=
+default
+sp%C3%A9%C3%9Fi%25le%25c0d%40dspa%20ce
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test
index 472b74d..71b2038 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test
@@ -4,13 +4,15 @@
{{ attribute(obj, method) }}
{{ attribute(array, item) }}
{{ attribute(obj, "bar", ["a", "b"]) }}
+{{ attribute(obj, "bar", arguments) }}
{{ attribute(obj, method) is defined ? 'ok' : 'ko' }}
{{ attribute(obj, nonmethod) is defined ? 'ok' : 'ko' }}
--DATA--
-return array('obj' => new TwigTestFoo(), 'method' => 'foo', 'array' => array('foo' => 'bar'), 'item' => 'foo', 'nonmethod' => 'xxx')
+return array('obj' => new TwigTestFoo(), 'method' => 'foo', 'array' => array('foo' => 'bar'), 'item' => 'foo', 'nonmethod' => 'xxx', 'arguments' => array('a', 'b'))
--EXPECT--
foo
bar
bar_a-b
+bar_a-b
ok
ko
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test
index 788a2ab..7b9ccac 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test
@@ -3,8 +3,11 @@
--TEMPLATE--
{{ include("foo.twig", sandboxed = true) }}
--TEMPLATE(foo.twig)--
+
+
+{{ foo|e }}
{{ foo|e }}
--DATA--
return array()
--EXCEPTION--
-Twig_Sandbox_SecurityError: Filter "e" is not allowed in "index.twig" at line 2.
+Twig_Sandbox_SecurityNotAllowedFilterError: Filter "e" is not allowed in "foo.twig" at line 4.
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test
new file mode 100644
index 0000000..f39712d
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test
@@ -0,0 +1,21 @@
+--TEST--
+"block" function recursively called in a parent template
+--TEMPLATE--
+{% extends "ordered_menu.twig" %}
+{% block label %}"{{ parent() }}"{% endblock %}
+{% block list %}{% set class = 'b' %}{{ parent() }}{% endblock %}
+--TEMPLATE(ordered_menu.twig)--
+{% extends "menu.twig" %}
+{% block list %}{% set class = class|default('a') %}{{ block('children') }}
{% endblock %}
+--TEMPLATE(menu.twig)--
+{% extends "base.twig" %}
+{% block list %}{% endblock %}
+{% block children %}{% set currentItem = item %}{% for item in currentItem %}{{ block('item') }}{% endfor %}{% set item = currentItem %}{% endblock %}
+{% block item %}{% if item is not iterable %}{{ block('label') }}{% else %}{{ block('list') }}{% endif %}{% endblock %}
+{% block label %}{{ item }}{{ block('unknown') }}{% endblock %}
+--TEMPLATE(base.twig)--
+{{ block('list') }}
+--DATA--
+return array('item' => array('1', '2', array('3.1', array('3.2.1', '3.2.2'), '3.4')))
+--EXPECT--
+- "1"
- "2"
- "3.1"
- "3.2.1"
- "3.2.2"
- "3.4"
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test
new file mode 100644
index 0000000..df48578
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test
@@ -0,0 +1,15 @@
+--TEST--
+Exception with bad line number
+--TEMPLATE--
+{% block content %}
+ {{ foo }}
+ {{ include("foo") }}
+{% endblock %}
+index
+--TEMPLATE(foo)--
+foo
+{{ foo.bar }}
+--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
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test
new file mode 100644
index 0000000..269a305
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test
@@ -0,0 +1,10 @@
+--TEST--
+Twig allows multi-word tests without a custom node class
+--TEMPLATE--
+{{ 'foo' is multi word ? 'yes' : 'no' }}
+{{ 'foo bar' is multi word ? 'yes' : 'no' }}
+--DATA--
+return array()
+--EXPECT--
+no
+yes
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test
new file mode 100644
index 0000000..9a81499
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test
@@ -0,0 +1,32 @@
+--TEST--
+block_expr
+--TEMPLATE--
+{% extends "base.twig" %}
+
+{% block element -%}
+ Element:
+ {{- parent() -}}
+{% endblock %}
+--TEMPLATE(base.twig)--
+{% spaceless %}
+{% block element -%}
+
+ {%- if item.children is defined %}
+ {%- for item in item.children %}
+ {{- block('element') -}}
+ {% endfor %}
+ {%- endif -%}
+
+{%- endblock %}
+{% endspaceless %}
+--DATA--
+return array(
+ 'item' => array(
+ 'children' => array(
+ null,
+ null,
+ )
+ )
+)
+--EXPECT--
+Element:
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test
new file mode 100644
index 0000000..3e868c0
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test
@@ -0,0 +1,34 @@
+--TEST--
+block_expr2
+--TEMPLATE--
+{% extends "base2.twig" %}
+
+{% block element -%}
+ Element:
+ {{- parent() -}}
+{% endblock %}
+--TEMPLATE(base2.twig)--
+{% extends "base.twig" %}
+--TEMPLATE(base.twig)--
+{% spaceless %}
+{% block element -%}
+
+ {%- if item.children is defined %}
+ {%- for item in item.children %}
+ {{- block('element') -}}
+ {% endfor %}
+ {%- endif -%}
+
+{%- endblock %}
+{% endspaceless %}
+--DATA--
+return array(
+ 'item' => array(
+ 'children' => array(
+ null,
+ null,
+ )
+ )
+)
+--EXPECT--
+Element:
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test
new file mode 100644
index 0000000..5679462
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test
@@ -0,0 +1,14 @@
+--TEST--
+Super globals as macro arguments
+--TEMPLATE--
+{% import _self as macros %}
+
+{{ macros.foo('foo') }}
+
+{% macro foo(GET) %}
+ {{ GET }}
+{% endmacro %}
+--DATA--
+return array()
+--EXPECT--
+foo
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test
new file mode 100644
index 0000000..6368b08
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test
@@ -0,0 +1,25 @@
+--TEST--
+"use" tag
+--TEMPLATE--
+{% use "parent.twig" %}
+
+{{ block('container') }}
+--TEMPLATE(parent.twig)--
+{% use "ancestor.twig" %}
+
+{% block sub_container %}
+ overriden sub_container
+{% endblock %}
+--TEMPLATE(ancestor.twig)--
+{% block container %}
+ {{ block('sub_container') }}
+{% endblock %}
+
+{% block sub_container %}
+ sub_container
+{% endblock %}
+--DATA--
+return array()
+--EXPECT--
+ overriden sub_container
+
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test
new file mode 100644
index 0000000..114e301
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test
@@ -0,0 +1,24 @@
+--TEST--
+"use" tag
+--TEMPLATE--
+{% use "ancestor.twig" %}
+{% use "parent.twig" %}
+
+{{ block('container') }}
+--TEMPLATE(parent.twig)--
+{% block sub_container %}
+ overriden sub_container
+{% endblock %}
+--TEMPLATE(ancestor.twig)--
+{% block container %}
+ {{ block('sub_container') }}
+{% endblock %}
+
+{% block sub_container %}
+ sub_container
+{% endblock %}
+--DATA--
+return array()
+--EXPECT--
+ overriden sub_container
+
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test
new file mode 100644
index 0000000..59db23d
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test
@@ -0,0 +1,24 @@
+--TEST--
+"use" tag
+--TEMPLATE--
+{% use 'file2.html.twig' with foobar as base_base_foobar %}
+{% block foobar %}
+ {{- block('base_base_foobar') -}}
+ Content of block (second override)
+{% endblock foobar %}
+--TEMPLATE(file2.html.twig)--
+{% use 'file1.html.twig' with foobar as base_foobar %}
+{% block foobar %}
+ {{- block('base_foobar') -}}
+ Content of block (first override)
+{% endblock foobar %}
+--TEMPLATE(file1.html.twig)--
+{% block foobar -%}
+ Content of block
+{% endblock foobar %}
+--DATA--
+return array()
+--EXPECT--
+Content of block
+Content of block (first override)
+Content of block (second override)
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test
new file mode 100644
index 0000000..d3f302d
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test
@@ -0,0 +1,24 @@
+--TEST--
+"use" tag
+--TEMPLATE--
+{% use 'file2.html.twig'%}
+{% block foobar %}
+ {{- parent() -}}
+ Content of block (second override)
+{% endblock foobar %}
+--TEMPLATE(file2.html.twig)--
+{% use 'file1.html.twig' %}
+{% block foobar %}
+ {{- parent() -}}
+ Content of block (first override)
+{% endblock foobar %}
+--TEMPLATE(file1.html.twig)--
+{% block foobar -%}
+ Content of block
+{% endblock foobar %}
+--DATA--
+return array()
+--EXPECT--
+Content of block
+Content of block (first override)
+Content of block (second override)
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test
new file mode 100644
index 0000000..95b55a4
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test
@@ -0,0 +1,38 @@
+--TEST--
+"use" tag
+--TEMPLATE--
+{% use 'file2.html.twig' %}
+{% use 'file1.html.twig' with foo %}
+{% block foo %}
+ {{- parent() -}}
+ Content of foo (second override)
+{% endblock foo %}
+{% block bar %}
+ {{- parent() -}}
+ Content of bar (second override)
+{% endblock bar %}
+--TEMPLATE(file2.html.twig)--
+{% use 'file1.html.twig' %}
+{% block foo %}
+ {{- parent() -}}
+ Content of foo (first override)
+{% endblock foo %}
+{% block bar %}
+ {{- parent() -}}
+ Content of bar (first override)
+{% endblock bar %}
+--TEMPLATE(file1.html.twig)--
+{% block foo -%}
+ Content of foo
+{% endblock foo %}
+{% block bar -%}
+ Content of bar
+{% endblock bar %}
+--DATA--
+return array()
+--EXPECT--
+Content of foo
+Content of foo (first override)
+Content of foo (second override)
+Content of bar
+Content of bar (second override)
diff --git a/core/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php b/core/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php
index ea00b02..70f9b80 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php
@@ -157,6 +157,13 @@ public function getFunctions()
);
}
+ public function getTests()
+ {
+ return array(
+ new Twig_SimpleTest('multi word', array($this, 'is_multi_word')),
+ );
+ }
+
public function §Filter($value)
{
return "§{$value}§";
@@ -210,6 +217,11 @@ public function br()
return '
';
}
+ public function is_multi_word($value)
+ {
+ return false !== strpos($value, ' ');
+ }
+
public function getName()
{
return 'integration_test';
diff --git a/core/vendor/twig/twig/test/Twig/Tests/LexerTest.php b/core/vendor/twig/twig/test/Twig/Tests/LexerTest.php
index ab104f4..c4d7083 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/LexerTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/LexerTest.php
@@ -46,7 +46,6 @@ protected function countToken($template, $type, $value = null)
$stream = $lexer->tokenize($template);
$count = 0;
- $tokens = array();
while (!$stream->isEOF()) {
$token = $stream->next();
if ($type === $token->getType()) {
@@ -114,7 +113,7 @@ public function testLongRaw()
$template = '{% raw %}'.str_repeat('*', 100000).'{% endraw %}';
$lexer = new Twig_Lexer(new Twig_Environment());
- $stream = $lexer->tokenize($template);
+ $lexer->tokenize($template);
// should not throw an exception
}
@@ -124,7 +123,7 @@ public function testLongVar()
$template = '{{ '.str_repeat('x', 100000).' }}';
$lexer = new Twig_Lexer(new Twig_Environment());
- $stream = $lexer->tokenize($template);
+ $lexer->tokenize($template);
// should not throw an exception
}
@@ -134,17 +133,13 @@ public function testLongBlock()
$template = '{% '.str_repeat('x', 100000).' %}';
$lexer = new Twig_Lexer(new Twig_Environment());
- $stream = $lexer->tokenize($template);
+ $lexer->tokenize($template);
// should not throw an exception
}
public function testBigNumbers()
{
- if ('hiphop' === substr(PHP_VERSION, -6)) {
- $this->markTestSkipped('hhvm thinks that the number is actually a T_CONSTANT_ENCAPSED_STRING!');
- }
-
$template = '{{ 922337203685477580700 }}';
$lexer = new Twig_Lexer(new Twig_Environment());
@@ -216,7 +211,7 @@ public function testStringWithUnterminatedInterpolation()
$template = '{{ "bar #{x" }}';
$lexer = new Twig_Lexer(new Twig_Environment());
- $stream = $lexer->tokenize($template);
+ $lexer->tokenize($template);
}
public function testStringWithNestedInterpolations()
@@ -281,7 +276,7 @@ public function testUnterminatedVariable()
';
$lexer = new Twig_Lexer(new Twig_Environment());
- $stream = $lexer->tokenize($template);
+ $lexer->tokenize($template);
}
/**
@@ -300,6 +295,6 @@ public function testUnterminatedBlock()
';
$lexer = new Twig_Lexer(new Twig_Environment());
- $stream = $lexer->tokenize($template);
+ $lexer->tokenize($template);
}
}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php b/core/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php
index 9519bdf..7de268c 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php
@@ -23,7 +23,7 @@ public function testGetProperties()
$d2 = new DateTime();
$output = $twig->render('{{ d1.date }}{{ d2.date }}', compact('d1', 'd2'));
- if ('hiphop' === substr(PHP_VERSION, -6)) {
+ if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Skip under HHVM as the behavior is not the same as plain PHP (which is an edge case anyway)');
}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php
index 62fb0d3..76cf5c6 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php
@@ -46,7 +46,7 @@ public function getTests()
$attr = new Twig_Node_Expression_Constant('bar', 1);
$args = new Twig_Node_Expression_Array(array(), 1);
$node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ANY_CALL, 1);
- $tests[] = array($node, sprintf('%s%s, "bar")', $this->getAttributeGetter(), $this->getVariableGetter('foo')));
+ $tests[] = array($node, sprintf('%s%s, "bar", array())', $this->getAttributeGetter(), $this->getVariableGetter('foo')));
$node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ARRAY_CALL, 1);
$tests[] = array($node, sprintf('%s%s, "bar", array(), "array")', $this->getAttributeGetter(), $this->getVariableGetter('foo')));
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php
index e8aa326..9afecef 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php
@@ -59,8 +59,7 @@ public function getTests()
$node = new Twig_Node_Include($expr, null, false, false, 1);
$tests[] = array($node, <<env->resolveTemplate(((true) ? ("foo") : ("foo")));
-\$template->display(\$context);
+\$this->env->resolveTemplate(((true) ? ("foo") : ("foo")))->display(\$context);
EOF
);
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php
index 4d2f641..2a77ac7 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php
@@ -46,11 +46,11 @@ public function getTests()
return array(
array($node, <<env->mergeGlobals(array(
- "foo" => \$_foo,
- "bar" => \$_bar,
+ "foo" => \$__foo__,
+ "bar" => \$__bar__,
));
\$blocks = array();
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php
index 421f210..bb9ffb7 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php
@@ -84,11 +84,29 @@ protected function doDisplay(array \$context, array \$blocks = array())
protected function checkSecurity()
{
- \$this->env->getExtension('sandbox')->checkSecurity(
- array('upper'),
- array('for'),
- array('cycle')
- );
+ \$tags = array();
+ \$filters = array();
+ \$functions = array();
+
+ try {
+ \$this->env->getExtension('sandbox')->checkSecurity(
+ array('upper'),
+ array('for'),
+ array('cycle')
+ );
+ } catch (Twig_Sandbox_SecurityError \$e) {
+ \$e->setTemplateFile(\$this->getTemplateName());
+
+ if (\$e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {
+ \$e->setTemplateLine(\$tags[\$e->getTagName()]);
+ } elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {
+ \$e->setTemplateLine(\$filters[\$e->getFilterName()]);
+ } elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {
+ \$e->setTemplateLine(\$functions[\$e->getFunctionName()]);
+ }
+
+ throw \$e;
+ }
}
public function getTemplateName()
@@ -143,11 +161,29 @@ protected function doDisplay(array \$context, array \$blocks = array())
protected function checkSecurity()
{
- \$this->env->getExtension('sandbox')->checkSecurity(
- array('upper'),
- array('for'),
- array('cycle')
- );
+ \$tags = array();
+ \$filters = array();
+ \$functions = array();
+
+ try {
+ \$this->env->getExtension('sandbox')->checkSecurity(
+ array('upper'),
+ array('for'),
+ array('cycle')
+ );
+ } catch (Twig_Sandbox_SecurityError \$e) {
+ \$e->setTemplateFile(\$this->getTemplateName());
+
+ if (\$e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {
+ \$e->setTemplateLine(\$tags[\$e->getTagName()]);
+ } elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {
+ \$e->setTemplateLine(\$filters[\$e->getFilterName()]);
+ } elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {
+ \$e->setTemplateLine(\$functions[\$e->getFunctionName()]);
+ }
+
+ throw \$e;
+ }
}
public function getTemplateName()
diff --git a/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php b/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php
index aa8dafd..e2f84ee 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php
@@ -28,6 +28,7 @@ public function testGetAttributeExceptions($template, $message, $useExt)
$context = array(
'string' => 'foo',
+ 'empty_array' => array(),
'array' => array('foo' => 'foo'),
'array_access' => new Twig_TemplateArrayAccessObject(),
'magic_exception' => new Twig_TemplateMagicPropertyObjectWithException(),
@@ -46,10 +47,12 @@ 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('{{ 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('{{ 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 }}', 'Method "a" for object "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1', false),
@@ -368,7 +371,7 @@ public function getGetAttributeTests()
$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" for array with keys "" does not exist'),
+ array(false, null, array(), 'a', array(), $anyType, false, 'Key "a" does not exist as the array is empty'),
));
// add twig_template_get_attributes tests
@@ -585,7 +588,6 @@ public function getZero()
public function getNull()
{
- return null;
}
public function isBar()
diff --git a/core/vendor/twig/twig/test/Twig/Tests/escapingTest.php b/core/vendor/twig/twig/test/Twig/Tests/escapingTest.php
index 34d2a2d..d581315 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/escapingTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/escapingTest.php
@@ -227,7 +227,7 @@ public function testUnicodeCodepointConversionToUtf8()
/**
* Convert a Unicode Codepoint to a literal UTF-8 character.
*
- * @param int Unicode codepoint in hex notation
+ * @param int $codepoint Unicode codepoint in hex notation
* @return string UTF-8 literal string
*/
protected function codepointToUtf8($codepoint)
@@ -301,7 +301,7 @@ public function testHtmlAttributeEscapingEscapesOwaspRecommendedRanges()
public function testCssEscapingEscapesOwaspRecommendedRanges()
{
- $immune = array(); // CSS has no exceptions to escaping ranges
+ // CSS has no exceptions to escaping ranges
for ($chr=0; $chr < 0xFF; $chr++) {
if ($chr >= 0x30 && $chr <= 0x39
|| $chr >= 0x41 && $chr <= 0x5A