From b621d7c2ff0a8fc06548eded4e3a27b8799a5e87 Mon Sep 17 00:00:00 2001 From: Andreas Neumann Date: Thu, 3 Mar 2016 12:19:19 +0100 Subject: [PATCH 01/17] [CHANGE] Require twig/twig,v1.24.0; Install in vendor-dir with vendor-prefix (SensioLabsInsight - netzweberei / herbie #15: The checker detected 1 security issues in package twig/twig installed in version 1.16.3.0 ) --- plugins/twig/composer.json | 7 +- plugins/twig/twig.php | 2 +- plugins/twig/vendor/autoload.php | 7 + plugins/twig/vendor/twig/twig/.editorconfig | 18 + plugins/twig/vendor/twig/twig/.gitignore | 5 + plugins/twig/vendor/twig/twig/.travis.yml | 39 + plugins/twig/vendor/twig/twig/CHANGELOG | 828 ++++++++++++ plugins/twig/vendor/twig/twig/LICENSE | 31 + plugins/twig/vendor/twig/twig/README.rst | 15 + plugins/twig/vendor/twig/twig/composer.json | 46 + .../twig/vendor/twig/twig/doc/advanced.rst | 872 +++++++++++++ .../vendor/twig/twig/doc/advanced_legacy.rst | 887 +++++++++++++ plugins/twig/vendor/twig/twig/doc/api.rst | 552 ++++++++ .../vendor/twig/twig/doc/coding_standards.rst | 101 ++ .../twig/vendor/twig/twig/doc/deprecated.rst | 162 +++ .../twig/vendor/twig/twig/doc/filters/abs.rst | 18 + .../vendor/twig/twig/doc/filters/batch.rst | 51 + .../twig/twig/doc/filters/capitalize.rst | 11 + .../twig/doc/filters/convert_encoding.rst | 28 + .../vendor/twig/twig/doc/filters/date.rst | 94 ++ .../twig/twig/doc/filters/date_modify.rst | 23 + .../vendor/twig/twig/doc/filters/default.rst | 33 + .../vendor/twig/twig/doc/filters/escape.rst | 116 ++ .../vendor/twig/twig/doc/filters/first.rst | 25 + .../vendor/twig/twig/doc/filters/format.rst | 16 + .../vendor/twig/twig/doc/filters/index.rst | 37 + .../vendor/twig/twig/doc/filters/join.rst | 23 + .../twig/twig/doc/filters/json_encode.rst | 21 + .../vendor/twig/twig/doc/filters/keys.rst | 11 + .../vendor/twig/twig/doc/filters/last.rst | 25 + .../vendor/twig/twig/doc/filters/length.rst | 11 + .../vendor/twig/twig/doc/filters/lower.rst | 10 + .../vendor/twig/twig/doc/filters/merge.rst | 48 + .../vendor/twig/twig/doc/filters/nl2br.rst | 22 + .../twig/twig/doc/filters/number_format.rst | 45 + .../twig/vendor/twig/twig/doc/filters/raw.rst | 36 + .../vendor/twig/twig/doc/filters/replace.rst | 19 + .../vendor/twig/twig/doc/filters/reverse.rst | 47 + .../vendor/twig/twig/doc/filters/round.rst | 37 + .../vendor/twig/twig/doc/filters/slice.rst | 71 ++ .../vendor/twig/twig/doc/filters/sort.rst | 18 + .../vendor/twig/twig/doc/filters/split.rst | 53 + .../twig/twig/doc/filters/striptags.rst | 15 + .../vendor/twig/twig/doc/filters/title.rst | 11 + .../vendor/twig/twig/doc/filters/trim.rst | 29 + .../vendor/twig/twig/doc/filters/upper.rst | 10 + .../twig/twig/doc/filters/url_encode.rst | 34 + .../twig/twig/doc/functions/attribute.rst | 26 + .../vendor/twig/twig/doc/functions/block.rst | 15 + .../twig/twig/doc/functions/constant.rst | 18 + .../vendor/twig/twig/doc/functions/cycle.rst | 28 + .../vendor/twig/twig/doc/functions/date.rst | 52 + .../vendor/twig/twig/doc/functions/dump.rst | 69 + .../twig/twig/doc/functions/include.rst | 80 ++ .../vendor/twig/twig/doc/functions/index.rst | 20 + .../vendor/twig/twig/doc/functions/max.rst | 20 + .../vendor/twig/twig/doc/functions/min.rst | 20 + .../vendor/twig/twig/doc/functions/parent.rst | 20 + .../vendor/twig/twig/doc/functions/random.rst | 29 + .../vendor/twig/twig/doc/functions/range.rst | 45 + .../vendor/twig/twig/doc/functions/source.rst | 32 + .../doc/functions/template_from_string.rst | 32 + plugins/twig/vendor/twig/twig/doc/index.rst | 19 + .../vendor/twig/twig/doc/installation.rst | 116 ++ .../twig/vendor/twig/twig/doc/internals.rst | 138 ++ plugins/twig/vendor/twig/twig/doc/intro.rst | 85 ++ plugins/twig/vendor/twig/twig/doc/recipes.rst | 518 ++++++++ .../vendor/twig/twig/doc/tags/autoescape.rst | 83 ++ .../twig/vendor/twig/twig/doc/tags/block.rst | 11 + plugins/twig/vendor/twig/twig/doc/tags/do.rst | 12 + .../twig/vendor/twig/twig/doc/tags/embed.rst | 178 +++ .../vendor/twig/twig/doc/tags/extends.rst | 268 ++++ .../twig/vendor/twig/twig/doc/tags/filter.rst | 21 + .../twig/vendor/twig/twig/doc/tags/flush.rst | 17 + .../twig/vendor/twig/twig/doc/tags/for.rst | 172 +++ .../twig/vendor/twig/twig/doc/tags/from.rst | 8 + plugins/twig/vendor/twig/twig/doc/tags/if.rst | 76 ++ .../twig/vendor/twig/twig/doc/tags/import.rst | 57 + .../vendor/twig/twig/doc/tags/include.rst | 86 ++ .../twig/vendor/twig/twig/doc/tags/index.rst | 24 + .../twig/vendor/twig/twig/doc/tags/macro.rst | 86 ++ .../vendor/twig/twig/doc/tags/sandbox.rst | 30 + .../twig/vendor/twig/twig/doc/tags/set.rst | 78 ++ .../vendor/twig/twig/doc/tags/spaceless.rst | 37 + .../twig/vendor/twig/twig/doc/tags/use.rst | 124 ++ .../vendor/twig/twig/doc/tags/verbatim.rst | 24 + .../twig/vendor/twig/twig/doc/templates.rst | 907 +++++++++++++ .../vendor/twig/twig/doc/tests/constant.rst | 22 + .../vendor/twig/twig/doc/tests/defined.rst | 30 + .../twig/twig/doc/tests/divisibleby.rst | 14 + .../twig/vendor/twig/twig/doc/tests/empty.rst | 11 + .../twig/vendor/twig/twig/doc/tests/even.rst | 10 + .../twig/vendor/twig/twig/doc/tests/index.rst | 15 + .../vendor/twig/twig/doc/tests/iterable.rst | 19 + .../twig/vendor/twig/twig/doc/tests/null.rst | 12 + .../twig/vendor/twig/twig/doc/tests/odd.rst | 10 + .../vendor/twig/twig/doc/tests/sameas.rst | 14 + .../twig/vendor/twig/twig/ext/twig/.gitignore | 30 + .../twig/vendor/twig/twig/ext/twig/config.m4 | 8 + .../twig/vendor/twig/twig/ext/twig/config.w32 | 8 + .../twig/vendor/twig/twig/ext/twig/php_twig.h | 35 + plugins/twig/vendor/twig/twig/ext/twig/twig.c | 1127 +++++++++++++++++ .../twig/{ => twig}/lib/Twig/Autoloader.php | 0 .../{ => twig}/lib/Twig/BaseNodeVisitor.php | 0 .../{ => twig}/lib/Twig/Cache/Filesystem.php | 0 .../twig/{ => twig}/lib/Twig/Cache/Null.php | 0 .../{ => twig}/lib/Twig/CacheInterface.php | 0 .../twig/{ => twig}/lib/Twig/Compiler.php | 0 .../{ => twig}/lib/Twig/CompilerInterface.php | 0 .../twig/{ => twig}/lib/Twig/Environment.php | 0 .../vendor/twig/{ => twig}/lib/Twig/Error.php | 0 .../twig/{ => twig}/lib/Twig/Error/Loader.php | 0 .../{ => twig}/lib/Twig/Error/Runtime.php | 0 .../twig/{ => twig}/lib/Twig/Error/Syntax.php | 0 .../lib/Twig/ExistsLoaderInterface.php | 0 .../{ => twig}/lib/Twig/ExpressionParser.php | 0 .../twig/{ => twig}/lib/Twig/Extension.php | 0 .../{ => twig}/lib/Twig/Extension/Core.php | 0 .../{ => twig}/lib/Twig/Extension/Debug.php | 0 .../{ => twig}/lib/Twig/Extension/Escaper.php | 0 .../lib/Twig/Extension/GlobalsInterface.php | 0 .../Twig/Extension/InitRuntimeInterface.php | 0 .../lib/Twig/Extension/Optimizer.php | 0 .../lib/Twig/Extension/Profiler.php | 0 .../{ => twig}/lib/Twig/Extension/Sandbox.php | 0 .../{ => twig}/lib/Twig/Extension/Staging.php | 0 .../lib/Twig/Extension/StringLoader.php | 0 .../lib/Twig/ExtensionInterface.php | 0 .../Twig/FileExtensionEscapingStrategy.php | 0 .../twig/{ => twig}/lib/Twig/Filter.php | 0 .../{ => twig}/lib/Twig/Filter/Function.php | 0 .../{ => twig}/lib/Twig/Filter/Method.php | 0 .../twig/{ => twig}/lib/Twig/Filter/Node.php | 0 .../lib/Twig/FilterCallableInterface.php | 0 .../{ => twig}/lib/Twig/FilterInterface.php | 0 .../twig/{ => twig}/lib/Twig/Function.php | 0 .../{ => twig}/lib/Twig/Function/Function.php | 0 .../{ => twig}/lib/Twig/Function/Method.php | 0 .../{ => twig}/lib/Twig/Function/Node.php | 0 .../lib/Twig/FunctionCallableInterface.php | 0 .../{ => twig}/lib/Twig/FunctionInterface.php | 0 .../vendor/twig/{ => twig}/lib/Twig/Lexer.php | 0 .../{ => twig}/lib/Twig/LexerInterface.php | 0 .../twig/{ => twig}/lib/Twig/Loader/Array.php | 0 .../twig/{ => twig}/lib/Twig/Loader/Chain.php | 0 .../{ => twig}/lib/Twig/Loader/Filesystem.php | 0 .../{ => twig}/lib/Twig/Loader/String.php | 0 .../{ => twig}/lib/Twig/LoaderInterface.php | 0 .../twig/{ => twig}/lib/Twig/Markup.php | 0 .../vendor/twig/{ => twig}/lib/Twig/Node.php | 0 .../{ => twig}/lib/Twig/Node/AutoEscape.php | 0 .../twig/{ => twig}/lib/Twig/Node/Block.php | 0 .../lib/Twig/Node/BlockReference.php | 0 .../twig/{ => twig}/lib/Twig/Node/Body.php | 0 .../lib/Twig/Node/CheckSecurity.php | 0 .../twig/{ => twig}/lib/Twig/Node/Do.php | 0 .../twig/{ => twig}/lib/Twig/Node/Embed.php | 0 .../{ => twig}/lib/Twig/Node/Expression.php | 0 .../lib/Twig/Node/Expression/Array.php | 0 .../lib/Twig/Node/Expression/AssignName.php | 0 .../lib/Twig/Node/Expression/Binary.php | 0 .../lib/Twig/Node/Expression/Binary/Add.php | 0 .../lib/Twig/Node/Expression/Binary/And.php | 0 .../Node/Expression/Binary/BitwiseAnd.php | 0 .../Twig/Node/Expression/Binary/BitwiseOr.php | 0 .../Node/Expression/Binary/BitwiseXor.php | 0 .../Twig/Node/Expression/Binary/Concat.php | 0 .../lib/Twig/Node/Expression/Binary/Div.php | 0 .../Twig/Node/Expression/Binary/EndsWith.php | 0 .../lib/Twig/Node/Expression/Binary/Equal.php | 0 .../Twig/Node/Expression/Binary/FloorDiv.php | 0 .../Twig/Node/Expression/Binary/Greater.php | 0 .../Node/Expression/Binary/GreaterEqual.php | 0 .../lib/Twig/Node/Expression/Binary/In.php | 0 .../lib/Twig/Node/Expression/Binary/Less.php | 0 .../Twig/Node/Expression/Binary/LessEqual.php | 0 .../Twig/Node/Expression/Binary/Matches.php | 0 .../lib/Twig/Node/Expression/Binary/Mod.php | 0 .../lib/Twig/Node/Expression/Binary/Mul.php | 0 .../Twig/Node/Expression/Binary/NotEqual.php | 0 .../lib/Twig/Node/Expression/Binary/NotIn.php | 0 .../lib/Twig/Node/Expression/Binary/Or.php | 0 .../lib/Twig/Node/Expression/Binary/Power.php | 0 .../lib/Twig/Node/Expression/Binary/Range.php | 0 .../Node/Expression/Binary/StartsWith.php | 0 .../lib/Twig/Node/Expression/Binary/Sub.php | 0 .../Twig/Node/Expression/BlockReference.php | 0 .../lib/Twig/Node/Expression/Call.php | 0 .../lib/Twig/Node/Expression/Conditional.php | 0 .../lib/Twig/Node/Expression/Constant.php | 0 .../Node/Expression/ExtensionReference.php | 0 .../lib/Twig/Node/Expression/Filter.php | 0 .../Twig/Node/Expression/Filter/Default.php | 0 .../lib/Twig/Node/Expression/Function.php | 0 .../lib/Twig/Node/Expression/GetAttr.php | 0 .../lib/Twig/Node/Expression/MethodCall.php | 0 .../lib/Twig/Node/Expression/Name.php | 0 .../lib/Twig/Node/Expression/NullCoalesce.php | 0 .../lib/Twig/Node/Expression/Parent.php | 0 .../lib/Twig/Node/Expression/TempName.php | 0 .../lib/Twig/Node/Expression/Test.php | 0 .../Twig/Node/Expression/Test/Constant.php | 0 .../lib/Twig/Node/Expression/Test/Defined.php | 0 .../Twig/Node/Expression/Test/Divisibleby.php | 0 .../lib/Twig/Node/Expression/Test/Even.php | 0 .../lib/Twig/Node/Expression/Test/Null.php | 0 .../lib/Twig/Node/Expression/Test/Odd.php | 0 .../lib/Twig/Node/Expression/Test/Sameas.php | 0 .../lib/Twig/Node/Expression/Unary.php | 0 .../lib/Twig/Node/Expression/Unary/Neg.php | 0 .../lib/Twig/Node/Expression/Unary/Not.php | 0 .../lib/Twig/Node/Expression/Unary/Pos.php | 0 .../twig/{ => twig}/lib/Twig/Node/Flush.php | 0 .../twig/{ => twig}/lib/Twig/Node/For.php | 0 .../twig/{ => twig}/lib/Twig/Node/ForLoop.php | 0 .../twig/{ => twig}/lib/Twig/Node/If.php | 0 .../twig/{ => twig}/lib/Twig/Node/Import.php | 0 .../twig/{ => twig}/lib/Twig/Node/Include.php | 0 .../twig/{ => twig}/lib/Twig/Node/Macro.php | 0 .../twig/{ => twig}/lib/Twig/Node/Module.php | 0 .../twig/{ => twig}/lib/Twig/Node/Print.php | 0 .../twig/{ => twig}/lib/Twig/Node/Sandbox.php | 0 .../lib/Twig/Node/SandboxedPrint.php | 0 .../twig/{ => twig}/lib/Twig/Node/Set.php | 0 .../twig/{ => twig}/lib/Twig/Node/SetTemp.php | 0 .../{ => twig}/lib/Twig/Node/Spaceless.php | 0 .../twig/{ => twig}/lib/Twig/Node/Text.php | 0 .../{ => twig}/lib/Twig/NodeInterface.php | 0 .../lib/Twig/NodeOutputInterface.php | 0 .../{ => twig}/lib/Twig/NodeTraverser.php | 0 .../lib/Twig/NodeVisitor/Escaper.php | 0 .../lib/Twig/NodeVisitor/Optimizer.php | 0 .../lib/Twig/NodeVisitor/SafeAnalysis.php | 0 .../lib/Twig/NodeVisitor/Sandbox.php | 0 .../lib/Twig/NodeVisitorInterface.php | 0 .../twig/{ => twig}/lib/Twig/Parser.php | 0 .../{ => twig}/lib/Twig/ParserInterface.php | 0 .../lib/Twig/Profiler/Dumper/Blackfire.php | 0 .../lib/Twig/Profiler/Dumper/Html.php | 0 .../lib/Twig/Profiler/Dumper/Text.php | 0 .../lib/Twig/Profiler/Node/EnterProfile.php | 0 .../lib/Twig/Profiler/Node/LeaveProfile.php | 0 .../Twig/Profiler/NodeVisitor/Profiler.php | 0 .../{ => twig}/lib/Twig/Profiler/Profile.php | 0 .../lib/Twig/Sandbox/SecurityError.php | 0 .../Sandbox/SecurityNotAllowedFilterError.php | 0 .../SecurityNotAllowedFunctionError.php | 0 .../Sandbox/SecurityNotAllowedTagError.php | 0 .../lib/Twig/Sandbox/SecurityPolicy.php | 0 .../Twig/Sandbox/SecurityPolicyInterface.php | 0 .../twig/{ => twig}/lib/Twig/SimpleFilter.php | 0 .../{ => twig}/lib/Twig/SimpleFunction.php | 0 .../twig/{ => twig}/lib/Twig/SimpleTest.php | 0 .../twig/{ => twig}/lib/Twig/Template.php | 0 .../{ => twig}/lib/Twig/TemplateInterface.php | 0 .../vendor/twig/{ => twig}/lib/Twig/Test.php | 0 .../{ => twig}/lib/Twig/Test/Function.php | 0 .../lib/Twig/Test/IntegrationTestCase.php | 0 .../twig/{ => twig}/lib/Twig/Test/Method.php | 0 .../twig/{ => twig}/lib/Twig/Test/Node.php | 0 .../{ => twig}/lib/Twig/Test/NodeTestCase.php | 0 .../lib/Twig/TestCallableInterface.php | 0 .../{ => twig}/lib/Twig/TestInterface.php | 0 .../vendor/twig/{ => twig}/lib/Twig/Token.php | 0 .../twig/{ => twig}/lib/Twig/TokenParser.php | 0 .../lib/Twig/TokenParser/AutoEscape.php | 0 .../{ => twig}/lib/Twig/TokenParser/Block.php | 0 .../{ => twig}/lib/Twig/TokenParser/Do.php | 0 .../{ => twig}/lib/Twig/TokenParser/Embed.php | 0 .../lib/Twig/TokenParser/Extends.php | 0 .../lib/Twig/TokenParser/Filter.php | 0 .../{ => twig}/lib/Twig/TokenParser/Flush.php | 0 .../{ => twig}/lib/Twig/TokenParser/For.php | 0 .../{ => twig}/lib/Twig/TokenParser/From.php | 0 .../{ => twig}/lib/Twig/TokenParser/If.php | 0 .../lib/Twig/TokenParser/Import.php | 0 .../lib/Twig/TokenParser/Include.php | 0 .../{ => twig}/lib/Twig/TokenParser/Macro.php | 0 .../lib/Twig/TokenParser/Sandbox.php | 0 .../{ => twig}/lib/Twig/TokenParser/Set.php | 0 .../lib/Twig/TokenParser/Spaceless.php | 0 .../{ => twig}/lib/Twig/TokenParser/Use.php | 0 .../{ => twig}/lib/Twig/TokenParserBroker.php | 0 .../lib/Twig/TokenParserBrokerInterface.php | 0 .../lib/Twig/TokenParserInterface.php | 0 .../twig/{ => twig}/lib/Twig/TokenStream.php | 0 .../lib/Twig/Util/DeprecationCollector.php | 0 .../lib/Twig/Util/TemplateDirIterator.php | 0 .../twig/vendor/twig/twig/phpunit.xml.dist | 25 + .../twig/test/Twig/Tests/AutoloaderTest.php | 24 + .../test/Twig/Tests/Cache/FilesystemTest.php | 193 +++ .../twig/test/Twig/Tests/CompilerTest.php | 33 + .../twig/test/Twig/Tests/EnvironmentTest.php | 529 ++++++++ .../twig/twig/test/Twig/Tests/ErrorTest.php | 144 +++ .../test/Twig/Tests/ExpressionParserTest.php | 368 ++++++ .../test/Twig/Tests/Extension/CoreTest.php | 158 +++ .../test/Twig/Tests/Extension/SandboxTest.php | 220 ++++ .../twig/test/Twig/Tests/FileCachingTest.php | 63 + .../FileExtensionEscapingStrategyTest.php | 51 + .../twig/test/Twig/Tests/FilesystemHelper.php | 30 + .../Tests/Fixtures/autoescape/filename.test | 18 + .../test/Twig/Tests/Fixtures/errors/base.html | 1 + .../Twig/Tests/Fixtures/errors/index.html | 7 + ...ltiline_array_with_undefined_variable.test | 18 + ...e_array_with_undefined_variable_again.test | 18 + ...line_function_with_undefined_variable.test | 12 + ...tiline_function_with_unknown_argument.test | 9 + ...multiline_tag_with_undefined_variable.test | 12 + .../syntax_error_in_reused_template.test | 10 + .../Fixtures/exceptions/unclosed_tag.test | 20 + .../Fixtures/exceptions/undefined_parent.test | 8 + .../undefined_template_in_child_template.test | 15 + .../Fixtures/exceptions/undefined_trait.test | 9 + .../Tests/Fixtures/expressions/array.test | 61 + .../Fixtures/expressions/array_call.test | 14 + .../Tests/Fixtures/expressions/binary.test | 46 + .../Tests/Fixtures/expressions/bitwise.test | 14 + .../Fixtures/expressions/comparison.test | 14 + .../Fixtures/expressions/divisibleby.test | 17 + .../Tests/Fixtures/expressions/dotdot.test | 20 + .../Tests/Fixtures/expressions/ends_with.test | 26 + .../Tests/Fixtures/expressions/grouping.test | 8 + .../Tests/Fixtures/expressions/literals.test | 22 + .../Fixtures/expressions/magic_call.test | 27 + .../Tests/Fixtures/expressions/matches.test | 12 + .../Fixtures/expressions/method_call.test | 28 + .../expressions/negative_numbers.test | 18 + .../expressions/operators_as_variables.test | 16 + .../Tests/Fixtures/expressions/postfix.test | 22 + .../Tests/Fixtures/expressions/sameas.test | 21 + .../Fixtures/expressions/starts_with.test | 27 + .../Tests/Fixtures/expressions/strings.test | 10 + .../expressions/ternary_operator.test | 18 + .../expressions/ternary_operator_noelse.test | 10 + .../expressions/ternary_operator_nothen.test | 10 + .../two_word_operators_as_variables.test | 8 + .../Tests/Fixtures/expressions/unary.test | 12 + .../expressions/unary_macro_arguments.test | 22 + .../expressions/unary_precedence.test | 14 + .../test/Twig/Tests/Fixtures/filters/abs.test | 30 + .../Twig/Tests/Fixtures/filters/batch.test | 31 + .../Tests/Fixtures/filters/batch_float.test | 29 + .../filters/batch_with_empty_fill.test | 37 + .../filters/batch_with_exact_elements.test | 33 + .../Fixtures/filters/batch_with_fill.test | 37 + .../Fixtures/filters/batch_with_keys.test | 10 + .../filters/batch_with_zero_elements.test | 10 + .../Fixtures/filters/convert_encoding.test | 10 + .../Twig/Tests/Fixtures/filters/date.test | 90 ++ .../Fixtures/filters/date_default_format.test | 14 + .../filters/date_default_format_interval.test | 16 + .../Fixtures/filters/date_immutable.test | 37 + .../Tests/Fixtures/filters/date_interval.test | 19 + .../Tests/Fixtures/filters/date_modify.test | 14 + .../Fixtures/filters/date_namedargs.test | 13 + .../Twig/Tests/Fixtures/filters/default.test | 150 +++ .../Fixtures/filters/dynamic_filter.test | 10 + .../Twig/Tests/Fixtures/filters/escape.test | 8 + .../Fixtures/filters/escape_html_attr.test | 8 + .../filters/escape_non_supported_charset.test | 8 + .../Twig/Tests/Fixtures/filters/first.test | 17 + .../Tests/Fixtures/filters/force_escape.test | 18 + .../Twig/Tests/Fixtures/filters/format.test | 8 + .../Twig/Tests/Fixtures/filters/join.test | 12 + .../Tests/Fixtures/filters/json_encode.test | 12 + .../Twig/Tests/Fixtures/filters/last.test | 17 + .../Twig/Tests/Fixtures/filters/length.test | 14 + .../Tests/Fixtures/filters/length_utf8.test | 12 + .../Twig/Tests/Fixtures/filters/merge.test | 18 + .../Twig/Tests/Fixtures/filters/nl2br.test | 14 + .../Tests/Fixtures/filters/number_format.test | 18 + .../filters/number_format_default.test | 21 + .../Twig/Tests/Fixtures/filters/replace.test | 12 + .../Fixtures/filters/replace_invalid_arg.test | 8 + .../Twig/Tests/Fixtures/filters/reverse.test | 18 + .../Twig/Tests/Fixtures/filters/round.test | 22 + .../Twig/Tests/Fixtures/filters/slice.test | 54 + .../Twig/Tests/Fixtures/filters/sort.test | 12 + .../Tests/Fixtures/filters/special_chars.test | 8 + .../Twig/Tests/Fixtures/filters/split.test | 20 + .../Tests/Fixtures/filters/split_utf8.test | 24 + .../Twig/Tests/Fixtures/filters/trim.test | 12 + .../Tests/Fixtures/filters/urlencode.test | 16 + .../filters/urlencode_deprecated.test | 16 + .../Tests/Fixtures/functions/attribute.test | 18 + .../Twig/Tests/Fixtures/functions/block.test | 12 + .../Tests/Fixtures/functions/constant.test | 10 + .../Twig/Tests/Fixtures/functions/cycle.test | 16 + .../Twig/Tests/Fixtures/functions/date.test | 25 + .../Fixtures/functions/date_namedargs.test | 11 + .../Twig/Tests/Fixtures/functions/dump.test | 16 + .../Tests/Fixtures/functions/dump_array.test | 19 + .../Fixtures/functions/dynamic_function.test | 10 + .../functions/include/assignment.test | 13 + .../functions/include/autoescaping.test | 10 + .../Fixtures/functions/include/basic.test | 17 + .../functions/include/expression.test | 17 + .../functions/include/ignore_missing.test | 10 + .../Fixtures/functions/include/missing.test | 8 + .../functions/include/missing_nested.test | 16 + .../Fixtures/functions/include/sandbox.test | 13 + .../functions/include/sandbox_disabling.test | 16 + .../sandbox_disabling_ignore_missing.test | 13 + .../functions/include/template_instance.test | 10 + .../functions/include/templates_as_array.test | 12 + .../functions/include/with_context.test | 16 + .../functions/include/with_variables.test | 12 + .../Twig/Tests/Fixtures/functions/max.test | 12 + .../Twig/Tests/Fixtures/functions/min.test | 12 + .../Twig/Tests/Fixtures/functions/range.test | 8 + .../recursive_block_with_inheritance.test | 21 + .../Twig/Tests/Fixtures/functions/source.test | 17 + .../Fixtures/functions/special_chars.test | 8 + .../functions/template_from_string.test | 15 + .../Tests/Fixtures/macros/default_values.test | 16 + .../Tests/Fixtures/macros/nested_calls.test | 18 + .../Fixtures/macros/reserved_variables.test | 14 + .../Twig/Tests/Fixtures/macros/simple.test | 22 + .../Twig/Tests/Fixtures/macros/varargs.test | 21 + .../Fixtures/macros/varargs_argument.test | 8 + .../Tests/Fixtures/macros/with_filters.test | 14 + .../regression/combined_debug_info.test | 15 + .../Fixtures/regression/empty_token.test | 8 + .../Tests/Fixtures/regression/issue_1143.test | 23 + .../Fixtures/regression/multi_word_tests.test | 10 + .../regression/simple_xml_element.test | 19 + .../regression/strings_like_numbers.test | 8 + .../Tests/Fixtures/tags/autoescape/basic.test | 26 + .../Fixtures/tags/autoescape/blocks.test | 12 + .../tags/autoescape/double_escaping.test | 10 + .../Fixtures/tags/autoescape/functions.test | 83 ++ .../Fixtures/tags/autoescape/literal.test | 45 + .../Fixtures/tags/autoescape/nested.test | 26 + .../Fixtures/tags/autoescape/objects.test | 26 + .../Tests/Fixtures/tags/autoescape/raw.test | 10 + .../tags/autoescape/strategy.legacy.test | 11 + .../Fixtures/tags/autoescape/strategy.test | 11 + .../Tests/Fixtures/tags/autoescape/type.test | 69 + .../tags/autoescape/with_filters.test | 131 ++ .../autoescape/with_filters_arguments.test | 23 + .../autoescape/with_pre_escape_filters.test | 68 + .../with_preserves_safety_filters.test | 50 + .../Twig/Tests/Fixtures/tags/block/basic.test | 11 + .../tags/block/block_unique_name.test | 11 + .../Fixtures/tags/block/special_chars.test | 10 + .../Twig/Tests/Fixtures/tags/embed/basic.test | 35 + .../Tests/Fixtures/tags/embed/error_line.test | 16 + .../Tests/Fixtures/tags/embed/multiple.test | 50 + .../Tests/Fixtures/tags/embed/nested.test | 42 + .../Fixtures/tags/embed/with_extends.test | 60 + .../Tests/Fixtures/tags/filter/basic.test | 10 + .../Fixtures/tags/filter/json_encode.test | 8 + .../Tests/Fixtures/tags/filter/multiple.test | 10 + .../Tests/Fixtures/tags/filter/nested.test | 16 + .../Fixtures/tags/filter/with_for_tag.test | 13 + .../Fixtures/tags/filter/with_if_tag.test | 29 + .../Tests/Fixtures/tags/for/condition.test | 14 + .../Twig/Tests/Fixtures/tags/for/context.test | 18 + .../Twig/Tests/Fixtures/tags/for/else.test | 23 + .../Fixtures/tags/for/inner_variables.test | 17 + .../Twig/Tests/Fixtures/tags/for/keys.test | 11 + .../Fixtures/tags/for/keys_and_values.test | 11 + .../Tests/Fixtures/tags/for/loop_context.test | 19 + .../Fixtures/tags/for/loop_context_local.test | 10 + .../Fixtures/tags/for/loop_not_defined.test | 10 + .../tags/for/loop_not_defined_cond.test | 9 + .../Tests/Fixtures/tags/for/nested_else.test | 17 + .../Twig/Tests/Fixtures/tags/for/objects.test | 43 + .../Fixtures/tags/for/objects_countable.test | 47 + .../Tests/Fixtures/tags/for/recursive.test | 18 + .../Twig/Tests/Fixtures/tags/for/values.test | 11 + .../test/Twig/Tests/Fixtures/tags/from.test | 14 + .../Twig/Tests/Fixtures/tags/if/basic.test | 22 + .../Tests/Fixtures/tags/if/expression.test | 22 + .../Tests/Fixtures/tags/include/basic.test | 16 + .../Fixtures/tags/include/expression.test | 16 + .../Fixtures/tags/include/ignore_missing.test | 10 + .../Tests/Fixtures/tags/include/missing.test | 8 + .../Fixtures/tags/include/missing_nested.test | 16 + .../Tests/Fixtures/tags/include/only.test | 16 + .../tags/include/template_instance.test | 10 + .../tags/include/templates_as_array.test | 12 + .../Fixtures/tags/include/with_variables.test | 12 + .../Fixtures/tags/inheritance/basic.test | 14 + .../Fixtures/tags/inheritance/block_expr.test | 32 + .../tags/inheritance/block_expr2.test | 34 + .../tags/inheritance/conditional.test | 14 + .../Fixtures/tags/inheritance/dynamic.test | 14 + .../Fixtures/tags/inheritance/empty.test | 10 + .../tags/inheritance/extends_as_array.test | 12 + .../extends_as_array_with_empty_name.test | 12 + .../extends_as_array_with_null_name.test | 12 + .../Fixtures/tags/inheritance/multiple.test | 12 + .../tags/inheritance/multiple_dynamic.test | 22 + .../tags/inheritance/nested_blocks.test | 22 + .../nested_blocks_parent_only.test | 15 + .../tags/inheritance/nested_inheritance.test | 16 + .../Fixtures/tags/inheritance/parent.test | 12 + .../tags/inheritance/parent_change.test | 16 + .../tags/inheritance/parent_in_a_block.test | 8 + .../tags/inheritance/parent_isolation.test | 20 + .../tags/inheritance/parent_nested.test | 28 + .../inheritance/parent_without_extends.test | 8 + .../parent_without_extends_but_traits.test | 14 + .../tags/inheritance/template_instance.test | 14 + .../Tests/Fixtures/tags/inheritance/use.test | 44 + .../Twig/Tests/Fixtures/tags/macro/basic.test | 17 + .../Fixtures/tags/macro/endmacro_name.test | 16 + .../Tests/Fixtures/tags/macro/external.test | 17 + .../Twig/Tests/Fixtures/tags/macro/from.test | 18 + .../tags/macro/from_with_reserved_name.test | 9 + .../Tests/Fixtures/tags/macro/global.test | 14 + .../tags/macro/import_with_reserved_nam.test | 11 + .../Fixtures/tags/macro/reserved_name.test | 10 + .../Fixtures/tags/macro/self_import.test | 17 + .../Fixtures/tags/macro/special_chars.test | 14 + .../Fixtures/tags/macro/super_globals.test | 14 + .../Tests/Fixtures/tags/raw/basic.legacy.test | 10 + .../tags/raw/mixed_usage_with_raw.legacy.test | 10 + .../tags/raw/whitespace_control.legacy.test | 56 + .../Fixtures/tags/sandbox/not_valid1.test | 11 + .../Fixtures/tags/sandbox/not_valid2.test | 14 + .../Tests/Fixtures/tags/sandbox/simple.test | 22 + .../Twig/Tests/Fixtures/tags/set/basic.test | 20 + .../Fixtures/tags/set/capture-empty.test | 9 + .../Twig/Tests/Fixtures/tags/set/capture.test | 10 + .../Tests/Fixtures/tags/set/expression.test | 12 + .../Tests/Fixtures/tags/spaceless/simple.test | 12 + .../Tests/Fixtures/tags/special_chars.test | 8 + .../Twig/Tests/Fixtures/tags/trim_block.test | 74 ++ .../Twig/Tests/Fixtures/tags/use/aliases.test | 12 + .../Twig/Tests/Fixtures/tags/use/basic.test | 12 + .../Twig/Tests/Fixtures/tags/use/deep.test | 22 + .../Tests/Fixtures/tags/use/deep_empty.test | 10 + .../Tests/Fixtures/tags/use/inheritance.test | 25 + .../Tests/Fixtures/tags/use/inheritance2.test | 24 + .../Tests/Fixtures/tags/use/multiple.test | 21 + .../Fixtures/tags/use/multiple_aliases.test | 23 + .../Tests/Fixtures/tags/use/parent_block.test | 24 + .../Fixtures/tags/use/parent_block2.test | 24 + .../Fixtures/tags/use/parent_block3.test | 38 + .../Tests/Fixtures/tags/verbatim/basic.test | 10 + .../tags/verbatim/mixed_usage_with_raw.test | 10 + .../tags/verbatim/whitespace_control.test | 56 + .../test/Twig/Tests/Fixtures/tests/array.test | 24 + .../Twig/Tests/Fixtures/tests/constant.test | 14 + .../Twig/Tests/Fixtures/tests/defined.test | 129 ++ .../test/Twig/Tests/Fixtures/tests/empty.test | 45 + .../test/Twig/Tests/Fixtures/tests/even.test | 14 + .../test/Twig/Tests/Fixtures/tests/in.test | 128 ++ .../Tests/Fixtures/tests/in_with_objects.test | 19 + .../Twig/Tests/Fixtures/tests/iterable.test | 19 + .../Tests/Fixtures/tests/null_coalesce.test | 30 + .../test/Twig/Tests/Fixtures/tests/odd.test | 10 + .../twig/test/Twig/Tests/IntegrationTest.php | 229 ++++ .../Tests/LegacyFixtures/test.legacy.test | 8 + .../test/Twig/Tests/LegacyIntegrationTest.php | 54 + .../twig/twig/test/Twig/Tests/LexerTest.php | 300 +++++ .../twig/test/Twig/Tests/Loader/ArrayTest.php | 97 ++ .../twig/test/Twig/Tests/Loader/ChainTest.php | 79 ++ .../test/Twig/Tests/Loader/FilesystemTest.php | 175 +++ .../array_inheritance_empty_parent.html.twig | 3 + ...y_inheritance_nonexistent_parent.html.twig | 3 + .../array_inheritance_null_parent.html.twig | 3 + .../array_inheritance_valid_parent.html.twig | 3 + .../Fixtures/inheritance/parent.html.twig | 1 + .../inheritance/spare_parent.html.twig | 1 + .../Tests/Loader/Fixtures/named/index.html | 1 + .../Loader/Fixtures/named_bis/index.html | 1 + .../Loader/Fixtures/named_final/index.html | 1 + .../Fixtures/named_quater/named_absolute.html | 1 + .../Loader/Fixtures/named_ter/index.html | 1 + .../Tests/Loader/Fixtures/normal/index.html | 1 + .../Loader/Fixtures/normal_bis/index.html | 1 + .../Loader/Fixtures/normal_final/index.html | 1 + .../Loader/Fixtures/normal_ter/index.html | 1 + .../Fixtures/themes/theme1/blocks.html.twig | 3 + .../Fixtures/themes/theme2/blocks.html.twig | 3 + .../test/Twig/Tests/NativeExtensionTest.php | 33 + .../test/Twig/Tests/Node/AutoEscapeTest.php | 32 + .../Twig/Tests/Node/BlockReferenceTest.php | 31 + .../twig/test/Twig/Tests/Node/BlockTest.php | 39 + .../twig/twig/test/Twig/Tests/Node/DoTest.php | 32 + .../Twig/Tests/Node/Expression/ArrayTest.php | 37 + .../Tests/Node/Expression/AssignNameTest.php | 29 + .../Tests/Node/Expression/Binary/AddTest.php | 34 + .../Tests/Node/Expression/Binary/AndTest.php | 34 + .../Node/Expression/Binary/ConcatTest.php | 34 + .../Tests/Node/Expression/Binary/DivTest.php | 34 + .../Node/Expression/Binary/FloorDivTest.php | 34 + .../Tests/Node/Expression/Binary/ModTest.php | 34 + .../Tests/Node/Expression/Binary/MulTest.php | 34 + .../Tests/Node/Expression/Binary/OrTest.php | 34 + .../Tests/Node/Expression/Binary/SubTest.php | 34 + .../Twig/Tests/Node/Expression/CallTest.php | 116 ++ .../Tests/Node/Expression/ConditionalTest.php | 38 + .../Tests/Node/Expression/ConstantTest.php | 30 + .../Twig/Tests/Node/Expression/FilterTest.php | 154 +++ .../Tests/Node/Expression/FunctionTest.php | 110 ++ .../Tests/Node/Expression/GetAttrTest.php | 50 + .../Twig/Tests/Node/Expression/NameTest.php | 35 + .../Node/Expression/PHP53/FilterInclude.php | 6 + .../Node/Expression/PHP53/FunctionInclude.php | 6 + .../Node/Expression/PHP53/TestInclude.php | 6 + .../Twig/Tests/Node/Expression/ParentTest.php | 28 + .../Twig/Tests/Node/Expression/TestTest.php | 82 ++ .../Tests/Node/Expression/Unary/NegTest.php | 32 + .../Tests/Node/Expression/Unary/NotTest.php | 31 + .../Tests/Node/Expression/Unary/PosTest.php | 31 + .../twig/test/Twig/Tests/Node/ForTest.php | 191 +++ .../twig/twig/test/Twig/Tests/Node/IfTest.php | 88 ++ .../twig/test/Twig/Tests/Node/ImportTest.php | 40 + .../twig/test/Twig/Tests/Node/IncludeTest.php | 83 ++ .../twig/test/Twig/Tests/Node/MacroTest.php | 70 + .../twig/test/Twig/Tests/Node/ModuleTest.php | 183 +++ .../twig/test/Twig/Tests/Node/PrintTest.php | 29 + .../twig/test/Twig/Tests/Node/SandboxTest.php | 44 + .../Twig/Tests/Node/SandboxedPrintTest.php | 33 + .../twig/test/Twig/Tests/Node/SetTest.php | 69 + .../test/Twig/Tests/Node/SpacelessTest.php | 37 + .../twig/test/Twig/Tests/Node/TextTest.php | 28 + .../Twig/Tests/NodeVisitor/OptimizerTest.php | 124 ++ .../twig/twig/test/Twig/Tests/ParserTest.php | 196 +++ .../Tests/Profiler/Dumper/AbstractTest.php | 101 ++ .../Tests/Profiler/Dumper/BlackfireTest.php | 32 + .../Twig/Tests/Profiler/Dumper/HtmlTest.php | 30 + .../Twig/Tests/Profiler/Dumper/TextTest.php | 30 + .../test/Twig/Tests/Profiler/ProfileTest.php | 100 ++ .../twig/test/Twig/Tests/TemplateTest.php | 693 ++++++++++ .../twig/test/Twig/Tests/TokenStreamTest.php | 70 + .../twig/test/Twig/Tests/escapingTest.php | 320 +++++ .../twig/vendor/twig/twig/test/bootstrap.php | 13 + 632 files changed, 21617 insertions(+), 3 deletions(-) create mode 100644 plugins/twig/vendor/autoload.php create mode 100644 plugins/twig/vendor/twig/twig/.editorconfig create mode 100644 plugins/twig/vendor/twig/twig/.gitignore create mode 100644 plugins/twig/vendor/twig/twig/.travis.yml create mode 100644 plugins/twig/vendor/twig/twig/CHANGELOG create mode 100644 plugins/twig/vendor/twig/twig/LICENSE create mode 100644 plugins/twig/vendor/twig/twig/README.rst create mode 100644 plugins/twig/vendor/twig/twig/composer.json create mode 100644 plugins/twig/vendor/twig/twig/doc/advanced.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/advanced_legacy.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/api.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/coding_standards.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/deprecated.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/abs.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/batch.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/capitalize.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/convert_encoding.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/date.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/date_modify.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/default.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/escape.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/first.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/format.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/index.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/join.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/json_encode.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/keys.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/last.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/length.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/lower.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/merge.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/nl2br.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/number_format.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/raw.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/replace.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/reverse.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/round.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/slice.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/sort.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/split.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/striptags.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/title.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/trim.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/upper.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/filters/url_encode.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/attribute.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/block.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/constant.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/cycle.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/date.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/dump.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/include.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/index.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/max.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/min.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/parent.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/random.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/range.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/source.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/functions/template_from_string.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/index.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/installation.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/internals.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/intro.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/recipes.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/autoescape.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/block.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/do.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/embed.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/extends.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/filter.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/flush.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/for.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/from.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/if.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/import.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/include.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/index.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/macro.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/sandbox.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/set.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/spaceless.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/use.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tags/verbatim.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/templates.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tests/constant.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tests/defined.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tests/divisibleby.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tests/empty.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tests/even.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tests/index.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tests/iterable.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tests/null.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tests/odd.rst create mode 100644 plugins/twig/vendor/twig/twig/doc/tests/sameas.rst create mode 100644 plugins/twig/vendor/twig/twig/ext/twig/.gitignore create mode 100644 plugins/twig/vendor/twig/twig/ext/twig/config.m4 create mode 100644 plugins/twig/vendor/twig/twig/ext/twig/config.w32 create mode 100644 plugins/twig/vendor/twig/twig/ext/twig/php_twig.h create mode 100644 plugins/twig/vendor/twig/twig/ext/twig/twig.c rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Autoloader.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/BaseNodeVisitor.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Cache/Filesystem.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Cache/Null.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/CacheInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Compiler.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/CompilerInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Environment.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Error.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Error/Loader.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Error/Runtime.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Error/Syntax.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/ExistsLoaderInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/ExpressionParser.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Extension.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Extension/Core.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Extension/Debug.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Extension/Escaper.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Extension/GlobalsInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Extension/InitRuntimeInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Extension/Optimizer.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Extension/Profiler.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Extension/Sandbox.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Extension/Staging.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Extension/StringLoader.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/ExtensionInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/FileExtensionEscapingStrategy.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Filter.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Filter/Function.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Filter/Method.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Filter/Node.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/FilterCallableInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/FilterInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Function.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Function/Function.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Function/Method.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Function/Node.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/FunctionCallableInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/FunctionInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Lexer.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/LexerInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Loader/Array.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Loader/Chain.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Loader/Filesystem.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Loader/String.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/LoaderInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Markup.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/AutoEscape.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Block.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/BlockReference.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Body.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/CheckSecurity.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Do.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Embed.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Array.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/AssignName.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/Add.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/And.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/BitwiseAnd.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/BitwiseOr.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/BitwiseXor.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/Concat.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/Div.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/EndsWith.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/Equal.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/FloorDiv.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/Greater.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/GreaterEqual.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/In.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/Less.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/LessEqual.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/Matches.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/Mod.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/Mul.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/NotEqual.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/NotIn.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/Or.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/Power.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/Range.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/StartsWith.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Binary/Sub.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/BlockReference.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Call.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Conditional.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Constant.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/ExtensionReference.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Filter.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Filter/Default.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Function.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/GetAttr.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/MethodCall.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Name.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/NullCoalesce.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Parent.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/TempName.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Test.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Test/Constant.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Test/Defined.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Test/Divisibleby.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Test/Even.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Test/Null.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Test/Odd.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Test/Sameas.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Unary.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Unary/Neg.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Unary/Not.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Expression/Unary/Pos.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Flush.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/For.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/ForLoop.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/If.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Import.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Include.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Macro.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Module.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Print.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Sandbox.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/SandboxedPrint.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Set.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/SetTemp.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Spaceless.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Node/Text.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/NodeInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/NodeOutputInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/NodeTraverser.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/NodeVisitor/Escaper.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/NodeVisitor/Optimizer.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/NodeVisitor/SafeAnalysis.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/NodeVisitor/Sandbox.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/NodeVisitorInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Parser.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/ParserInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Profiler/Dumper/Blackfire.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Profiler/Dumper/Html.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Profiler/Dumper/Text.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Profiler/Node/EnterProfile.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Profiler/Node/LeaveProfile.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Profiler/NodeVisitor/Profiler.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Profiler/Profile.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Sandbox/SecurityError.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Sandbox/SecurityNotAllowedTagError.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Sandbox/SecurityPolicy.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Sandbox/SecurityPolicyInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/SimpleFilter.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/SimpleFunction.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/SimpleTest.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Template.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TemplateInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Test.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Test/Function.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Test/IntegrationTestCase.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Test/Method.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Test/Node.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Test/NodeTestCase.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TestCallableInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TestInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Token.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/AutoEscape.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/Block.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/Do.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/Embed.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/Extends.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/Filter.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/Flush.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/For.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/From.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/If.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/Import.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/Include.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/Macro.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/Sandbox.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/Set.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/Spaceless.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParser/Use.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParserBroker.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParserBrokerInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenParserInterface.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/TokenStream.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Util/DeprecationCollector.php (100%) rename plugins/twig/vendor/twig/{ => twig}/lib/Twig/Util/TemplateDirIterator.php (100%) create mode 100644 plugins/twig/vendor/twig/twig/phpunit.xml.dist create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/CompilerTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/ErrorTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/filename.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/LexerTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/DoTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/ParserTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/TemplateTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/escapingTest.php create mode 100644 plugins/twig/vendor/twig/twig/test/bootstrap.php diff --git a/plugins/twig/composer.json b/plugins/twig/composer.json index f248dbe3..7a04e2ac 100644 --- a/plugins/twig/composer.json +++ b/plugins/twig/composer.json @@ -4,5 +4,8 @@ "description": "Herbie Twig Plugin.", "keywords": ["herbie", "plugin", "twig"], "type": "herbie-plugin", - "license": "BSD-3-Clause" -} \ No newline at end of file + "license": "BSD-3-Clause", + "require": { + "twig/twig": "v1.24.0" + } +} diff --git a/plugins/twig/twig.php b/plugins/twig/twig.php index c0569c2c..bbffabf4 100644 --- a/plugins/twig/twig.php +++ b/plugins/twig/twig.php @@ -23,7 +23,7 @@ public function initTwig() // Add custom namespace path to Imagine lib $vendorDir = $config->get('site.path') . '/../vendor'; $autoload = require($vendorDir . '/autoload.php'); - $autoload->add('Twig_', __DIR__ . '/vendor/twig/lib'); + $autoload->add('Twig_', __DIR__ . '/vendor/twig/twig/lib'); $this->twig = new Twig($config); $this->twig->init(); diff --git a/plugins/twig/vendor/autoload.php b/plugins/twig/vendor/autoload.php new file mode 100644 index 00000000..606718a5 --- /dev/null +++ b/plugins/twig/vendor/autoload.php @@ -0,0 +1,7 @@ +> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi + - if [ ${TRAVIS_PHP_VERSION:0:3} == "5.2" ]; then sed -i.bak "s|vendor/autoload.php|test/bootstrap.php|" phpunit.xml.dist; fi + +matrix: + fast_finish: true + exclude: + - php: hhvm + env: TWIG_EXT=yes + allow_failures: + - php: 7.0 + env: TWIG_EXT=yes diff --git a/plugins/twig/vendor/twig/twig/CHANGELOG b/plugins/twig/vendor/twig/twig/CHANGELOG new file mode 100644 index 00000000..85de10dd --- /dev/null +++ b/plugins/twig/vendor/twig/twig/CHANGELOG @@ -0,0 +1,828 @@ +* 1.24.0 (2016-01-25) + + * adding support for the ?? operator + * fixed the defined test when used on a constant, a map, or a sequence + * undeprecated _self (should only be used to get the template name, not the template instance) + * fixed parsing on PHP7 + +* 1.23.3 (2016-01-11) + + * fixed typo + +* 1.23.2 (2015-01-11) + + * added versions in deprecated messages + * made file cache tolerant for trailing (back)slashes on directory configuration + * deprecated unused Twig_Node_Expression_ExtensionReference class + +* 1.23.1 (2015-11-05) + + * fixed some exception messages which triggered PHP warnings + * fixed BC on Twig_Test_NodeTestCase + +* 1.23.0 (2015-10-29) + + * deprecated the possibility to override an extension by registering another one with the same name + * deprecated Twig_ExtensionInterface::getGlobals() (added Twig_Extension_GlobalsInterface for BC) + * deprecated Twig_ExtensionInterface::initRuntime() (added Twig_Extension_InitRuntimeInterface for BC) + * deprecated Twig_Environment::computeAlternatives() + +* 1.22.3 (2015-10-13) + + * fixed regression when using null as a cache strategy + * improved performance when checking template freshness + * fixed warnings when loaded templates do not exist + * fixed template class name generation to prevent possible collisions + * fixed logic for custom escapers to call them even on integers and null values + * changed template cache names to take into account the Twig C extension + +* 1.22.2 (2015-09-22) + + * fixed a race condition in template loading + +* 1.22.1 (2015-09-15) + + * fixed regression in template_from_string + +* 1.22.0 (2015-09-13) + + * made Twig_Test_IntegrationTestCase more flexible + * added an option to force PHP bytecode invalidation when writing a compiled template into the cache + * fixed the profiler duration for the root node + * changed template cache names to take into account enabled extensions + * deprecated Twig_Environment::clearCacheFiles(), Twig_Environment::getCacheFilename(), + Twig_Environment::writeCacheFile(), and Twig_Environment::getTemplateClassPrefix() + * added a way to override the filesystem template cache system + * added a way to get the original template source from Twig_Template + +* 1.21.2 (2015-09-09) + + * fixed variable names for the deprecation triggering code + * fixed escaping strategy detection based on filename + * added Traversable support for replace, merge, and sort + * deprecated support for character by character replacement for the "replace" filter + +* 1.21.1 (2015-08-26) + + * fixed regression when using the deprecated Twig_Test_* classes + +* 1.21.0 (2015-08-24) + + * added deprecation notices for deprecated features + * added a deprecation "framework" for filters/functions/tests and test fixtures + +* 1.20.0 (2015-08-12) + + * forbid access to the Twig environment from templates and internal parts of Twig_Template + * fixed limited RCEs when in sandbox mode + * deprecated Twig_Template::getEnvironment() + * deprecated the _self variable for usage outside of the from and import tags + * added Twig_BaseNodeVisitor to ease the compatibility of node visitors + between 1.x and 2.x + +* 1.19.0 (2015-07-31) + + * fixed wrong error message when including an undefined template in a child template + * added support for variadic filters, functions, and tests + * added support for extra positional arguments in macros + * added ignore_missing flag to the source function + * fixed batch filter with zero items + * deprecated Twig_Environment::clearTemplateCache() + * fixed sandbox disabling when using the include function + +* 1.18.2 (2015-06-06) + + * fixed template/line guessing in exceptions for nested templates + * optimized the number of inodes and the size of realpath cache when using the cache + +* 1.18.1 (2015-04-19) + + * fixed memory leaks in the C extension + * deprecated Twig_Loader_String + * fixed the slice filter when used with a SimpleXMLElement object + * fixed filesystem loader when trying to load non-files (like directories) + +* 1.18.0 (2015-01-25) + + * fixed some error messages where the line was wrong (unknown variables or argument names) + * added a new way to customize the main Module node (via empty nodes) + * added Twig_Environment::createTemplate() to create a template from a string + * added a profiler + * fixed filesystem loader cache when different file paths are used for the same template + +* 1.17.0 (2015-01-14) + + * added a 'filename' autoescaping strategy, which dynamically chooses the + autoescaping strategy for a template based on template file extension. + +* 1.16.3 (2014-12-25) + + * fixed regression for dynamic parent templates + * fixed cache management with statcache + * fixed a regression in the slice filter + +* 1.16.2 (2014-10-17) + + * fixed timezone on dates as strings + * fixed 2-words test names when a custom node class is not used + * fixed macros when using an argument named like a PHP super global (like GET or POST) + * fixed date_modify when working with DateTimeImmutable + * optimized for loops + * fixed multi-byte characters handling in the split filter + * fixed a regression in the in operator + * fixed a regression in the slice filter + +* 1.16.1 (2014-10-10) + + * improved error reporting in a sandboxed template + * fixed missing error file/line information under certain circumstances + * fixed wrong error line number in some error messages + * fixed the in operator to use strict comparisons + * sped up the slice filter + * fixed for mb function overload mb_substr acting different + * fixed the attribute() function when passing a variable for the arguments + +* 1.16.0 (2014-07-05) + + * changed url_encode to always encode according to RFC 3986 + * fixed inheritance in a 'use'-hierarchy + * removed the __toString policy check when the sandbox is disabled + * fixed recursively calling blocks in templates with inheritance + +* 1.15.1 (2014-02-13) + + * fixed the conversion of the special '0000-00-00 00:00' date + * added an error message when trying to import an undefined block from a trait + * fixed a C extension crash when accessing defined but uninitialized property. + +* 1.15.0 (2013-12-06) + + * made ignoreStrictCheck in Template::getAttribute() works with __call() methods throwing BadMethodCallException + * added min and max functions + * added the round filter + * fixed a bug that prevented the optimizers to be enabled/disabled selectively + * fixed first and last filters for UTF-8 strings + * added a source function to include the content of a template without rendering it + * fixed the C extension sandbox behavior when get or set is prepend to method name + +* 1.14.2 (2013-10-30) + + * fixed error filename/line when an error occurs in an included file + * allowed operators that contain whitespaces to have more than one whitespace + * allowed tests to be made of 1 or 2 words (like "same as" or "divisible by") + +* 1.14.1 (2013-10-15) + + * made it possible to use named operators as variables + * fixed the possibility to have a variable named 'matches' + * added support for PHP 5.5 DateTimeInterface + +* 1.14.0 (2013-10-03) + + * fixed usage of the html_attr escaping strategy to avoid double-escaping with the html strategy + * added new operators: ends with, starts with, and matches + * fixed some compatibility issues with HHVM + * added a way to add custom escaping strategies + * fixed the C extension compilation on Windows + * fixed the batch filter when using a fill argument with an exact match of elements to batch + * fixed the filesystem loader cache when a template name exists in several namespaces + * fixed template_from_string when the template includes or extends other ones + * fixed a crash of the C extension on an edge case + +* 1.13.2 (2013-08-03) + + * fixed the error line number for an error occurs in and embedded template + * fixed crashes of the C extension on some edge cases + +* 1.13.1 (2013-06-06) + + * added the possibility to ignore the filesystem constructor argument in Twig_Loader_Filesystem + * fixed Twig_Loader_Chain::exists() for a loader which implements Twig_ExistsLoaderInterface + * adjusted backtrace call to reduce memory usage when an error occurs + * added support for object instances as the second argument of the constant test + * fixed the include function when used in an assignment + +* 1.13.0 (2013-05-10) + + * fixed getting a numeric-like item on a variable ('09' for instance) + * fixed getting a boolean or float key on an array, so it is consistent with PHP's array access: + `{{ array[false] }}` behaves the same as `echo $array[false];` (equals `$array[0]`) + * made the escape filter 20% faster for happy path (escaping string for html with UTF-8) + * changed ☃ to § in tests + * enforced usage of named arguments after positional ones + +* 1.12.3 (2013-04-08) + + * fixed a security issue in the filesystem loader where it was possible to include a template one + level above the configured path + * fixed fatal error that should be an exception when adding a filter/function/test too late + * added a batch filter + * added support for encoding an array as query string in the url_encode filter + +* 1.12.2 (2013-02-09) + + * fixed the timezone used by the date filter and function when the given date contains a timezone (like 2010-01-28T15:00:00+02:00) + * fixed globals when getGlobals is called early on + * added the first and last filter + +* 1.12.1 (2013-01-15) + + * added support for object instances as the second argument of the constant function + * relaxed globals management to avoid a BC break + * added support for {{ some_string[:2] }} + +* 1.12.0 (2013-01-08) + + * added verbatim as an alias for the raw tag to avoid confusion with the raw filter + * fixed registration of tests and functions as anonymous functions + * fixed globals management + +* 1.12.0-RC1 (2012-12-29) + + * added an include function (does the same as the include tag but in a more flexible way) + * added the ability to use any PHP callable to define filters, functions, and tests + * added a syntax error when using a loop variable that is not defined + * added the ability to set default values for macro arguments + * added support for named arguments for filters, tests, and functions + * moved filters/functions/tests syntax errors to the parser + * added support for extended ternary operator syntaxes + +* 1.11.1 (2012-11-11) + + * fixed debug info line numbering (was off by 2) + * fixed escaping when calling a macro inside another one (regression introduced in 1.9.1) + * optimized variable access on PHP 5.4 + * fixed a crash of the C extension when an exception was thrown from a macro called without being imported (using _self.XXX) + +* 1.11.0 (2012-11-07) + + * fixed macro compilation when a variable name is a PHP reserved keyword + * changed the date filter behavior to always apply the default timezone, except if false is passed as the timezone + * fixed bitwise operator precedences + * added the template_from_string function + * fixed default timezone usage for the date function + * optimized the way Twig exceptions are managed (to make them faster) + * added Twig_ExistsLoaderInterface (implementing this interface in your loader make the chain loader much faster) + +* 1.10.3 (2012-10-19) + + * fixed wrong template location in some error messages + * reverted a BC break introduced in 1.10.2 + * added a split filter + +* 1.10.2 (2012-10-15) + + * fixed macro calls on PHP 5.4 + +* 1.10.1 (2012-10-15) + + * made a speed optimization to macro calls when imported via the "import" tag + * fixed C extension compilation on Windows + * fixed a segfault in the C extension when using DateTime objects + +* 1.10.0 (2012-09-28) + + * extracted functional tests framework to make it reusable for third-party extensions + * added namespaced templates support in Twig_Loader_Filesystem + * added Twig_Loader_Filesystem::prependPath() + * fixed an error when a token parser pass a closure as a test to the subparse() method + +* 1.9.2 (2012-08-25) + + * fixed the in operator for objects that contain circular references + * fixed the C extension when accessing a public property of an object implementing the \ArrayAccess interface + +* 1.9.1 (2012-07-22) + + * optimized macro calls when auto-escaping is on + * fixed wrong parent class for Twig_Function_Node + * made Twig_Loader_Chain more explicit about problems + +* 1.9.0 (2012-07-13) + + * made the parsing independent of the template loaders + * fixed exception trace when an error occurs when rendering a child template + * added escaping strategies for CSS, URL, and HTML attributes + * fixed nested embed tag calls + * added the date_modify filter + +* 1.8.3 (2012-06-17) + + * fixed paths in the filesystem loader when passing a path that ends with a slash or a backslash + * fixed escaping when a project defines a function named html or js + * fixed chmod mode to apply the umask correctly + +* 1.8.2 (2012-05-30) + + * added the abs filter + * fixed a regression when using a number in template attributes + * fixed compiler when mbstring.func_overload is set to 2 + * fixed DateTimeZone support in date filter + +* 1.8.1 (2012-05-17) + + * fixed a regression when dealing with SimpleXMLElement instances in templates + * fixed "is_safe" value for the "dump" function when "html_errors" is not defined in php.ini + * switched to use mbstring whenever possible instead of iconv (you might need to update your encoding as mbstring and iconv encoding names sometimes differ) + +* 1.8.0 (2012-05-08) + + * enforced interface when adding tests, filters, functions, and node visitors from extensions + * fixed a side-effect of the date filter where the timezone might be changed + * simplified usage of the autoescape tag; the only (optional) argument is now the escaping strategy or false (with a BC layer) + * added a way to dynamically change the auto-escaping strategy according to the template "filename" + * changed the autoescape option to also accept a supported escaping strategy (for BC, true is equivalent to html) + * added an embed tag + +* 1.7.0 (2012-04-24) + + * fixed a PHP warning when using CIFS + * fixed template line number in some exceptions + * added an iterable test + * added an error when defining two blocks with the same name in a template + * added the preserves_safety option for filters + * fixed a PHP notice when trying to access a key on a non-object/array variable + * enhanced error reporting when the template file is an instance of SplFileInfo + * added Twig_Environment::mergeGlobals() + * added compilation checks to avoid misuses of the sandbox tag + * fixed filesystem loader freshness logic for high traffic websites + * fixed random function when charset is null + +* 1.6.5 (2012-04-11) + + * fixed a regression when a template only extends another one without defining any blocks + +* 1.6.4 (2012-04-02) + + * fixed PHP notice in Twig_Error::guessTemplateLine() introduced in 1.6.3 + * fixed performance when compiling large files + * optimized parent template creation when the template does not use dynamic inheritance + +* 1.6.3 (2012-03-22) + + * fixed usage of Z_ADDREF_P for PHP 5.2 in the C extension + * fixed compilation of numeric values used in templates when using a locale where the decimal separator is not a dot + * made the strategy used to guess the real template file name and line number in exception messages much faster and more accurate + +* 1.6.2 (2012-03-18) + + * fixed sandbox mode when used with inheritance + * added preserveKeys support for the slice filter + * fixed the date filter when a DateTime instance is passed with a specific timezone + * added a trim filter + +* 1.6.1 (2012-02-29) + + * fixed Twig C extension + * removed the creation of Twig_Markup instances when not needed + * added a way to set the default global timezone for dates + * fixed the slice filter on strings when the length is not specified + * fixed the creation of the cache directory in case of a race condition + +* 1.6.0 (2012-02-04) + + * fixed raw blocks when used with the whitespace trim option + * made a speed optimization to macro calls when imported via the "from" tag + * fixed globals, parsers, visitors, filters, tests, and functions management in Twig_Environment when a new one or new extension is added + * fixed the attribute function when passing arguments + * added slice notation support for the [] operator (syntactic sugar for the slice operator) + * added a slice filter + * added string support for the reverse filter + * fixed the empty test and the length filter for Twig_Markup instances + * added a date function to ease date comparison + * fixed unary operators precedence + * added recursive parsing support in the parser + * added string and integer handling for the random function + +* 1.5.1 (2012-01-05) + + * fixed a regression when parsing strings + +* 1.5.0 (2012-01-04) + + * added Traversable objects support for the join filter + +* 1.5.0-RC2 (2011-12-30) + + * added a way to set the default global date interval format + * fixed the date filter for DateInterval instances (setTimezone() does not exist for them) + * refactored Twig_Template::display() to ease its extension + * added a number_format filter + +* 1.5.0-RC1 (2011-12-26) + + * removed the need to quote hash keys + * allowed hash keys to be any expression + * added a do tag + * added a flush tag + * added support for dynamically named filters and functions + * added a dump function to help debugging templates + * added a nl2br filter + * added a random function + * added a way to change the default format for the date filter + * fixed the lexer when an operator ending with a letter ends a line + * added string interpolation support + * enhanced exceptions for unknown filters, functions, tests, and tags + +* 1.4.0 (2011-12-07) + + * fixed lexer when using big numbers (> PHP_INT_MAX) + * added missing preserveKeys argument to the reverse filter + * fixed macros containing filter tag calls + +* 1.4.0-RC2 (2011-11-27) + + * removed usage of Reflection in Twig_Template::getAttribute() + * added a C extension that can optionally replace Twig_Template::getAttribute() + * added negative timestamp support to the date filter + +* 1.4.0-RC1 (2011-11-20) + + * optimized variable access when using PHP 5.4 + * changed the precedence of the .. operator to be more consistent with languages that implements such a feature like Ruby + * added an Exception to Twig_Loader_Array::isFresh() method when the template does not exist to be consistent with other loaders + * added Twig_Function_Node to allow more complex functions to have their own Node class + * added Twig_Filter_Node to allow more complex filters to have their own Node class + * added Twig_Test_Node to allow more complex tests to have their own Node class + * added a better error message when a template is empty but contain a BOM + * fixed "in" operator for empty strings + * fixed the "defined" test and the "default" filter (now works with more than one call (foo.bar.foo) and for both values of the strict_variables option) + * changed the way extensions are loaded (addFilter/addFunction/addGlobal/addTest/addNodeVisitor/addTokenParser/addExtension can now be called in any order) + * added Twig_Environment::display() + * made the escape filter smarter when the encoding is not supported by PHP + * added a convert_encoding filter + * moved all node manipulations outside the compile() Node method + * made several speed optimizations + +* 1.3.0 (2011-10-08) + +no changes + +* 1.3.0-RC1 (2011-10-04) + + * added an optimization for the parent() function + * added cache reloading when auto_reload is true and an extension has been modified + * added the possibility to force the escaping of a string already marked as safe (instance of Twig_Markup) + * allowed empty templates to be used as traits + * added traits support for the "parent" function + +* 1.2.0 (2011-09-13) + +no changes + +* 1.2.0-RC1 (2011-09-10) + + * enhanced the exception when a tag remains unclosed + * added support for empty Countable objects for the "empty" test + * fixed algorithm that determines if a template using inheritance is valid (no output between block definitions) + * added better support for encoding problems when escaping a string (available as of PHP 5.4) + * added a way to ignore a missing template when using the "include" tag ({% include "foo" ignore missing %}) + * added support for an array of templates to the "include" and "extends" tags ({% include ['foo', 'bar'] %}) + * added support for bitwise operators in expressions + * added the "attribute" function to allow getting dynamic attributes on variables + * added Twig_Loader_Chain + * added Twig_Loader_Array::setTemplate() + * added an optimization for the set tag when used to capture a large chunk of static text + * changed name regex to match PHP one "[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*" (works for blocks, tags, functions, filters, and macros) + * removed the possibility to use the "extends" tag from a block + * added "if" modifier support to "for" loops + +* 1.1.2 (2011-07-30) + + * fixed json_encode filter on PHP 5.2 + * fixed regression introduced in 1.1.1 ({{ block(foo|lower) }}) + * fixed inheritance when using conditional parents + * fixed compilation of templates when the body of a child template is not empty + * fixed output when a macro throws an exception + * fixed a parsing problem when a large chunk of text is enclosed in a comment tag + * added PHPDoc for all Token parsers and Core extension functions + +* 1.1.1 (2011-07-17) + + * added a performance optimization in the Optimizer (also helps to lower the number of nested level calls) + * made some performance improvement for some edge cases + +* 1.1.0 (2011-06-28) + + * fixed json_encode filter + +* 1.1.0-RC3 (2011-06-24) + + * fixed method case-sensitivity when using the sandbox mode + * added timezone support for the date filter + * fixed possible security problems with NUL bytes + +* 1.1.0-RC2 (2011-06-16) + + * added an exception when the template passed to "use" is not a string + * made 'a.b is defined' not throw an exception if a is not defined (in strict mode) + * added {% line \d+ %} directive + +* 1.1.0-RC1 (2011-05-28) + +Flush your cache after upgrading. + + * fixed date filter when using a timestamp + * fixed the defined test for some cases + * fixed a parsing problem when a large chunk of text is enclosed in a raw tag + * added support for horizontal reuse of template blocks (see docs for more information) + * added whitespace control modifier to all tags (see docs for more information) + * added null as an alias for none (the null test is also an alias for the none test now) + * made TRUE, FALSE, NONE equivalent to their lowercase counterparts + * wrapped all compilation and runtime exceptions with Twig_Error_Runtime and added logic to guess the template name and line + * moved display() method to Twig_Template (generated templates should now use doDisplay() instead) + +* 1.0.0 (2011-03-27) + + * fixed output when using mbstring + * fixed duplicate call of methods when using the sandbox + * made the charset configurable for the escape filter + +* 1.0.0-RC2 (2011-02-21) + + * changed the way {% set %} works when capturing (the content is now marked as safe) + * added support for macro name in the endmacro tag + * make Twig_Error compatible with PHP 5.3.0 > + * fixed an infinite loop on some Windows configurations + * fixed the "length" filter for numbers + * fixed Template::getAttribute() as properties in PHP are case sensitive + * removed coupling between Twig_Node and Twig_Template + * fixed the ternary operator precedence rule + +* 1.0.0-RC1 (2011-01-09) + +Backward incompatibilities: + + * the "items" filter, which has been deprecated for quite a long time now, has been removed + * the "range" filter has been converted to a function: 0|range(10) -> range(0, 10) + * the "constant" filter has been converted to a function: {{ some_date|date('DATE_W3C'|constant) }} -> {{ some_date|date(constant('DATE_W3C')) }} + * the "cycle" filter has been converted to a function: {{ ['odd', 'even']|cycle(i) }} -> {{ cycle(['odd', 'even'], i) }} + * the "for" tag does not support "joined by" anymore + * the "autoescape" first argument is now "true"/"false" (instead of "on"/"off") + * the "parent" tag has been replaced by a "parent" function ({{ parent() }} instead of {% parent %}) + * the "display" tag has been replaced by a "block" function ({{ block('title') }} instead of {% display title %}) + * removed the grammar and simple token parser (moved to the Twig Extensions repository) + +Changes: + + * added "needs_context" option for filters and functions (the context is then passed as a first argument) + * added global variables support + * made macros return their value instead of echoing directly (fixes calling a macro in sandbox mode) + * added the "from" tag to import macros as functions + * added support for functions (a function is just syntactic sugar for a getAttribute() call) + * made macros callable when sandbox mode is enabled + * added an exception when a macro uses a reserved name + * the "default" filter now uses the "empty" test instead of just checking for null + * added the "empty" test + +* 0.9.10 (2010-12-16) + +Backward incompatibilities: + + * The Escaper extension is enabled by default, which means that all displayed + variables are now automatically escaped. You can revert to the previous + behavior by removing the extension via $env->removeExtension('escaper') + or just set the 'autoescape' option to 'false'. + * removed the "without loop" attribute for the "for" tag (not needed anymore + as the Optimizer take care of that for most cases) + * arrays and hashes have now a different syntax + * arrays keep the same syntax with square brackets: [1, 2] + * hashes now use curly braces (["a": "b"] should now be written as {"a": "b"}) + * support for "arrays with keys" and "hashes without keys" is not supported anymore ([1, "foo": "bar"] or {"foo": "bar", 1}) + * the i18n extension is now part of the Twig Extensions repository + +Changes: + + * added the merge filter + * removed 'is_escaper' option for filters (a left over from the previous version) -- you must use 'is_safe' now instead + * fixed usage of operators as method names (like is, in, and not) + * changed the order of execution for node visitors + * fixed default() filter behavior when used with strict_variables set to on + * fixed filesystem loader compatibility with PHAR files + * enhanced error messages when an unexpected token is parsed in an expression + * fixed filename not being added to syntax error messages + * added the autoescape option to enable/disable autoescaping + * removed the newline after a comment (mimics PHP behavior) + * added a syntax error exception when parent block is used on a template that does not extend another one + * made the Escaper extension enabled by default + * fixed sandbox extension when used with auto output escaping + * fixed escaper when wrapping a Twig_Node_Print (the original class must be preserved) + * added an Optimizer extension (enabled by default; optimizes "for" loops and "raw" filters) + * added priority to node visitors + +* 0.9.9 (2010-11-28) + +Backward incompatibilities: + * the self special variable has been renamed to _self + * the odd and even filters are now tests: + {{ foo|odd }} must now be written {{ foo is odd }} + * the "safe" filter has been renamed to "raw" + * in Node classes, + sub-nodes are now accessed via getNode() (instead of property access) + attributes via getAttribute() (instead of array access) + * the urlencode filter had been renamed to url_encode + * the include tag now merges the passed variables with the current context by default + (the old behavior is still possible by adding the "only" keyword) + * moved Exceptions to Twig_Error_* (Twig_SyntaxError/Twig_RuntimeError are now Twig_Error_Syntax/Twig_Error_Runtime) + * removed support for {{ 1 < i < 3 }} (use {{ i > 1 and i < 3 }} instead) + * the "in" filter has been removed ({{ a|in(b) }} should now be written {{ a in b }}) + +Changes: + * added file and line to Twig_Error_Runtime exceptions thrown from Twig_Template + * changed trans tag to accept any variable for the plural count + * fixed sandbox mode (__toString() method check was not enforced if called implicitly from complex statements) + * added the ** (power) operator + * changed the algorithm used for parsing expressions + * added the spaceless tag + * removed trim_blocks option + * added support for is*() methods for attributes (foo.bar now looks for foo->getBar() or foo->isBar()) + * changed all exceptions to extend Twig_Error + * fixed unary expressions ({{ not(1 or 0) }}) + * fixed child templates (with an extend tag) that uses one or more imports + * added support for {{ 1 not in [2, 3] }} (more readable than the current {{ not (1 in [2, 3]) }}) + * escaping has been rewritten + * the implementation of template inheritance has been rewritten + (blocks can now be called individually and still work with inheritance) + * fixed error handling for if tag when a syntax error occurs within a subparse process + * added a way to implement custom logic for resolving token parsers given a tag name + * fixed js escaper to be stricter (now uses a whilelist-based js escaper) + * added the following filers: "constant", "trans", "replace", "json_encode" + * added a "constant" test + * fixed objects with __toString() not being autoescaped + * fixed subscript expressions when calling __call() (methods now keep the case) + * added "test" feature (accessible via the "is" operator) + * removed the debug tag (should be done in an extension) + * fixed trans tag when no vars are used in plural form + * fixed race condition when writing template cache + * added the special _charset variable to reference the current charset + * added the special _context variable to reference the current context + * renamed self to _self (to avoid conflict) + * fixed Twig_Template::getAttribute() for protected properties + +* 0.9.8 (2010-06-28) + +Backward incompatibilities: + * the trans tag plural count is now attached to the plural tag: + old: `{% trans count %}...{% plural %}...{% endtrans %}` + new: `{% trans %}...{% plural count %}...{% endtrans %}` + + * added a way to translate strings coming from a variable ({% trans var %}) + * fixed trans tag when used with the Escaper extension + * fixed default cache umask + * removed Twig_Template instances from the debug tag output + * fixed objects with __isset() defined + * fixed set tag when used with a capture + * fixed type hinting for Twig_Environment::addFilter() method + +* 0.9.7 (2010-06-12) + +Backward incompatibilities: + * changed 'as' to '=' for the set tag ({% set title as "Title" %} must now be {% set title = "Title" %}) + * removed the sandboxed attribute of the include tag (use the new sandbox tag instead) + * refactored the Node system (if you have custom nodes, you will have to update them to use the new API) + + * added self as a special variable that refers to the current template (useful for importing macros from the current template) + * added Twig_Template instance support to the include tag + * added support for dynamic and conditional inheritance ({% extends some_var %} and {% extends standalone ? "minimum" : "base" %}) + * added a grammar sub-framework to ease the creation of custom tags + * fixed the for tag for large arrays (some loop variables are now only available for arrays and objects that implement the Countable interface) + * removed the Twig_Resource::resolveMissingFilter() method + * fixed the filter tag which did not apply filtering to included files + * added a bunch of unit tests + * added a bunch of phpdoc + * added a sandbox tag in the sandbox extension + * changed the date filter to support any date format supported by DateTime + * added strict_variable setting to throw an exception when an invalid variable is used in a template (disabled by default) + * added the lexer, parser, and compiler as arguments to the Twig_Environment constructor + * changed the cache option to only accepts an explicit path to a cache directory or false + * added a way to add token parsers, filters, and visitors without creating an extension + * added three interfaces: Twig_NodeInterface, Twig_TokenParserInterface, and Twig_FilterInterface + * changed the generated code to match the new coding standards + * fixed sandbox mode (__toString() method check was not enforced if called implicitly from a simple statement like {{ article }}) + * added an exception when a child template has a non-empty body (as it is always ignored when rendering) + +* 0.9.6 (2010-05-12) + + * fixed variables defined outside a loop and for which the value changes in a for loop + * fixed the test suite for PHP 5.2 and older versions of PHPUnit + * added support for __call() in expression resolution + * fixed node visiting for macros (macros are now visited by visitors as any other node) + * fixed nested block definitions with a parent call (rarely useful but nonetheless supported now) + * added the cycle filter + * fixed the Lexer when mbstring.func_overload is used with an mbstring.internal_encoding different from ASCII + * added a long-syntax for the set tag ({% set foo %}...{% endset %}) + * unit tests are now powered by PHPUnit + * added support for gettext via the `i18n` extension + * fixed twig_capitalize_string_filter() and fixed twig_length_filter() when used with UTF-8 values + * added a more useful exception if an if tag is not closed properly + * added support for escaping strategy in the autoescape tag + * fixed lexer when a template has a big chunk of text between/in a block + +* 0.9.5 (2010-01-20) + +As for any new release, don't forget to remove all cached templates after +upgrading. + +If you have defined custom filters, you MUST upgrade them for this release. To +upgrade, replace "array" with "new Twig_Filter_Function", and replace the +environment constant by the "needs_environment" option: + + // before + 'even' => array('twig_is_even_filter', false), + 'escape' => array('twig_escape_filter', true), + + // after + 'even' => new Twig_Filter_Function('twig_is_even_filter'), + 'escape' => new Twig_Filter_Function('twig_escape_filter', array('needs_environment' => true)), + +If you have created NodeTransformer classes, you will need to upgrade them to +the new interface (please note that the interface is not yet considered +stable). + + * fixed list nodes that did not extend the Twig_NodeListInterface + * added the "without loop" option to the for tag (it disables the generation of the loop variable) + * refactored node transformers to node visitors + * fixed automatic-escaping for blocks + * added a way to specify variables to pass to an included template + * changed the automatic-escaping rules to be more sensible and more configurable in custom filters (the documentation lists all the rules) + * improved the filter system to allow object methods to be used as filters + * changed the Array and String loaders to actually make use of the cache mechanism + * included the default filter function definitions in the extension class files directly (Core, Escaper) + * added the // operator (like the floor() PHP function) + * added the .. operator (as a syntactic sugar for the range filter when the step is 1) + * added the in operator (as a syntactic sugar for the in filter) + * added the following filters in the Core extension: in, range + * added support for arrays (same behavior as in PHP, a mix between lists and dictionaries, arrays and hashes) + * enhanced some error messages to provide better feedback in case of parsing errors + +* 0.9.4 (2009-12-02) + +If you have custom loaders, you MUST upgrade them for this release: The +Twig_Loader base class has been removed, and the Twig_LoaderInterface has also +been changed (see the source code for more information or the documentation). + + * added support for DateTime instances for the date filter + * fixed loop.last when the array only has one item + * made it possible to insert newlines in tag and variable blocks + * fixed a bug when a literal '\n' were present in a template text + * fixed bug when the filename of a template contains */ + * refactored loaders + +* 0.9.3 (2009-11-11) + +This release is NOT backward compatible with the previous releases. + + The loaders do not take the cache and autoReload arguments anymore. Instead, + the Twig_Environment class has two new options: cache and auto_reload. + Upgrading your code means changing this kind of code: + + $loader = new Twig_Loader_Filesystem('/path/to/templates', '/path/to/compilation_cache', true); + $twig = new Twig_Environment($loader); + + to something like this: + + $loader = new Twig_Loader_Filesystem('/path/to/templates'); + $twig = new Twig_Environment($loader, array( + 'cache' => '/path/to/compilation_cache', + 'auto_reload' => true, + )); + + * deprecated the "items" filter as it is not needed anymore + * made cache and auto_reload options of Twig_Environment instead of arguments of Twig_Loader + * optimized template loading speed + * removed output when an error occurs in a template and render() is used + * made major speed improvements for loops (up to 300% on even the smallest loops) + * added properties as part of the sandbox mode + * added public properties support (obj.item can now be the item property on the obj object) + * extended set tag to support expression as value ({% set foo as 'foo' ~ 'bar' %} ) + * fixed bug when \ was used in HTML + +* 0.9.2 (2009-10-29) + + * made some speed optimizations + * changed the cache extension to .php + * added a js escaping strategy + * added support for short block tag + * changed the filter tag to allow chained filters + * made lexer more flexible as you can now change the default delimiters + * added set tag + * changed default directory permission when cache dir does not exist (more secure) + * added macro support + * changed filters first optional argument to be a Twig_Environment instance instead of a Twig_Template instance + * made Twig_Autoloader::autoload() a static method + * avoid writing template file if an error occurs + * added $ escaping when outputting raw strings + * enhanced some error messages to ease debugging + * fixed empty cache files when the template contains an error + +* 0.9.1 (2009-10-14) + + * fixed a bug in PHP 5.2.6 + * fixed numbers with one than one decimal + * added support for method calls with arguments ({{ foo.bar('a', 43) }}) + * made small speed optimizations + * made minor tweaks to allow better extensibility and flexibility + +* 0.9.0 (2009-10-12) + + * Initial release diff --git a/plugins/twig/vendor/twig/twig/LICENSE b/plugins/twig/vendor/twig/twig/LICENSE new file mode 100644 index 00000000..cc74f810 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/LICENSE @@ -0,0 +1,31 @@ +Copyright (c) 2009-2016 by the Twig Team. + +Some rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * The names of the contributors may not be used to endorse or + promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/plugins/twig/vendor/twig/twig/README.rst b/plugins/twig/vendor/twig/twig/README.rst new file mode 100644 index 00000000..81737b0b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/README.rst @@ -0,0 +1,15 @@ +Twig, the flexible, fast, and secure template language for PHP +============================================================== + +Twig is a template language for PHP, released under the new BSD license (code +and documentation). + +Twig uses a syntax similar to the Django and Jinja template languages which +inspired the Twig runtime environment. + +More Information +---------------- + +Read the `documentation`_ for more information. + +.. _documentation: http://twig.sensiolabs.org/documentation diff --git a/plugins/twig/vendor/twig/twig/composer.json b/plugins/twig/vendor/twig/twig/composer.json new file mode 100644 index 00000000..507d8aec --- /dev/null +++ b/plugins/twig/vendor/twig/twig/composer.json @@ -0,0 +1,46 @@ +{ + "name": "twig/twig", + "type": "library", + "description": "Twig, the flexible, fast, and secure template language for PHP", + "keywords": ["templating"], + "homepage": "http://twig.sensiolabs.org", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "support": { + "forum": "https://groups.google.com/forum/#!forum/twig-users" + }, + "require": { + "php": ">=5.2.7" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7", + "symfony/debug": "~2.7" + }, + "autoload": { + "psr-0" : { + "Twig_" : "lib/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.24-dev" + } + } +} diff --git a/plugins/twig/vendor/twig/twig/doc/advanced.rst b/plugins/twig/vendor/twig/twig/doc/advanced.rst new file mode 100644 index 00000000..5b436ff2 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/advanced.rst @@ -0,0 +1,872 @@ +Extending Twig +============== + +.. caution:: + + This section describes how to extend Twig as of **Twig 1.12**. If you are + using an older version, read the :doc:`legacy` chapter + instead. + +Twig can be extended in many ways; you can add extra tags, filters, tests, +operators, global variables, and functions. You can even extend the parser +itself with node visitors. + +.. note:: + + The first section of this chapter describes how to extend Twig easily. If + you want to reuse your changes in different projects or if you want to + share them with others, you should then create an extension as described + in the following section. + +.. caution:: + + When extending Twig without creating an extension, Twig won't be able to + recompile your templates when the PHP code is updated. To see your changes + in real-time, either disable template caching or package your code into an + extension (see the next section of this chapter). + +Before extending Twig, you must understand the differences between all the +different possible extension points and when to use them. + +First, remember that Twig has two main language constructs: + +* ``{{ }}``: used to print the result of an expression evaluation; + +* ``{% %}``: used to execute statements. + +To understand why Twig exposes so many extension points, let's see how to +implement a *Lorem ipsum* generator (it needs to know the number of words to +generate). + +You can use a ``lipsum`` *tag*: + +.. code-block:: jinja + + {% lipsum 40 %} + +That works, but using a tag for ``lipsum`` is not a good idea for at least +three main reasons: + +* ``lipsum`` is not a language construct; +* The tag outputs something; +* The tag is not flexible as you cannot use it in an expression: + + .. code-block:: jinja + + {{ 'some text' ~ {% lipsum 40 %} ~ 'some more text' }} + +In fact, you rarely need to create tags; and that's good news because tags are +the most complex extension point of Twig. + +Now, let's use a ``lipsum`` *filter*: + +.. code-block:: jinja + + {{ 40|lipsum }} + +Again, it works, but it looks weird. A filter transforms the passed value to +something else but here we use the value to indicate the number of words to +generate (so, ``40`` is an argument of the filter, not the value we want to +transform). + +Next, let's use a ``lipsum`` *function*: + +.. code-block:: jinja + + {{ lipsum(40) }} + +Here we go. For this specific example, the creation of a function is the +extension point to use. And you can use it anywhere an expression is accepted: + +.. code-block:: jinja + + {{ 'some text' ~ lipsum(40) ~ 'some more text' }} + + {% set lipsum = lipsum(40) %} + +Last but not the least, you can also use a *global* object with a method able +to generate lorem ipsum text: + +.. code-block:: jinja + + {{ text.lipsum(40) }} + +As a rule of thumb, use functions for frequently used features and global +objects for everything else. + +Keep in mind the following when you want to extend Twig: + +========== ========================== ========== ========================= +What? Implementation difficulty? How often? When? +========== ========================== ========== ========================= +*macro* trivial frequent Content generation +*global* trivial frequent Helper object +*function* trivial frequent Content generation +*filter* trivial frequent Value transformation +*tag* complex rare DSL language construct +*test* trivial rare Boolean decision +*operator* trivial rare Values transformation +========== ========================== ========== ========================= + +Globals +------- + +A global variable is like any other template variable, except that it's +available in all templates and macros:: + + $twig = new Twig_Environment($loader); + $twig->addGlobal('text', new Text()); + +You can then use the ``text`` variable anywhere in a template: + +.. code-block:: jinja + + {{ text.lipsum(40) }} + +Filters +------- + +Creating a filter is as simple as associating a name with a PHP callable:: + + // an anonymous function + $filter = new Twig_SimpleFilter('rot13', function ($string) { + return str_rot13($string); + }); + + // or a simple PHP function + $filter = new Twig_SimpleFilter('rot13', 'str_rot13'); + + // or a class method + $filter = new Twig_SimpleFilter('rot13', array('SomeClass', 'rot13Filter')); + +The first argument passed to the ``Twig_SimpleFilter`` constructor is the name +of the filter you will use in templates and the second one is the PHP callable +to associate with it. + +Then, add the filter to your Twig environment:: + + $twig = new Twig_Environment($loader); + $twig->addFilter($filter); + +And here is how to use it in a template: + +.. code-block:: jinja + + {{ 'Twig'|rot13 }} + + {# will output Gjvt #} + +When called by Twig, the PHP callable receives the left side of the filter +(before the pipe ``|``) as the first argument and the extra arguments passed +to the filter (within parentheses ``()``) as extra arguments. + +For instance, the following code: + +.. code-block:: jinja + + {{ 'TWIG'|lower }} + {{ now|date('d/m/Y') }} + +is compiled to something like the following:: + + + + +The ``Twig_SimpleFilter`` class takes an array of options as its last +argument:: + + $filter = new Twig_SimpleFilter('rot13', 'str_rot13', $options); + +Environment-aware Filters +~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you want to access the current environment instance in your filter, set the +``needs_environment`` option to ``true``; Twig will pass the current +environment as the first argument to the filter call:: + + $filter = new Twig_SimpleFilter('rot13', function (Twig_Environment $env, $string) { + // get the current charset for instance + $charset = $env->getCharset(); + + return str_rot13($string); + }, array('needs_environment' => true)); + +Context-aware Filters +~~~~~~~~~~~~~~~~~~~~~ + +If you want to access the current context in your filter, set the +``needs_context`` option to ``true``; Twig will pass the current context as +the first argument to the filter call (or the second one if +``needs_environment`` is also set to ``true``):: + + $filter = new Twig_SimpleFilter('rot13', function ($context, $string) { + // ... + }, array('needs_context' => true)); + + $filter = new Twig_SimpleFilter('rot13', function (Twig_Environment $env, $context, $string) { + // ... + }, array('needs_context' => true, 'needs_environment' => true)); + +Automatic Escaping +~~~~~~~~~~~~~~~~~~ + +If automatic escaping is enabled, the output of the filter may be escaped +before printing. If your filter acts as an escaper (or explicitly outputs HTML +or JavaScript code), you will want the raw output to be printed. In such a +case, set the ``is_safe`` option:: + + $filter = new Twig_SimpleFilter('nl2br', 'nl2br', array('is_safe' => array('html'))); + +Some filters may need to work on input that is already escaped or safe, for +example when adding (safe) HTML tags to originally unsafe output. In such a +case, set the ``pre_escape`` option to escape the input data before it is run +through your filter:: + + $filter = new Twig_SimpleFilter('somefilter', 'somefilter', array('pre_escape' => 'html', 'is_safe' => array('html'))); + +Variadic Filters +~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.19 + Support for variadic filters was added in Twig 1.19. + +When a filter should accept an arbitrary number of arguments, set the +``is_variadic`` option to ``true``; Twig will pass the extra arguments as the +last argument to the filter call as an array:: + + $filter = new Twig_SimpleFilter('thumbnail', function ($file, array $options = array()) { + // ... + }, array('is_variadic' => true)); + +Be warned that named arguments passed to a variadic filter cannot be checked +for validity as they will automatically end up in the option array. + +Dynamic Filters +~~~~~~~~~~~~~~~ + +A filter name containing the special ``*`` character is a dynamic filter as +the ``*`` can be any string:: + + $filter = new Twig_SimpleFilter('*_path', function ($name, $arguments) { + // ... + }); + +The following filters will be matched by the above defined dynamic filter: + +* ``product_path`` +* ``category_path`` + +A dynamic filter can define more than one dynamic parts:: + + $filter = new Twig_SimpleFilter('*_path_*', function ($name, $suffix, $arguments) { + // ... + }); + +The filter will receive all dynamic part values before the normal filter +arguments, but after the environment and the context. For instance, a call to +``'foo'|a_path_b()`` will result in the following arguments to be passed to +the filter: ``('a', 'b', 'foo')``. + +Deprecated Filters +~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.21 + Support for deprecated filters was added in Twig 1.21. + +You can mark a filter as being deprecated by setting the ``deprecated`` option +to ``true``. You can also give an alternative filter that replaces the +deprecated one when that makes sense:: + + $filter = new Twig_SimpleFilter('obsolete', function () { + // ... + }, array('deprecated' => true, 'alternative' => 'new_one')); + +When a filter is deprecated, Twig emits a deprecation notice when compiling a +template using it. See :ref:`deprecation-notices` for more information. + +Functions +--------- + +Functions are defined in the exact same way as filters, but you need to create +an instance of ``Twig_SimpleFunction``:: + + $twig = new Twig_Environment($loader); + $function = new Twig_SimpleFunction('function_name', function () { + // ... + }); + $twig->addFunction($function); + +Functions support the same features as filters, except for the ``pre_escape`` +and ``preserves_safety`` options. + +Tests +----- + +Tests are defined in the exact same way as filters and functions, but you need +to create an instance of ``Twig_SimpleTest``:: + + $twig = new Twig_Environment($loader); + $test = new Twig_SimpleTest('test_name', function () { + // ... + }); + $twig->addTest($test); + +Tests allow you to create custom application specific logic for evaluating +boolean conditions. As a simple example, let's create a Twig test that checks if +objects are 'red':: + + $twig = new Twig_Environment($loader); + $test = new Twig_SimpleTest('red', function ($value) { + if (isset($value->color) && $value->color == 'red') { + return true; + } + if (isset($value->paint) && $value->paint == 'red') { + return true; + } + return false; + }); + $twig->addTest($test); + +Test functions should always return true/false. + +When creating tests you can use the ``node_class`` option to provide custom test +compilation. This is useful if your test can be compiled into PHP primitives. +This is used by many of the tests built into Twig:: + + $twig = new Twig_Environment($loader); + $test = new Twig_SimpleTest( + 'odd', + null, + array('node_class' => 'Twig_Node_Expression_Test_Odd')); + $twig->addTest($test); + + class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test + { + public function compile(Twig_Compiler $compiler) + { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' % 2 == 1') + ->raw(')') + ; + } + } + +The above example shows how you can create tests that use a node class. The +node class has access to one sub-node called 'node'. This sub-node contains the +value that is being tested. When the ``odd`` filter is used in code such as: + +.. code-block:: jinja + + {% if my_value is odd %} + +The ``node`` sub-node will contain an expression of ``my_value``. Node-based +tests also have access to the ``arguments`` node. This node will contain the +various other arguments that have been provided to your test. + +If you want to pass a variable number of positional or named arguments to the +test, set the ``is_variadic`` option to ``true``. Tests also support dynamic +name feature as filters and functions. + +Tags +---- + +One of the most exciting features of a template engine like Twig is the +possibility to define new language constructs. This is also the most complex +feature as you need to understand how Twig's internals work. + +Let's create a simple ``set`` tag that allows the definition of simple +variables from within a template. The tag can be used like follows: + +.. code-block:: jinja + + {% set name = "value" %} + + {{ name }} + + {# should output value #} + +.. note:: + + The ``set`` tag is part of the Core extension and as such is always + available. The built-in version is slightly more powerful and supports + multiple assignments by default (cf. the template designers chapter for + more information). + +Three steps are needed to define a new tag: + +* Defining a Token Parser class (responsible for parsing the template code); + +* Defining a Node class (responsible for converting the parsed code to PHP); + +* Registering the tag. + +Registering a new tag +~~~~~~~~~~~~~~~~~~~~~ + +Adding a tag is as simple as calling the ``addTokenParser`` method on the +``Twig_Environment`` instance:: + + $twig = new Twig_Environment($loader); + $twig->addTokenParser(new Project_Set_TokenParser()); + +Defining a Token Parser +~~~~~~~~~~~~~~~~~~~~~~~ + +Now, let's see the actual code of this class:: + + class Project_Set_TokenParser extends Twig_TokenParser + { + public function parse(Twig_Token $token) + { + $parser = $this->parser; + $stream = $parser->getStream(); + + $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); + $stream->expect(Twig_Token::OPERATOR_TYPE, '='); + $value = $parser->getExpressionParser()->parseExpression(); + $stream->expect(Twig_Token::BLOCK_END_TYPE); + + return new Project_Set_Node($name, $value, $token->getLine(), $this->getTag()); + } + + public function getTag() + { + return 'set'; + } + } + +The ``getTag()`` method must return the tag we want to parse, here ``set``. + +The ``parse()`` method is invoked whenever the parser encounters a ``set`` +tag. It should return a ``Twig_Node`` instance that represents the node (the +``Project_Set_Node`` calls creating is explained in the next section). + +The parsing process is simplified thanks to a bunch of methods you can call +from the token stream (``$this->parser->getStream()``): + +* ``getCurrent()``: Gets the current token in the stream. + +* ``next()``: Moves to the next token in the stream, *but returns the old one*. + +* ``test($type)``, ``test($value)`` or ``test($type, $value)``: Determines whether + the current token is of a particular type or value (or both). The value may be an + array of several possible values. + +* ``expect($type[, $value[, $message]])``: If the current token isn't of the given + type/value a syntax error is thrown. Otherwise, if the type and value are correct, + the token is returned and the stream moves to the next token. + +* ``look()``: Looks a the next token without consuming it. + +Parsing expressions is done by calling the ``parseExpression()`` like we did for +the ``set`` tag. + +.. tip:: + + Reading the existing ``TokenParser`` classes is the best way to learn all + the nitty-gritty details of the parsing process. + +Defining a Node +~~~~~~~~~~~~~~~ + +The ``Project_Set_Node`` class itself is rather simple:: + + class Project_Set_Node extends Twig_Node + { + public function __construct($name, Twig_Node_Expression $value, $line, $tag = null) + { + parent::__construct(array('value' => $value), array('name' => $name), $line, $tag); + } + + public function compile(Twig_Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write('$context[\''.$this->getAttribute('name').'\'] = ') + ->subcompile($this->getNode('value')) + ->raw(";\n") + ; + } + } + +The compiler implements a fluid interface and provides methods that helps the +developer generate beautiful and readable PHP code: + +* ``subcompile()``: Compiles a node. + +* ``raw()``: Writes the given string as is. + +* ``write()``: Writes the given string by adding indentation at the beginning + of each line. + +* ``string()``: Writes a quoted string. + +* ``repr()``: Writes a PHP representation of a given value (see + ``Twig_Node_For`` for a usage example). + +* ``addDebugInfo()``: Adds the line of the original template file related to + the current node as a comment. + +* ``indent()``: Indents the generated code (see ``Twig_Node_Block`` for a + usage example). + +* ``outdent()``: Outdents the generated code (see ``Twig_Node_Block`` for a + usage example). + +.. _creating_extensions: + +Creating an Extension +--------------------- + +The main motivation for writing an extension is to move often used code into a +reusable class like adding support for internationalization. An extension can +define tags, filters, tests, operators, global variables, functions, and node +visitors. + +Creating an extension also makes for a better separation of code that is +executed at compilation time and code needed at runtime. As such, it makes +your code faster. + +Most of the time, it is useful to create a single extension for your project, +to host all the specific tags and filters you want to add to Twig. + +.. tip:: + + When packaging your code into an extension, Twig is smart enough to + recompile your templates whenever you make a change to it (when + ``auto_reload`` is enabled). + +.. note:: + + Before writing your own extensions, have a look at the Twig official + extension repository: http://github.com/twigphp/Twig-extensions. + +An extension is a class that implements the following interface:: + + interface Twig_ExtensionInterface + { + /** + * Initializes the runtime environment. + * + * This is where you can load some file that contains filter functions for instance. + * + * @param Twig_Environment $environment The current Twig_Environment instance + * + * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead + */ + function initRuntime(Twig_Environment $environment); + + /** + * Returns the token parser instances to add to the existing list. + * + * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances + */ + function getTokenParsers(); + + /** + * Returns the node visitor instances to add to the existing list. + * + * @return array An array of Twig_NodeVisitorInterface instances + */ + function getNodeVisitors(); + + /** + * Returns a list of filters to add to the existing list. + * + * @return array An array of filters + */ + function getFilters(); + + /** + * Returns a list of tests to add to the existing list. + * + * @return array An array of tests + */ + function getTests(); + + /** + * Returns a list of functions to add to the existing list. + * + * @return array An array of functions + */ + function getFunctions(); + + /** + * Returns a list of operators to add to the existing list. + * + * @return array An array of operators + */ + function getOperators(); + + /** + * Returns a list of global variables to add to the existing list. + * + * @return array An array of global variables + * + * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_GlobalsInterface instead + */ + function getGlobals(); + + /** + * Returns the name of the extension. + * + * @return string The extension name + */ + function getName(); + } + +To keep your extension class clean and lean, it can inherit from the built-in +``Twig_Extension`` class instead of implementing the whole interface. That +way, you just need to implement the ``getName()`` method as the +``Twig_Extension`` provides empty implementations for all other methods. + +The ``getName()`` method must return a unique identifier for your extension. + +Now, with this information in mind, let's create the most basic extension +possible:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getName() + { + return 'project'; + } + } + +.. note:: + + Of course, this extension does nothing for now. We will customize it in + the next sections. + +Twig does not care where you save your extension on the filesystem, as all +extensions must be registered explicitly to be available in your templates. + +You can register an extension by using the ``addExtension()`` method on your +main ``Environment`` object:: + + $twig = new Twig_Environment($loader); + $twig->addExtension(new Project_Twig_Extension()); + +.. tip:: + + The bundled extensions are great examples of how extensions work. + +Globals +~~~~~~~ + +Global variables can be registered in an extension via the ``getGlobals()`` +method:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getGlobals() + { + return array( + 'text' => new Text(), + ); + } + + // ... + } + +Functions +~~~~~~~~~ + +Functions can be registered in an extension via the ``getFunctions()`` +method:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getFunctions() + { + return array( + new Twig_SimpleFunction('lipsum', 'generate_lipsum'), + ); + } + + // ... + } + +Filters +~~~~~~~ + +To add a filter to an extension, you need to override the ``getFilters()`` +method. This method must return an array of filters to add to the Twig +environment:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getFilters() + { + return array( + new Twig_SimpleFilter('rot13', 'str_rot13'), + ); + } + + // ... + } + +Tags +~~~~ + +Adding a tag in an extension can be done by overriding the +``getTokenParsers()`` method. This method must return an array of tags to add +to the Twig environment:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getTokenParsers() + { + return array(new Project_Set_TokenParser()); + } + + // ... + } + +In the above code, we have added a single new tag, defined by the +``Project_Set_TokenParser`` class. The ``Project_Set_TokenParser`` class is +responsible for parsing the tag and compiling it to PHP. + +Operators +~~~~~~~~~ + +The ``getOperators()`` methods lets you add new operators. Here is how to add +``!``, ``||``, and ``&&`` operators:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getOperators() + { + return array( + array( + '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), + ), + array( + '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + ), + ); + } + + // ... + } + +Tests +~~~~~ + +The ``getTests()`` method lets you add new test functions:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getTests() + { + return array( + new Twig_SimpleTest('even', 'twig_test_even'), + ); + } + + // ... + } + +Overloading +----------- + +To overload an already defined filter, test, operator, global variable, or +function, re-define it in an extension and register it **as late as +possible** (order matters):: + + class MyCoreExtension extends Twig_Extension + { + public function getFilters() + { + return array( + new Twig_SimpleFilter('date', array($this, 'dateFilter')), + ); + } + + public function dateFilter($timestamp, $format = 'F j, Y H:i') + { + // do something different from the built-in date filter + } + + public function getName() + { + return 'project'; + } + } + + $twig = new Twig_Environment($loader); + $twig->addExtension(new MyCoreExtension()); + +Here, we have overloaded the built-in ``date`` filter with a custom one. + +If you do the same on the Twig_Environment itself, beware that it takes +precedence over any other registered extensions:: + + $twig = new Twig_Environment($loader); + $twig->addFilter(new Twig_SimpleFilter('date', function ($timestamp, $format = 'F j, Y H:i') { + // do something different from the built-in date filter + })); + // the date filter will come from the above registration, not + // from the registered extension below + $twig->addExtension(new MyCoreExtension()); + +.. caution:: + + Note that overloading the built-in Twig elements is not recommended as it + might be confusing. + +Testing an Extension +-------------------- + +Functional Tests +~~~~~~~~~~~~~~~~ + +You can create functional tests for extensions simply by creating the +following file structure in your test directory:: + + Fixtures/ + filters/ + foo.test + bar.test + functions/ + foo.test + bar.test + tags/ + foo.test + bar.test + IntegrationTest.php + +The ``IntegrationTest.php`` file should look like this:: + + class Project_Tests_IntegrationTest extends Twig_Test_IntegrationTestCase + { + public function getExtensions() + { + return array( + new Project_Twig_Extension1(), + new Project_Twig_Extension2(), + ); + } + + public function getFixturesDir() + { + return dirname(__FILE__).'/Fixtures/'; + } + } + +Fixtures examples can be found within the Twig repository +`tests/Twig/Fixtures`_ directory. + +Node Tests +~~~~~~~~~~ + +Testing the node visitors can be complex, so extend your test cases from +``Twig_Test_NodeTestCase``. Examples can be found in the Twig repository +`tests/Twig/Node`_ directory. + +.. _`rot13`: http://www.php.net/manual/en/function.str-rot13.php +.. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Fixtures +.. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Node diff --git a/plugins/twig/vendor/twig/twig/doc/advanced_legacy.rst b/plugins/twig/vendor/twig/twig/doc/advanced_legacy.rst new file mode 100644 index 00000000..2ef6bfde --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/advanced_legacy.rst @@ -0,0 +1,887 @@ +Extending Twig +============== + +.. caution:: + + This section describes how to extends Twig for versions **older than + 1.12**. If you are using a newer version, read the :doc:`newer` + chapter instead. + +Twig can be extended in many ways; you can add extra tags, filters, tests, +operators, global variables, and functions. You can even extend the parser +itself with node visitors. + +.. note:: + + The first section of this chapter describes how to extend Twig easily. If + you want to reuse your changes in different projects or if you want to + share them with others, you should then create an extension as described + in the following section. + +.. caution:: + + When extending Twig by calling methods on the Twig environment instance, + Twig won't be able to recompile your templates when the PHP code is + updated. To see your changes in real-time, either disable template caching + or package your code into an extension (see the next section of this + chapter). + +Before extending Twig, you must understand the differences between all the +different possible extension points and when to use them. + +First, remember that Twig has two main language constructs: + +* ``{{ }}``: used to print the result of an expression evaluation; + +* ``{% %}``: used to execute statements. + +To understand why Twig exposes so many extension points, let's see how to +implement a *Lorem ipsum* generator (it needs to know the number of words to +generate). + +You can use a ``lipsum`` *tag*: + +.. code-block:: jinja + + {% lipsum 40 %} + +That works, but using a tag for ``lipsum`` is not a good idea for at least +three main reasons: + +* ``lipsum`` is not a language construct; +* The tag outputs something; +* The tag is not flexible as you cannot use it in an expression: + + .. code-block:: jinja + + {{ 'some text' ~ {% lipsum 40 %} ~ 'some more text' }} + +In fact, you rarely need to create tags; and that's good news because tags are +the most complex extension point of Twig. + +Now, let's use a ``lipsum`` *filter*: + +.. code-block:: jinja + + {{ 40|lipsum }} + +Again, it works, but it looks weird. A filter transforms the passed value to +something else but here we use the value to indicate the number of words to +generate (so, ``40`` is an argument of the filter, not the value we want to +transform). + +Next, let's use a ``lipsum`` *function*: + +.. code-block:: jinja + + {{ lipsum(40) }} + +Here we go. For this specific example, the creation of a function is the +extension point to use. And you can use it anywhere an expression is accepted: + +.. code-block:: jinja + + {{ 'some text' ~ ipsum(40) ~ 'some more text' }} + + {% set ipsum = ipsum(40) %} + +Last but not the least, you can also use a *global* object with a method able +to generate lorem ipsum text: + +.. code-block:: jinja + + {{ text.lipsum(40) }} + +As a rule of thumb, use functions for frequently used features and global +objects for everything else. + +Keep in mind the following when you want to extend Twig: + +========== ========================== ========== ========================= +What? Implementation difficulty? How often? When? +========== ========================== ========== ========================= +*macro* trivial frequent Content generation +*global* trivial frequent Helper object +*function* trivial frequent Content generation +*filter* trivial frequent Value transformation +*tag* complex rare DSL language construct +*test* trivial rare Boolean decision +*operator* trivial rare Values transformation +========== ========================== ========== ========================= + +Globals +------- + +A global variable is like any other template variable, except that it's +available in all templates and macros:: + + $twig = new Twig_Environment($loader); + $twig->addGlobal('text', new Text()); + +You can then use the ``text`` variable anywhere in a template: + +.. code-block:: jinja + + {{ text.lipsum(40) }} + +Filters +------- + +A filter is a regular PHP function or an object method that takes the left +side of the filter (before the pipe ``|``) as first argument and the extra +arguments passed to the filter (within parentheses ``()``) as extra arguments. + +Defining a filter is as easy as associating the filter name with a PHP +callable. For instance, let's say you have the following code in a template: + +.. code-block:: jinja + + {{ 'TWIG'|lower }} + +When compiling this template to PHP, Twig looks for the PHP callable +associated with the ``lower`` filter. The ``lower`` filter is a built-in Twig +filter, and it is simply mapped to the PHP ``strtolower()`` function. After +compilation, the generated PHP code is roughly equivalent to: + +.. code-block:: html+php + + + +As you can see, the ``'TWIG'`` string is passed as a first argument to the PHP +function. + +A filter can also take extra arguments like in the following example: + +.. code-block:: jinja + + {{ now|date('d/m/Y') }} + +In this case, the extra arguments are passed to the function after the main +argument, and the compiled code is equivalent to: + +.. code-block:: html+php + + + +Let's see how to create a new filter. + +In this section, we will create a ``rot13`` filter, which should return the +`rot13`_ transformation of a string. Here is an example of its usage and the +expected output: + +.. code-block:: jinja + + {{ "Twig"|rot13 }} + + {# should displays Gjvt #} + +Adding a filter is as simple as calling the ``addFilter()`` method on the +``Twig_Environment`` instance:: + + $twig = new Twig_Environment($loader); + $twig->addFilter('rot13', new Twig_Filter_Function('str_rot13')); + +The second argument of ``addFilter()`` is an instance of ``Twig_Filter``. +Here, we use ``Twig_Filter_Function`` as the filter is a PHP function. The +first argument passed to the ``Twig_Filter_Function`` constructor is the name +of the PHP function to call, here ``str_rot13``, a native PHP function. + +Let's say I now want to be able to add a prefix before the converted string: + +.. code-block:: jinja + + {{ "Twig"|rot13('prefix_') }} + + {# should displays prefix_Gjvt #} + +As the PHP ``str_rot13()`` function does not support this requirement, let's +create a new PHP function:: + + function project_compute_rot13($string, $prefix = '') + { + return $prefix.str_rot13($string); + } + +As you can see, the ``prefix`` argument of the filter is passed as an extra +argument to the ``project_compute_rot13()`` function. + +Adding this filter is as easy as before:: + + $twig->addFilter('rot13', new Twig_Filter_Function('project_compute_rot13')); + +For better encapsulation, a filter can also be defined as a static method of a +class. The ``Twig_Filter_Function`` class can also be used to register such +static methods as filters:: + + $twig->addFilter('rot13', new Twig_Filter_Function('SomeClass::rot13Filter')); + +.. tip:: + + In an extension, you can also define a filter as a static method of the + extension class. + +Environment aware Filters +~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``Twig_Filter`` classes take options as their last argument. For instance, +if you want access to the current environment instance in your filter, set the +``needs_environment`` option to ``true``:: + + $filter = new Twig_Filter_Function('str_rot13', array('needs_environment' => true)); + +Twig will then pass the current environment as the first argument to the +filter call:: + + function twig_compute_rot13(Twig_Environment $env, $string) + { + // get the current charset for instance + $charset = $env->getCharset(); + + return str_rot13($string); + } + +Automatic Escaping +~~~~~~~~~~~~~~~~~~ + +If automatic escaping is enabled, the output of the filter may be escaped +before printing. If your filter acts as an escaper (or explicitly outputs HTML +or JavaScript code), you will want the raw output to be printed. In such a +case, set the ``is_safe`` option:: + + $filter = new Twig_Filter_Function('nl2br', array('is_safe' => array('html'))); + +Some filters may need to work on input that is already escaped or safe, for +example when adding (safe) HTML tags to originally unsafe output. In such a +case, set the ``pre_escape`` option to escape the input data before it is run +through your filter:: + + $filter = new Twig_Filter_Function('somefilter', array('pre_escape' => 'html', 'is_safe' => array('html'))); + +Dynamic Filters +~~~~~~~~~~~~~~~ + +.. versionadded:: 1.5 + Dynamic filters support was added in Twig 1.5. + +A filter name containing the special ``*`` character is a dynamic filter as +the ``*`` can be any string:: + + $twig->addFilter('*_path_*', new Twig_Filter_Function('twig_path')); + + function twig_path($name, $arguments) + { + // ... + } + +The following filters will be matched by the above defined dynamic filter: + +* ``product_path`` +* ``category_path`` + +A dynamic filter can define more than one dynamic parts:: + + $twig->addFilter('*_path_*', new Twig_Filter_Function('twig_path')); + + function twig_path($name, $suffix, $arguments) + { + // ... + } + +The filter will receive all dynamic part values before the normal filters +arguments. For instance, a call to ``'foo'|a_path_b()`` will result in the +following PHP call: ``twig_path('a', 'b', 'foo')``. + +Functions +--------- + +A function is a regular PHP function or an object method that can be called from +templates. + +.. code-block:: jinja + + {{ constant("DATE_W3C") }} + +When compiling this template to PHP, Twig looks for the PHP callable +associated with the ``constant`` function. The ``constant`` function is a built-in Twig +function, and it is simply mapped to the PHP ``constant()`` function. After +compilation, the generated PHP code is roughly equivalent to: + +.. code-block:: html+php + + + +Adding a function is similar to adding a filter. This can be done by calling the +``addFunction()`` method on the ``Twig_Environment`` instance:: + + $twig = new Twig_Environment($loader); + $twig->addFunction('functionName', new Twig_Function_Function('someFunction')); + +You can also expose extension methods as functions in your templates:: + + // $this is an object that implements Twig_ExtensionInterface. + $twig = new Twig_Environment($loader); + $twig->addFunction('otherFunction', new Twig_Function_Method($this, 'someMethod')); + +Functions also support ``needs_environment`` and ``is_safe`` parameters. + +Dynamic Functions +~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.5 + Dynamic functions support was added in Twig 1.5. + +A function name containing the special ``*`` character is a dynamic function +as the ``*`` can be any string:: + + $twig->addFunction('*_path', new Twig_Function_Function('twig_path')); + + function twig_path($name, $arguments) + { + // ... + } + +The following functions will be matched by the above defined dynamic function: + +* ``product_path`` +* ``category_path`` + +A dynamic function can define more than one dynamic parts:: + + $twig->addFilter('*_path_*', new Twig_Filter_Function('twig_path')); + + function twig_path($name, $suffix, $arguments) + { + // ... + } + +The function will receive all dynamic part values before the normal functions +arguments. For instance, a call to ``a_path_b('foo')`` will result in the +following PHP call: ``twig_path('a', 'b', 'foo')``. + +Tags +---- + +One of the most exciting feature of a template engine like Twig is the +possibility to define new language constructs. This is also the most complex +feature as you need to understand how Twig's internals work. + +Let's create a simple ``set`` tag that allows the definition of simple +variables from within a template. The tag can be used like follows: + +.. code-block:: jinja + + {% set name = "value" %} + + {{ name }} + + {# should output value #} + +.. note:: + + The ``set`` tag is part of the Core extension and as such is always + available. The built-in version is slightly more powerful and supports + multiple assignments by default (cf. the template designers chapter for + more information). + +Three steps are needed to define a new tag: + +* Defining a Token Parser class (responsible for parsing the template code); + +* Defining a Node class (responsible for converting the parsed code to PHP); + +* Registering the tag. + +Registering a new tag +~~~~~~~~~~~~~~~~~~~~~ + +Adding a tag is as simple as calling the ``addTokenParser`` method on the +``Twig_Environment`` instance:: + + $twig = new Twig_Environment($loader); + $twig->addTokenParser(new Project_Set_TokenParser()); + +Defining a Token Parser +~~~~~~~~~~~~~~~~~~~~~~~ + +Now, let's see the actual code of this class:: + + class Project_Set_TokenParser extends Twig_TokenParser + { + public function parse(Twig_Token $token) + { + $lineno = $token->getLine(); + $name = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(); + $this->parser->getStream()->expect(Twig_Token::OPERATOR_TYPE, '='); + $value = $this->parser->getExpressionParser()->parseExpression(); + + $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + + return new Project_Set_Node($name, $value, $lineno, $this->getTag()); + } + + public function getTag() + { + return 'set'; + } + } + +The ``getTag()`` method must return the tag we want to parse, here ``set``. + +The ``parse()`` method is invoked whenever the parser encounters a ``set`` +tag. It should return a ``Twig_Node`` instance that represents the node (the +``Project_Set_Node`` calls creating is explained in the next section). + +The parsing process is simplified thanks to a bunch of methods you can call +from the token stream (``$this->parser->getStream()``): + +* ``getCurrent()``: Gets the current token in the stream. + +* ``next()``: Moves to the next token in the stream, *but returns the old one*. + +* ``test($type)``, ``test($value)`` or ``test($type, $value)``: Determines whether + the current token is of a particular type or value (or both). The value may be an + array of several possible values. + +* ``expect($type[, $value[, $message]])``: If the current token isn't of the given + type/value a syntax error is thrown. Otherwise, if the type and value are correct, + the token is returned and the stream moves to the next token. + +* ``look()``: Looks a the next token without consuming it. + +Parsing expressions is done by calling the ``parseExpression()`` like we did for +the ``set`` tag. + +.. tip:: + + Reading the existing ``TokenParser`` classes is the best way to learn all + the nitty-gritty details of the parsing process. + +Defining a Node +~~~~~~~~~~~~~~~ + +The ``Project_Set_Node`` class itself is rather simple:: + + class Project_Set_Node extends Twig_Node + { + public function __construct($name, Twig_Node_Expression $value, $lineno, $tag = null) + { + parent::__construct(array('value' => $value), array('name' => $name), $lineno, $tag); + } + + public function compile(Twig_Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write('$context[\''.$this->getAttribute('name').'\'] = ') + ->subcompile($this->getNode('value')) + ->raw(";\n") + ; + } + } + +The compiler implements a fluid interface and provides methods that helps the +developer generate beautiful and readable PHP code: + +* ``subcompile()``: Compiles a node. + +* ``raw()``: Writes the given string as is. + +* ``write()``: Writes the given string by adding indentation at the beginning + of each line. + +* ``string()``: Writes a quoted string. + +* ``repr()``: Writes a PHP representation of a given value (see + ``Twig_Node_For`` for a usage example). + +* ``addDebugInfo()``: Adds the line of the original template file related to + the current node as a comment. + +* ``indent()``: Indents the generated code (see ``Twig_Node_Block`` for a + usage example). + +* ``outdent()``: Outdents the generated code (see ``Twig_Node_Block`` for a + usage example). + +.. _creating_extensions: + +Creating an Extension +--------------------- + +The main motivation for writing an extension is to move often used code into a +reusable class like adding support for internationalization. An extension can +define tags, filters, tests, operators, global variables, functions, and node +visitors. + +Creating an extension also makes for a better separation of code that is +executed at compilation time and code needed at runtime. As such, it makes +your code faster. + +Most of the time, it is useful to create a single extension for your project, +to host all the specific tags and filters you want to add to Twig. + +.. tip:: + + When packaging your code into an extension, Twig is smart enough to + recompile your templates whenever you make a change to it (when the + ``auto_reload`` is enabled). + +.. note:: + + Before writing your own extensions, have a look at the Twig official + extension repository: http://github.com/twigphp/Twig-extensions. + +An extension is a class that implements the following interface:: + + interface Twig_ExtensionInterface + { + /** + * Initializes the runtime environment. + * + * This is where you can load some file that contains filter functions for instance. + * + * @param Twig_Environment $environment The current Twig_Environment instance + */ + function initRuntime(Twig_Environment $environment); + + /** + * Returns the token parser instances to add to the existing list. + * + * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances + */ + function getTokenParsers(); + + /** + * Returns the node visitor instances to add to the existing list. + * + * @return array An array of Twig_NodeVisitorInterface instances + */ + function getNodeVisitors(); + + /** + * Returns a list of filters to add to the existing list. + * + * @return array An array of filters + */ + function getFilters(); + + /** + * Returns a list of tests to add to the existing list. + * + * @return array An array of tests + */ + function getTests(); + + /** + * Returns a list of functions to add to the existing list. + * + * @return array An array of functions + */ + function getFunctions(); + + /** + * Returns a list of operators to add to the existing list. + * + * @return array An array of operators + */ + function getOperators(); + + /** + * Returns a list of global variables to add to the existing list. + * + * @return array An array of global variables + */ + function getGlobals(); + + /** + * Returns the name of the extension. + * + * @return string The extension name + */ + function getName(); + } + +To keep your extension class clean and lean, it can inherit from the built-in +``Twig_Extension`` class instead of implementing the whole interface. That +way, you just need to implement the ``getName()`` method as the +``Twig_Extension`` provides empty implementations for all other methods. + +The ``getName()`` method must return a unique identifier for your extension. + +Now, with this information in mind, let's create the most basic extension +possible:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getName() + { + return 'project'; + } + } + +.. note:: + + Of course, this extension does nothing for now. We will customize it in + the next sections. + +Twig does not care where you save your extension on the filesystem, as all +extensions must be registered explicitly to be available in your templates. + +You can register an extension by using the ``addExtension()`` method on your +main ``Environment`` object:: + + $twig = new Twig_Environment($loader); + $twig->addExtension(new Project_Twig_Extension()); + +Of course, you need to first load the extension file by either using +``require_once()`` or by using an autoloader (see `spl_autoload_register()`_). + +.. tip:: + + The bundled extensions are great examples of how extensions work. + +Globals +~~~~~~~ + +Global variables can be registered in an extension via the ``getGlobals()`` +method:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getGlobals() + { + return array( + 'text' => new Text(), + ); + } + + // ... + } + +Functions +~~~~~~~~~ + +Functions can be registered in an extension via the ``getFunctions()`` +method:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getFunctions() + { + return array( + 'lipsum' => new Twig_Function_Function('generate_lipsum'), + ); + } + + // ... + } + +Filters +~~~~~~~ + +To add a filter to an extension, you need to override the ``getFilters()`` +method. This method must return an array of filters to add to the Twig +environment:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getFilters() + { + return array( + 'rot13' => new Twig_Filter_Function('str_rot13'), + ); + } + + // ... + } + +As you can see in the above code, the ``getFilters()`` method returns an array +where keys are the name of the filters (``rot13``) and the values the +definition of the filter (``new Twig_Filter_Function('str_rot13')``). + +As seen in the previous chapter, you can also define filters as static methods +on the extension class:: + +$twig->addFilter('rot13', new Twig_Filter_Function('Project_Twig_Extension::rot13Filter')); + +You can also use ``Twig_Filter_Method`` instead of ``Twig_Filter_Function`` +when defining a filter to use a method:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getFilters() + { + return array( + 'rot13' => new Twig_Filter_Method($this, 'rot13Filter'), + ); + } + + public function rot13Filter($string) + { + return str_rot13($string); + } + + // ... + } + +The first argument of the ``Twig_Filter_Method`` constructor is always +``$this``, the current extension object. The second one is the name of the +method to call. + +Using methods for filters is a great way to package your filter without +polluting the global namespace. This also gives the developer more flexibility +at the cost of a small overhead. + +Overriding default Filters +.......................... + +If some default core filters do not suit your needs, you can easily override +them by creating your own extension. Just use the same names as the one you +want to override:: + + class MyCoreExtension extends Twig_Extension + { + public function getFilters() + { + return array( + 'date' => new Twig_Filter_Method($this, 'dateFilter'), + // ... + ); + } + + public function dateFilter($timestamp, $format = 'F j, Y H:i') + { + return '...'.twig_date_format_filter($timestamp, $format); + } + + public function getName() + { + return 'project'; + } + } + +Here, we override the ``date`` filter with a custom one. Using this extension +is as simple as registering the ``MyCoreExtension`` extension by calling the +``addExtension()`` method on the environment instance:: + + $twig = new Twig_Environment($loader); + $twig->addExtension(new MyCoreExtension()); + +Tags +~~~~ + +Adding a tag in an extension can be done by overriding the +``getTokenParsers()`` method. This method must return an array of tags to add +to the Twig environment:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getTokenParsers() + { + return array(new Project_Set_TokenParser()); + } + + // ... + } + +In the above code, we have added a single new tag, defined by the +``Project_Set_TokenParser`` class. The ``Project_Set_TokenParser`` class is +responsible for parsing the tag and compiling it to PHP. + +Operators +~~~~~~~~~ + +The ``getOperators()`` methods allows to add new operators. Here is how to add +``!``, ``||``, and ``&&`` operators:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getOperators() + { + return array( + array( + '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), + ), + array( + '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + ), + ); + } + + // ... + } + +Tests +~~~~~ + +The ``getTests()`` methods allows to add new test functions:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getTests() + { + return array( + 'even' => new Twig_Test_Function('twig_test_even'), + ); + } + + // ... + } + +Testing an Extension +-------------------- + +.. versionadded:: 1.10 + Support for functional tests was added in Twig 1.10. + +Functional Tests +~~~~~~~~~~~~~~~~ + +You can create functional tests for extensions simply by creating the +following file structure in your test directory:: + + Fixtures/ + filters/ + foo.test + bar.test + functions/ + foo.test + bar.test + tags/ + foo.test + bar.test + IntegrationTest.php + +The ``IntegrationTest.php`` file should look like this:: + + class Project_Tests_IntegrationTest extends Twig_Test_IntegrationTestCase + { + public function getExtensions() + { + return array( + new Project_Twig_Extension1(), + new Project_Twig_Extension2(), + ); + } + + public function getFixturesDir() + { + return dirname(__FILE__).'/Fixtures/'; + } + } + +Fixtures examples can be found within the Twig repository +`tests/Twig/Fixtures`_ directory. + +Node Tests +~~~~~~~~~~ + +Testing the node visitors can be complex, so extend your test cases from +``Twig_Test_NodeTestCase``. Examples can be found in the Twig repository +`tests/Twig/Node`_ directory. + +.. _`spl_autoload_register()`: http://www.php.net/spl_autoload_register +.. _`rot13`: http://www.php.net/manual/en/function.str-rot13.php +.. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Fixtures +.. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Node diff --git a/plugins/twig/vendor/twig/twig/doc/api.rst b/plugins/twig/vendor/twig/twig/doc/api.rst new file mode 100644 index 00000000..f367db07 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/api.rst @@ -0,0 +1,552 @@ +Twig for Developers +=================== + +This chapter describes the API to Twig and not the template language. It will +be most useful as reference to those implementing the template interface to +the application and not those who are creating Twig templates. + +Basics +------ + +Twig uses a central object called the **environment** (of class +``Twig_Environment``). Instances of this class are used to store the +configuration and extensions, and are used to load templates from the file +system or other locations. + +Most applications will create one ``Twig_Environment`` object on application +initialization and use that to load templates. In some cases it's however +useful to have multiple environments side by side, if different configurations +are in use. + +The simplest way to configure Twig to load templates for your application +looks roughly like this:: + + require_once '/path/to/lib/Twig/Autoloader.php'; + Twig_Autoloader::register(); + + $loader = new Twig_Loader_Filesystem('/path/to/templates'); + $twig = new Twig_Environment($loader, array( + 'cache' => '/path/to/compilation_cache', + )); + +This will create a template environment with the default settings and a loader +that looks up the templates in the ``/path/to/templates/`` folder. Different +loaders are available and you can also write your own if you want to load +templates from a database or other resources. + +.. note:: + + Notice that the second argument of the environment is an array of options. + The ``cache`` option is a compilation cache directory, where Twig caches + the compiled templates to avoid the parsing phase for sub-sequent + requests. It is very different from the cache you might want to add for + the evaluated templates. For such a need, you can use any available PHP + cache library. + +To load a template from this environment you just have to call the +``loadTemplate()`` method which then returns a ``Twig_Template`` instance:: + + $template = $twig->loadTemplate('index.html'); + +To render the template with some variables, call the ``render()`` method:: + + echo $template->render(array('the' => 'variables', 'go' => 'here')); + +.. note:: + + The ``display()`` method is a shortcut to output the template directly. + +You can also load and render the template in one fell swoop:: + + echo $twig->render('index.html', array('the' => 'variables', 'go' => 'here')); + +.. _environment_options: + +Environment Options +------------------- + +When creating a new ``Twig_Environment`` instance, you can pass an array of +options as the constructor second argument:: + + $twig = new Twig_Environment($loader, array('debug' => true)); + +The following options are available: + +* ``debug`` *boolean* + + When set to ``true``, the generated templates have a + ``__toString()`` method that you can use to display the generated nodes + (default to ``false``). + +* ``charset`` *string (default to ``utf-8``)* + + The charset used by the templates. + +* ``base_template_class`` *string (default to ``Twig_Template``)* + + The base template class to use for generated + templates. + +* ``cache`` *string|false* + + An absolute path where to store the compiled templates, or + ``false`` to disable caching (which is the default). + +* ``auto_reload`` *boolean* + + When developing with Twig, it's useful to recompile the + template whenever the source code changes. If you don't provide a value for + the ``auto_reload`` option, it will be determined automatically based on the + ``debug`` value. + +* ``strict_variables`` *boolean* + + If set to ``false``, Twig will silently ignore invalid + variables (variables and or attributes/methods that do not exist) and + replace them with a ``null`` value. When set to ``true``, Twig throws an + exception instead (default to ``false``). + +* ``autoescape`` *string|boolean* + + If set to ``true``, HTML auto-escaping will be enabled by + default for all templates (default to ``true``). + + As of Twig 1.8, you can set the escaping strategy to use (``html``, ``js``, + ``false`` to disable). + + As of Twig 1.9, you can set the escaping strategy to use (``css``, ``url``, + ``html_attr``, or a PHP callback that takes the template "filename" and must + return the escaping strategy to use -- the callback cannot be a function name + to avoid collision with built-in escaping strategies). + + As of Twig 1.17, the ``filename`` escaping strategy determines the escaping + strategy to use for a template based on the template filename extension (this + strategy does not incur any overhead at runtime as auto-escaping is done at + compilation time.) + +* ``optimizations`` *integer* + + A flag that indicates which optimizations to apply + (default to ``-1`` -- all optimizations are enabled; set it to ``0`` to + disable). + +Loaders +------- + +Loaders are responsible for loading templates from a resource such as the file +system. + +Compilation Cache +~~~~~~~~~~~~~~~~~ + +All template loaders can cache the compiled templates on the filesystem for +future reuse. It speeds up Twig a lot as templates are only compiled once; and +the performance boost is even larger if you use a PHP accelerator such as APC. +See the ``cache`` and ``auto_reload`` options of ``Twig_Environment`` above +for more information. + +Built-in Loaders +~~~~~~~~~~~~~~~~ + +Here is a list of the built-in loaders Twig provides: + +``Twig_Loader_Filesystem`` +.......................... + +.. versionadded:: 1.10 + The ``prependPath()`` and support for namespaces were added in Twig 1.10. + +``Twig_Loader_Filesystem`` loads templates from the file system. This loader +can find templates in folders on the file system and is the preferred way to +load them:: + + $loader = new Twig_Loader_Filesystem($templateDir); + +It can also look for templates in an array of directories:: + + $loader = new Twig_Loader_Filesystem(array($templateDir1, $templateDir2)); + +With such a configuration, Twig will first look for templates in +``$templateDir1`` and if they do not exist, it will fallback to look for them +in the ``$templateDir2``. + +You can add or prepend paths via the ``addPath()`` and ``prependPath()`` +methods:: + + $loader->addPath($templateDir3); + $loader->prependPath($templateDir4); + +The filesystem loader also supports namespaced templates. This allows to group +your templates under different namespaces which have their own template paths. + +When using the ``setPaths()``, ``addPath()``, and ``prependPath()`` methods, +specify the namespace as the second argument (when not specified, these +methods act on the "main" namespace):: + + $loader->addPath($templateDir, 'admin'); + +Namespaced templates can be accessed via the special +``@namespace_name/template_path`` notation:: + + $twig->render('@admin/index.html', array()); + +``Twig_Loader_Array`` +..................... + +``Twig_Loader_Array`` loads a template from a PHP array. It's passed an array +of strings bound to template names:: + + $loader = new Twig_Loader_Array(array( + 'index.html' => 'Hello {{ name }}!', + )); + $twig = new Twig_Environment($loader); + + echo $twig->render('index.html', array('name' => 'Fabien')); + +This loader is very useful for unit testing. It can also be used for small +projects where storing all templates in a single PHP file might make sense. + +.. tip:: + + When using the ``Array`` or ``String`` loaders with a cache mechanism, you + should know that a new cache key is generated each time a template content + "changes" (the cache key being the source code of the template). If you + don't want to see your cache grows out of control, you need to take care + of clearing the old cache file by yourself. + +``Twig_Loader_Chain`` +..................... + +``Twig_Loader_Chain`` delegates the loading of templates to other loaders:: + + $loader1 = new Twig_Loader_Array(array( + 'base.html' => '{% block content %}{% endblock %}', + )); + $loader2 = new Twig_Loader_Array(array( + 'index.html' => '{% extends "base.html" %}{% block content %}Hello {{ name }}{% endblock %}', + 'base.html' => 'Will never be loaded', + )); + + $loader = new Twig_Loader_Chain(array($loader1, $loader2)); + + $twig = new Twig_Environment($loader); + +When looking for a template, Twig will try each loader in turn and it will +return as soon as the template is found. When rendering the ``index.html`` +template from the above example, Twig will load it with ``$loader2`` but the +``base.html`` template will be loaded from ``$loader1``. + +``Twig_Loader_Chain`` accepts any loader that implements +``Twig_LoaderInterface``. + +.. note:: + + You can also add loaders via the ``addLoader()`` method. + +Create your own Loader +~~~~~~~~~~~~~~~~~~~~~~ + +All loaders implement the ``Twig_LoaderInterface``:: + + interface Twig_LoaderInterface + { + /** + * Gets the source code of a template, given its name. + * + * @param string $name string The name of the template to load + * + * @return string The template source code + */ + function getSource($name); + + /** + * Gets the cache key to use for the cache for a given template name. + * + * @param string $name string The name of the template to load + * + * @return string The cache key + */ + function getCacheKey($name); + + /** + * Returns true if the template is still fresh. + * + * @param string $name The template name + * @param timestamp $time The last modification time of the cached template + */ + function isFresh($name, $time); + } + +The ``isFresh()`` method must return ``true`` if the current cached template +is still fresh, given the last modification time, or ``false`` otherwise. + +.. tip:: + + As of Twig 1.11.0, you can also implement ``Twig_ExistsLoaderInterface`` + to make your loader faster when used with the chain loader. + +Using Extensions +---------------- + +Twig extensions are packages that add new features to Twig. Using an +extension is as simple as using the ``addExtension()`` method:: + + $twig->addExtension(new Twig_Extension_Sandbox()); + +Twig comes bundled with the following extensions: + +* *Twig_Extension_Core*: Defines all the core features of Twig. + +* *Twig_Extension_Escaper*: Adds automatic output-escaping and the possibility + to escape/unescape blocks of code. + +* *Twig_Extension_Sandbox*: Adds a sandbox mode to the default Twig + environment, making it safe to evaluate untrusted code. + +* *Twig_Extension_Profiler*: Enabled the built-in Twig profiler (as of Twig + 1.18). + +* *Twig_Extension_Optimizer*: Optimizes the node tree before compilation. + +The core, escaper, and optimizer extensions do not need to be added to the +Twig environment, as they are registered by default. + +Built-in Extensions +------------------- + +This section describes the features added by the built-in extensions. + +.. tip:: + + Read the chapter about extending Twig to learn how to create your own + extensions. + +Core Extension +~~~~~~~~~~~~~~ + +The ``core`` extension defines all the core features of Twig: + +* :doc:`Tags `; +* :doc:`Filters `; +* :doc:`Functions `; +* :doc:`Tests `. + +Escaper Extension +~~~~~~~~~~~~~~~~~ + +The ``escaper`` extension adds automatic output escaping to Twig. It defines a +tag, ``autoescape``, and a filter, ``raw``. + +When creating the escaper extension, you can switch on or off the global +output escaping strategy:: + + $escaper = new Twig_Extension_Escaper('html'); + $twig->addExtension($escaper); + +If set to ``html``, all variables in templates are escaped (using the ``html`` +escaping strategy), except those using the ``raw`` filter: + +.. code-block:: jinja + + {{ article.to_html|raw }} + +You can also change the escaping mode locally by using the ``autoescape`` tag +(see the :doc:`autoescape` doc for the syntax used before +Twig 1.8): + +.. code-block:: jinja + + {% autoescape 'html' %} + {{ var }} + {{ var|raw }} {# var won't be escaped #} + {{ var|escape }} {# var won't be double-escaped #} + {% endautoescape %} + +.. warning:: + + The ``autoescape`` tag has no effect on included files. + +The escaping rules are implemented as follows: + +* Literals (integers, booleans, arrays, ...) used in the template directly as + variables or filter arguments are never automatically escaped: + + .. code-block:: jinja + + {{ "Twig
" }} {# won't be escaped #} + + {% set text = "Twig
" %} + {{ text }} {# will be escaped #} + +* Expressions which the result is always a literal or a variable marked safe + are never automatically escaped: + + .. code-block:: jinja + + {{ foo ? "Twig
" : "
Twig" }} {# won't be escaped #} + + {% set text = "Twig
" %} + {{ foo ? text : "
Twig" }} {# will be escaped #} + + {% set text = "Twig
" %} + {{ foo ? text|raw : "
Twig" }} {# won't be escaped #} + + {% set text = "Twig
" %} + {{ foo ? text|escape : "
Twig" }} {# the result of the expression won't be escaped #} + +* Escaping is applied before printing, after any other filter is applied: + + .. code-block:: jinja + + {{ var|upper }} {# is equivalent to {{ var|upper|escape }} #} + +* The `raw` filter should only be used at the end of the filter chain: + + .. code-block:: jinja + + {{ var|raw|upper }} {# will be escaped #} + + {{ var|upper|raw }} {# won't be escaped #} + +* Automatic escaping is not applied if the last filter in the chain is marked + safe for the current context (e.g. ``html`` or ``js``). ``escape`` and + ``escape('html')`` are marked safe for HTML, ``escape('js')`` is marked + safe for JavaScript, ``raw`` is marked safe for everything. + + .. code-block:: jinja + + {% autoescape 'js' %} + {{ var|escape('html') }} {# will be escaped for HTML and JavaScript #} + {{ var }} {# will be escaped for JavaScript #} + {{ var|escape('js') }} {# won't be double-escaped #} + {% endautoescape %} + +.. note:: + + Note that autoescaping has some limitations as escaping is applied on + expressions after evaluation. For instance, when working with + concatenation, ``{{ foo|raw ~ bar }}`` won't give the expected result as + escaping is applied on the result of the concatenation, not on the + individual variables (so, the ``raw`` filter won't have any effect here). + +Sandbox Extension +~~~~~~~~~~~~~~~~~ + +The ``sandbox`` extension can be used to evaluate untrusted code. Access to +unsafe attributes and methods is prohibited. The sandbox security is managed +by a policy instance. By default, Twig comes with one policy class: +``Twig_Sandbox_SecurityPolicy``. This class allows you to white-list some +tags, filters, properties, and methods:: + + $tags = array('if'); + $filters = array('upper'); + $methods = array( + 'Article' => array('getTitle', 'getBody'), + ); + $properties = array( + 'Article' => array('title', 'body'), + ); + $functions = array('range'); + $policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions); + +With the previous configuration, the security policy will only allow usage of +the ``if`` tag, and the ``upper`` filter. Moreover, the templates will only be +able to call the ``getTitle()`` and ``getBody()`` methods on ``Article`` +objects, and the ``title`` and ``body`` public properties. Everything else +won't be allowed and will generate a ``Twig_Sandbox_SecurityError`` exception. + +The policy object is the first argument of the sandbox constructor:: + + $sandbox = new Twig_Extension_Sandbox($policy); + $twig->addExtension($sandbox); + +By default, the sandbox mode is disabled and should be enabled when including +untrusted template code by using the ``sandbox`` tag: + +.. code-block:: jinja + + {% sandbox %} + {% include 'user.html' %} + {% endsandbox %} + +You can sandbox all templates by passing ``true`` as the second argument of +the extension constructor:: + + $sandbox = new Twig_Extension_Sandbox($policy, true); + +Profiler Extension +~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.18 + The Profile extension was added in Twig 1.18. + +The ``profiler`` extension enables a profiler for Twig templates; it should +only be used on your development machines as it adds some overhead:: + + $profile = new Twig_Profiler_Profile(); + $twig->addExtension(new Twig_Extension_Profiler($profile)); + + $dumper = new Twig_Profiler_Dumper_Text(); + echo $dumper->dump($profile); + +A profile contains information about time and memory consumption for template, +block, and macro executions. + +You can also dump the data in a `Blackfire.io `_ +compatible format:: + + $dumper = new Twig_Profiler_Dumper_Blackfire(); + file_put_contents('/path/to/profile.prof', $dumper->dump($profile)); + +Upload the profile to visualize it (create a `free account +`_ first): + +.. code-block:: sh + + blackfire --slot=7 upload /path/to/profile.prof + +Optimizer Extension +~~~~~~~~~~~~~~~~~~~ + +The ``optimizer`` extension optimizes the node tree before compilation:: + + $twig->addExtension(new Twig_Extension_Optimizer()); + +By default, all optimizations are turned on. You can select the ones you want +to enable by passing them to the constructor:: + + $optimizer = new Twig_Extension_Optimizer(Twig_NodeVisitor_Optimizer::OPTIMIZE_FOR); + + $twig->addExtension($optimizer); + +Twig supports the following optimizations: + +* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_ALL``, enables all optimizations + (this is the default value). +* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_NONE``, disables all optimizations. + This reduces the compilation time, but it can increase the execution time + and the consumed memory. +* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_FOR``, optimizes the ``for`` tag by + removing the ``loop`` variable creation whenever possible. +* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_RAW_FILTER``, removes the ``raw`` + filter whenever possible. +* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_VAR_ACCESS``, simplifies the creation + and access of variables in the compiled templates whenever possible. + +Exceptions +---------- + +Twig can throw exceptions: + +* ``Twig_Error``: The base exception for all errors. + +* ``Twig_Error_Syntax``: Thrown to tell the user that there is a problem with + the template syntax. + +* ``Twig_Error_Runtime``: Thrown when an error occurs at runtime (when a filter + does not exist for instance). + +* ``Twig_Error_Loader``: Thrown when an error occurs during template loading. + +* ``Twig_Sandbox_SecurityError``: Thrown when an unallowed tag, filter, or + method is called in a sandboxed template. diff --git a/plugins/twig/vendor/twig/twig/doc/coding_standards.rst b/plugins/twig/vendor/twig/twig/doc/coding_standards.rst new file mode 100644 index 00000000..f435df49 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/coding_standards.rst @@ -0,0 +1,101 @@ +Coding Standards +================ + +When writing Twig templates, we recommend you to follow these official coding +standards: + +* Put one (and only one) space after the start of a delimiter (``{{``, ``{%``, + and ``{#``) and before the end of a delimiter (``}}``, ``%}``, and ``#}``): + + .. code-block:: jinja + + {{ foo }} + {# comment #} + {% if foo %}{% endif %} + + When using the whitespace control character, do not put any spaces between + it and the delimiter: + + .. code-block:: jinja + + {{- foo -}} + {#- comment -#} + {%- if foo -%}{%- endif -%} + +* Put one (and only one) space before and after the following operators: + comparison operators (``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``), math + operators (``+``, ``-``, ``/``, ``*``, ``%``, ``//``, ``**``), logic + operators (``not``, ``and``, ``or``), ``~``, ``is``, ``in``, and the ternary + operator (``?:``): + + .. code-block:: jinja + + {{ 1 + 2 }} + {{ foo ~ bar }} + {{ true ? true : false }} + +* Put one (and only one) space after the ``:`` sign in hashes and ``,`` in + arrays and hashes: + + .. code-block:: jinja + + {{ [1, 2, 3] }} + {{ {'foo': 'bar'} }} + +* Do not put any spaces after an opening parenthesis and before a closing + parenthesis in expressions: + + .. code-block:: jinja + + {{ 1 + (2 * 3) }} + +* Do not put any spaces before and after string delimiters: + + .. code-block:: jinja + + {{ 'foo' }} + {{ "foo" }} + +* Do not put any spaces before and after the following operators: ``|``, + ``.``, ``..``, ``[]``: + + .. code-block:: jinja + + {{ foo|upper|lower }} + {{ user.name }} + {{ user[name] }} + {% for i in 1..12 %}{% endfor %} + +* Do not put any spaces before and after the parenthesis used for filter and + function calls: + + .. code-block:: jinja + + {{ foo|default('foo') }} + {{ range(1..10) }} + +* Do not put any spaces before and after the opening and the closing of arrays + and hashes: + + .. code-block:: jinja + + {{ [1, 2, 3] }} + {{ {'foo': 'bar'} }} + +* Use lower cased and underscored variable names: + + .. code-block:: jinja + + {% set foo = 'foo' %} + {% set foo_bar = 'foo' %} + +* Indent your code inside tags (use the same indentation as the one used for + the target language of the rendered template): + + .. code-block:: jinja + + {% block foo %} + {% if true %} + true + {% endif %} + {% endblock %} diff --git a/plugins/twig/vendor/twig/twig/doc/deprecated.rst b/plugins/twig/vendor/twig/twig/doc/deprecated.rst new file mode 100644 index 00000000..d31f1dd3 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/deprecated.rst @@ -0,0 +1,162 @@ +Deprecated Features +=================== + +This document lists all deprecated features in Twig. Deprecated features are +kept for backward compatibility and removed in the next major release (a +feature that was deprecated in Twig 1.x is removed in Twig 2.0). + +Deprecation Notices +------------------- + +As of Twig 1.21, Twig generates deprecation notices when a template uses +deprecated features. See :ref:`deprecation-notices` for more information. + +Token Parsers +------------- + +* As of Twig 1.x, the token parser broker sub-system is deprecated. The + following class and interface will be removed in 2.0: + + * ``Twig_TokenParserBrokerInterface`` + * ``Twig_TokenParserBroker`` + +Extensions +---------- + +* As of Twig 1.x, the ability to remove an extension is deprecated and the + ``Twig_Environment::removeExtension()`` method will be removed in 2.0. + +* As of Twig 1.23, the ``Twig_ExtensionInterface::initRuntime()`` method is + deprecated. You have two options to avoid the deprecation notice: if you + implement this method to store the environment for your custom filters, + functions, or tests, use the ``needs_environment`` option instead; if you + have more complex needs, explicitly implement + ``Twig_Extension_InitRuntimeInterface`` (not recommended). + +* As of Twig 1.23, the ``Twig_ExtensionInterface::getGlobals()`` method is + deprecated. Implement ``Twig_Extension_GlobalsInterface`` to avoid + deprecation notices. + +PEAR +---- + +PEAR support has been discontinued in Twig 1.15.1, and no PEAR packages are +provided anymore. Use Composer instead. + +Filters +------- + +* As of Twig 1.x, use ``Twig_SimpleFilter`` to add a filter. The following + classes and interfaces will be removed in 2.0: + + * ``Twig_FilterInterface`` + * ``Twig_FilterCallableInterface`` + * ``Twig_Filter`` + * ``Twig_Filter_Function`` + * ``Twig_Filter_Method`` + * ``Twig_Filter_Node`` + +* As of Twig 2.x, the ``Twig_SimpleFilter`` class is deprecated and will be + removed in Twig 3.x (use ``Twig_Filter`` instead). In Twig 2.x, + ``Twig_SimpleFilter`` is just an alias for ``Twig_Filter``. + +Functions +--------- + +* As of Twig 1.x, use ``Twig_SimpleFunction`` to add a function. The following + classes and interfaces will be removed in 2.0: + + * ``Twig_FunctionInterface`` + * ``Twig_FunctionCallableInterface`` + * ``Twig_Function`` + * ``Twig_Function_Function`` + * ``Twig_Function_Method`` + * ``Twig_Function_Node`` + +* As of Twig 2.x, the ``Twig_SimpleFunction`` class is deprecated and will be + removed in Twig 3.x (use ``Twig_Function`` instead). In Twig 2.x, + ``Twig_SimpleFunction`` is just an alias for ``Twig_Function``. + +Tests +----- + +* As of Twig 1.x, use ``Twig_SimpleTest`` to add a test. The following classes + and interfaces will be removed in 2.0: + + * ``Twig_TestInterface`` + * ``Twig_TestCallableInterface`` + * ``Twig_Test`` + * ``Twig_Test_Function`` + * ``Twig_Test_Method`` + * ``Twig_Test_Node`` + +* As of Twig 2.x, the ``Twig_SimpleTest`` class is deprecated and will be + removed in Twig 3.x (use ``Twig_Test`` instead). In Twig 2.x, + ``Twig_SimpleTest`` is just an alias for ``Twig_Test``. + +* The ``sameas`` and ``divisibleby`` tests are deprecated in favor of ``same + as`` and ``divisible by`` respectively. + +Tags +---- + +* As of Twig 1.x, the ``raw`` tag is deprecated. You should use ``verbatim`` + instead. + +Nodes +----- + +* As of Twig 1.x, ``Node::toXml()`` is deprecated and will be removed in Twig + 2.0. + +Interfaces +---------- + +* As of Twig 2.x, the following interfaces are deprecated and empty (they will + be removed in Twig 3.0): + +* ``Twig_CompilerInterface`` (use ``Twig_Compiler`` instead) +* ``Twig_LexerInterface`` (use ``Twig_Lexer`` instead) +* ``Twig_NodeInterface`` (use ``Twig_Node`` instead) +* ``Twig_ParserInterface`` (use ``Twig_Parser`` instead) +* ``Twig_ExistsLoaderInterface`` (merged with ``Twig_LoaderInterface``) +* ``Twig_TemplateInterface`` (use ``Twig_Template`` instead, and use + those constants Twig_Template::ANY_CALL, Twig_Template::ARRAY_CALL, + Twig_Template::METHOD_CALL) + +Loaders +------- + +* As of Twig 1.x, ``Twig_Loader_String`` is deprecated and will be removed in + 2.0. You can render a string via ``Twig_Environment::createTemplate()``. + +Node Visitors +------------- + +* Because of the removal of ``Twig_NodeInterface`` in 2.0, you need to extend + ``Twig_BaseNodeVisitor`` instead of implementing ``Twig_NodeVisitorInterface`` + directly to make your node visitors compatible with both Twig 1.x and 2.x. + +Globals +------- + +* As of Twig 2.x, the ability to register a global variable after the runtime + or the extensions have been initialized is not possible anymore (but + changing the value of an already registered global is possible). + +* As of Twig 1.x, using the ``_self`` global variable to get access to the + current ``Twig_Template`` instance is deprecated; most usages only need the + current template name, which will continue to work in Twig 2.0. In Twig 2.0, + ``_self`` returns the current template name instead of the current + ``Twig_Template`` instance. + +Miscellaneous +------------- + +* As of Twig 1.x, ``Twig_Environment::clearTemplateCache()``, ``Twig_Environment::writeCacheFile()``, + ``Twig_Environment::clearCacheFiles()``, ``Twig_Environment::getCacheFilename()``, and + ``Twig_Environment::getTemplateClassPrefix()`` are deprecated and will be removed in 2.0. + +* As of Twig 1.x, ``Twig_Template::getEnvironment()`` and + ``Twig_TemplateInterface::getEnvironment()`` are deprecated and will be + removed in 2.0. diff --git a/plugins/twig/vendor/twig/twig/doc/filters/abs.rst b/plugins/twig/vendor/twig/twig/doc/filters/abs.rst new file mode 100644 index 00000000..22fa59d0 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/abs.rst @@ -0,0 +1,18 @@ +``abs`` +======= + +The ``abs`` filter returns the absolute value. + +.. code-block:: jinja + + {# number = -5 #} + + {{ number|abs }} + + {# outputs 5 #} + +.. note:: + + Internally, Twig uses the PHP `abs`_ function. + +.. _`abs`: http://php.net/abs diff --git a/plugins/twig/vendor/twig/twig/doc/filters/batch.rst b/plugins/twig/vendor/twig/twig/doc/filters/batch.rst new file mode 100644 index 00000000..f8b6fa9d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/batch.rst @@ -0,0 +1,51 @@ +``batch`` +========= + +.. versionadded:: 1.12.3 + The ``batch`` filter was added in Twig 1.12.3. + +The ``batch`` filter "batches" items by returning a list of lists with the +given number of items. A second parameter can be provided and used to fill in +missing items: + +.. code-block:: jinja + + {% set items = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] %} + + + {% for row in items|batch(3, 'No item') %} + + {% for column in row %} + + {% endfor %} + + {% endfor %} +
{{ column }}
+ +The above example will be rendered as: + +.. code-block:: jinja + + + + + + + + + + + + + + + + + +
abc
def
gNo itemNo item
+ +Arguments +--------- + +* ``size``: The size of the batch; fractional numbers will be rounded up +* ``fill``: Used to fill in missing items diff --git a/plugins/twig/vendor/twig/twig/doc/filters/capitalize.rst b/plugins/twig/vendor/twig/twig/doc/filters/capitalize.rst new file mode 100644 index 00000000..10546a1f --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/capitalize.rst @@ -0,0 +1,11 @@ +``capitalize`` +============== + +The ``capitalize`` filter capitalizes a value. The first character will be +uppercase, all others lowercase: + +.. code-block:: jinja + + {{ 'my first car'|capitalize }} + + {# outputs 'My first car' #} diff --git a/plugins/twig/vendor/twig/twig/doc/filters/convert_encoding.rst b/plugins/twig/vendor/twig/twig/doc/filters/convert_encoding.rst new file mode 100644 index 00000000..f4ebe580 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/convert_encoding.rst @@ -0,0 +1,28 @@ +``convert_encoding`` +==================== + +.. versionadded:: 1.4 + The ``convert_encoding`` filter was added in Twig 1.4. + +The ``convert_encoding`` filter converts a string from one encoding to +another. The first argument is the expected output charset and the second one +is the input charset: + +.. code-block:: jinja + + {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }} + +.. note:: + + This filter relies on the `iconv`_ or `mbstring`_ extension, so one of + them must be installed. In case both are installed, `mbstring`_ is used by + default (Twig before 1.8.1 uses `iconv`_ by default). + +Arguments +--------- + +* ``to``: The output charset +* ``from``: The input charset + +.. _`iconv`: http://php.net/iconv +.. _`mbstring`: http://php.net/mbstring diff --git a/plugins/twig/vendor/twig/twig/doc/filters/date.rst b/plugins/twig/vendor/twig/twig/doc/filters/date.rst new file mode 100644 index 00000000..c86d42ba --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/date.rst @@ -0,0 +1,94 @@ +``date`` +======== + +.. versionadded:: 1.1 + The timezone support has been added in Twig 1.1. + +.. versionadded:: 1.5 + The default date format support has been added in Twig 1.5. + +.. versionadded:: 1.6.1 + The default timezone support has been added in Twig 1.6.1. + +.. versionadded:: 1.11.0 + The introduction of the false value for the timezone was introduced in Twig 1.11.0 + +The ``date`` filter formats a date to a given format: + +.. code-block:: jinja + + {{ post.published_at|date("m/d/Y") }} + +The format specifier is the same as supported by `date`_, +except when the filtered data is of type `DateInterval`_, when the format must conform to +`DateInterval::format`_ instead. + +The ``date`` filter accepts strings (it must be in a format supported by the +`strtotime`_ function), `DateTime`_ instances, or `DateInterval`_ instances. For +instance, to display the current date, filter the word "now": + +.. code-block:: jinja + + {{ "now"|date("m/d/Y") }} + +To escape words and characters in the date format use ``\\`` in front of each +character: + +.. code-block:: jinja + + {{ post.published_at|date("F jS \\a\\t g:ia") }} + +If the value passed to the ``date`` filter is ``null``, it will return the +current date by default. If an empty string is desired instead of the current +date, use a ternary operator: + +.. code-block:: jinja + + {{ post.published_at is empty ? "" : post.published_at|date("m/d/Y") }} + +If no format is provided, Twig will use the default one: ``F j, Y H:i``. This +default can be easily changed by calling the ``setDateFormat()`` method on the +``core`` extension instance. The first argument is the default format for +dates and the second one is the default format for date intervals: + +.. code-block:: php + + $twig = new Twig_Environment($loader); + $twig->getExtension('core')->setDateFormat('d/m/Y', '%d days'); + +Timezone +-------- + +By default, the date is displayed by applying the default timezone (the one +specified in php.ini or declared in Twig -- see below), but you can override +it by explicitly specifying a timezone: + +.. code-block:: jinja + + {{ post.published_at|date("m/d/Y", "Europe/Paris") }} + +If the date is already a DateTime object, and if you want to keep its current +timezone, pass ``false`` as the timezone value: + +.. code-block:: jinja + + {{ post.published_at|date("m/d/Y", false) }} + +The default timezone can also be set globally by calling ``setTimezone()``: + +.. code-block:: php + + $twig = new Twig_Environment($loader); + $twig->getExtension('core')->setTimezone('Europe/Paris'); + +Arguments +--------- + +* ``format``: The date format +* ``timezone``: The date timezone + +.. _`strtotime`: http://www.php.net/strtotime +.. _`DateTime`: http://www.php.net/DateTime +.. _`DateInterval`: http://www.php.net/DateInterval +.. _`date`: http://www.php.net/date +.. _`DateInterval::format`: http://www.php.net/DateInterval.format diff --git a/plugins/twig/vendor/twig/twig/doc/filters/date_modify.rst b/plugins/twig/vendor/twig/twig/doc/filters/date_modify.rst new file mode 100644 index 00000000..add40b56 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/date_modify.rst @@ -0,0 +1,23 @@ +``date_modify`` +=============== + +.. versionadded:: 1.9.0 + The date_modify filter has been added in Twig 1.9.0. + +The ``date_modify`` filter modifies a date with a given modifier string: + +.. code-block:: jinja + + {{ post.published_at|date_modify("+1 day")|date("m/d/Y") }} + +The ``date_modify`` filter accepts strings (it must be in a format supported +by the `strtotime`_ function) or `DateTime`_ instances. You can easily combine +it with the :doc:`date` filter for formatting. + +Arguments +--------- + +* ``modifier``: The modifier + +.. _`strtotime`: http://www.php.net/strtotime +.. _`DateTime`: http://www.php.net/DateTime diff --git a/plugins/twig/vendor/twig/twig/doc/filters/default.rst b/plugins/twig/vendor/twig/twig/doc/filters/default.rst new file mode 100644 index 00000000..641ac6e7 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/default.rst @@ -0,0 +1,33 @@ +``default`` +=========== + +The ``default`` filter returns the passed default value if the value is +undefined or empty, otherwise the value of the variable: + +.. code-block:: jinja + + {{ var|default('var is not defined') }} + + {{ var.foo|default('foo item on var is not defined') }} + + {{ var['foo']|default('foo item on var is not defined') }} + + {{ ''|default('passed var is empty') }} + +When using the ``default`` filter on an expression that uses variables in some +method calls, be sure to use the ``default`` filter whenever a variable can be +undefined: + +.. code-block:: jinja + + {{ var.method(foo|default('foo'))|default('foo') }} + +.. note:: + + Read the documentation for the :doc:`defined<../tests/defined>` and + :doc:`empty<../tests/empty>` tests to learn more about their semantics. + +Arguments +--------- + +* ``default``: The default value diff --git a/plugins/twig/vendor/twig/twig/doc/filters/escape.rst b/plugins/twig/vendor/twig/twig/doc/filters/escape.rst new file mode 100644 index 00000000..fc9771ac --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/escape.rst @@ -0,0 +1,116 @@ +``escape`` +========== + +.. versionadded:: 1.9.0 + The ``css``, ``url``, and ``html_attr`` strategies were added in Twig + 1.9.0. + +.. versionadded:: 1.14.0 + The ability to define custom escapers was added in Twig 1.14.0. + +The ``escape`` filter escapes a string for safe insertion into the final +output. It supports different escaping strategies depending on the template +context. + +By default, it uses the HTML escaping strategy: + +.. code-block:: jinja + + {{ user.username|escape }} + +For convenience, the ``e`` filter is defined as an alias: + +.. code-block:: jinja + + {{ user.username|e }} + +The ``escape`` filter can also be used in other contexts than HTML thanks to +an optional argument which defines the escaping strategy to use: + +.. code-block:: jinja + + {{ user.username|e }} + {# is equivalent to #} + {{ user.username|e('html') }} + +And here is how to escape variables included in JavaScript code: + +.. code-block:: jinja + + {{ user.username|escape('js') }} + {{ user.username|e('js') }} + +The ``escape`` filter supports the following escaping strategies: + +* ``html``: escapes a string for the **HTML body** context. + +* ``js``: escapes a string for the **JavaScript context**. + +* ``css``: escapes a string for the **CSS context**. CSS escaping can be + applied to any string being inserted into CSS and escapes everything except + alphanumerics. + +* ``url``: escapes a string for the **URI or parameter contexts**. This should + not be used to escape an entire URI; only a subcomponent being inserted. + +* ``html_attr``: escapes a string for the **HTML attribute** context. + +.. note:: + + Internally, ``escape`` uses the PHP native `htmlspecialchars`_ function + for the HTML escaping strategy. + +.. caution:: + + When using automatic escaping, Twig tries to not double-escape a variable + when the automatic escaping strategy is the same as the one applied by the + escape filter; but that does not work when using a variable as the + escaping strategy: + + .. code-block:: jinja + + {% set strategy = 'html' %} + + {% autoescape 'html' %} + {{ var|escape('html') }} {# won't be double-escaped #} + {{ var|escape(strategy) }} {# will be double-escaped #} + {% endautoescape %} + + When using a variable as the escaping strategy, you should disable + automatic escaping: + + .. code-block:: jinja + + {% set strategy = 'html' %} + + {% autoescape 'html' %} + {{ var|escape(strategy)|raw }} {# won't be double-escaped #} + {% endautoescape %} + +Custom Escapers +--------------- + +You can define custom escapers by calling the ``setEscaper()`` method on the +``core`` extension instance. The first argument is the escaper name (to be +used in the ``escape`` call) and the second one must be a valid PHP callable: + +.. code-block:: php + + $twig = new Twig_Environment($loader); + $twig->getExtension('core')->setEscaper('csv', 'csv_escaper')); + +When called by Twig, the callable receives the Twig environment instance, the +string to escape, and the charset. + +.. note:: + + Built-in escapers cannot be overridden mainly they should be considered as + the final implementation and also for better performance. + +Arguments +--------- + +* ``strategy``: The escaping strategy +* ``charset``: The string charset + +.. _`htmlspecialchars`: http://php.net/htmlspecialchars diff --git a/plugins/twig/vendor/twig/twig/doc/filters/first.rst b/plugins/twig/vendor/twig/twig/doc/filters/first.rst new file mode 100644 index 00000000..674c1f9e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/first.rst @@ -0,0 +1,25 @@ +``first`` +========= + +.. versionadded:: 1.12.2 + The ``first`` filter was added in Twig 1.12.2. + +The ``first`` filter returns the first "element" of a sequence, a mapping, or +a string: + +.. code-block:: jinja + + {{ [1, 2, 3, 4]|first }} + {# outputs 1 #} + + {{ { a: 1, b: 2, c: 3, d: 4 }|first }} + {# outputs 1 #} + + {{ '1234'|first }} + {# outputs 1 #} + +.. note:: + + It also works with objects implementing the `Traversable`_ interface. + +.. _`Traversable`: http://php.net/manual/en/class.traversable.php diff --git a/plugins/twig/vendor/twig/twig/doc/filters/format.rst b/plugins/twig/vendor/twig/twig/doc/filters/format.rst new file mode 100644 index 00000000..f8effd9a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/format.rst @@ -0,0 +1,16 @@ +``format`` +========== + +The ``format`` filter formats a given string by replacing the placeholders +(placeholders follows the `sprintf`_ notation): + +.. code-block:: jinja + + {{ "I like %s and %s."|format(foo, "bar") }} + + {# outputs I like foo and bar + if the foo parameter equals to the foo string. #} + +.. _`sprintf`: http://www.php.net/sprintf + +.. seealso:: :doc:`replace` diff --git a/plugins/twig/vendor/twig/twig/doc/filters/index.rst b/plugins/twig/vendor/twig/twig/doc/filters/index.rst new file mode 100644 index 00000000..8daa9611 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/index.rst @@ -0,0 +1,37 @@ +Filters +======= + +.. toctree:: + :maxdepth: 1 + + abs + batch + capitalize + convert_encoding + date + date_modify + default + escape + first + format + join + json_encode + keys + last + length + lower + merge + nl2br + number_format + raw + replace + reverse + round + slice + sort + split + striptags + title + trim + upper + url_encode diff --git a/plugins/twig/vendor/twig/twig/doc/filters/join.rst b/plugins/twig/vendor/twig/twig/doc/filters/join.rst new file mode 100644 index 00000000..2fab9452 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/join.rst @@ -0,0 +1,23 @@ +``join`` +======== + +The ``join`` filter returns a string which is the concatenation of the items +of a sequence: + +.. code-block:: jinja + + {{ [1, 2, 3]|join }} + {# returns 123 #} + +The separator between elements is an empty string per default, but you can +define it with the optional first parameter: + +.. code-block:: jinja + + {{ [1, 2, 3]|join('|') }} + {# outputs 1|2|3 #} + +Arguments +--------- + +* ``glue``: The separator diff --git a/plugins/twig/vendor/twig/twig/doc/filters/json_encode.rst b/plugins/twig/vendor/twig/twig/doc/filters/json_encode.rst new file mode 100644 index 00000000..a39bb476 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/json_encode.rst @@ -0,0 +1,21 @@ +``json_encode`` +=============== + +The ``json_encode`` filter returns the JSON representation of a value: + +.. code-block:: jinja + + {{ data|json_encode() }} + +.. note:: + + Internally, Twig uses the PHP `json_encode`_ function. + +Arguments +--------- + +* ``options``: A bitmask of `json_encode options`_ (``{{ + data|json_encode(constant('JSON_PRETTY_PRINT')) }}``) + +.. _`json_encode`: http://php.net/json_encode +.. _`json_encode options`: http://www.php.net/manual/en/json.constants.php diff --git a/plugins/twig/vendor/twig/twig/doc/filters/keys.rst b/plugins/twig/vendor/twig/twig/doc/filters/keys.rst new file mode 100644 index 00000000..e4f090c6 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/keys.rst @@ -0,0 +1,11 @@ +``keys`` +======== + +The ``keys`` filter returns the keys of an array. It is useful when you want to +iterate over the keys of an array: + +.. code-block:: jinja + + {% for key in array|keys %} + ... + {% endfor %} diff --git a/plugins/twig/vendor/twig/twig/doc/filters/last.rst b/plugins/twig/vendor/twig/twig/doc/filters/last.rst new file mode 100644 index 00000000..345b6573 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/last.rst @@ -0,0 +1,25 @@ +``last`` +======== + +.. versionadded:: 1.12.2 + The ``last`` filter was added in Twig 1.12.2. + +The ``last`` filter returns the last "element" of a sequence, a mapping, or +a string: + +.. code-block:: jinja + + {{ [1, 2, 3, 4]|last }} + {# outputs 4 #} + + {{ { a: 1, b: 2, c: 3, d: 4 }|last }} + {# outputs 4 #} + + {{ '1234'|last }} + {# outputs 4 #} + +.. note:: + + It also works with objects implementing the `Traversable`_ interface. + +.. _`Traversable`: http://php.net/manual/en/class.traversable.php diff --git a/plugins/twig/vendor/twig/twig/doc/filters/length.rst b/plugins/twig/vendor/twig/twig/doc/filters/length.rst new file mode 100644 index 00000000..1f783b3d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/length.rst @@ -0,0 +1,11 @@ +``length`` +========== + +The ``length`` filter returns the number of items of a sequence or mapping, or +the length of a string: + +.. code-block:: jinja + + {% if users|length > 10 %} + ... + {% endif %} diff --git a/plugins/twig/vendor/twig/twig/doc/filters/lower.rst b/plugins/twig/vendor/twig/twig/doc/filters/lower.rst new file mode 100644 index 00000000..ef9faa90 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/lower.rst @@ -0,0 +1,10 @@ +``lower`` +========= + +The ``lower`` filter converts a value to lowercase: + +.. code-block:: jinja + + {{ 'WELCOME'|lower }} + + {# outputs 'welcome' #} diff --git a/plugins/twig/vendor/twig/twig/doc/filters/merge.rst b/plugins/twig/vendor/twig/twig/doc/filters/merge.rst new file mode 100644 index 00000000..88780dd6 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/merge.rst @@ -0,0 +1,48 @@ +``merge`` +========= + +The ``merge`` filter merges an array with another array: + +.. code-block:: jinja + + {% set values = [1, 2] %} + + {% set values = values|merge(['apple', 'orange']) %} + + {# values now contains [1, 2, 'apple', 'orange'] #} + +New values are added at the end of the existing ones. + +The ``merge`` filter also works on hashes: + +.. code-block:: jinja + + {% set items = { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'unknown' } %} + + {% set items = items|merge({ 'peugeot': 'car', 'renault': 'car' }) %} + + {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car', 'renault': 'car' } #} + +For hashes, the merging process occurs on the keys: if the key does not +already exist, it is added but if the key already exists, its value is +overridden. + +.. tip:: + + If you want to ensure that some values are defined in an array (by given + default values), reverse the two elements in the call: + + .. code-block:: jinja + + {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} + + {% set items = { 'apple': 'unknown' }|merge(items) %} + + {# items now contains { 'apple': 'fruit', 'orange': 'fruit' } #} + +.. note:: + + Internally, Twig uses the PHP `array_merge`_ function. It supports + Traversable objects by transforming those to arrays. + +.. _`array_merge`: http://php.net/array_merge diff --git a/plugins/twig/vendor/twig/twig/doc/filters/nl2br.rst b/plugins/twig/vendor/twig/twig/doc/filters/nl2br.rst new file mode 100644 index 00000000..5c923e14 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/nl2br.rst @@ -0,0 +1,22 @@ +``nl2br`` +========= + +.. versionadded:: 1.5 + The ``nl2br`` filter was added in Twig 1.5. + +The ``nl2br`` filter inserts HTML line breaks before all newlines in a string: + +.. code-block:: jinja + + {{ "I like Twig.\nYou will like it too."|nl2br }} + {# outputs + + I like Twig.
+ You will like it too. + + #} + +.. note:: + + The ``nl2br`` filter pre-escapes the input before applying the + transformation. diff --git a/plugins/twig/vendor/twig/twig/doc/filters/number_format.rst b/plugins/twig/vendor/twig/twig/doc/filters/number_format.rst new file mode 100644 index 00000000..3114e845 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/number_format.rst @@ -0,0 +1,45 @@ +``number_format`` +================= + +.. versionadded:: 1.5 + The ``number_format`` filter was added in Twig 1.5 + +The ``number_format`` filter formats numbers. It is a wrapper around PHP's +`number_format`_ function: + +.. code-block:: jinja + + {{ 200.35|number_format }} + +You can control the number of decimal places, decimal point, and thousands +separator using the additional arguments: + +.. code-block:: jinja + + {{ 9800.333|number_format(2, '.', ',') }} + +If no formatting options are provided then Twig will use the default formatting +options of: + +* 0 decimal places. +* ``.`` as the decimal point. +* ``,`` as the thousands separator. + +These defaults can be easily changed through the core extension: + +.. code-block:: php + + $twig = new Twig_Environment($loader); + $twig->getExtension('core')->setNumberFormat(3, '.', ','); + +The defaults set for ``number_format`` can be over-ridden upon each call using the +additional parameters. + +Arguments +--------- + +* ``decimal``: The number of decimal points to display +* ``decimal_point``: The character(s) to use for the decimal point +* ``thousand_sep``: The character(s) to use for the thousands separator + +.. _`number_format`: http://php.net/number_format diff --git a/plugins/twig/vendor/twig/twig/doc/filters/raw.rst b/plugins/twig/vendor/twig/twig/doc/filters/raw.rst new file mode 100644 index 00000000..e5e5b12e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/raw.rst @@ -0,0 +1,36 @@ +``raw`` +======= + +The ``raw`` filter marks the value as being "safe", which means that in an +environment with automatic escaping enabled this variable will not be escaped +if ``raw`` is the last filter applied to it: + +.. code-block:: jinja + + {% autoescape %} + {{ var|raw }} {# var won't be escaped #} + {% endautoescape %} + +.. note:: + + Be careful when using the ``raw`` filter inside expressions: + + .. code-block:: jinja + + {% autoescape %} + {% set hello = 'Hello' %} + {% set hola = 'Hola' %} + + {{ false ? 'Hola' : hello|raw }} + does not render the same as + {{ false ? hola : hello|raw }} + but renders the same as + {{ (false ? hola : hello)|raw }} + {% endautoescape %} + + The first ternary statement is not escaped: ``hello`` is marked as being + safe and Twig does not escape static values (see + :doc:`escape<../tags/autoescape>`). In the second ternary statement, even + if ``hello`` is marked as safe, ``hola`` remains unsafe and so is the whole + expression. The third ternary statement is marked as safe and the result is + not escaped. diff --git a/plugins/twig/vendor/twig/twig/doc/filters/replace.rst b/plugins/twig/vendor/twig/twig/doc/filters/replace.rst new file mode 100644 index 00000000..1227957b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/replace.rst @@ -0,0 +1,19 @@ +``replace`` +=========== + +The ``replace`` filter formats a given string by replacing the placeholders +(placeholders are free-form): + +.. code-block:: jinja + + {{ "I like %this% and %that%."|replace({'%this%': foo, '%that%': "bar"}) }} + + {# outputs I like foo and bar + if the foo parameter equals to the foo string. #} + +Arguments +--------- + +* ``replace_pairs``: The placeholder values + +.. seealso:: :doc:`format` diff --git a/plugins/twig/vendor/twig/twig/doc/filters/reverse.rst b/plugins/twig/vendor/twig/twig/doc/filters/reverse.rst new file mode 100644 index 00000000..76fd2c1a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/reverse.rst @@ -0,0 +1,47 @@ +``reverse`` +=========== + +.. versionadded:: 1.6 + Support for strings has been added in Twig 1.6. + +The ``reverse`` filter reverses a sequence, a mapping, or a string: + +.. code-block:: jinja + + {% for user in users|reverse %} + ... + {% endfor %} + + {{ '1234'|reverse }} + + {# outputs 4321 #} + +.. tip:: + + For sequences and mappings, numeric keys are not preserved. To reverse + them as well, pass ``true`` as an argument to the ``reverse`` filter: + + .. code-block:: jinja + + {% for key, value in {1: "a", 2: "b", 3: "c"}|reverse %} + {{ key }}: {{ value }} + {%- endfor %} + + {# output: 0: c 1: b 2: a #} + + {% for key, value in {1: "a", 2: "b", 3: "c"}|reverse(true) %} + {{ key }}: {{ value }} + {%- endfor %} + + {# output: 3: c 2: b 1: a #} + +.. note:: + + It also works with objects implementing the `Traversable`_ interface. + +Arguments +--------- + +* ``preserve_keys``: Preserve keys when reversing a mapping or a sequence. + +.. _`Traversable`: http://php.net/Traversable diff --git a/plugins/twig/vendor/twig/twig/doc/filters/round.rst b/plugins/twig/vendor/twig/twig/doc/filters/round.rst new file mode 100644 index 00000000..2521cf16 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/round.rst @@ -0,0 +1,37 @@ +``round`` +========= + +.. versionadded:: 1.15.0 + The ``round`` filter was added in Twig 1.15.0. + +The ``round`` filter rounds a number to a given precision: + +.. code-block:: jinja + + {{ 42.55|round }} + {# outputs 43 #} + + {{ 42.55|round(1, 'floor') }} + {# outputs 42.5 #} + +The ``round`` filter takes two optional arguments; the first one specifies the +precision (default is ``0``) and the second the rounding method (default is +``common``): + +* ``common`` rounds either up or down (rounds the value up to precision decimal + places away from zero, when it is half way there -- making 1.5 into 2 and + -1.5 into -2); + +* ``ceil`` always rounds up; + +* ``floor`` always rounds down. + +.. note:: + + The ``//`` operator is equivalent to ``|round(0, 'floor')``. + +Arguments +--------- + +* ``precision``: The rounding precision +* ``method``: The rounding method diff --git a/plugins/twig/vendor/twig/twig/doc/filters/slice.rst b/plugins/twig/vendor/twig/twig/doc/filters/slice.rst new file mode 100644 index 00000000..70bf139e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/slice.rst @@ -0,0 +1,71 @@ +``slice`` +=========== + +.. versionadded:: 1.6 + The ``slice`` filter was added in Twig 1.6. + +The ``slice`` filter extracts a slice of a sequence, a mapping, or a string: + +.. code-block:: jinja + + {% for i in [1, 2, 3, 4, 5]|slice(1, 2) %} + {# will iterate over 2 and 3 #} + {% endfor %} + + {{ '12345'|slice(1, 2) }} + + {# outputs 23 #} + +You can use any valid expression for both the start and the length: + +.. code-block:: jinja + + {% for i in [1, 2, 3, 4, 5]|slice(start, length) %} + {# ... #} + {% endfor %} + +As syntactic sugar, you can also use the ``[]`` notation: + +.. code-block:: jinja + + {% for i in [1, 2, 3, 4, 5][start:length] %} + {# ... #} + {% endfor %} + + {{ '12345'[1:2] }} {# will display "23" #} + + {# you can omit the first argument -- which is the same as 0 #} + {{ '12345'[:2] }} {# will display "12" #} + + {# you can omit the last argument -- which will select everything till the end #} + {{ '12345'[2:] }} {# will display "345" #} + +The ``slice`` filter works as the `array_slice`_ PHP function for arrays and +`mb_substr`_ for strings with a fallback to `substr`_. + +If the start is non-negative, the sequence will start at that start in the +variable. If start is negative, the sequence will start that far from the end +of the variable. + +If length is given and is positive, then the sequence will have up to that +many elements in it. If the variable is shorter than the length, then only the +available variable elements will be present. If length is given and is +negative then the sequence will stop that many elements from the end of the +variable. If it is omitted, then the sequence will have everything from offset +up until the end of the variable. + +.. note:: + + It also works with objects implementing the `Traversable`_ interface. + +Arguments +--------- + +* ``start``: The start of the slice +* ``length``: The size of the slice +* ``preserve_keys``: Whether to preserve key or not (when the input is an array) + +.. _`Traversable`: http://php.net/manual/en/class.traversable.php +.. _`array_slice`: http://php.net/array_slice +.. _`mb_substr` : http://php.net/mb-substr +.. _`substr`: http://php.net/substr diff --git a/plugins/twig/vendor/twig/twig/doc/filters/sort.rst b/plugins/twig/vendor/twig/twig/doc/filters/sort.rst new file mode 100644 index 00000000..350207f8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/sort.rst @@ -0,0 +1,18 @@ +``sort`` +======== + +The ``sort`` filter sorts an array: + +.. code-block:: jinja + + {% for user in users|sort %} + ... + {% endfor %} + +.. note:: + + Internally, Twig uses the PHP `asort`_ function to maintain index + association. It supports Traversable objects by transforming + those to arrays. + +.. _`asort`: http://php.net/asort diff --git a/plugins/twig/vendor/twig/twig/doc/filters/split.rst b/plugins/twig/vendor/twig/twig/doc/filters/split.rst new file mode 100644 index 00000000..bbc6d798 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/split.rst @@ -0,0 +1,53 @@ +``split`` +========= + +.. versionadded:: 1.10.3 + The ``split`` filter was added in Twig 1.10.3. + +The ``split`` filter splits a string by the given delimiter and returns a list +of strings: + +.. code-block:: jinja + + {% set foo = "one,two,three"|split(',') %} + {# foo contains ['one', 'two', 'three'] #} + +You can also pass a ``limit`` argument: + + * If ``limit`` is positive, the returned array will contain a maximum of + limit elements with the last element containing the rest of string; + + * If ``limit`` is negative, all components except the last -limit are + returned; + + * If ``limit`` is zero, then this is treated as 1. + +.. code-block:: jinja + + {% set foo = "one,two,three,four,five"|split(',', 3) %} + {# foo contains ['one', 'two', 'three,four,five'] #} + +If the ``delimiter`` is an empty string, then value will be split by equal +chunks. Length is set by the ``limit`` argument (one character by default). + +.. code-block:: jinja + + {% set foo = "123"|split('') %} + {# foo contains ['1', '2', '3'] #} + + {% set bar = "aabbcc"|split('', 2) %} + {# bar contains ['aa', 'bb', 'cc'] #} + +.. note:: + + Internally, Twig uses the PHP `explode`_ or `str_split`_ (if delimiter is + empty) functions for string splitting. + +Arguments +--------- + +* ``delimiter``: The delimiter +* ``limit``: The limit argument + +.. _`explode`: http://php.net/explode +.. _`str_split`: http://php.net/str_split diff --git a/plugins/twig/vendor/twig/twig/doc/filters/striptags.rst b/plugins/twig/vendor/twig/twig/doc/filters/striptags.rst new file mode 100644 index 00000000..72c6f252 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/striptags.rst @@ -0,0 +1,15 @@ +``striptags`` +============= + +The ``striptags`` filter strips SGML/XML tags and replace adjacent whitespace +by one space: + +.. code-block:: jinja + + {{ some_html|striptags }} + +.. note:: + + Internally, Twig uses the PHP `strip_tags`_ function. + +.. _`strip_tags`: http://php.net/strip_tags diff --git a/plugins/twig/vendor/twig/twig/doc/filters/title.rst b/plugins/twig/vendor/twig/twig/doc/filters/title.rst new file mode 100644 index 00000000..c5a318e8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/title.rst @@ -0,0 +1,11 @@ +``title`` +========= + +The ``title`` filter returns a titlecased version of the value. Words will +start with uppercase letters, all remaining characters are lowercase: + +.. code-block:: jinja + + {{ 'my first car'|title }} + + {# outputs 'My First Car' #} diff --git a/plugins/twig/vendor/twig/twig/doc/filters/trim.rst b/plugins/twig/vendor/twig/twig/doc/filters/trim.rst new file mode 100644 index 00000000..4ddb2083 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/trim.rst @@ -0,0 +1,29 @@ +``trim`` +======== + +.. versionadded:: 1.6.2 + The ``trim`` filter was added in Twig 1.6.2. + +The ``trim`` filter strips whitespace (or other characters) from the beginning +and end of a string: + +.. code-block:: jinja + + {{ ' I like Twig. '|trim }} + + {# outputs 'I like Twig.' #} + + {{ ' I like Twig.'|trim('.') }} + + {# outputs ' I like Twig' #} + +.. note:: + + Internally, Twig uses the PHP `trim`_ function. + +Arguments +--------- + +* ``character_mask``: The characters to strip + +.. _`trim`: http://php.net/trim diff --git a/plugins/twig/vendor/twig/twig/doc/filters/upper.rst b/plugins/twig/vendor/twig/twig/doc/filters/upper.rst new file mode 100644 index 00000000..561cebe3 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/upper.rst @@ -0,0 +1,10 @@ +``upper`` +========= + +The ``upper`` filter converts a value to uppercase: + +.. code-block:: jinja + + {{ 'welcome'|upper }} + + {# outputs 'WELCOME' #} diff --git a/plugins/twig/vendor/twig/twig/doc/filters/url_encode.rst b/plugins/twig/vendor/twig/twig/doc/filters/url_encode.rst new file mode 100644 index 00000000..5944e59c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/filters/url_encode.rst @@ -0,0 +1,34 @@ +``url_encode`` +============== + +.. versionadded:: 1.12.3 + Support for encoding an array as query string was added in Twig 1.12.3. + +.. versionadded:: 1.16.0 + The ``raw`` argument was removed in Twig 1.16.0. Twig now always encodes + according to RFC 3986. + +The ``url_encode`` filter percent encodes a given string as URL segment +or an array as query string: + +.. code-block:: jinja + + {{ "path-seg*ment"|url_encode }} + {# outputs "path-seg%2Ament" #} + + {{ "string with spaces"|url_encode }} + {# outputs "string%20with%20spaces" #} + + {{ {'param': 'value', 'foo': 'bar'}|url_encode }} + {# outputs "param=value&foo=bar" #} + +.. note:: + + Internally, Twig uses the PHP `urlencode`_ (or `rawurlencode`_ if you pass + ``true`` as the first parameter) or the `http_build_query`_ function. Note + that as of Twig 1.16.0, ``urlencode`` **always** uses ``rawurlencode`` (the + ``raw`` argument was removed.) + +.. _`urlencode`: http://php.net/urlencode +.. _`rawurlencode`: http://php.net/rawurlencode +.. _`http_build_query`: http://php.net/http_build_query diff --git a/plugins/twig/vendor/twig/twig/doc/functions/attribute.rst b/plugins/twig/vendor/twig/twig/doc/functions/attribute.rst new file mode 100644 index 00000000..ceba96b0 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/attribute.rst @@ -0,0 +1,26 @@ +``attribute`` +============= + +.. versionadded:: 1.2 + The ``attribute`` function was added in Twig 1.2. + +The ``attribute`` function can be used to access a "dynamic" attribute of a +variable: + +.. code-block:: jinja + + {{ attribute(object, method) }} + {{ attribute(object, method, arguments) }} + {{ attribute(array, item) }} + +In addition, the ``defined`` test can check for the existence of a dynamic +attribute: + +.. code-block:: jinja + + {{ attribute(object, method) is defined ? 'Method exists' : 'Method does not exist' }} + +.. note:: + + The resolution algorithm is the same as the one used for the ``.`` + notation, except that the item can be any valid expression. diff --git a/plugins/twig/vendor/twig/twig/doc/functions/block.rst b/plugins/twig/vendor/twig/twig/doc/functions/block.rst new file mode 100644 index 00000000..fd571efb --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/block.rst @@ -0,0 +1,15 @@ +``block`` +========= + +When a template uses inheritance and if you want to print a block multiple +times, use the ``block`` function: + +.. code-block:: jinja + + {% block title %}{% endblock %} + +

{{ block('title') }}

+ + {% block body %}{% endblock %} + +.. seealso:: :doc:`extends<../tags/extends>`, :doc:`parent<../functions/parent>` diff --git a/plugins/twig/vendor/twig/twig/doc/functions/constant.rst b/plugins/twig/vendor/twig/twig/doc/functions/constant.rst new file mode 100644 index 00000000..bea0e9fc --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/constant.rst @@ -0,0 +1,18 @@ +``constant`` +============ + +.. versionadded: 1.12.1 + constant now accepts object instances as the second argument. + +``constant`` returns the constant value for a given string: + +.. code-block:: jinja + + {{ some_date|date(constant('DATE_W3C')) }} + {{ constant('Namespace\\Classname::CONSTANT_NAME') }} + +As of 1.12.1 you can read constants from object instances as well: + +.. code-block:: jinja + + {{ constant('RSS', date) }} diff --git a/plugins/twig/vendor/twig/twig/doc/functions/cycle.rst b/plugins/twig/vendor/twig/twig/doc/functions/cycle.rst new file mode 100644 index 00000000..e3434932 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/cycle.rst @@ -0,0 +1,28 @@ +``cycle`` +========= + +The ``cycle`` function cycles on an array of values: + +.. code-block:: jinja + + {% set start_year = date() | date('Y') %} + {% set end_year = start_year + 5 %} + + {% for year in start_year..end_year %} + {{ cycle(['odd', 'even'], loop.index0) }} + {% endfor %} + +The array can contain any number of values: + +.. code-block:: jinja + + {% set fruits = ['apple', 'orange', 'citrus'] %} + + {% for i in 0..10 %} + {{ cycle(fruits, i) }} + {% endfor %} + +Arguments +--------- + +* ``position``: The cycle position diff --git a/plugins/twig/vendor/twig/twig/doc/functions/date.rst b/plugins/twig/vendor/twig/twig/doc/functions/date.rst new file mode 100644 index 00000000..714e08c4 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/date.rst @@ -0,0 +1,52 @@ +``date`` +======== + +.. versionadded:: 1.6 + The date function has been added in Twig 1.6. + +.. versionadded:: 1.6.1 + The default timezone support has been added in Twig 1.6.1. + +Converts an argument to a date to allow date comparison: + +.. code-block:: jinja + + {% if date(user.created_at) < date('-2days') %} + {# do something #} + {% endif %} + +The argument must be in one of PHP’s supported `date and time formats`_. + +You can pass a timezone as the second argument: + +.. code-block:: jinja + + {% if date(user.created_at) < date('-2days', 'Europe/Paris') %} + {# do something #} + {% endif %} + +If no argument is passed, the function returns the current date: + +.. code-block:: jinja + + {% if date(user.created_at) < date() %} + {# always! #} + {% endif %} + +.. note:: + + You can set the default timezone globally by calling ``setTimezone()`` on + the ``core`` extension instance: + + .. code-block:: php + + $twig = new Twig_Environment($loader); + $twig->getExtension('core')->setTimezone('Europe/Paris'); + +Arguments +--------- + +* ``date``: The date +* ``timezone``: The timezone + +.. _`date and time formats`: http://php.net/manual/en/datetime.formats.php diff --git a/plugins/twig/vendor/twig/twig/doc/functions/dump.rst b/plugins/twig/vendor/twig/twig/doc/functions/dump.rst new file mode 100644 index 00000000..a231f089 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/dump.rst @@ -0,0 +1,69 @@ +``dump`` +======== + +.. versionadded:: 1.5 + The ``dump`` function was added in Twig 1.5. + +The ``dump`` function dumps information about a template variable. This is +mostly useful to debug a template that does not behave as expected by +introspecting its variables: + +.. code-block:: jinja + + {{ dump(user) }} + +.. note:: + + The ``dump`` function is not available by default. You must add the + ``Twig_Extension_Debug`` extension explicitly when creating your Twig + environment:: + + $twig = new Twig_Environment($loader, array( + 'debug' => true, + // ... + )); + $twig->addExtension(new Twig_Extension_Debug()); + + Even when enabled, the ``dump`` function won't display anything if the + ``debug`` option on the environment is not enabled (to avoid leaking debug + information on a production server). + +In an HTML context, wrap the output with a ``pre`` tag to make it easier to +read: + +.. code-block:: jinja + +
+        {{ dump(user) }}
+    
+ +.. tip:: + + Using a ``pre`` tag is not needed when `XDebug`_ is enabled and + ``html_errors`` is ``on``; as a bonus, the output is also nicer with + XDebug enabled. + +You can debug several variables by passing them as additional arguments: + +.. code-block:: jinja + + {{ dump(user, categories) }} + +If you don't pass any value, all variables from the current context are +dumped: + +.. code-block:: jinja + + {{ dump() }} + +.. note:: + + Internally, Twig uses the PHP `var_dump`_ function. + +Arguments +--------- + +* ``context``: The context to dump + +.. _`XDebug`: http://xdebug.org/docs/display +.. _`var_dump`: http://php.net/var_dump diff --git a/plugins/twig/vendor/twig/twig/doc/functions/include.rst b/plugins/twig/vendor/twig/twig/doc/functions/include.rst new file mode 100644 index 00000000..33bd56d1 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/include.rst @@ -0,0 +1,80 @@ +``include`` +=========== + +.. versionadded:: 1.12 + The ``include`` function was added in Twig 1.12. + +The ``include`` function returns the rendered content of a template: + +.. code-block:: jinja + + {{ include('template.html') }} + {{ include(some_var) }} + +Included templates have access to the variables of the active context. + +If you are using the filesystem loader, the templates are looked for in the +paths defined by it. + +The context is passed by default to the template but you can also pass +additional variables: + +.. code-block:: jinja + + {# template.html will have access to the variables from the current context and the additional ones provided #} + {{ include('template.html', {foo: 'bar'}) }} + +You can disable access to the context by setting ``with_context`` to +``false``: + +.. code-block:: jinja + + {# only the foo variable will be accessible #} + {{ include('template.html', {foo: 'bar'}, with_context = false) }} + +.. code-block:: jinja + + {# no variables will be accessible #} + {{ include('template.html', with_context = false) }} + +And if the expression evaluates to a ``Twig_Template`` object, Twig will use it +directly:: + + // {{ include(template) }} + + $template = $twig->loadTemplate('some_template.twig'); + + $twig->loadTemplate('template.twig')->display(array('template' => $template)); + +When you set the ``ignore_missing`` flag, Twig will return an empty string if +the template does not exist: + +.. code-block:: jinja + + {{ include('sidebar.html', ignore_missing = true) }} + +You can also provide a list of templates that are checked for existence before +inclusion. The first template that exists will be rendered: + +.. code-block:: jinja + + {{ include(['page_detailed.html', 'page.html']) }} + +If ``ignore_missing`` is set, it will fall back to rendering nothing if none +of the templates exist, otherwise it will throw an exception. + +When including a template created by an end user, you should consider +sandboxing it: + +.. code-block:: jinja + + {{ include('page.html', sandboxed = true) }} + +Arguments +--------- + +* ``template``: The template to render +* ``variables``: The variables to pass to the template +* ``with_context``: Whether to pass the current context variables or not +* ``ignore_missing``: Whether to ignore missing templates or not +* ``sandboxed``: Whether to sandbox the template or not diff --git a/plugins/twig/vendor/twig/twig/doc/functions/index.rst b/plugins/twig/vendor/twig/twig/doc/functions/index.rst new file mode 100644 index 00000000..07214a76 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/index.rst @@ -0,0 +1,20 @@ +Functions +========= + +.. toctree:: + :maxdepth: 1 + + attribute + block + constant + cycle + date + dump + include + max + min + parent + random + range + source + template_from_string diff --git a/plugins/twig/vendor/twig/twig/doc/functions/max.rst b/plugins/twig/vendor/twig/twig/doc/functions/max.rst new file mode 100644 index 00000000..6f3cfc53 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/max.rst @@ -0,0 +1,20 @@ +``max`` +======= + +.. versionadded:: 1.15 + The ``max`` function was added in Twig 1.15. + +``max`` returns the biggest value of a sequence or a set of values: + +.. code-block:: jinja + + {{ max(1, 3, 2) }} + {{ max([1, 3, 2]) }} + +When called with a mapping, max ignores keys and only compares values: + +.. code-block:: jinja + + {{ max({2: "e", 1: "a", 3: "b", 5: "d", 4: "c"}) }} + {# returns "e" #} + diff --git a/plugins/twig/vendor/twig/twig/doc/functions/min.rst b/plugins/twig/vendor/twig/twig/doc/functions/min.rst new file mode 100644 index 00000000..7b6a65e1 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/min.rst @@ -0,0 +1,20 @@ +``min`` +======= + +.. versionadded:: 1.15 + The ``min`` function was added in Twig 1.15. + +``min`` returns the lowest value of a sequence or a set of values: + +.. code-block:: jinja + + {{ min(1, 3, 2) }} + {{ min([1, 3, 2]) }} + +When called with a mapping, min ignores keys and only compares values: + +.. code-block:: jinja + + {{ min({2: "e", 3: "a", 1: "b", 5: "d", 4: "c"}) }} + {# returns "a" #} + diff --git a/plugins/twig/vendor/twig/twig/doc/functions/parent.rst b/plugins/twig/vendor/twig/twig/doc/functions/parent.rst new file mode 100644 index 00000000..f5bd2001 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/parent.rst @@ -0,0 +1,20 @@ +``parent`` +========== + +When a template uses inheritance, it's possible to render the contents of the +parent block when overriding a block by using the ``parent`` function: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block sidebar %} +

Table Of Contents

+ ... + {{ parent() }} + {% endblock %} + +The ``parent()`` call will return the content of the ``sidebar`` block as +defined in the ``base.html`` template. + +.. seealso:: :doc:`extends<../tags/extends>`, :doc:`block<../functions/block>`, :doc:`block<../tags/block>` diff --git a/plugins/twig/vendor/twig/twig/doc/functions/random.rst b/plugins/twig/vendor/twig/twig/doc/functions/random.rst new file mode 100644 index 00000000..168e74f8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/random.rst @@ -0,0 +1,29 @@ +``random`` +========== + +.. versionadded:: 1.5 + The ``random`` function was added in Twig 1.5. + +.. versionadded:: 1.6 + String and integer handling was added in Twig 1.6. + +The ``random`` function returns a random value depending on the supplied +parameter type: + +* a random item from a sequence; +* a random character from a string; +* a random integer between 0 and the integer parameter (inclusive). + +.. code-block:: jinja + + {{ random(['apple', 'orange', 'citrus']) }} {# example output: orange #} + {{ random('ABC') }} {# example output: C #} + {{ random() }} {# example output: 15386094 (works as the native PHP mt_rand function) #} + {{ random(5) }} {# example output: 3 #} + +Arguments +--------- + +* ``values``: The values + +.. _`mt_rand`: http://php.net/mt_rand diff --git a/plugins/twig/vendor/twig/twig/doc/functions/range.rst b/plugins/twig/vendor/twig/twig/doc/functions/range.rst new file mode 100644 index 00000000..b7cd0111 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/range.rst @@ -0,0 +1,45 @@ +``range`` +========= + +Returns a list containing an arithmetic progression of integers: + +.. code-block:: jinja + + {% for i in range(0, 3) %} + {{ i }}, + {% endfor %} + + {# outputs 0, 1, 2, 3, #} + +When step is given (as the third parameter), it specifies the increment (or +decrement): + +.. code-block:: jinja + + {% for i in range(0, 6, 2) %} + {{ i }}, + {% endfor %} + + {# outputs 0, 2, 4, 6, #} + +The Twig built-in ``..`` operator is just syntactic sugar for the ``range`` +function (with a step of 1): + +.. code-block:: jinja + + {% for i in 0..3 %} + {{ i }}, + {% endfor %} + +.. tip:: + + The ``range`` function works as the native PHP `range`_ function. + +Arguments +--------- + +* ``low``: The first value of the sequence. +* ``high``: The highest possible value of the sequence. +* ``step``: The increment between elements of the sequence. + +.. _`range`: http://php.net/range diff --git a/plugins/twig/vendor/twig/twig/doc/functions/source.rst b/plugins/twig/vendor/twig/twig/doc/functions/source.rst new file mode 100644 index 00000000..3c921b1c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/source.rst @@ -0,0 +1,32 @@ +``source`` +========== + +.. versionadded:: 1.15 + The ``source`` function was added in Twig 1.15. + +.. versionadded:: 1.18.3 + The ``ignore_missing`` flag was added in Twig 1.18.3. + +The ``source`` function returns the content of a template without rendering it: + +.. code-block:: jinja + + {{ source('template.html') }} + {{ source(some_var) }} + +When you set the ``ignore_missing`` flag, Twig will return an empty string if +the template does not exist: + +.. code-block:: jinja + + {{ source('template.html', ignore_missing = true) }} + +The function uses the same template loaders as the ones used to include +templates. So, if you are using the filesystem loader, the templates are looked +for in the paths defined by it. + +Arguments +--------- + +* ``name``: The name of the template to read +* ``ignore_missing``: Whether to ignore missing templates or not diff --git a/plugins/twig/vendor/twig/twig/doc/functions/template_from_string.rst b/plugins/twig/vendor/twig/twig/doc/functions/template_from_string.rst new file mode 100644 index 00000000..ce6a60dc --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/functions/template_from_string.rst @@ -0,0 +1,32 @@ +``template_from_string`` +======================== + +.. versionadded:: 1.11 + The ``template_from_string`` function was added in Twig 1.11. + +The ``template_from_string`` function loads a template from a string: + +.. code-block:: jinja + + {{ include(template_from_string("Hello {{ name }}")) }} + {{ include(template_from_string(page.template)) }} + +.. note:: + + The ``template_from_string`` function is not available by default. You + must add the ``Twig_Extension_StringLoader`` extension explicitly when + creating your Twig environment:: + + $twig = new Twig_Environment(...); + $twig->addExtension(new Twig_Extension_StringLoader()); + +.. note:: + + Even if you will probably always use the ``template_from_string`` function + with the ``include`` function, you can use it with any tag or function that + takes a template as an argument (like the ``embed`` or ``extends`` tags). + +Arguments +--------- + +* ``template``: The template diff --git a/plugins/twig/vendor/twig/twig/doc/index.rst b/plugins/twig/vendor/twig/twig/doc/index.rst new file mode 100644 index 00000000..358bd738 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/index.rst @@ -0,0 +1,19 @@ +Twig +==== + +.. toctree:: + :maxdepth: 2 + + intro + installation + templates + api + advanced + internals + deprecated + recipes + coding_standards + tags/index + filters/index + functions/index + tests/index diff --git a/plugins/twig/vendor/twig/twig/doc/installation.rst b/plugins/twig/vendor/twig/twig/doc/installation.rst new file mode 100644 index 00000000..afdcf165 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/installation.rst @@ -0,0 +1,116 @@ +Installation +============ + +You have multiple ways to install Twig. + +Installing the Twig PHP package +------------------------------- + +Installing via Composer (recommended) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Install `Composer`_ and run the following command to get the latest version: + +.. code-block:: bash + + composer require twig/twig:~1.0 + +Installing from the tarball release +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1. Download the most recent tarball from the `download page`_ +2. Verify the integrity of the tarball http://fabien.potencier.org/article/73/signing-project-releases +3. Unpack the tarball +4. Move the files somewhere in your project + +Installing the development version +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: bash + + git clone git://github.com/twigphp/Twig.git + +Installing the PEAR package +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. note:: + + Using PEAR for installing Twig is deprecated and Twig 1.15.1 was the last + version published on the PEAR channel; use Composer instead. + +.. code-block:: bash + + pear channel-discover pear.twig-project.org + pear install twig/Twig + +Installing the C extension +-------------------------- + +.. versionadded:: 1.4 + The C extension was added in Twig 1.4. + +.. note:: + + The C extension is **optional** but it brings some nice performance + improvements. Note that the extension is not a replacement for the PHP + code; it only implements a small part of the PHP code to improve the + performance at runtime; you must still install the regular PHP code. + +Twig comes with a C extension that enhances the performance of the Twig +runtime engine; install it like any other PHP extensions: + +.. code-block:: bash + + cd ext/twig + phpize + ./configure + make + make install + +.. note:: + + You can also install the C extension via PEAR (note that this method is + deprecated and newer versions of Twig are not available on the PEAR + channel): + + .. code-block:: bash + + pear channel-discover pear.twig-project.org + pear install twig/CTwig + +For Windows: + +1. Setup the build environment following the `PHP documentation`_ +2. Put Twig's C extension source code into ``C:\php-sdk\phpdev\vcXX\x86\php-source-directory\ext\twig`` +3. Use the ``configure --disable-all --enable-cli --enable-twig=shared`` command instead of step 14 +4. ``nmake`` +5. Copy the ``C:\php-sdk\phpdev\vcXX\x86\php-source-directory\Release_TS\php_twig.dll`` file to your PHP setup. + +.. tip:: + + For Windows ZendServer, ZTS is not enabled as mentioned in `Zend Server + FAQ`_. + + You have to use ``configure --disable-all --disable-zts --enable-cli + --enable-twig=shared`` to be able to build the twig C extension for + ZendServer. + + The built DLL will be available in + ``C:\\php-sdk\\phpdev\\vcXX\\x86\\php-source-directory\\Release`` + +Finally, enable the extension in your ``php.ini`` configuration file: + +.. code-block:: ini + + extension=twig.so #For Unix systems + extension=php_twig.dll #For Windows systems + +And from now on, Twig will automatically compile your templates to take +advantage of the C extension. Note that this extension does not replace the +PHP code but only provides an optimized version of the +``Twig_Template::getAttribute()`` method. + +.. _`download page`: https://github.com/twigphp/Twig/tags +.. _`Composer`: https://getcomposer.org/download/ +.. _`PHP documentation`: https://wiki.php.net/internals/windows/stepbystepbuild +.. _`Zend Server FAQ`: http://www.zend.com/en/products/server/faq#faqD6 diff --git a/plugins/twig/vendor/twig/twig/doc/internals.rst b/plugins/twig/vendor/twig/twig/doc/internals.rst new file mode 100644 index 00000000..ef1174dd --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/internals.rst @@ -0,0 +1,138 @@ +Twig Internals +============== + +Twig is very extensible and you can easily hack it. Keep in mind that you +should probably try to create an extension before hacking the core, as most +features and enhancements can be handled with extensions. This chapter is also +useful for people who want to understand how Twig works under the hood. + +How does Twig work? +------------------- + +The rendering of a Twig template can be summarized into four key steps: + +* **Load** the template: If the template is already compiled, load it and go + to the *evaluation* step, otherwise: + + * First, the **lexer** tokenizes the template source code into small pieces + for easier processing; + * Then, the **parser** converts the token stream into a meaningful tree + of nodes (the Abstract Syntax Tree); + * Eventually, the *compiler* transforms the AST into PHP code. + +* **Evaluate** the template: It basically means calling the ``display()`` + method of the compiled template and passing it the context. + +The Lexer +--------- + +The lexer tokenizes a template source code into a token stream (each token is +an instance of ``Twig_Token``, and the stream is an instance of +``Twig_TokenStream``). The default lexer recognizes 13 different token types: + +* ``Twig_Token::BLOCK_START_TYPE``, ``Twig_Token::BLOCK_END_TYPE``: Delimiters for blocks (``{% %}``) +* ``Twig_Token::VAR_START_TYPE``, ``Twig_Token::VAR_END_TYPE``: Delimiters for variables (``{{ }}``) +* ``Twig_Token::TEXT_TYPE``: A text outside an expression; +* ``Twig_Token::NAME_TYPE``: A name in an expression; +* ``Twig_Token::NUMBER_TYPE``: A number in an expression; +* ``Twig_Token::STRING_TYPE``: A string in an expression; +* ``Twig_Token::OPERATOR_TYPE``: An operator; +* ``Twig_Token::PUNCTUATION_TYPE``: A punctuation sign; +* ``Twig_Token::INTERPOLATION_START_TYPE``, ``Twig_Token::INTERPOLATION_END_TYPE`` (as of Twig 1.5): Delimiters for string interpolation; +* ``Twig_Token::EOF_TYPE``: Ends of template. + +You can manually convert a source code into a token stream by calling the +``tokenize()`` method of an environment:: + + $stream = $twig->tokenize($source, $identifier); + +As the stream has a ``__toString()`` method, you can have a textual +representation of it by echoing the object:: + + echo $stream."\n"; + +Here is the output for the ``Hello {{ name }}`` template: + +.. code-block:: text + + TEXT_TYPE(Hello ) + VAR_START_TYPE() + NAME_TYPE(name) + VAR_END_TYPE() + EOF_TYPE() + +.. note:: + + The default lexer (``Twig_Lexer``) can be changed by calling + the ``setLexer()`` method:: + + $twig->setLexer($lexer); + +The Parser +---------- + +The parser converts the token stream into an AST (Abstract Syntax Tree), or a +node tree (an instance of ``Twig_Node_Module``). The core extension defines +the basic nodes like: ``for``, ``if``, ... and the expression nodes. + +You can manually convert a token stream into a node tree by calling the +``parse()`` method of an environment:: + + $nodes = $twig->parse($stream); + +Echoing the node object gives you a nice representation of the tree:: + + echo $nodes."\n"; + +Here is the output for the ``Hello {{ name }}`` template: + +.. code-block:: text + + Twig_Node_Module( + Twig_Node_Text(Hello ) + Twig_Node_Print( + Twig_Node_Expression_Name(name) + ) + ) + +.. note:: + + The default parser (``Twig_TokenParser``) can be changed by calling the + ``setParser()`` method:: + + $twig->setParser($parser); + +The Compiler +------------ + +The last step is done by the compiler. It takes a node tree as an input and +generates PHP code usable for runtime execution of the template. + +You can manually compile a node tree to PHP code with the ``compile()`` method +of an environment:: + + $php = $twig->compile($nodes); + +The generated template for a ``Hello {{ name }}`` template reads as follows +(the actual output can differ depending on the version of Twig you are +using):: + + /* Hello {{ name }} */ + class __TwigTemplate_1121b6f109fe93ebe8c6e22e3712bceb extends Twig_Template + { + protected function doDisplay(array $context, array $blocks = array()) + { + // line 1 + echo "Hello "; + echo twig_escape_filter($this->env, isset($context["name"]) ? $context["name"] : null), "html", null, true); + } + + // some more code + } + +.. note:: + + The default compiler (``Twig_Compiler``) can be changed by calling the + ``setCompiler()`` method:: + + $twig->setCompiler($compiler); diff --git a/plugins/twig/vendor/twig/twig/doc/intro.rst b/plugins/twig/vendor/twig/twig/doc/intro.rst new file mode 100644 index 00000000..9b38c97d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/intro.rst @@ -0,0 +1,85 @@ +Introduction +============ + +This is the documentation for Twig, the flexible, fast, and secure template +engine for PHP. + +If you have any exposure to other text-based template languages, such as +Smarty, Django, or Jinja, you should feel right at home with Twig. It's both +designer and developer friendly by sticking to PHP's principles and adding +functionality useful for templating environments. + +The key-features are... + +* *Fast*: Twig compiles templates down to plain optimized PHP code. The + overhead compared to regular PHP code was reduced to the very minimum. + +* *Secure*: Twig has a sandbox mode to evaluate untrusted template code. This + allows Twig to be used as a template language for applications where users + may modify the template design. + +* *Flexible*: Twig is powered by a flexible lexer and parser. This allows the + developer to define its own custom tags and filters, and create its own DSL. + +Twig is used by many Open-Source projects like Symfony, Drupal8, eZPublish, +phpBB, Piwik, OroCRM, and many frameworks have support for it as well like +Slim, Yii, Laravel, Codeigniter, and Kohana, just to name a few. + +Prerequisites +------------- + +Twig needs at least **PHP 5.2.7** to run. + +Installation +------------ + +The recommended way to install Twig is via Composer: + +.. code-block:: bash + + composer require "twig/twig:~1.0" + +.. note:: + + To learn more about the other installation methods, read the + :doc:`installation` chapter; it also explains how to install + the Twig C extension. + +Basic API Usage +--------------- + +This section gives you a brief introduction to the PHP API for Twig. + +.. code-block:: php + + require_once '/path/to/vendor/autoload.php'; + + $loader = new Twig_Loader_Array(array( + 'index' => 'Hello {{ name }}!', + )); + $twig = new Twig_Environment($loader); + + echo $twig->render('index', array('name' => 'Fabien')); + +Twig uses a loader (``Twig_Loader_Array``) to locate templates, and an +environment (``Twig_Environment``) to store the configuration. + +The ``render()`` method loads the template passed as a first argument and +renders it with the variables passed as a second argument. + +As templates are generally stored on the filesystem, Twig also comes with a +filesystem loader:: + + $loader = new Twig_Loader_Filesystem('/path/to/templates'); + $twig = new Twig_Environment($loader, array( + 'cache' => '/path/to/compilation_cache', + )); + + echo $twig->render('index.html', array('name' => 'Fabien')); + +.. tip:: + + If you are not using Composer, use the Twig built-in autoloader:: + + require_once '/path/to/lib/Twig/Autoloader.php'; + Twig_Autoloader::register(); diff --git a/plugins/twig/vendor/twig/twig/doc/recipes.rst b/plugins/twig/vendor/twig/twig/doc/recipes.rst new file mode 100644 index 00000000..6ad53276 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/recipes.rst @@ -0,0 +1,518 @@ +Recipes +======= + +.. _deprecation-notices: + +Displaying Deprecation Notices +------------------------------ + +.. versionadded:: 1.21 + This works as of Twig 1.21. + +Deprecated features generate deprecation notices (via a call to the +``trigger_error()`` PHP function). By default, they are silenced and never +displayed nor logged. + +To easily remove all deprecated feature usages from your templates, write and +run a script along the lines of the following:: + + require_once __DIR__.'/vendor/autoload.php'; + + $twig = create_your_twig_env(); + + $deprecations = new Twig_Util_DeprecationCollector($twig); + + print_r($deprecations->collectDir(__DIR__.'/templates')); + +The ``collectDir()`` method compiles all templates found in a directory, +catches deprecation notices, and return them. + +.. tip:: + + If your templates are not stored on the filesystem, use the ``collect()`` + method instead which takes an ``Iterator``; the iterator must return + template names as keys and template contents as values (as done by + ``Twig_Util_TemplateDirIterator``). + +However, this code won't find all deprecations (like using deprecated some Twig +classes). To catch all notices, register a custom error handler like the one +below:: + + $deprecations = array(); + set_error_handler(function ($type, $msg) use (&$deprecations) { + if (E_USER_DEPRECATED === $type) { + $deprecations[] = $msg; + } + }); + + // run your application + + print_r($deprecations); + +Note that most deprecation notices are triggered during **compilation**, so +they won't be generated when templates are already cached. + +.. tip:: + + If you want to manage the deprecation notices from your PHPUnit tests, have + a look at the `symfony/phpunit-bridge + `_ package, which eases the + process a lot. + +Making a Layout conditional +--------------------------- + +Working with Ajax means that the same content is sometimes displayed as is, +and sometimes decorated with a layout. As Twig layout template names can be +any valid expression, you can pass a variable that evaluates to ``true`` when +the request is made via Ajax and choose the layout accordingly: + +.. code-block:: jinja + + {% extends request.ajax ? "base_ajax.html" : "base.html" %} + + {% block content %} + This is the content to be displayed. + {% endblock %} + +Making an Include dynamic +------------------------- + +When including a template, its name does not need to be a string. For +instance, the name can depend on the value of a variable: + +.. code-block:: jinja + + {% include var ~ '_foo.html' %} + +If ``var`` evaluates to ``index``, the ``index_foo.html`` template will be +rendered. + +As a matter of fact, the template name can be any valid expression, such as +the following: + +.. code-block:: jinja + + {% include var|default('index') ~ '_foo.html' %} + +Overriding a Template that also extends itself +---------------------------------------------- + +A template can be customized in two different ways: + +* *Inheritance*: A template *extends* a parent template and overrides some + blocks; + +* *Replacement*: If you use the filesystem loader, Twig loads the first + template it finds in a list of configured directories; a template found in a + directory *replaces* another one from a directory further in the list. + +But how do you combine both: *replace* a template that also extends itself +(aka a template in a directory further in the list)? + +Let's say that your templates are loaded from both ``.../templates/mysite`` +and ``.../templates/default`` in this order. The ``page.twig`` template, +stored in ``.../templates/default`` reads as follows: + +.. code-block:: jinja + + {# page.twig #} + {% extends "layout.twig" %} + + {% block content %} + {% endblock %} + +You can replace this template by putting a file with the same name in +``.../templates/mysite``. And if you want to extend the original template, you +might be tempted to write the following: + +.. code-block:: jinja + + {# page.twig in .../templates/mysite #} + {% extends "page.twig" %} {# from .../templates/default #} + +Of course, this will not work as Twig will always load the template from +``.../templates/mysite``. + +It turns out it is possible to get this to work, by adding a directory right +at the end of your template directories, which is the parent of all of the +other directories: ``.../templates`` in our case. This has the effect of +making every template file within our system uniquely addressable. Most of the +time you will use the "normal" paths, but in the special case of wanting to +extend a template with an overriding version of itself we can reference its +parent's full, unambiguous template path in the extends tag: + +.. code-block:: jinja + + {# page.twig in .../templates/mysite #} + {% extends "default/page.twig" %} {# from .../templates #} + +.. note:: + + This recipe was inspired by the following Django wiki page: + http://code.djangoproject.com/wiki/ExtendingTemplates + +Customizing the Syntax +---------------------- + +Twig allows some syntax customization for the block delimiters. It's not +recommended to use this feature as templates will be tied with your custom +syntax. But for specific projects, it can make sense to change the defaults. + +To change the block delimiters, you need to create your own lexer object:: + + $twig = new Twig_Environment(); + + $lexer = new Twig_Lexer($twig, array( + 'tag_comment' => array('{#', '#}'), + 'tag_block' => array('{%', '%}'), + 'tag_variable' => array('{{', '}}'), + 'interpolation' => array('#{', '}'), + )); + $twig->setLexer($lexer); + +Here are some configuration example that simulates some other template engines +syntax:: + + // Ruby erb syntax + $lexer = new Twig_Lexer($twig, array( + 'tag_comment' => array('<%#', '%>'), + 'tag_block' => array('<%', '%>'), + 'tag_variable' => array('<%=', '%>'), + )); + + // SGML Comment Syntax + $lexer = new Twig_Lexer($twig, array( + 'tag_comment' => array(''), + 'tag_block' => array(''), + 'tag_variable' => array('${', '}'), + )); + + // Smarty like + $lexer = new Twig_Lexer($twig, array( + 'tag_comment' => array('{*', '*}'), + 'tag_block' => array('{', '}'), + 'tag_variable' => array('{$', '}'), + )); + +Using dynamic Object Properties +------------------------------- + +When Twig encounters a variable like ``article.title``, it tries to find a +``title`` public property in the ``article`` object. + +It also works if the property does not exist but is rather defined dynamically +thanks to the magic ``__get()`` method; you just need to also implement the +``__isset()`` magic method like shown in the following snippet of code:: + + class Article + { + public function __get($name) + { + if ('title' == $name) { + return 'The title'; + } + + // throw some kind of error + } + + public function __isset($name) + { + if ('title' == $name) { + return true; + } + + return false; + } + } + +Accessing the parent Context in Nested Loops +-------------------------------------------- + +Sometimes, when using nested loops, you need to access the parent context. The +parent context is always accessible via the ``loop.parent`` variable. For +instance, if you have the following template data:: + + $data = array( + 'topics' => array( + 'topic1' => array('Message 1 of topic 1', 'Message 2 of topic 1'), + 'topic2' => array('Message 1 of topic 2', 'Message 2 of topic 2'), + ), + ); + +And the following template to display all messages in all topics: + +.. code-block:: jinja + + {% for topic, messages in topics %} + * {{ loop.index }}: {{ topic }} + {% for message in messages %} + - {{ loop.parent.loop.index }}.{{ loop.index }}: {{ message }} + {% endfor %} + {% endfor %} + +The output will be similar to: + +.. code-block:: text + + * 1: topic1 + - 1.1: The message 1 of topic 1 + - 1.2: The message 2 of topic 1 + * 2: topic2 + - 2.1: The message 1 of topic 2 + - 2.2: The message 2 of topic 2 + +In the inner loop, the ``loop.parent`` variable is used to access the outer +context. So, the index of the current ``topic`` defined in the outer for loop +is accessible via the ``loop.parent.loop.index`` variable. + +Defining undefined Functions and Filters on the Fly +--------------------------------------------------- + +When a function (or a filter) is not defined, Twig defaults to throw a +``Twig_Error_Syntax`` exception. However, it can also call a `callback`_ (any +valid PHP callable) which should return a function (or a filter). + +For filters, register callbacks with ``registerUndefinedFilterCallback()``. +For functions, use ``registerUndefinedFunctionCallback()``:: + + // auto-register all native PHP functions as Twig functions + // don't try this at home as it's not secure at all! + $twig->registerUndefinedFunctionCallback(function ($name) { + if (function_exists($name)) { + return new Twig_Function_Function($name); + } + + return false; + }); + +If the callable is not able to return a valid function (or filter), it must +return ``false``. + +If you register more than one callback, Twig will call them in turn until one +does not return ``false``. + +.. tip:: + + As the resolution of functions and filters is done during compilation, + there is no overhead when registering these callbacks. + +Validating the Template Syntax +------------------------------ + +When template code is provided by a third-party (through a web interface for +instance), it might be interesting to validate the template syntax before +saving it. If the template code is stored in a `$template` variable, here is +how you can do it:: + + try { + $twig->parse($twig->tokenize($template)); + + // the $template is valid + } catch (Twig_Error_Syntax $e) { + // $template contains one or more syntax errors + } + +If you iterate over a set of files, you can pass the filename to the +``tokenize()`` method to get the filename in the exception message:: + + foreach ($files as $file) { + try { + $twig->parse($twig->tokenize($template, $file)); + + // the $template is valid + } catch (Twig_Error_Syntax $e) { + // $template contains one or more syntax errors + } + } + +.. note:: + + This method won't catch any sandbox policy violations because the policy + is enforced during template rendering (as Twig needs the context for some + checks like allowed methods on objects). + +Refreshing modified Templates when OPcache or APC is enabled +------------------------------------------------------------ + +When using OPcache with ``opcache.validate_timestamps`` set to ``0`` or APC +with ``apc.stat`` set to ``0`` and Twig cache enabled, clearing the template +cache won't update the cache. + +To get around this, force Twig to invalidate the bytecode cache:: + + $twig = new Twig_Environment($loader, array( + 'cache' => new Twig_Cache_Filesystem('/some/cache/path', Twig_Cache_Filesystem::FORCE_BYTECODE_INVALIDATION), + // ... + )); + +.. note:: + + Before Twig 1.22, you should extend ``Twig_Environment`` instead:: + + class OpCacheAwareTwigEnvironment extends Twig_Environment + { + protected function writeCacheFile($file, $content) + { + parent::writeCacheFile($file, $content); + + // Compile cached file into bytecode cache + if (function_exists('opcache_invalidate')) { + opcache_invalidate($file, true); + } elseif (function_exists('apc_compile_file')) { + apc_compile_file($file); + } + } + } + +Reusing a stateful Node Visitor +------------------------------- + +When attaching a visitor to a ``Twig_Environment`` instance, Twig uses it to +visit *all* templates it compiles. If you need to keep some state information +around, you probably want to reset it when visiting a new template. + +This can be easily achieved with the following code:: + + protected $someTemplateState = array(); + + public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) + { + if ($node instanceof Twig_Node_Module) { + // reset the state as we are entering a new template + $this->someTemplateState = array(); + } + + // ... + + return $node; + } + +Using a Database to store Templates +----------------------------------- + +If you are developing a CMS, templates are usually stored in a database. This +recipe gives you a simple PDO template loader you can use as a starting point +for your own. + +First, let's create a temporary in-memory SQLite3 database to work with:: + + $dbh = new PDO('sqlite::memory:'); + $dbh->exec('CREATE TABLE templates (name STRING, source STRING, last_modified INTEGER)'); + $base = '{% block content %}{% endblock %}'; + $index = ' + {% extends "base.twig" %} + {% block content %}Hello {{ name }}{% endblock %} + '; + $now = time(); + $dbh->exec("INSERT INTO templates (name, source, last_modified) VALUES ('base.twig', '$base', $now)"); + $dbh->exec("INSERT INTO templates (name, source, last_modified) VALUES ('index.twig', '$index', $now)"); + +We have created a simple ``templates`` table that hosts two templates: +``base.twig`` and ``index.twig``. + +Now, let's define a loader able to use this database:: + + class DatabaseTwigLoader implements Twig_LoaderInterface, Twig_ExistsLoaderInterface + { + protected $dbh; + + public function __construct(PDO $dbh) + { + $this->dbh = $dbh; + } + + public function getSource($name) + { + if (false === $source = $this->getValue('source', $name)) { + throw new Twig_Error_Loader(sprintf('Template "%s" does not exist.', $name)); + } + + return $source; + } + + // Twig_ExistsLoaderInterface as of Twig 1.11 + public function exists($name) + { + return $name === $this->getValue('name', $name); + } + + public function getCacheKey($name) + { + return $name; + } + + public function isFresh($name, $time) + { + if (false === $lastModified = $this->getValue('last_modified', $name)) { + return false; + } + + return $lastModified <= $time; + } + + protected function getValue($column, $name) + { + $sth = $this->dbh->prepare('SELECT '.$column.' FROM templates WHERE name = :name'); + $sth->execute(array(':name' => (string) $name)); + + return $sth->fetchColumn(); + } + } + +Finally, here is an example on how you can use it:: + + $loader = new DatabaseTwigLoader($dbh); + $twig = new Twig_Environment($loader); + + echo $twig->render('index.twig', array('name' => 'Fabien')); + +Using different Template Sources +-------------------------------- + +This recipe is the continuation of the previous one. Even if you store the +contributed templates in a database, you might want to keep the original/base +templates on the filesystem. When templates can be loaded from different +sources, you need to use the ``Twig_Loader_Chain`` loader. + +As you can see in the previous recipe, we reference the template in the exact +same way as we would have done it with a regular filesystem loader. This is +the key to be able to mix and match templates coming from the database, the +filesystem, or any other loader for that matter: the template name should be a +logical name, and not the path from the filesystem:: + + $loader1 = new DatabaseTwigLoader($dbh); + $loader2 = new Twig_Loader_Array(array( + 'base.twig' => '{% block content %}{% endblock %}', + )); + $loader = new Twig_Loader_Chain(array($loader1, $loader2)); + + $twig = new Twig_Environment($loader); + + echo $twig->render('index.twig', array('name' => 'Fabien')); + +Now that the ``base.twig`` templates is defined in an array loader, you can +remove it from the database, and everything else will still work as before. + +Loading a Template from a String +-------------------------------- + +From a template, you can easily load a template stored in a string via the +``template_from_string`` function (available as of Twig 1.11 via the +``Twig_Extension_StringLoader`` extension):: + +.. code-block:: jinja + + {{ include(template_from_string("Hello {{ name }}")) }} + +From PHP, it's also possible to load a template stored in a string via +``Twig_Environment::createTemplate()`` (available as of Twig 1.18):: + + $template = $twig->createTemplate('hello {{ name }}'); + echo $template->render(array('name' => 'Fabien')); + +.. note:: + + Never use the ``Twig_Loader_String`` loader, which has severe limitations. + +.. _callback: http://www.php.net/manual/en/function.is-callable.php diff --git a/plugins/twig/vendor/twig/twig/doc/tags/autoescape.rst b/plugins/twig/vendor/twig/twig/doc/tags/autoescape.rst new file mode 100644 index 00000000..4208d1a3 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/autoescape.rst @@ -0,0 +1,83 @@ +``autoescape`` +============== + +Whether automatic escaping is enabled or not, you can mark a section of a +template to be escaped or not by using the ``autoescape`` tag: + +.. code-block:: jinja + + {# The following syntax works as of Twig 1.8 -- see the note below for previous versions #} + + {% autoescape %} + Everything will be automatically escaped in this block + using the HTML strategy + {% endautoescape %} + + {% autoescape 'html' %} + Everything will be automatically escaped in this block + using the HTML strategy + {% endautoescape %} + + {% autoescape 'js' %} + Everything will be automatically escaped in this block + using the js escaping strategy + {% endautoescape %} + + {% autoescape false %} + Everything will be outputted as is in this block + {% endautoescape %} + +.. note:: + + Before Twig 1.8, the syntax was different: + + .. code-block:: jinja + + {% autoescape true %} + Everything will be automatically escaped in this block + using the HTML strategy + {% endautoescape %} + + {% autoescape false %} + Everything will be outputted as is in this block + {% endautoescape %} + + {% autoescape true js %} + Everything will be automatically escaped in this block + using the js escaping strategy + {% endautoescape %} + +When automatic escaping is enabled everything is escaped by default except for +values explicitly marked as safe. Those can be marked in the template by using +the :doc:`raw<../filters/raw>` filter: + +.. code-block:: jinja + + {% autoescape %} + {{ safe_value|raw }} + {% endautoescape %} + +Functions returning template data (like :doc:`macros` and +:doc:`parent<../functions/parent>`) always return safe markup. + +.. note:: + + Twig is smart enough to not escape an already escaped value by the + :doc:`escape<../filters/escape>` filter. + +.. note:: + + Twig does not escape static expressions: + + .. code-block:: jinja + + {% set hello = "Hello" %} + {{ hello }} + {{ "world" }} + + Will be rendered "Hello **world**". + +.. note:: + + The chapter :doc:`Twig for Developers<../api>` gives more information + about when and how automatic escaping is applied. diff --git a/plugins/twig/vendor/twig/twig/doc/tags/block.rst b/plugins/twig/vendor/twig/twig/doc/tags/block.rst new file mode 100644 index 00000000..e3804823 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/block.rst @@ -0,0 +1,11 @@ +``block`` +========= + +Blocks are used for inheritance and act as placeholders and replacements at +the same time. They are documented in detail in the documentation for the +:doc:`extends<../tags/extends>` tag. + +Block names should consist of alphanumeric characters, and underscores. Dashes +are not permitted. + +.. seealso:: :doc:`block<../functions/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>`, :doc:`extends<../tags/extends>` diff --git a/plugins/twig/vendor/twig/twig/doc/tags/do.rst b/plugins/twig/vendor/twig/twig/doc/tags/do.rst new file mode 100644 index 00000000..1c344e30 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/do.rst @@ -0,0 +1,12 @@ +``do`` +====== + +.. versionadded:: 1.5 + The ``do`` tag was added in Twig 1.5. + +The ``do`` tag works exactly like the regular variable expression (``{{ ... +}}``) just that it doesn't print anything: + +.. code-block:: jinja + + {% do 1 + 2 %} diff --git a/plugins/twig/vendor/twig/twig/doc/tags/embed.rst b/plugins/twig/vendor/twig/twig/doc/tags/embed.rst new file mode 100644 index 00000000..5a6a0299 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/embed.rst @@ -0,0 +1,178 @@ +``embed`` +========= + +.. versionadded:: 1.8 + The ``embed`` tag was added in Twig 1.8. + +The ``embed`` tag combines the behaviour of :doc:`include` and +:doc:`extends`. +It allows you to include another template's contents, just like ``include`` +does. But it also allows you to override any block defined inside the +included template, like when extending a template. + +Think of an embedded template as a "micro layout skeleton". + +.. code-block:: jinja + + {% embed "teasers_skeleton.twig" %} + {# These blocks are defined in "teasers_skeleton.twig" #} + {# and we override them right here: #} + {% block left_teaser %} + Some content for the left teaser box + {% endblock %} + {% block right_teaser %} + Some content for the right teaser box + {% endblock %} + {% endembed %} + +The ``embed`` tag takes the idea of template inheritance to the level of +content fragments. While template inheritance allows for "document skeletons", +which are filled with life by child templates, the ``embed`` tag allows you to +create "skeletons" for smaller units of content and re-use and fill them +anywhere you like. + +Since the use case may not be obvious, let's look at a simplified example. +Imagine a base template shared by multiple HTML pages, defining a single block +named "content": + +.. code-block:: text + + ┌─── page layout ─────────────────────┐ + │ │ + │ ┌── block "content" ──┐ │ + │ │ │ │ + │ │ │ │ + │ │ (child template to │ │ + │ │ put content here) │ │ + │ │ │ │ + │ │ │ │ + │ └─────────────────────┘ │ + │ │ + └─────────────────────────────────────┘ + +Some pages ("foo" and "bar") share the same content structure - +two vertically stacked boxes: + +.. code-block:: text + + ┌─── page layout ─────────────────────┐ + │ │ + │ ┌── block "content" ──┐ │ + │ │ ┌─ block "top" ───┐ │ │ + │ │ │ │ │ │ + │ │ └─────────────────┘ │ │ + │ │ ┌─ block "bottom" ┐ │ │ + │ │ │ │ │ │ + │ │ └─────────────────┘ │ │ + │ └─────────────────────┘ │ + │ │ + └─────────────────────────────────────┘ + +While other pages ("boom" and "baz") share a different content structure - +two boxes side by side: + +.. code-block:: text + + ┌─── page layout ─────────────────────┐ + │ │ + │ ┌── block "content" ──┐ │ + │ │ │ │ + │ │ ┌ block ┐ ┌ block ┐ │ │ + │ │ │"left" │ │"right"│ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ └───────┘ └───────┘ │ │ + │ └─────────────────────┘ │ + │ │ + └─────────────────────────────────────┘ + +Without the ``embed`` tag, you have two ways to design your templates: + + * Create two "intermediate" base templates that extend the master layout + template: one with vertically stacked boxes to be used by the "foo" and + "bar" pages and another one with side-by-side boxes for the "boom" and + "baz" pages. + + * Embed the markup for the top/bottom and left/right boxes into each page + template directly. + +These two solutions do not scale well because they each have a major drawback: + + * The first solution may indeed work for this simplified example. But imagine + we add a sidebar, which may again contain different, recurring structures + of content. Now we would need to create intermediate base templates for + all occurring combinations of content structure and sidebar structure... + and so on. + + * The second solution involves duplication of common code with all its negative + consequences: any change involves finding and editing all affected copies + of the structure, correctness has to be verified for each copy, copies may + go out of sync by careless modifications etc. + +In such a situation, the ``embed`` tag comes in handy. The common layout +code can live in a single base template, and the two different content structures, +let's call them "micro layouts" go into separate templates which are embedded +as necessary: + +Page template ``foo.twig``: + +.. code-block:: jinja + + {% extends "layout_skeleton.twig" %} + + {% block content %} + {% embed "vertical_boxes_skeleton.twig" %} + {% block top %} + Some content for the top box + {% endblock %} + + {% block bottom %} + Some content for the bottom box + {% endblock %} + {% endembed %} + {% endblock %} + +And here is the code for ``vertical_boxes_skeleton.twig``: + +.. code-block:: html+jinja + +
+ {% block top %} + Top box default content + {% endblock %} +
+ +
+ {% block bottom %} + Bottom box default content + {% endblock %} +
+ +The goal of the ``vertical_boxes_skeleton.twig`` template being to factor +out the HTML markup for the boxes. + +The ``embed`` tag takes the exact same arguments as the ``include`` tag: + +.. code-block:: jinja + + {% embed "base" with {'foo': 'bar'} %} + ... + {% endembed %} + + {% embed "base" with {'foo': 'bar'} only %} + ... + {% endembed %} + + {% embed "base" ignore missing %} + ... + {% endembed %} + +.. warning:: + + As embedded templates do not have "names", auto-escaping strategies based + on the template "filename" won't work as expected if you change the + context (for instance, if you embed a CSS/JavaScript template into an HTML + one). In that case, explicitly set the default auto-escaping strategy with + the ``autoescape`` tag. + +.. seealso:: :doc:`include<../tags/include>` diff --git a/plugins/twig/vendor/twig/twig/doc/tags/extends.rst b/plugins/twig/vendor/twig/twig/doc/tags/extends.rst new file mode 100644 index 00000000..1ad2b12b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/extends.rst @@ -0,0 +1,268 @@ +``extends`` +=========== + +The ``extends`` tag can be used to extend a template from another one. + +.. note:: + + Like PHP, Twig does not support multiple inheritance. So you can only have + one extends tag called per rendering. However, Twig supports horizontal + :doc:`reuse`. + +Let's define a base template, ``base.html``, which defines a simple HTML +skeleton document: + +.. code-block:: html+jinja + + + + + {% block head %} + + {% block title %}{% endblock %} - My Webpage + {% endblock %} + + +
{% block content %}{% endblock %}
+ + + + +In this example, the :doc:`block` tags define four blocks that child +templates can fill in. + +All the ``block`` tag does is to tell the template engine that a child +template may override those portions of the template. + +Child Template +-------------- + +A child template might look like this: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block title %}Index{% endblock %} + {% block head %} + {{ parent() }} + + {% endblock %} + {% block content %} +

Index

+

+ Welcome on my awesome homepage. +

+ {% endblock %} + +The ``extends`` tag is the key here. It tells the template engine that this +template "extends" another template. When the template system evaluates this +template, first it locates the parent. The extends tag should be the first tag +in the template. + +Note that since the child template doesn't define the ``footer`` block, the +value from the parent template is used instead. + +You can't define multiple ``block`` tags with the same name in the same +template. This limitation exists because a block tag works in "both" +directions. That is, a block tag doesn't just provide a hole to fill - it also +defines the content that fills the hole in the *parent*. If there were two +similarly-named ``block`` tags in a template, that template's parent wouldn't +know which one of the blocks' content to use. + +If you want to print a block multiple times you can however use the +``block`` function: + +.. code-block:: jinja + + {% block title %}{% endblock %} +

{{ block('title') }}

+ {% block body %}{% endblock %} + +Parent Blocks +------------- + +It's possible to render the contents of the parent block by using the +:doc:`parent<../functions/parent>` function. This gives back the results of +the parent block: + +.. code-block:: jinja + + {% block sidebar %} +

Table Of Contents

+ ... + {{ parent() }} + {% endblock %} + +Named Block End-Tags +-------------------- + +Twig allows you to put the name of the block after the end tag for better +readability: + +.. code-block:: jinja + + {% block sidebar %} + {% block inner_sidebar %} + ... + {% endblock inner_sidebar %} + {% endblock sidebar %} + +Of course, the name after the ``endblock`` word must match the block name. + +Block Nesting and Scope +----------------------- + +Blocks can be nested for more complex layouts. Per default, blocks have access +to variables from outer scopes: + +.. code-block:: jinja + + {% for item in seq %} +
  • {% block loop_item %}{{ item }}{% endblock %}
  • + {% endfor %} + +Block Shortcuts +--------------- + +For blocks with few content, it's possible to use a shortcut syntax. The +following constructs do the same: + +.. code-block:: jinja + + {% block title %} + {{ page_title|title }} + {% endblock %} + +.. code-block:: jinja + + {% block title page_title|title %} + +Dynamic Inheritance +------------------- + +Twig supports dynamic inheritance by using a variable as the base template: + +.. code-block:: jinja + + {% extends some_var %} + +If the variable evaluates to a ``Twig_Template`` object, Twig will use it as +the parent template:: + + // {% extends layout %} + + $layout = $twig->loadTemplate('some_layout_template.twig'); + + $twig->display('template.twig', array('layout' => $layout)); + +.. versionadded:: 1.2 + The possibility to pass an array of templates has been added in Twig 1.2. + +You can also provide a list of templates that are checked for existence. The +first template that exists will be used as a parent: + +.. code-block:: jinja + + {% extends ['layout.html', 'base_layout.html'] %} + +Conditional Inheritance +----------------------- + +As the template name for the parent can be any valid Twig expression, it's +possible to make the inheritance mechanism conditional: + +.. code-block:: jinja + + {% extends standalone ? "minimum.html" : "base.html" %} + +In this example, the template will extend the "minimum.html" layout template +if the ``standalone`` variable evaluates to ``true``, and "base.html" +otherwise. + +How do blocks work? +------------------- + +A block provides a way to change how a certain part of a template is rendered +but it does not interfere in any way with the logic around it. + +Let's take the following example to illustrate how a block works and more +importantly, how it does not work: + +.. code-block:: jinja + + {# base.twig #} + + {% for post in posts %} + {% block post %} +

    {{ post.title }}

    +

    {{ post.body }}

    + {% endblock %} + {% endfor %} + +If you render this template, the result would be exactly the same with or +without the ``block`` tag. The ``block`` inside the ``for`` loop is just a way +to make it overridable by a child template: + +.. code-block:: jinja + + {# child.twig #} + + {% extends "base.twig" %} + + {% block post %} +
    +
    {{ post.title }}
    +
    {{ post.text }}
    +
    + {% endblock %} + +Now, when rendering the child template, the loop is going to use the block +defined in the child template instead of the one defined in the base one; the +executed template is then equivalent to the following one: + +.. code-block:: jinja + + {% for post in posts %} +
    +
    {{ post.title }}
    +
    {{ post.text }}
    +
    + {% endfor %} + +Let's take another example: a block included within an ``if`` statement: + +.. code-block:: jinja + + {% if posts is empty %} + {% block head %} + {{ parent() }} + + + {% endblock head %} + {% endif %} + +Contrary to what you might think, this template does not define a block +conditionally; it just makes overridable by a child template the output of +what will be rendered when the condition is ``true``. + +If you want the output to be displayed conditionally, use the following +instead: + +.. code-block:: jinja + + {% block head %} + {{ parent() }} + + {% if posts is empty %} + + {% endif %} + {% endblock head %} + +.. seealso:: :doc:`block<../functions/block>`, :doc:`block<../tags/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>` diff --git a/plugins/twig/vendor/twig/twig/doc/tags/filter.rst b/plugins/twig/vendor/twig/twig/doc/tags/filter.rst new file mode 100644 index 00000000..82ca5c62 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/filter.rst @@ -0,0 +1,21 @@ +``filter`` +========== + +Filter sections allow you to apply regular Twig filters on a block of template +data. Just wrap the code in the special ``filter`` section: + +.. code-block:: jinja + + {% filter upper %} + This text becomes uppercase + {% endfilter %} + +You can also chain filters: + +.. code-block:: jinja + + {% filter lower|escape %} + SOME TEXT + {% endfilter %} + + {# outputs "<strong>some text</strong>" #} diff --git a/plugins/twig/vendor/twig/twig/doc/tags/flush.rst b/plugins/twig/vendor/twig/twig/doc/tags/flush.rst new file mode 100644 index 00000000..55ef593a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/flush.rst @@ -0,0 +1,17 @@ +``flush`` +========= + +.. versionadded:: 1.5 + The flush tag was added in Twig 1.5. + +The ``flush`` tag tells Twig to flush the output buffer: + +.. code-block:: jinja + + {% flush %} + +.. note:: + + Internally, Twig uses the PHP `flush`_ function. + +.. _`flush`: http://php.net/flush diff --git a/plugins/twig/vendor/twig/twig/doc/tags/for.rst b/plugins/twig/vendor/twig/twig/doc/tags/for.rst new file mode 100644 index 00000000..0673b551 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/for.rst @@ -0,0 +1,172 @@ +``for`` +======= + +Loop over each item in a sequence. For example, to display a list of users +provided in a variable called ``users``: + +.. code-block:: jinja + +

    Members

    +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + +.. note:: + + A sequence can be either an array or an object implementing the + ``Traversable`` interface. + +If you do need to iterate over a sequence of numbers, you can use the ``..`` +operator: + +.. code-block:: jinja + + {% for i in 0..10 %} + * {{ i }} + {% endfor %} + +The above snippet of code would print all numbers from 0 to 10. + +It can be also useful with letters: + +.. code-block:: jinja + + {% for letter in 'a'..'z' %} + * {{ letter }} + {% endfor %} + +The ``..`` operator can take any expression at both sides: + +.. code-block:: jinja + + {% for letter in 'a'|upper..'z'|upper %} + * {{ letter }} + {% endfor %} + +.. tip: + + If you need a step different from 1, you can use the ``range`` function + instead. + +The `loop` variable +------------------- + +Inside of a ``for`` loop block you can access some special variables: + +===================== ============================================================= +Variable Description +===================== ============================================================= +``loop.index`` The current iteration of the loop. (1 indexed) +``loop.index0`` The current iteration of the loop. (0 indexed) +``loop.revindex`` The number of iterations from the end of the loop (1 indexed) +``loop.revindex0`` The number of iterations from the end of the loop (0 indexed) +``loop.first`` True if first iteration +``loop.last`` True if last iteration +``loop.length`` The number of items in the sequence +``loop.parent`` The parent context +===================== ============================================================= + +.. code-block:: jinja + + {% for user in users %} + {{ loop.index }} - {{ user.username }} + {% endfor %} + +.. note:: + + The ``loop.length``, ``loop.revindex``, ``loop.revindex0``, and + ``loop.last`` variables are only available for PHP arrays, or objects that + implement the ``Countable`` interface. They are also not available when + looping with a condition. + +.. versionadded:: 1.2 + The ``if`` modifier support has been added in Twig 1.2. + +Adding a condition +------------------ + +Unlike in PHP, it's not possible to ``break`` or ``continue`` in a loop. You +can however filter the sequence during iteration which allows you to skip +items. The following example skips all the users which are not active: + +.. code-block:: jinja + +
      + {% for user in users if user.active %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + +The advantage is that the special loop variable will count correctly thus not +counting the users not iterated over. Keep in mind that properties like +``loop.last`` will not be defined when using loop conditions. + +.. note:: + + Using the ``loop`` variable within the condition is not recommended as it + will probably not be doing what you expect it to. For instance, adding a + condition like ``loop.index > 4`` won't work as the index is only + incremented when the condition is true (so the condition will never + match). + +The `else` Clause +----------------- + +If no iteration took place because the sequence was empty, you can render a +replacement block by using ``else``: + +.. code-block:: jinja + +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% else %} +
    • no user found
    • + {% endfor %} +
    + +Iterating over Keys +------------------- + +By default, a loop iterates over the values of the sequence. You can iterate +on keys by using the ``keys`` filter: + +.. code-block:: jinja + +

    Members

    +
      + {% for key in users|keys %} +
    • {{ key }}
    • + {% endfor %} +
    + +Iterating over Keys and Values +------------------------------ + +You can also access both keys and values: + +.. code-block:: jinja + +

    Members

    +
      + {% for key, user in users %} +
    • {{ key }}: {{ user.username|e }}
    • + {% endfor %} +
    + +Iterating over a Subset +----------------------- + +You might want to iterate over a subset of values. This can be achieved using +the :doc:`slice <../filters/slice>` filter: + +.. code-block:: jinja + +

    Top Ten Members

    +
      + {% for user in users|slice(0, 10) %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    diff --git a/plugins/twig/vendor/twig/twig/doc/tags/from.rst b/plugins/twig/vendor/twig/twig/doc/tags/from.rst new file mode 100644 index 00000000..39334fdd --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/from.rst @@ -0,0 +1,8 @@ +``from`` +======== + +The ``from`` tag imports :doc:`macro<../tags/macro>` names into the current +namespace. The tag is documented in detail in the documentation for the +:doc:`import<../tags/import>` tag. + +.. seealso:: :doc:`macro<../tags/macro>`, :doc:`import<../tags/import>` diff --git a/plugins/twig/vendor/twig/twig/doc/tags/if.rst b/plugins/twig/vendor/twig/twig/doc/tags/if.rst new file mode 100644 index 00000000..12edf980 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/if.rst @@ -0,0 +1,76 @@ +``if`` +====== + +The ``if`` statement in Twig is comparable with the if statements of PHP. + +In the simplest form you can use it to test if an expression evaluates to +``true``: + +.. code-block:: jinja + + {% if online == false %} +

    Our website is in maintenance mode. Please, come back later.

    + {% endif %} + +You can also test if an array is not empty: + +.. code-block:: jinja + + {% if users %} +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + {% endif %} + +.. note:: + + If you want to test if the variable is defined, use ``if users is + defined`` instead. + +You can also use ``not`` to check for values that evaluate to ``false``: + +.. code-block:: jinja + + {% if not user.subscribed %} +

    You are not subscribed to our mailing list.

    + {% endif %} + +For multiple conditions, ``and`` and ``or`` can be used: + +.. code-block:: jinja + + {% if temperature > 18 and temperature < 27 %} +

    It's a nice day for a walk in the park.

    + {% endif %} + +For multiple branches ``elseif`` and ``else`` can be used like in PHP. You can +use more complex ``expressions`` there too: + +.. code-block:: jinja + + {% if kenny.sick %} + Kenny is sick. + {% elseif kenny.dead %} + You killed Kenny! You bastard!!! + {% else %} + Kenny looks okay --- so far + {% endif %} + +.. note:: + + The rules to determine if an expression is ``true`` or ``false`` are the + same as in PHP; here are the edge cases rules: + + ====================== ==================== + Value Boolean evaluation + ====================== ==================== + empty string false + numeric zero false + whitespace-only string true + empty array false + null false + non-empty array true + object true + ====================== ==================== diff --git a/plugins/twig/vendor/twig/twig/doc/tags/import.rst b/plugins/twig/vendor/twig/twig/doc/tags/import.rst new file mode 100644 index 00000000..21a1e198 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/import.rst @@ -0,0 +1,57 @@ +``import`` +========== + +Twig supports putting often used code into :doc:`macros<../tags/macro>`. These +macros can go into different templates and get imported from there. + +There are two ways to import templates. You can import the complete template +into a variable or request specific macros from it. + +Imagine we have a helper module that renders forms (called ``forms.html``): + +.. code-block:: jinja + + {% macro input(name, value, type, size) %} + + {% endmacro %} + + {% macro textarea(name, value, rows, cols) %} + + {% endmacro %} + +The easiest and most flexible is importing the whole module into a variable. +That way you can access the attributes: + +.. code-block:: jinja + + {% import 'forms.html' as forms %} + +
    +
    Username
    +
    {{ forms.input('username') }}
    +
    Password
    +
    {{ forms.input('password', null, 'password') }}
    +
    +

    {{ forms.textarea('comment') }}

    + +Alternatively you can import names from the template into the current +namespace: + +.. code-block:: jinja + + {% from 'forms.html' import input as input_field, textarea %} + +
    +
    Username
    +
    {{ input_field('username') }}
    +
    Password
    +
    {{ input_field('password', '', 'password') }}
    +
    +

    {{ textarea('comment') }}

    + +.. tip:: + + To import macros from the current file, use the special ``_self`` variable + for the source. + +.. seealso:: :doc:`macro<../tags/macro>`, :doc:`from<../tags/from>` diff --git a/plugins/twig/vendor/twig/twig/doc/tags/include.rst b/plugins/twig/vendor/twig/twig/doc/tags/include.rst new file mode 100644 index 00000000..da18dc65 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/include.rst @@ -0,0 +1,86 @@ +``include`` +=========== + +The ``include`` statement includes a template and returns the rendered content +of that file into the current namespace: + +.. code-block:: jinja + + {% include 'header.html' %} + Body + {% include 'footer.html' %} + +Included templates have access to the variables of the active context. + +If you are using the filesystem loader, the templates are looked for in the +paths defined by it. + +You can add additional variables by passing them after the ``with`` keyword: + +.. code-block:: jinja + + {# template.html will have access to the variables from the current context and the additional ones provided #} + {% include 'template.html' with {'foo': 'bar'} %} + + {% set vars = {'foo': 'bar'} %} + {% include 'template.html' with vars %} + +You can disable access to the context by appending the ``only`` keyword: + +.. code-block:: jinja + + {# only the foo variable will be accessible #} + {% include 'template.html' with {'foo': 'bar'} only %} + +.. code-block:: jinja + + {# no variables will be accessible #} + {% include 'template.html' only %} + +.. tip:: + + When including a template created by an end user, you should consider + sandboxing it. More information in the :doc:`Twig for Developers<../api>` + chapter and in the :doc:`sandbox<../tags/sandbox>` tag documentation. + +The template name can be any valid Twig expression: + +.. code-block:: jinja + + {% include some_var %} + {% include ajax ? 'ajax.html' : 'not_ajax.html' %} + +And if the expression evaluates to a ``Twig_Template`` object, Twig will use it +directly:: + + // {% include template %} + + $template = $twig->loadTemplate('some_template.twig'); + + $twig->loadTemplate('template.twig')->display(array('template' => $template)); + +.. versionadded:: 1.2 + The ``ignore missing`` feature has been added in Twig 1.2. + +You can mark an include with ``ignore missing`` in which case Twig will ignore +the statement if the template to be included does not exist. It has to be +placed just after the template name. Here some valid examples: + +.. code-block:: jinja + + {% include 'sidebar.html' ignore missing %} + {% include 'sidebar.html' ignore missing with {'foo': 'bar'} %} + {% include 'sidebar.html' ignore missing only %} + +.. versionadded:: 1.2 + The possibility to pass an array of templates has been added in Twig 1.2. + +You can also provide a list of templates that are checked for existence before +inclusion. The first template that exists will be included: + +.. code-block:: jinja + + {% include ['page_detailed.html', 'page.html'] %} + +If ``ignore missing`` is given, it will fall back to rendering nothing if none +of the templates exist, otherwise it will throw an exception. diff --git a/plugins/twig/vendor/twig/twig/doc/tags/index.rst b/plugins/twig/vendor/twig/twig/doc/tags/index.rst new file mode 100644 index 00000000..e6a632b7 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/index.rst @@ -0,0 +1,24 @@ +Tags +==== + +.. toctree:: + :maxdepth: 1 + + autoescape + block + do + embed + extends + filter + flush + for + from + if + import + include + macro + sandbox + set + spaceless + use + verbatim diff --git a/plugins/twig/vendor/twig/twig/doc/tags/macro.rst b/plugins/twig/vendor/twig/twig/doc/tags/macro.rst new file mode 100644 index 00000000..60a1567d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/macro.rst @@ -0,0 +1,86 @@ +``macro`` +========= + +Macros are comparable with functions in regular programming languages. They +are useful to put often used HTML idioms into reusable elements to not repeat +yourself. + +Here is a small example of a macro that renders a form element: + +.. code-block:: jinja + + {% macro input(name, value, type, size) %} + + {% endmacro %} + +Macros differs from native PHP functions in a few ways: + +* Default argument values are defined by using the ``default`` filter in the + macro body; + +* Arguments of a macro are always optional. + +* If extra positional arguments are passed to a macro, they end up in the + special ``varargs`` variable as a list of values. + +But as with PHP functions, macros don't have access to the current template +variables. + +.. tip:: + + You can pass the whole context as an argument by using the special + ``_context`` variable. + +Macros can be defined in any template, and need to be "imported" before being +used (see the documentation for the :doc:`import<../tags/import>` tag for more +information): + +.. code-block:: jinja + + {% import "forms.html" as forms %} + +The above ``import`` call imports the "forms.html" file (which can contain only +macros, or a template and some macros), and import the functions as items of +the ``forms`` variable. + +The macro can then be called at will: + +.. code-block:: jinja + +

    {{ forms.input('username') }}

    +

    {{ forms.input('password', null, 'password') }}

    + +If macros are defined and used in the same template, you can use the +special ``_self`` variable to import them: + +.. code-block:: jinja + + {% import _self as forms %} + +

    {{ forms.input('username') }}

    + +.. warning:: + + When you define a macro in the template where you are going to use it, you + might be tempted to call the macro directly via ``_self.input()`` instead + of importing it; even if seems to work, this is just a side-effect of the + current implementation and it won't work anymore in Twig 2.x. + +When you want to use a macro in another macro from the same file, you need to +import it locally: + +.. code-block:: jinja + + {% macro input(name, value, type, size) %} + + {% endmacro %} + + {% macro wrapped_input(name, value, type, size) %} + {% import _self as forms %} + +
    + {{ forms.input(name, value, type, size) }} +
    + {% endmacro %} + +.. seealso:: :doc:`from<../tags/from>`, :doc:`import<../tags/import>` diff --git a/plugins/twig/vendor/twig/twig/doc/tags/sandbox.rst b/plugins/twig/vendor/twig/twig/doc/tags/sandbox.rst new file mode 100644 index 00000000..e186726c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/sandbox.rst @@ -0,0 +1,30 @@ +``sandbox`` +=========== + +The ``sandbox`` tag can be used to enable the sandboxing mode for an included +template, when sandboxing is not enabled globally for the Twig environment: + +.. code-block:: jinja + + {% sandbox %} + {% include 'user.html' %} + {% endsandbox %} + +.. warning:: + + The ``sandbox`` tag is only available when the sandbox extension is + enabled (see the :doc:`Twig for Developers<../api>` chapter). + +.. note:: + + The ``sandbox`` tag can only be used to sandbox an include tag and it + cannot be used to sandbox a section of a template. The following example + won't work: + + .. code-block:: jinja + + {% sandbox %} + {% for i in 1..2 %} + {{ i }} + {% endfor %} + {% endsandbox %} diff --git a/plugins/twig/vendor/twig/twig/doc/tags/set.rst b/plugins/twig/vendor/twig/twig/doc/tags/set.rst new file mode 100644 index 00000000..3eba239a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/set.rst @@ -0,0 +1,78 @@ +``set`` +======= + +Inside code blocks you can also assign values to variables. Assignments use +the ``set`` tag and can have multiple targets. + +Here is how you can assign the ``bar`` value to the ``foo`` variable: + +.. code-block:: jinja + + {% set foo = 'bar' %} + +After the ``set`` call, the ``foo`` variable is available in the template like +any other ones: + +.. code-block:: jinja + + {# displays bar #} + {{ foo }} + +The assigned value can be any valid :ref:`Twig expressions +`: + +.. code-block:: jinja + + {% set foo = [1, 2] %} + {% set foo = {'foo': 'bar'} %} + {% set foo = 'foo' ~ 'bar' %} + +Several variables can be assigned in one block: + +.. code-block:: jinja + + {% set foo, bar = 'foo', 'bar' %} + + {# is equivalent to #} + + {% set foo = 'foo' %} + {% set bar = 'bar' %} + +The ``set`` tag can also be used to 'capture' chunks of text: + +.. code-block:: jinja + + {% set foo %} + + {% endset %} + +.. caution:: + + If you enable automatic output escaping, Twig will only consider the + content to be safe when capturing chunks of text. + +.. note:: + + Note that loops are scoped in Twig; therefore a variable declared inside a + ``for`` loop is not accessible outside the loop itself: + + .. code-block:: jinja + + {% for item in list %} + {% set foo = item %} + {% endfor %} + + {# foo is NOT available #} + + If you want to access the variable, just declare it before the loop: + + .. code-block:: jinja + + {% set foo = "" %} + {% for item in list %} + {% set foo = item %} + {% endfor %} + + {# foo is available #} diff --git a/plugins/twig/vendor/twig/twig/doc/tags/spaceless.rst b/plugins/twig/vendor/twig/twig/doc/tags/spaceless.rst new file mode 100644 index 00000000..b39cb27e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/spaceless.rst @@ -0,0 +1,37 @@ +``spaceless`` +============= + +Use the ``spaceless`` tag to remove whitespace *between HTML tags*, not +whitespace within HTML tags or whitespace in plain text: + +.. code-block:: jinja + + {% spaceless %} +
    + foo +
    + {% endspaceless %} + + {# output will be
    foo
    #} + +This tag is not meant to "optimize" the size of the generated HTML content but +merely to avoid extra whitespace between HTML tags to avoid browser rendering +quirks under some circumstances. + +.. tip:: + + If you want to optimize the size of the generated HTML content, gzip + compress the output instead. + +.. tip:: + + If you want to create a tag that actually removes all extra whitespace in + an HTML string, be warned that this is not as easy as it seems to be + (think of ``textarea`` or ``pre`` tags for instance). Using a third-party + library like Tidy is probably a better idea. + +.. tip:: + + For more information on whitespace control, read the + :ref:`dedicated section ` of the documentation and learn how + you can also use the whitespace control modifier on your tags. diff --git a/plugins/twig/vendor/twig/twig/doc/tags/use.rst b/plugins/twig/vendor/twig/twig/doc/tags/use.rst new file mode 100644 index 00000000..071b1975 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/use.rst @@ -0,0 +1,124 @@ +``use`` +======= + +.. versionadded:: 1.1 + Horizontal reuse was added in Twig 1.1. + +.. note:: + + Horizontal reuse is an advanced Twig feature that is hardly ever needed in + regular templates. It is mainly used by projects that need to make + template blocks reusable without using inheritance. + +Template inheritance is one of the most powerful Twig's feature but it is +limited to single inheritance; a template can only extend one other template. +This limitation makes template inheritance simple to understand and easy to +debug: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +Horizontal reuse is a way to achieve the same goal as multiple inheritance, +but without the associated complexity: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% use "blocks.html" %} + + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +The ``use`` statement tells Twig to import the blocks defined in +``blocks.html`` into the current template (it's like macros, but for blocks): + +.. code-block:: jinja + + {# blocks.html #} + + {% block sidebar %}{% endblock %} + +In this example, the ``use`` statement imports the ``sidebar`` block into the +main template. The code is mostly equivalent to the following one (the +imported blocks are not outputted automatically): + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block sidebar %}{% endblock %} + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +.. note:: + + The ``use`` tag only imports a template if it does not extend another + template, if it does not define macros, and if the body is empty. But it + can *use* other templates. + +.. note:: + + Because ``use`` statements are resolved independently of the context + passed to the template, the template reference cannot be an expression. + +The main template can also override any imported block. If the template +already defines the ``sidebar`` block, then the one defined in ``blocks.html`` +is ignored. To avoid name conflicts, you can rename imported blocks: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% use "blocks.html" with sidebar as base_sidebar, title as base_title %} + + {% block sidebar %}{% endblock %} + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +.. versionadded:: 1.3 + The ``parent()`` support was added in Twig 1.3. + +The ``parent()`` function automatically determines the correct inheritance +tree, so it can be used when overriding a block defined in an imported +template: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% use "blocks.html" %} + + {% block sidebar %} + {{ parent() }} + {% endblock %} + + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +In this example, ``parent()`` will correctly call the ``sidebar`` block from +the ``blocks.html`` template. + +.. tip:: + + In Twig 1.2, renaming allows you to simulate inheritance by calling the + "parent" block: + + .. code-block:: jinja + + {% extends "base.html" %} + + {% use "blocks.html" with sidebar as parent_sidebar %} + + {% block sidebar %} + {{ block('parent_sidebar') }} + {% endblock %} + +.. note:: + + You can use as many ``use`` statements as you want in any given template. + If two imported templates define the same block, the latest one wins. diff --git a/plugins/twig/vendor/twig/twig/doc/tags/verbatim.rst b/plugins/twig/vendor/twig/twig/doc/tags/verbatim.rst new file mode 100644 index 00000000..fe61ca1b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tags/verbatim.rst @@ -0,0 +1,24 @@ +``verbatim`` +============ + +.. versionadded:: 1.12 + The ``verbatim`` tag was added in Twig 1.12 (it was named ``raw`` before). + +The ``verbatim`` tag marks sections as being raw text that should not be +parsed. For example to put Twig syntax as example into a template you can use +this snippet: + +.. code-block:: jinja + + {% verbatim %} +
      + {% for item in seq %} +
    • {{ item }}
    • + {% endfor %} +
    + {% endverbatim %} + +.. note:: + + The ``verbatim`` tag works in the exact same way as the old ``raw`` tag, + but was renamed to avoid confusion with the ``raw`` filter. \ No newline at end of file diff --git a/plugins/twig/vendor/twig/twig/doc/templates.rst b/plugins/twig/vendor/twig/twig/doc/templates.rst new file mode 100644 index 00000000..36a0a7fa --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/templates.rst @@ -0,0 +1,907 @@ +Twig for Template Designers +=========================== + +This document describes the syntax and semantics of the template engine and +will be most useful as reference to those creating Twig templates. + +Synopsis +-------- + +A template is simply a text file. It can generate any text-based format (HTML, +XML, CSV, LaTeX, etc.). It doesn't have a specific extension, ``.html`` or +``.xml`` are just fine. + +A template contains **variables** or **expressions**, which get replaced with +values when the template is evaluated, and **tags**, which control the logic +of the template. + +Below is a minimal template that illustrates a few basics. We will cover further +details later on: + +.. code-block:: html+jinja + + + + + My Webpage + + + + +

    My Webpage

    + {{ a_variable }} + + + +There are two kinds of delimiters: ``{% ... %}`` and ``{{ ... }}``. The first +one is used to execute statements such as for-loops, the latter prints the +result of an expression to the template. + +IDEs Integration +---------------- + +Many IDEs support syntax highlighting and auto-completion for Twig: + +* *Textmate* via the `Twig bundle`_ +* *Vim* via the `Jinja syntax plugin`_ or the `vim-twig plugin`_ +* *Netbeans* via the `Twig syntax plugin`_ (until 7.1, native as of 7.2) +* *PhpStorm* (native as of 2.1) +* *Eclipse* via the `Twig plugin`_ +* *Sublime Text* via the `Twig bundle`_ +* *GtkSourceView* via the `Twig language definition`_ (used by gedit and other projects) +* *Coda* and *SubEthaEdit* via the `Twig syntax mode`_ +* *Coda 2* via the `other Twig syntax mode`_ +* *Komodo* and *Komodo Edit* via the Twig highlight/syntax check mode +* *Notepad++* via the `Notepad++ Twig Highlighter`_ +* *Emacs* via `web-mode.el`_ +* *Atom* via the `PHP-twig for atom`_ + +Also, `TwigFiddle`_ is an online service that allows you to execute Twig templates +from a browser; it supports all versions of Twig. + +Variables +--------- + +The application passes variables to the templates for manipulation in the +template. Variables may have attributes or elements you can access, +too. The visual representation of a variable depends heavily on the application providing +it. + +You can use a dot (``.``) to access attributes of a variable (methods or +properties of a PHP object, or items of a PHP array), or the so-called +"subscript" syntax (``[]``): + +.. code-block:: jinja + + {{ foo.bar }} + {{ foo['bar'] }} + +When the attribute contains special characters (like ``-`` that would be +interpreted as the minus operator), use the ``attribute`` function instead to +access the variable attribute: + +.. code-block:: jinja + + {# equivalent to the non-working foo.data-foo #} + {{ attribute(foo, 'data-foo') }} + +.. note:: + + It's important to know that the curly braces are *not* part of the + variable but the print statement. When accessing variables inside tags, + don't put the braces around them. + +If a variable or attribute does not exist, you will receive a ``null`` value +when the ``strict_variables`` option is set to ``false``; alternatively, if ``strict_variables`` +is set, Twig will throw an error (see :ref:`environment options`). + +.. sidebar:: Implementation + + For convenience's sake ``foo.bar`` does the following things on the PHP + layer: + + * check if ``foo`` is an array and ``bar`` a valid element; + * if not, and if ``foo`` is an object, check that ``bar`` is a valid property; + * if not, and if ``foo`` is an object, check that ``bar`` is a valid method + (even if ``bar`` is the constructor - use ``__construct()`` instead); + * if not, and if ``foo`` is an object, check that ``getBar`` is a valid method; + * if not, and if ``foo`` is an object, check that ``isBar`` is a valid method; + * if not, return a ``null`` value. + + ``foo['bar']`` on the other hand only works with PHP arrays: + + * check if ``foo`` is an array and ``bar`` a valid element; + * if not, return a ``null`` value. + +.. note:: + + If you want to access a dynamic attribute of a variable, use the + :doc:`attribute` function instead. + +Global Variables +~~~~~~~~~~~~~~~~ + +The following variables are always available in templates: + +* ``_self``: references the current template; +* ``_context``: references the current context; +* ``_charset``: references the current charset. + +Setting Variables +~~~~~~~~~~~~~~~~~ + +You can assign values to variables inside code blocks. Assignments use the +:doc:`set` tag: + +.. code-block:: jinja + + {% set foo = 'foo' %} + {% set foo = [1, 2] %} + {% set foo = {'foo': 'bar'} %} + +Filters +------- + +Variables can be modified by **filters**. Filters are separated from the +variable by a pipe symbol (``|``) and may have optional arguments in +parentheses. Multiple filters can be chained. The output of one filter is +applied to the next. + +The following example removes all HTML tags from the ``name`` and title-cases +it: + +.. code-block:: jinja + + {{ name|striptags|title }} + +Filters that accept arguments have parentheses around the arguments. This +example will join a list by commas: + +.. code-block:: jinja + + {{ list|join(', ') }} + +To apply a filter on a section of code, wrap it in the +:doc:`filter` tag: + +.. code-block:: jinja + + {% filter upper %} + This text becomes uppercase + {% endfilter %} + +Go to the :doc:`filters` page to learn more about built-in +filters. + +Functions +--------- + +Functions can be called to generate content. Functions are called by their +name followed by parentheses (``()``) and may have arguments. + +For instance, the ``range`` function returns a list containing an arithmetic +progression of integers: + +.. code-block:: jinja + + {% for i in range(0, 3) %} + {{ i }}, + {% endfor %} + +Go to the :doc:`functions` page to learn more about the +built-in functions. + +Named Arguments +--------------- + +.. versionadded:: 1.12 + Support for named arguments was added in Twig 1.12. + +.. code-block:: jinja + + {% for i in range(low=1, high=10, step=2) %} + {{ i }}, + {% endfor %} + +Using named arguments makes your templates more explicit about the meaning of +the values you pass as arguments: + +.. code-block:: jinja + + {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }} + + {# versus #} + + {{ data|convert_encoding(from='iso-2022-jp', to='UTF-8') }} + +Named arguments also allow you to skip some arguments for which you don't want +to change the default value: + +.. code-block:: jinja + + {# the first argument is the date format, which defaults to the global date format if null is passed #} + {{ "now"|date(null, "Europe/Paris") }} + + {# or skip the format value by using a named argument for the time zone #} + {{ "now"|date(timezone="Europe/Paris") }} + +You can also use both positional and named arguments in one call, in which +case positional arguments must always come before named arguments: + +.. code-block:: jinja + + {{ "now"|date('d/m/Y H:i', timezone="Europe/Paris") }} + +.. tip:: + + Each function and filter documentation page has a section where the names + of all arguments are listed when supported. + +Control Structure +----------------- + +A control structure refers to all those things that control the flow of a +program - conditionals (i.e. ``if``/``elseif``/``else``), ``for``-loops, as +well as things like blocks. Control structures appear inside ``{% ... %}`` +blocks. + +For example, to display a list of users provided in a variable called +``users``, use the :doc:`for` tag: + +.. code-block:: jinja + +

    Members

    +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + +The :doc:`if` tag can be used to test an expression: + +.. code-block:: jinja + + {% if users|length > 0 %} +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + {% endif %} + +Go to the :doc:`tags` page to learn more about the built-in tags. + +Comments +-------- + +To comment-out part of a line in a template, use the comment syntax ``{# ... +#}``. This is useful for debugging or to add information for other template +designers or yourself: + +.. code-block:: jinja + + {# note: disabled template because we no longer use this + {% for user in users %} + ... + {% endfor %} + #} + +Including other Templates +------------------------- + +The :doc:`include` tag is useful to include a template and +return the rendered content of that template into the current one: + +.. code-block:: jinja + + {% include 'sidebar.html' %} + +Per default included templates are passed the current context. + +The context that is passed to the included template includes variables defined +in the template: + +.. code-block:: jinja + + {% for box in boxes %} + {% include "render_box.html" %} + {% endfor %} + +The included template ``render_box.html`` is able to access ``box``. + +The filename of the template depends on the template loader. For instance, the +``Twig_Loader_Filesystem`` allows you to access other templates by giving the +filename. You can access templates in subdirectories with a slash: + +.. code-block:: jinja + + {% include "sections/articles/sidebar.html" %} + +This behavior depends on the application embedding Twig. + +Template Inheritance +-------------------- + +The most powerful part of Twig is template inheritance. Template inheritance +allows you to build a base "skeleton" template that contains all the common +elements of your site and defines **blocks** that child templates can +override. + +Sounds complicated but it is very basic. It's easier to understand it by +starting with an example. + +Let's define a base template, ``base.html``, which defines a simple HTML +skeleton document that you might use for a simple two-column page: + +.. code-block:: html+jinja + + + + + {% block head %} + + {% block title %}{% endblock %} - My Webpage + {% endblock %} + + +
    {% block content %}{% endblock %}
    + + + + +In this example, the :doc:`block` tags define four blocks that +child templates can fill in. All the ``block`` tag does is to tell the +template engine that a child template may override those portions of the +template. + +A child template might look like this: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block title %}Index{% endblock %} + {% block head %} + {{ parent() }} + + {% endblock %} + {% block content %} +

    Index

    +

    + Welcome to my awesome homepage. +

    + {% endblock %} + +The :doc:`extends` tag is the key here. It tells the template +engine that this template "extends" another template. When the template system +evaluates this template, first it locates the parent. The extends tag should +be the first tag in the template. + +Note that since the child template doesn't define the ``footer`` block, the +value from the parent template is used instead. + +It's possible to render the contents of the parent block by using the +:doc:`parent` function. This gives back the results of the +parent block: + +.. code-block:: jinja + + {% block sidebar %} +

    Table Of Contents

    + ... + {{ parent() }} + {% endblock %} + +.. tip:: + + The documentation page for the :doc:`extends` tag describes + more advanced features like block nesting, scope, dynamic inheritance, and + conditional inheritance. + +.. note:: + + Twig also supports multiple inheritance with the so called horizontal reuse + with the help of the :doc:`use` tag. This is an advanced feature + hardly ever needed in regular templates. + +HTML Escaping +------------- + +When generating HTML from templates, there's always a risk that a variable +will include characters that affect the resulting HTML. There are two +approaches: manually escaping each variable or automatically escaping +everything by default. + +Twig supports both, automatic escaping is enabled by default. + +.. note:: + + Automatic escaping is only supported if the *escaper* extension has been + enabled (which is the default). + +Working with Manual Escaping +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If manual escaping is enabled, it is **your** responsibility to escape +variables if needed. What to escape? Any variable you don't trust. + +Escaping works by piping the variable through the +:doc:`escape` or ``e`` filter: + +.. code-block:: jinja + + {{ user.username|e }} + +By default, the ``escape`` filter uses the ``html`` strategy, but depending on +the escaping context, you might want to explicitly use any other available +strategies: + +.. code-block:: jinja + + {{ user.username|e('js') }} + {{ user.username|e('css') }} + {{ user.username|e('url') }} + {{ user.username|e('html_attr') }} + +Working with Automatic Escaping +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Whether automatic escaping is enabled or not, you can mark a section of a +template to be escaped or not by using the :doc:`autoescape` +tag: + +.. code-block:: jinja + + {% autoescape %} + Everything will be automatically escaped in this block (using the HTML strategy) + {% endautoescape %} + +By default, auto-escaping uses the ``html`` escaping strategy. If you output +variables in other contexts, you need to explicitly escape them with the +appropriate escaping strategy: + +.. code-block:: jinja + + {% autoescape 'js' %} + Everything will be automatically escaped in this block (using the JS strategy) + {% endautoescape %} + +Escaping +-------- + +It is sometimes desirable or even necessary to have Twig ignore parts it would +otherwise handle as variables or blocks. For example if the default syntax is +used and you want to use ``{{`` as raw string in the template and not start a +variable you have to use a trick. + +The easiest way is to output the variable delimiter (``{{``) by using a variable +expression: + +.. code-block:: jinja + + {{ '{{' }} + +For bigger sections it makes sense to mark a block +:doc:`verbatim`. + +Macros +------ + +.. versionadded:: 1.12 + Support for default argument values was added in Twig 1.12. + +Macros are comparable with functions in regular programming languages. They +are useful to reuse often used HTML fragments to not repeat yourself. + +A macro is defined via the :doc:`macro` tag. Here is a small example +(subsequently called ``forms.html``) of a macro that renders a form element: + +.. code-block:: jinja + + {% macro input(name, value, type, size) %} + + {% endmacro %} + +Macros can be defined in any template, and need to be "imported" via the +:doc:`import` tag before being used: + +.. code-block:: jinja + + {% import "forms.html" as forms %} + +

    {{ forms.input('username') }}

    + +Alternatively, you can import individual macro names from a template into the +current namespace via the :doc:`from` tag and optionally alias them: + +.. code-block:: jinja + + {% from 'forms.html' import input as input_field %} + +
    +
    Username
    +
    {{ input_field('username') }}
    +
    Password
    +
    {{ input_field('password', '', 'password') }}
    +
    + +A default value can also be defined for macro arguments when not provided in a +macro call: + +.. code-block:: jinja + + {% macro input(name, value = "", type = "text", size = 20) %} + + {% endmacro %} + +If extra positional arguments are passed to a macro call, they end up in the +special ``varargs`` variable as a list of values. + +.. _twig-expressions: + +Expressions +----------- + +Twig allows expressions everywhere. These work very similar to regular PHP and +even if you're not working with PHP you should feel comfortable with it. + +.. note:: + + The operator precedence is as follows, with the lowest-precedence + operators listed first: ``b-and``, ``b-xor``, ``b-or``, ``or``, ``and``, + ``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``, ``in``, ``matches``, + ``starts with``, ``ends with``, ``..``, ``+``, ``-``, ``~``, ``*``, ``/``, + ``//``, ``%``, ``is``, ``**``, ``|``, ``[]``, and ``.``: + + .. code-block:: jinja + + {% set greeting = 'Hello ' %} + {% set name = 'Fabien' %} + + {{ greeting ~ name|lower }} {# Hello fabien #} + + {# use parenthesis to change precedence #} + {{ (greeting ~ name)|lower }} {# hello fabien #} + +Literals +~~~~~~~~ + +.. versionadded:: 1.5 + Support for hash keys as names and expressions was added in Twig 1.5. + +The simplest form of expressions are literals. Literals are representations +for PHP types such as strings, numbers, and arrays. The following literals +exist: + +* ``"Hello World"``: Everything between two double or single quotes is a + string. They are useful whenever you need a string in the template (for + example as arguments to function calls, filters or just to extend or include + a template). A string can contain a delimiter if it is preceded by a + backslash (``\``) -- like in ``'It\'s good'``. + +* ``42`` / ``42.23``: Integers and floating point numbers are created by just + writing the number down. If a dot is present the number is a float, + otherwise an integer. + +* ``["foo", "bar"]``: Arrays are defined by a sequence of expressions + separated by a comma (``,``) and wrapped with squared brackets (``[]``). + +* ``{"foo": "bar"}``: Hashes are defined by a list of keys and values + separated by a comma (``,``) and wrapped with curly braces (``{}``): + + .. code-block:: jinja + + {# keys as string #} + { 'foo': 'foo', 'bar': 'bar' } + + {# keys as names (equivalent to the previous hash) -- as of Twig 1.5 #} + { foo: 'foo', bar: 'bar' } + + {# keys as integer #} + { 2: 'foo', 4: 'bar' } + + {# keys as expressions (the expression must be enclosed into parentheses) -- as of Twig 1.5 #} + { (1 + 1): 'foo', (a ~ 'b'): 'bar' } + +* ``true`` / ``false``: ``true`` represents the true value, ``false`` + represents the false value. + +* ``null``: ``null`` represents no specific value. This is the value returned + when a variable does not exist. ``none`` is an alias for ``null``. + +Arrays and hashes can be nested: + +.. code-block:: jinja + + {% set foo = [1, {"foo": "bar"}] %} + +.. tip:: + + Using double-quoted or single-quoted strings has no impact on performance + but string interpolation is only supported in double-quoted strings. + +Math +~~~~ + +Twig allows you to calculate with values. This is rarely useful in templates +but exists for completeness' sake. The following operators are supported: + +* ``+``: Adds two objects together (the operands are casted to numbers). ``{{ + 1 + 1 }}`` is ``2``. + +* ``-``: Subtracts the second number from the first one. ``{{ 3 - 2 }}`` is + ``1``. + +* ``/``: Divides two numbers. The returned value will be a floating point + number. ``{{ 1 / 2 }}`` is ``{{ 0.5 }}``. + +* ``%``: Calculates the remainder of an integer division. ``{{ 11 % 7 }}`` is + ``4``. + +* ``//``: Divides two numbers and returns the floored integer result. ``{{ 20 + // 7 }}`` is ``2``, ``{{ -20 // 7 }}`` is ``-3`` (this is just syntactic + sugar for the :doc:`round` filter). + +* ``*``: Multiplies the left operand with the right one. ``{{ 2 * 2 }}`` would + return ``4``. + +* ``**``: Raises the left operand to the power of the right operand. ``{{ 2 ** + 3 }}`` would return ``8``. + +Logic +~~~~~ + +You can combine multiple expressions with the following operators: + +* ``and``: Returns true if the left and the right operands are both true. + +* ``or``: Returns true if the left or the right operand is true. + +* ``not``: Negates a statement. + +* ``(expr)``: Groups an expression. + +.. note:: + + Twig also support bitwise operators (``b-and``, ``b-xor``, and ``b-or``). + +.. note:: + + Operators are case sensitive. + +Comparisons +~~~~~~~~~~~ + +The following comparison operators are supported in any expression: ``==``, +``!=``, ``<``, ``>``, ``>=``, and ``<=``. + +You can also check if a string ``starts with`` or ``ends with`` another +string: + +.. code-block:: jinja + + {% if 'Fabien' starts with 'F' %} + {% endif %} + + {% if 'Fabien' ends with 'n' %} + {% endif %} + +.. note:: + + For complex string comparisons, the ``matches`` operator allows you to use + `regular expressions`_: + + .. code-block:: jinja + + {% if phone matches '/^[\\d\\.]+$/' %} + {% endif %} + +Containment Operator +~~~~~~~~~~~~~~~~~~~~ + +The ``in`` operator performs containment test. + +It returns ``true`` if the left operand is contained in the right: + +.. code-block:: jinja + + {# returns true #} + + {{ 1 in [1, 2, 3] }} + + {{ 'cd' in 'abcde' }} + +.. tip:: + + You can use this filter to perform a containment test on strings, arrays, + or objects implementing the ``Traversable`` interface. + +To perform a negative test, use the ``not in`` operator: + +.. code-block:: jinja + + {% if 1 not in [1, 2, 3] %} + + {# is equivalent to #} + {% if not (1 in [1, 2, 3]) %} + +Test Operator +~~~~~~~~~~~~~ + +The ``is`` operator performs tests. Tests can be used to test a variable against +a common expression. The right operand is name of the test: + +.. code-block:: jinja + + {# find out if a variable is odd #} + + {{ name is odd }} + +Tests can accept arguments too: + +.. code-block:: jinja + + {% if post.status is constant('Post::PUBLISHED') %} + +Tests can be negated by using the ``is not`` operator: + +.. code-block:: jinja + + {% if post.status is not constant('Post::PUBLISHED') %} + + {# is equivalent to #} + {% if not (post.status is constant('Post::PUBLISHED')) %} + +Go to the :doc:`tests` page to learn more about the built-in +tests. + +Other Operators +~~~~~~~~~~~~~~~ + +.. versionadded:: 1.12.0 + Support for the extended ternary operator was added in Twig 1.12.0. + +The following operators don't fit into any of the other categories: + +* ``|``: Applies a filter. + +* ``..``: Creates a sequence based on the operand before and after the operator + (this is just syntactic sugar for the :doc:`range` function): + + .. code-block:: jinja + + {{ 1..5 }} + + {# equivalent to #} + {{ range(1, 5) }} + + Note that you must use parentheses when combining it with the filter operator + due to the :ref:`operator precedence rules `: + + .. code-block:: jinja + + (1..5)|join(', ') + +* ``~``: Converts all operands into strings and concatenates them. ``{{ "Hello + " ~ name ~ "!" }}`` would return (assuming ``name`` is ``'John'``) ``Hello + John!``. + +* ``.``, ``[]``: Gets an attribute of an object. + +* ``?:``: The ternary operator: + + .. code-block:: jinja + + {{ foo ? 'yes' : 'no' }} + + {# as of Twig 1.12.0 #} + {{ foo ?: 'no' }} is the same as {{ foo ? foo : 'no' }} + {{ foo ? 'yes' }} is the same as {{ foo ? 'yes' : '' }} + +* ``??``: The null-coalescing operator: + + .. code-block:: jinja + + {# returns the value of foo if it is defined and not null, 'no' otherwise #} + {{ foo ?? 'no' }} + +String Interpolation +~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.5 + String interpolation was added in Twig 1.5. + +String interpolation (`#{expression}`) allows any valid expression to appear +within a *double-quoted string*. The result of evaluating that expression is +inserted into the string: + +.. code-block:: jinja + + {{ "foo #{bar} baz" }} + {{ "foo #{1 + 2} baz" }} + +.. _templates-whitespace-control: + +Whitespace Control +------------------ + +.. versionadded:: 1.1 + Tag level whitespace control was added in Twig 1.1. + +The first newline after a template tag is removed automatically (like in PHP.) +Whitespace is not further modified by the template engine, so each whitespace +(spaces, tabs, newlines etc.) is returned unchanged. + +Use the ``spaceless`` tag to remove whitespace *between HTML tags*: + +.. code-block:: jinja + + {% spaceless %} +
    + foo bar +
    + {% endspaceless %} + + {# output will be
    foo bar
    #} + +In addition to the spaceless tag you can also control whitespace on a per tag +level. By using the whitespace control modifier on your tags, you can trim +leading and or trailing whitespace: + +.. code-block:: jinja + + {% set value = 'no spaces' %} + {#- No leading/trailing whitespace -#} + {%- if true -%} + {{- value -}} + {%- endif -%} + + {# output 'no spaces' #} + +The above sample shows the default whitespace control modifier, and how you can +use it to remove whitespace around tags. Trimming space will consume all whitespace +for that side of the tag. It is possible to use whitespace trimming on one side +of a tag: + +.. code-block:: jinja + + {% set value = 'no spaces' %} +
  • {{- value }}
  • + + {# outputs '
  • no spaces
  • ' #} + +Extensions +---------- + +Twig can be easily extended. + +If you are looking for new tags, filters, or functions, have a look at the Twig official +`extension repository`_. + +If you want to create your own, read the :ref:`Creating an +Extension` chapter. + +.. _`Twig bundle`: https://github.com/Anomareh/PHP-Twig.tmbundle +.. _`Jinja syntax plugin`: http://jinja.pocoo.org/docs/integration/#vim +.. _`vim-twig plugin`: https://github.com/evidens/vim-twig +.. _`Twig syntax plugin`: http://plugins.netbeans.org/plugin/37069/php-twig +.. _`Twig plugin`: https://github.com/pulse00/Twig-Eclipse-Plugin +.. _`Twig language definition`: https://github.com/gabrielcorpse/gedit-twig-template-language +.. _`extension repository`: http://github.com/twigphp/Twig-extensions +.. _`Twig syntax mode`: https://github.com/bobthecow/Twig-HTML.mode +.. _`other Twig syntax mode`: https://github.com/muxx/Twig-HTML.mode +.. _`Notepad++ Twig Highlighter`: https://github.com/Banane9/notepadplusplus-twig +.. _`web-mode.el`: http://web-mode.org/ +.. _`regular expressions`: http://php.net/manual/en/pcre.pattern.php +.. _`PHP-twig for atom`: https://github.com/reesef/php-twig +.. _`TwigFiddle`: http://twigfiddle.com/ diff --git a/plugins/twig/vendor/twig/twig/doc/tests/constant.rst b/plugins/twig/vendor/twig/twig/doc/tests/constant.rst new file mode 100644 index 00000000..8d0724a8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tests/constant.rst @@ -0,0 +1,22 @@ +``constant`` +============ + +.. versionadded: 1.13.1 + constant now accepts object instances as the second argument. + +``constant`` checks if a variable has the exact same value as a constant. You +can use either global constants or class constants: + +.. code-block:: jinja + + {% if post.status is constant('Post::PUBLISHED') %} + the status attribute is exactly the same as Post::PUBLISHED + {% endif %} + +You can test constants from object instances as well: + +.. code-block:: jinja + + {% if post.status is constant('PUBLISHED', post) %} + the status attribute is exactly the same as Post::PUBLISHED + {% endif %} diff --git a/plugins/twig/vendor/twig/twig/doc/tests/defined.rst b/plugins/twig/vendor/twig/twig/doc/tests/defined.rst new file mode 100644 index 00000000..702ce725 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tests/defined.rst @@ -0,0 +1,30 @@ +``defined`` +=========== + +``defined`` checks if a variable is defined in the current context. This is very +useful if you use the ``strict_variables`` option: + +.. code-block:: jinja + + {# defined works with variable names #} + {% if foo is defined %} + ... + {% endif %} + + {# and attributes on variables names #} + {% if foo.bar is defined %} + ... + {% endif %} + + {% if foo['bar'] is defined %} + ... + {% endif %} + +When using the ``defined`` test on an expression that uses variables in some +method calls, be sure that they are all defined first: + +.. code-block:: jinja + + {% if var is defined and foo.method(var) is defined %} + ... + {% endif %} diff --git a/plugins/twig/vendor/twig/twig/doc/tests/divisibleby.rst b/plugins/twig/vendor/twig/twig/doc/tests/divisibleby.rst new file mode 100644 index 00000000..6c693b2b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tests/divisibleby.rst @@ -0,0 +1,14 @@ +``divisible by`` +================ + +.. versionadded:: 1.14.2 + The ``divisible by`` test was added in Twig 1.14.2 as an alias for + ``divisibleby``. + +``divisible by`` checks if a variable is divisible by a number: + +.. code-block:: jinja + + {% if loop.index is divisible by(3) %} + ... + {% endif %} diff --git a/plugins/twig/vendor/twig/twig/doc/tests/empty.rst b/plugins/twig/vendor/twig/twig/doc/tests/empty.rst new file mode 100644 index 00000000..e5b55999 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tests/empty.rst @@ -0,0 +1,11 @@ +``empty`` +========= + +``empty`` checks if a variable is empty: + +.. code-block:: jinja + + {# evaluates to true if the foo variable is null, false, an empty array, or the empty string #} + {% if foo is empty %} + ... + {% endif %} diff --git a/plugins/twig/vendor/twig/twig/doc/tests/even.rst b/plugins/twig/vendor/twig/twig/doc/tests/even.rst new file mode 100644 index 00000000..6ab5cc39 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tests/even.rst @@ -0,0 +1,10 @@ +``even`` +======== + +``even`` returns ``true`` if the given number is even: + +.. code-block:: jinja + + {{ var is even }} + +.. seealso:: :doc:`odd<../tests/odd>` diff --git a/plugins/twig/vendor/twig/twig/doc/tests/index.rst b/plugins/twig/vendor/twig/twig/doc/tests/index.rst new file mode 100644 index 00000000..c63208ee --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tests/index.rst @@ -0,0 +1,15 @@ +Tests +===== + +.. toctree:: + :maxdepth: 1 + + constant + defined + divisibleby + empty + even + iterable + null + odd + sameas diff --git a/plugins/twig/vendor/twig/twig/doc/tests/iterable.rst b/plugins/twig/vendor/twig/twig/doc/tests/iterable.rst new file mode 100644 index 00000000..89a172f7 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tests/iterable.rst @@ -0,0 +1,19 @@ +``iterable`` +============ + +.. versionadded:: 1.7 + The iterable test was added in Twig 1.7. + +``iterable`` checks if a variable is an array or a traversable object: + +.. code-block:: jinja + + {# evaluates to true if the foo variable is iterable #} + {% if users is iterable %} + {% for user in users %} + Hello {{ user }}! + {% endfor %} + {% else %} + {# users is probably a string #} + Hello {{ users }}! + {% endif %} diff --git a/plugins/twig/vendor/twig/twig/doc/tests/null.rst b/plugins/twig/vendor/twig/twig/doc/tests/null.rst new file mode 100644 index 00000000..44eec62e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tests/null.rst @@ -0,0 +1,12 @@ +``null`` +======== + +``null`` returns ``true`` if the variable is ``null``: + +.. code-block:: jinja + + {{ var is null }} + +.. note:: + + ``none`` is an alias for ``null``. diff --git a/plugins/twig/vendor/twig/twig/doc/tests/odd.rst b/plugins/twig/vendor/twig/twig/doc/tests/odd.rst new file mode 100644 index 00000000..9eece777 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tests/odd.rst @@ -0,0 +1,10 @@ +``odd`` +======= + +``odd`` returns ``true`` if the given number is odd: + +.. code-block:: jinja + + {{ var is odd }} + +.. seealso:: :doc:`even<../tests/even>` diff --git a/plugins/twig/vendor/twig/twig/doc/tests/sameas.rst b/plugins/twig/vendor/twig/twig/doc/tests/sameas.rst new file mode 100644 index 00000000..16f904d5 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/doc/tests/sameas.rst @@ -0,0 +1,14 @@ +``same as`` +=========== + +.. versionadded:: 1.14.2 + The ``same as`` test was added in Twig 1.14.2 as an alias for ``sameas``. + +``same as`` checks if a variable is the same as another variable. +This is the equivalent to ``===`` in PHP: + +.. code-block:: jinja + + {% if foo.attribute is same as(false) %} + the foo attribute really is the 'false' PHP value + {% endif %} diff --git a/plugins/twig/vendor/twig/twig/ext/twig/.gitignore b/plugins/twig/vendor/twig/twig/ext/twig/.gitignore new file mode 100644 index 00000000..56ea76cc --- /dev/null +++ b/plugins/twig/vendor/twig/twig/ext/twig/.gitignore @@ -0,0 +1,30 @@ +*.sw* +.deps +Makefile +Makefile.fragments +Makefile.global +Makefile.objects +acinclude.m4 +aclocal.m4 +build/ +config.cache +config.guess +config.h +config.h.in +config.log +config.nice +config.status +config.sub +configure +configure.in +install-sh +libtool +ltmain.sh +missing +mkinstalldirs +run-tests.php +twig.loT +.libs/ +modules/ +twig.la +twig.lo diff --git a/plugins/twig/vendor/twig/twig/ext/twig/config.m4 b/plugins/twig/vendor/twig/twig/ext/twig/config.m4 new file mode 100644 index 00000000..83486be4 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/ext/twig/config.m4 @@ -0,0 +1,8 @@ +dnl config.m4 for extension twig + +PHP_ARG_ENABLE(twig, whether to enable twig support, +[ --enable-twig Enable twig support]) + +if test "$PHP_TWIG" != "no"; then + PHP_NEW_EXTENSION(twig, twig.c, $ext_shared) +fi diff --git a/plugins/twig/vendor/twig/twig/ext/twig/config.w32 b/plugins/twig/vendor/twig/twig/ext/twig/config.w32 new file mode 100644 index 00000000..cb287b99 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/ext/twig/config.w32 @@ -0,0 +1,8 @@ +// vim:ft=javascript + +ARG_ENABLE("twig", "Twig support", "no"); + +if (PHP_TWIG != "no") { + AC_DEFINE('HAVE_TWIG', 1); + EXTENSION('twig', 'twig.c'); +} diff --git a/plugins/twig/vendor/twig/twig/ext/twig/php_twig.h b/plugins/twig/vendor/twig/twig/ext/twig/php_twig.h new file mode 100644 index 00000000..2973e9d9 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/ext/twig/php_twig.h @@ -0,0 +1,35 @@ +/* + +----------------------------------------------------------------------+ + | Twig Extension | + +----------------------------------------------------------------------+ + | Copyright (c) 2011 Derick Rethans | + +----------------------------------------------------------------------+ + | Redistribution and use in source and binary forms, with or without | + | modification, are permitted provided that the conditions mentioned | + | in the accompanying LICENSE file are met (BSD-3-Clause). | + +----------------------------------------------------------------------+ + | Author: Derick Rethans | + +----------------------------------------------------------------------+ + */ + +#ifndef PHP_TWIG_H +#define PHP_TWIG_H + +#define PHP_TWIG_VERSION "1.24.0" + +#include "php.h" + +extern zend_module_entry twig_module_entry; +#define phpext_twig_ptr &twig_module_entry +#ifndef PHP_WIN32 +zend_module_entry *get_module(void); +#endif + +#ifdef ZTS +#include "TSRM.h" +#endif + +PHP_FUNCTION(twig_template_get_attributes); +PHP_RSHUTDOWN_FUNCTION(twig); + +#endif diff --git a/plugins/twig/vendor/twig/twig/ext/twig/twig.c b/plugins/twig/vendor/twig/twig/ext/twig/twig.c new file mode 100644 index 00000000..92d1addc --- /dev/null +++ b/plugins/twig/vendor/twig/twig/ext/twig/twig.c @@ -0,0 +1,1127 @@ +/* + +----------------------------------------------------------------------+ + | Twig Extension | + +----------------------------------------------------------------------+ + | Copyright (c) 2011 Derick Rethans | + +----------------------------------------------------------------------+ + | Redistribution and use in source and binary forms, with or without | + | modification, are permitted provided that the conditions mentioned | + | in the accompanying LICENSE file are met (BSD-3-Clause). | + +----------------------------------------------------------------------+ + | Author: Derick Rethans | + +----------------------------------------------------------------------+ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "php.h" +#include "php_twig.h" +#include "ext/standard/php_var.h" +#include "ext/standard/php_string.h" +#include "ext/standard/php_smart_str.h" +#include "ext/spl/spl_exceptions.h" + +#include "Zend/zend_object_handlers.h" +#include "Zend/zend_interfaces.h" +#include "Zend/zend_exceptions.h" + +#ifndef Z_ADDREF_P +#define Z_ADDREF_P(pz) (pz)->refcount++ +#endif + +#define FREE_DTOR(z) \ + zval_dtor(z); \ + efree(z); + +#if PHP_VERSION_ID >= 50300 + #define APPLY_TSRMLS_DC TSRMLS_DC + #define APPLY_TSRMLS_CC TSRMLS_CC + #define APPLY_TSRMLS_FETCH() +#else + #define APPLY_TSRMLS_DC + #define APPLY_TSRMLS_CC + #define APPLY_TSRMLS_FETCH() TSRMLS_FETCH() +#endif + +ZEND_BEGIN_ARG_INFO_EX(twig_template_get_attribute_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 6) + ZEND_ARG_INFO(0, template) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, item) + ZEND_ARG_INFO(0, arguments) + ZEND_ARG_INFO(0, type) + ZEND_ARG_INFO(0, isDefinedTest) +ZEND_END_ARG_INFO() + +#ifndef PHP_FE_END +#define PHP_FE_END { NULL, NULL, NULL} +#endif + +static const zend_function_entry twig_functions[] = { + PHP_FE(twig_template_get_attributes, twig_template_get_attribute_args) + PHP_FE_END +}; + +PHP_RSHUTDOWN_FUNCTION(twig) +{ +#if ZEND_DEBUG + CG(unclean_shutdown) = 0; /* get rid of PHPUnit's exit() and report memleaks */ +#endif + return SUCCESS; +} + +zend_module_entry twig_module_entry = { + STANDARD_MODULE_HEADER, + "twig", + twig_functions, + NULL, + NULL, + NULL, + PHP_RSHUTDOWN(twig), + NULL, + PHP_TWIG_VERSION, + STANDARD_MODULE_PROPERTIES +}; + + +#ifdef COMPILE_DL_TWIG +ZEND_GET_MODULE(twig) +#endif + +static int TWIG_ARRAY_KEY_EXISTS(zval *array, zval *key) +{ + if (Z_TYPE_P(array) != IS_ARRAY) { + return 0; + } + + switch (Z_TYPE_P(key)) { + case IS_NULL: + return zend_hash_exists(Z_ARRVAL_P(array), "", 1); + + case IS_BOOL: + case IS_DOUBLE: + convert_to_long(key); + case IS_LONG: + return zend_hash_index_exists(Z_ARRVAL_P(array), Z_LVAL_P(key)); + + default: + convert_to_string(key); + return zend_symtable_exists(Z_ARRVAL_P(array), Z_STRVAL_P(key), Z_STRLEN_P(key) + 1); + } +} + +static int TWIG_INSTANCE_OF(zval *object, zend_class_entry *interface TSRMLS_DC) +{ + if (Z_TYPE_P(object) != IS_OBJECT) { + return 0; + } + return instanceof_function(Z_OBJCE_P(object), interface TSRMLS_CC); +} + +static int TWIG_INSTANCE_OF_USERLAND(zval *object, char *interface TSRMLS_DC) +{ + zend_class_entry **pce; + if (Z_TYPE_P(object) != IS_OBJECT) { + return 0; + } + if (zend_lookup_class(interface, strlen(interface), &pce TSRMLS_CC) == FAILURE) { + return 0; + } + return instanceof_function(Z_OBJCE_P(object), *pce TSRMLS_CC); +} + +static zval *TWIG_GET_ARRAYOBJECT_ELEMENT(zval *object, zval *offset TSRMLS_DC) +{ + zend_class_entry *ce = Z_OBJCE_P(object); + zval *retval; + + if (Z_TYPE_P(object) == IS_OBJECT) { + SEPARATE_ARG_IF_REF(offset); + zend_call_method_with_1_params(&object, ce, NULL, "offsetget", &retval, offset); + + zval_ptr_dtor(&offset); + + if (!retval) { + if (!EG(exception)) { + zend_error(E_ERROR, "Undefined offset for object of type %s used as array", ce->name); + } + return NULL; + } + + return retval; + } + return NULL; +} + +static int TWIG_ISSET_ARRAYOBJECT_ELEMENT(zval *object, zval *offset TSRMLS_DC) +{ + zend_class_entry *ce = Z_OBJCE_P(object); + zval *retval; + + if (Z_TYPE_P(object) == IS_OBJECT) { + SEPARATE_ARG_IF_REF(offset); + zend_call_method_with_1_params(&object, ce, NULL, "offsetexists", &retval, offset); + + zval_ptr_dtor(&offset); + + if (!retval) { + if (!EG(exception)) { + zend_error(E_ERROR, "Undefined offset for object of type %s used as array", ce->name); + } + return 0; + } + + return (retval && Z_TYPE_P(retval) == IS_BOOL && Z_LVAL_P(retval)); + } + return 0; +} + +static char *TWIG_STRTOLOWER(const char *str, int str_len) +{ + char *item_dup; + + item_dup = estrndup(str, str_len); + php_strtolower(item_dup, str_len); + return item_dup; +} + +static zval *TWIG_CALL_USER_FUNC_ARRAY(zval *object, char *function, zval *arguments TSRMLS_DC) +{ + zend_fcall_info fci; + zval ***args = NULL; + int arg_count = 0; + HashTable *table; + HashPosition pos; + int i = 0; + zval *retval_ptr; + zval *zfunction; + + if (arguments) { + table = HASH_OF(arguments); + args = safe_emalloc(sizeof(zval **), table->nNumOfElements, 0); + + zend_hash_internal_pointer_reset_ex(table, &pos); + + while (zend_hash_get_current_data_ex(table, (void **)&args[i], &pos) == SUCCESS) { + i++; + zend_hash_move_forward_ex(table, &pos); + } + arg_count = table->nNumOfElements; + } + + MAKE_STD_ZVAL(zfunction); + ZVAL_STRING(zfunction, function, 1); + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = zfunction; + fci.symbol_table = NULL; +#if PHP_VERSION_ID >= 50300 + fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = arg_count; + fci.params = args; + fci.no_separation = 0; + + if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { + ALLOC_INIT_ZVAL(retval_ptr); + ZVAL_BOOL(retval_ptr, 0); + } + + if (args) { + efree(fci.params); + } + FREE_DTOR(zfunction); + return retval_ptr; +} + +static int TWIG_CALL_BOOLEAN(zval *object, char *functionName TSRMLS_DC) +{ + zval *ret; + int res; + + ret = TWIG_CALL_USER_FUNC_ARRAY(object, functionName, NULL TSRMLS_CC); + res = Z_LVAL_P(ret); + zval_ptr_dtor(&ret); + return res; +} + +static zval *TWIG_GET_STATIC_PROPERTY(zval *class, char *prop_name TSRMLS_DC) +{ + zval **tmp_zval; + zend_class_entry *ce; + + if (class == NULL || Z_TYPE_P(class) != IS_OBJECT) { + return NULL; + } + + ce = zend_get_class_entry(class TSRMLS_CC); +#if PHP_VERSION_ID >= 50400 + tmp_zval = zend_std_get_static_property(ce, prop_name, strlen(prop_name), 0, NULL TSRMLS_CC); +#else + tmp_zval = zend_std_get_static_property(ce, prop_name, strlen(prop_name), 0 TSRMLS_CC); +#endif + return *tmp_zval; +} + +static zval *TWIG_GET_ARRAY_ELEMENT_ZVAL(zval *class, zval *prop_name TSRMLS_DC) +{ + zval **tmp_zval; + + if (class == NULL || Z_TYPE_P(class) != IS_ARRAY) { + if (class != NULL && Z_TYPE_P(class) == IS_OBJECT && TWIG_INSTANCE_OF(class, zend_ce_arrayaccess TSRMLS_CC)) { + // array access object + return TWIG_GET_ARRAYOBJECT_ELEMENT(class, prop_name TSRMLS_CC); + } + return NULL; + } + + switch(Z_TYPE_P(prop_name)) { + case IS_NULL: + zend_hash_find(HASH_OF(class), "", 1, (void**) &tmp_zval); + return *tmp_zval; + + case IS_BOOL: + case IS_DOUBLE: + convert_to_long(prop_name); + case IS_LONG: + zend_hash_index_find(HASH_OF(class), Z_LVAL_P(prop_name), (void **) &tmp_zval); + return *tmp_zval; + + case IS_STRING: + zend_symtable_find(HASH_OF(class), Z_STRVAL_P(prop_name), Z_STRLEN_P(prop_name) + 1, (void**) &tmp_zval); + return *tmp_zval; + } + + return NULL; +} + +static zval *TWIG_GET_ARRAY_ELEMENT(zval *class, char *prop_name, int prop_name_length TSRMLS_DC) +{ + zval **tmp_zval; + + if (class == NULL/* || Z_TYPE_P(class) != IS_ARRAY*/) { + return NULL; + } + + if (class != NULL && Z_TYPE_P(class) == IS_OBJECT && TWIG_INSTANCE_OF(class, zend_ce_arrayaccess TSRMLS_CC)) { + // array access object + zval *tmp_name_zval; + zval *tmp_ret_zval; + + ALLOC_INIT_ZVAL(tmp_name_zval); + ZVAL_STRING(tmp_name_zval, prop_name, 1); + tmp_ret_zval = TWIG_GET_ARRAYOBJECT_ELEMENT(class, tmp_name_zval TSRMLS_CC); + FREE_DTOR(tmp_name_zval); + return tmp_ret_zval; + } + + if (zend_symtable_find(HASH_OF(class), prop_name, prop_name_length+1, (void**)&tmp_zval) == SUCCESS) { + return *tmp_zval; + } + return NULL; +} + +static zval *TWIG_PROPERTY(zval *object, zval *propname TSRMLS_DC) +{ + zval *tmp = NULL; + + if (Z_OBJ_HT_P(object)->read_property) { +#if PHP_VERSION_ID >= 50400 + tmp = Z_OBJ_HT_P(object)->read_property(object, propname, BP_VAR_IS, NULL TSRMLS_CC); +#else + tmp = Z_OBJ_HT_P(object)->read_property(object, propname, BP_VAR_IS TSRMLS_CC); +#endif + if (tmp == EG(uninitialized_zval_ptr)) { + ZVAL_NULL(tmp); + } + } + return tmp; +} + +static int TWIG_HAS_PROPERTY(zval *object, zval *propname TSRMLS_DC) +{ + if (Z_OBJ_HT_P(object)->has_property) { +#if PHP_VERSION_ID >= 50400 + return Z_OBJ_HT_P(object)->has_property(object, propname, 0, NULL TSRMLS_CC); +#else + return Z_OBJ_HT_P(object)->has_property(object, propname, 0 TSRMLS_CC); +#endif + } + return 0; +} + +static int TWIG_HAS_DYNAMIC_PROPERTY(zval *object, char *prop, int prop_len TSRMLS_DC) +{ + if (Z_OBJ_HT_P(object)->get_properties) { + return zend_hash_quick_exists( + Z_OBJ_HT_P(object)->get_properties(object TSRMLS_CC), // the properties hash + prop, // property name + prop_len + 1, // property length + zend_get_hash_value(prop, prop_len + 1) // hash value + ); + } + return 0; +} + +static zval *TWIG_PROPERTY_CHAR(zval *object, char *propname TSRMLS_DC) +{ + zval *tmp_name_zval, *tmp; + + ALLOC_INIT_ZVAL(tmp_name_zval); + ZVAL_STRING(tmp_name_zval, propname, 1); + tmp = TWIG_PROPERTY(object, tmp_name_zval TSRMLS_CC); + FREE_DTOR(tmp_name_zval); + return tmp; +} + +static zval *TWIG_CALL_S(zval *object, char *method, char *arg0 TSRMLS_DC) +{ + zend_fcall_info fci; + zval **args[1]; + zval *argument; + zval *zfunction; + zval *retval_ptr; + + MAKE_STD_ZVAL(argument); + ZVAL_STRING(argument, arg0, 1); + args[0] = &argument; + + MAKE_STD_ZVAL(zfunction); + ZVAL_STRING(zfunction, method, 1); + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = zfunction; + fci.symbol_table = NULL; +#if PHP_VERSION_ID >= 50300 + fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 1; + fci.params = args; + fci.no_separation = 0; + + if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { + FREE_DTOR(zfunction); + zval_ptr_dtor(&argument); + return 0; + } + FREE_DTOR(zfunction); + zval_ptr_dtor(&argument); + return retval_ptr; +} + +static int TWIG_CALL_SB(zval *object, char *method, char *arg0 TSRMLS_DC) +{ + zval *retval_ptr; + int success; + + retval_ptr = TWIG_CALL_S(object, method, arg0 TSRMLS_CC); + success = (retval_ptr && (Z_TYPE_P(retval_ptr) == IS_BOOL) && Z_LVAL_P(retval_ptr)); + + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + + return success; +} + +static int TWIG_CALL_ZZ(zval *object, char *method, zval *arg1, zval *arg2 TSRMLS_DC) +{ + zend_fcall_info fci; + zval **args[2]; + zval *zfunction; + zval *retval_ptr; + int success; + + args[0] = &arg1; + args[1] = &arg2; + + MAKE_STD_ZVAL(zfunction); + ZVAL_STRING(zfunction, method, 1); + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = zfunction; + fci.symbol_table = NULL; +#if PHP_VERSION_ID >= 50300 + fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 2; + fci.params = args; + fci.no_separation = 0; + + if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { + FREE_DTOR(zfunction); + return 0; + } + + FREE_DTOR(zfunction); + + success = (retval_ptr && (Z_TYPE_P(retval_ptr) == IS_BOOL) && Z_LVAL_P(retval_ptr)); + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + + return success; +} + +#ifndef Z_SET_REFCOUNT_P +# define Z_SET_REFCOUNT_P(pz, rc) pz->refcount = rc +# define Z_UNSET_ISREF_P(pz) pz->is_ref = 0 +#endif + +static void TWIG_NEW(zval *object, char *class, zval *arg0, zval *arg1 TSRMLS_DC) +{ + zend_class_entry **pce; + + if (zend_lookup_class(class, strlen(class), &pce TSRMLS_CC) == FAILURE) { + return; + } + + Z_TYPE_P(object) = IS_OBJECT; + object_init_ex(object, *pce); + Z_SET_REFCOUNT_P(object, 1); + Z_UNSET_ISREF_P(object); + + TWIG_CALL_ZZ(object, "__construct", arg0, arg1 TSRMLS_CC); +} + +static int twig_add_array_key_to_string(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + smart_str *buf; + char *joiner; + APPLY_TSRMLS_FETCH(); + + buf = va_arg(args, smart_str*); + joiner = va_arg(args, char*); + + if (buf->len != 0) { + smart_str_appends(buf, joiner); + } + + if (hash_key->nKeyLength == 0) { + smart_str_append_long(buf, (long) hash_key->h); + } else { + char *key, *tmp_str; + int key_len, tmp_len; + key = php_addcslashes(hash_key->arKey, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC); + tmp_str = php_str_to_str_ex(key, key_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len, 0, NULL); + + smart_str_appendl(buf, tmp_str, tmp_len); + efree(key); + efree(tmp_str); + } + + return 0; +} + +static char *TWIG_IMPLODE_ARRAY_KEYS(char *joiner, zval *array TSRMLS_DC) +{ + smart_str collector = { 0, 0, 0 }; + + smart_str_appendl(&collector, "", 0); + zend_hash_apply_with_arguments(HASH_OF(array) APPLY_TSRMLS_CC, twig_add_array_key_to_string, 2, &collector, joiner); + smart_str_0(&collector); + + return collector.c; +} + +static void TWIG_RUNTIME_ERROR(zval *template TSRMLS_DC, char *message, ...) +{ + char *buffer; + va_list args; + zend_class_entry **pce; + zval *ex; + zval *constructor; + zval *zmessage; + zval *lineno; + zval *filename_func; + zval *filename; + zval *constructor_args[3]; + zval *constructor_retval; + + if (zend_lookup_class("Twig_Error_Runtime", strlen("Twig_Error_Runtime"), &pce TSRMLS_CC) == FAILURE) { + return; + } + + va_start(args, message); + vspprintf(&buffer, 0, message, args); + va_end(args); + + MAKE_STD_ZVAL(ex); + object_init_ex(ex, *pce); + + // Call Twig_Error constructor + MAKE_STD_ZVAL(constructor); + MAKE_STD_ZVAL(zmessage); + MAKE_STD_ZVAL(lineno); + MAKE_STD_ZVAL(filename); + MAKE_STD_ZVAL(filename_func); + MAKE_STD_ZVAL(constructor_retval); + + ZVAL_STRINGL(constructor, "__construct", sizeof("__construct")-1, 1); + ZVAL_STRING(zmessage, buffer, 1); + ZVAL_LONG(lineno, -1); + + // Get template filename + ZVAL_STRINGL(filename_func, "getTemplateName", sizeof("getTemplateName")-1, 1); + call_user_function(EG(function_table), &template, filename_func, filename, 0, 0 TSRMLS_CC); + + constructor_args[0] = zmessage; + constructor_args[1] = lineno; + constructor_args[2] = filename; + call_user_function(EG(function_table), &ex, constructor, constructor_retval, 3, constructor_args TSRMLS_CC); + + zval_ptr_dtor(&constructor_retval); + zval_ptr_dtor(&zmessage); + zval_ptr_dtor(&lineno); + zval_ptr_dtor(&filename); + FREE_DTOR(constructor); + FREE_DTOR(filename_func); + efree(buffer); + + zend_throw_exception_object(ex TSRMLS_CC); +} + +static char *TWIG_GET_CLASS_NAME(zval *object TSRMLS_DC) +{ + char *class_name; + zend_uint class_name_len; + + if (Z_TYPE_P(object) != IS_OBJECT) { + return ""; + } +#if PHP_API_VERSION >= 20100412 + zend_get_object_classname(object, (const char **) &class_name, &class_name_len TSRMLS_CC); +#else + zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); +#endif + return class_name; +} + +static int twig_add_method_to_class(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + zend_class_entry *ce; + zval *retval; + char *item; + size_t item_len; + zend_function *mptr = (zend_function *) pDest; + APPLY_TSRMLS_FETCH(); + + if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC)) { + return 0; + } + + ce = *va_arg(args, zend_class_entry**); + retval = va_arg(args, zval*); + + item_len = strlen(mptr->common.function_name); + item = estrndup(mptr->common.function_name, item_len); + php_strtolower(item, item_len); + + if (strcmp("getenvironment", item) == 0) { + zend_class_entry **twig_template_ce; + if (zend_lookup_class("Twig_Template", strlen("Twig_Template"), &twig_template_ce TSRMLS_CC) == FAILURE) { + return 0; + } + if (instanceof_function(ce, *twig_template_ce TSRMLS_CC)) { + return 0; + } + } + + add_assoc_stringl_ex(retval, item, item_len+1, item, item_len, 0); + + return 0; +} + +static int twig_add_property_to_class(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + zend_class_entry *ce; + zval *retval; + char *class_name, *prop_name; + zend_property_info *pptr = (zend_property_info *) pDest; + APPLY_TSRMLS_FETCH(); + + if (!(pptr->flags & ZEND_ACC_PUBLIC) || (pptr->flags & ZEND_ACC_STATIC)) { + return 0; + } + + ce = *va_arg(args, zend_class_entry**); + retval = va_arg(args, zval*); + +#if PHP_API_VERSION >= 20100412 + zend_unmangle_property_name(pptr->name, pptr->name_length, (const char **) &class_name, (const char **) &prop_name); +#else + zend_unmangle_property_name(pptr->name, pptr->name_length, &class_name, &prop_name); +#endif + + add_assoc_string(retval, prop_name, prop_name, 1); + + return 0; +} + +static void twig_add_class_to_cache(zval *cache, zval *object, char *class_name TSRMLS_DC) +{ + zval *class_info, *class_methods, *class_properties; + zend_class_entry *class_ce; + + class_ce = zend_get_class_entry(object TSRMLS_CC); + + ALLOC_INIT_ZVAL(class_info); + ALLOC_INIT_ZVAL(class_methods); + ALLOC_INIT_ZVAL(class_properties); + array_init(class_info); + array_init(class_methods); + array_init(class_properties); + // add all methods to self::cache[$class]['methods'] + zend_hash_apply_with_arguments(&class_ce->function_table APPLY_TSRMLS_CC, twig_add_method_to_class, 2, &class_ce, class_methods); + zend_hash_apply_with_arguments(&class_ce->properties_info APPLY_TSRMLS_CC, twig_add_property_to_class, 2, &class_ce, class_properties); + + add_assoc_zval(class_info, "methods", class_methods); + add_assoc_zval(class_info, "properties", class_properties); + add_assoc_zval(cache, class_name, class_info); +} + +/* {{{ proto mixed twig_template_get_attributes(TwigTemplate template, mixed object, mixed item, array arguments, string type, boolean isDefinedTest, boolean ignoreStrictCheck) + A C implementation of TwigTemplate::getAttribute() */ +PHP_FUNCTION(twig_template_get_attributes) +{ + zval *template; + zval *object; + char *item; + int item_len; + zval *zitem, ztmpitem; + zval *arguments = NULL; + zval *ret = NULL; + char *type = NULL; + int type_len = 0; + zend_bool isDefinedTest = 0; + zend_bool ignoreStrictCheck = 0; + int free_ret = 0; + zval *tmp_self_cache; + char *class_name = NULL; + zval *tmp_class; + char *type_name; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ozz|asbb", &template, &object, &zitem, &arguments, &type, &type_len, &isDefinedTest, &ignoreStrictCheck) == FAILURE) { + return; + } + + // convert the item to a string + ztmpitem = *zitem; + zval_copy_ctor(&ztmpitem); + convert_to_string(&ztmpitem); + item_len = Z_STRLEN(ztmpitem); + item = estrndup(Z_STRVAL(ztmpitem), item_len); + zval_dtor(&ztmpitem); + + if (!type) { + type = "any"; + } + +/* + // array + if (Twig_Template::METHOD_CALL !== $type) { + $arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item; + + if ((is_array($object) && array_key_exists($arrayItem, $object)) + || ($object instanceof ArrayAccess && isset($object[$arrayItem])) + ) { + if ($isDefinedTest) { + return true; + } + + return $object[$arrayItem]; + } +*/ + + + if (strcmp("method", type) != 0) { + if ((TWIG_ARRAY_KEY_EXISTS(object, zitem)) + || (TWIG_INSTANCE_OF(object, zend_ce_arrayaccess TSRMLS_CC) && TWIG_ISSET_ARRAYOBJECT_ELEMENT(object, zitem TSRMLS_CC)) + ) { + + if (isDefinedTest) { + efree(item); + RETURN_TRUE; + } + + ret = TWIG_GET_ARRAY_ELEMENT_ZVAL(object, zitem TSRMLS_CC); + + if (!ret) { + ret = &EG(uninitialized_zval); + } + RETVAL_ZVAL(ret, 1, 0); + if (free_ret) { + zval_ptr_dtor(&ret); + } + efree(item); + return; + } +/* + if (Twig_Template::ARRAY_CALL === $type) { + if ($isDefinedTest) { + return false; + } + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return null; + } +*/ + if (strcmp("array", type) == 0 || Z_TYPE_P(object) != IS_OBJECT) { + if (isDefinedTest) { + efree(item); + RETURN_FALSE; + } + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + efree(item); + return; + } +/* + if ($object instanceof ArrayAccess) { + $message = sprintf('Key "%s" in object with ArrayAccess of class "%s" does not exist', $arrayItem, get_class($object)); + } elseif (is_object($object)) { + $message = sprintf('Impossible to access a key "%s" on an object of class "%s" that does not implement ArrayAccess interface', $item, get_class($object)); + } elseif (is_array($object)) { + if (empty($object)) { + $message = sprintf('Key "%s" does not exist as the array is empty', $arrayItem); + } else { + $message = sprintf('Key "%s" for array with keys "%s" does not exist', $arrayItem, implode(', ', array_keys($object))); + } + } elseif (Twig_Template::ARRAY_CALL === $type) { + if (null === $object) { + $message = sprintf('Impossible to access a key ("%s") on a null variable', $item); + } else { + $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s")', $item, gettype($object), $object); + } + } elseif (null === $object) { + $message = sprintf('Impossible to access an attribute ("%s") on a null variable', $item); + } else { + $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s")', $item, gettype($object), $object); + } + throw new Twig_Error_Runtime($message, -1, $this->getTemplateName()); + } + } +*/ + if (TWIG_INSTANCE_OF(object, zend_ce_arrayaccess TSRMLS_CC)) { + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Key \"%s\" in object with ArrayAccess of class \"%s\" does not exist", item, TWIG_GET_CLASS_NAME(object TSRMLS_CC)); + } else if (Z_TYPE_P(object) == IS_OBJECT) { + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to access a key \"%s\" on an object of class \"%s\" that does not implement ArrayAccess interface", item, TWIG_GET_CLASS_NAME(object TSRMLS_CC)); + } else if (Z_TYPE_P(object) == IS_ARRAY) { + if (0 == zend_hash_num_elements(Z_ARRVAL_P(object))) { + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Key \"%s\" does not exist as the array is empty", item); + } else { + char *array_keys = TWIG_IMPLODE_ARRAY_KEYS(", ", object TSRMLS_CC); + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Key \"%s\" for array with keys \"%s\" does not exist", item, array_keys); + efree(array_keys); + } + } else { + char *type_name = zend_zval_type_name(object); + Z_ADDREF_P(object); + if (Z_TYPE_P(object) == IS_NULL) { + convert_to_string(object); + TWIG_RUNTIME_ERROR(template TSRMLS_CC, + (strcmp("array", type) == 0) + ? "Impossible to access a key (\"%s\") on a %s variable" + : "Impossible to access an attribute (\"%s\") on a %s variable", + item, type_name); + } else { + convert_to_string(object); + TWIG_RUNTIME_ERROR(template TSRMLS_CC, + (strcmp("array", type) == 0) + ? "Impossible to access a key (\"%s\") on a %s variable (\"%s\")" + : "Impossible to access an attribute (\"%s\") on a %s variable (\"%s\")", + item, type_name, Z_STRVAL_P(object)); + } + zval_ptr_dtor(&object); + } + efree(item); + return; + } + } + +/* + if (!is_object($object)) { + if ($isDefinedTest) { + return false; + } +*/ + + if (Z_TYPE_P(object) != IS_OBJECT) { + if (isDefinedTest) { + efree(item); + RETURN_FALSE; + } +/* + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return null; + } + + if (null === $object) { + $message = sprintf('Impossible to invoke a method ("%s") on a null variable', $item); + } else { + $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object); + } + + throw new Twig_Error_Runtime($message, -1, $this->getTemplateName()); + } +*/ + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + efree(item); + return; + } + + type_name = zend_zval_type_name(object); + Z_ADDREF_P(object); + if (Z_TYPE_P(object) == IS_NULL) { + convert_to_string_ex(&object); + + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a %s variable", item, type_name); + } else { + convert_to_string_ex(&object); + + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a %s variable (\"%s\")", item, type_name, Z_STRVAL_P(object)); + } + + zval_ptr_dtor(&object); + efree(item); + return; + } +/* + $class = get_class($object); +*/ + + class_name = TWIG_GET_CLASS_NAME(object TSRMLS_CC); + tmp_self_cache = TWIG_GET_STATIC_PROPERTY(template, "cache" TSRMLS_CC); + tmp_class = TWIG_GET_ARRAY_ELEMENT(tmp_self_cache, class_name, strlen(class_name) TSRMLS_CC); + + if (!tmp_class) { + twig_add_class_to_cache(tmp_self_cache, object, class_name TSRMLS_CC); + tmp_class = TWIG_GET_ARRAY_ELEMENT(tmp_self_cache, class_name, strlen(class_name) TSRMLS_CC); + } + efree(class_name); + +/* + // object property + if (Twig_Template::METHOD_CALL !== $type && !$object instanceof Twig_Template) { + if (isset($object->$item) || array_key_exists((string) $item, $object)) { + if ($isDefinedTest) { + return true; + } + + if ($this->env->hasExtension('sandbox')) { + $this->env->getExtension('sandbox')->checkPropertyAllowed($object, $item); + } + + return $object->$item; + } + } +*/ + if (strcmp("method", type) != 0 && !TWIG_INSTANCE_OF_USERLAND(object, "Twig_Template" TSRMLS_CC)) { + zval *tmp_properties, *tmp_item; + + tmp_properties = TWIG_GET_ARRAY_ELEMENT(tmp_class, "properties", strlen("properties") TSRMLS_CC); + tmp_item = TWIG_GET_ARRAY_ELEMENT(tmp_properties, item, item_len TSRMLS_CC); + + if (tmp_item || TWIG_HAS_PROPERTY(object, zitem TSRMLS_CC) || TWIG_HAS_DYNAMIC_PROPERTY(object, item, item_len TSRMLS_CC)) { + if (isDefinedTest) { + efree(item); + RETURN_TRUE; + } + if (TWIG_CALL_SB(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "hasExtension", "sandbox" TSRMLS_CC)) { + TWIG_CALL_ZZ(TWIG_CALL_S(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "getExtension", "sandbox" TSRMLS_CC), "checkPropertyAllowed", object, zitem TSRMLS_CC); + } + if (EG(exception)) { + efree(item); + return; + } + + ret = TWIG_PROPERTY(object, zitem TSRMLS_CC); + efree(item); + RETURN_ZVAL(ret, 1, 0); + } + } +/* + // object method + if (!isset(self::$cache[$class]['methods'])) { + if ($object instanceof self) { + $ref = new ReflectionClass($class); + $methods = array(); + + foreach ($ref->getMethods(ReflectionMethod::IS_PUBLIC) as $refMethod) { + $methodName = strtolower($refMethod->name); + + // Accessing the environment from templates is forbidden to prevent untrusted changes to the environment + if ('getenvironment' !== $methodName) { + $methods[$methodName] = true; + } + } + + self::$cache[$class]['methods'] = $methods; + } else { + self::$cache[$class]['methods'] = array_change_key_case(array_flip(get_class_methods($object))); + } + } + + $call = false; + $lcItem = strtolower($item); + if (isset(self::$cache[$class]['methods'][$lcItem])) { + $method = (string) $item; + } elseif (isset(self::$cache[$class]['methods']['get'.$lcItem])) { + $method = 'get'.$item; + } elseif (isset(self::$cache[$class]['methods']['is'.$lcItem])) { + $method = 'is'.$item; + } elseif (isset(self::$cache[$class]['methods']['__call'])) { + $method = (string) $item; + $call = true; +*/ + { + int call = 0; + char *lcItem = TWIG_STRTOLOWER(item, item_len); + int lcItem_length; + char *method = NULL; + char *tmp_method_name_get; + char *tmp_method_name_is; + zval *zmethod; + zval *tmp_methods; + + lcItem_length = strlen(lcItem); + tmp_method_name_get = emalloc(4 + lcItem_length); + tmp_method_name_is = emalloc(3 + lcItem_length); + + sprintf(tmp_method_name_get, "get%s", lcItem); + sprintf(tmp_method_name_is, "is%s", lcItem); + + tmp_methods = TWIG_GET_ARRAY_ELEMENT(tmp_class, "methods", strlen("methods") TSRMLS_CC); + + if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, lcItem, lcItem_length TSRMLS_CC)) { + method = item; + } else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, tmp_method_name_get, lcItem_length + 3 TSRMLS_CC)) { + method = tmp_method_name_get; + } else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, tmp_method_name_is, lcItem_length + 2 TSRMLS_CC)) { + method = tmp_method_name_is; + } else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, "__call", 6 TSRMLS_CC)) { + method = item; + call = 1; +/* + } else { + if ($isDefinedTest) { + return false; + } + + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return null; + } + + throw new Twig_Error_Runtime(sprintf('Method "%s" for object "%s" does not exist', $item, get_class($object)), -1, $this->getTemplateName()); + } + + if ($isDefinedTest) { + return true; + } +*/ + } else { + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem); + + if (isDefinedTest) { + efree(item); + RETURN_FALSE; + } + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + efree(item); + return; + } + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Method \"%s\" for object \"%s\" does not exist", item, TWIG_GET_CLASS_NAME(object TSRMLS_CC)); + efree(item); + return; + } + + if (isDefinedTest) { + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem);efree(item); + RETURN_TRUE; + } +/* + if ($this->env->hasExtension('sandbox')) { + $this->env->getExtension('sandbox')->checkMethodAllowed($object, $method); + } +*/ + MAKE_STD_ZVAL(zmethod); + ZVAL_STRING(zmethod, method, 1); + if (TWIG_CALL_SB(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "hasExtension", "sandbox" TSRMLS_CC)) { + TWIG_CALL_ZZ(TWIG_CALL_S(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "getExtension", "sandbox" TSRMLS_CC), "checkMethodAllowed", object, zmethod TSRMLS_CC); + } + zval_ptr_dtor(&zmethod); + if (EG(exception)) { + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem);efree(item); + return; + } +/* + // Some objects throw exceptions when they have __call, and the method we try + // to call is not supported. If ignoreStrictCheck is true, we should return null. + try { + $ret = call_user_func_array(array($object, $method), $arguments); + } catch (BadMethodCallException $e) { + if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) { + return null; + } + throw $e; + } +*/ + ret = TWIG_CALL_USER_FUNC_ARRAY(object, method, arguments TSRMLS_CC); + if (EG(exception) && TWIG_INSTANCE_OF(EG(exception), spl_ce_BadMethodCallException TSRMLS_CC)) { + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem);efree(item); + zend_clear_exception(TSRMLS_C); + return; + } + } + free_ret = 1; + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem); + } +/* + // useful when calling a template method from a template + // this is not supported but unfortunately heavily used in the Symfony profiler + if ($object instanceof Twig_TemplateInterface) { + return $ret === '' ? '' : new Twig_Markup($ret, $this->env->getCharset()); + } + + return $ret; +*/ + efree(item); + // ret can be null, if e.g. the called method throws an exception + if (ret) { + if (TWIG_INSTANCE_OF_USERLAND(object, "Twig_TemplateInterface" TSRMLS_CC)) { + if (Z_STRLEN_P(ret) != 0) { + zval *charset = TWIG_CALL_USER_FUNC_ARRAY(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "getCharset", NULL TSRMLS_CC); + TWIG_NEW(return_value, "Twig_Markup", ret, charset TSRMLS_CC); + zval_ptr_dtor(&charset); + if (ret) { + zval_ptr_dtor(&ret); + } + return; + } + } + + RETVAL_ZVAL(ret, 1, 0); + if (free_ret) { + zval_ptr_dtor(&ret); + } + } +} diff --git a/plugins/twig/vendor/twig/lib/Twig/Autoloader.php b/plugins/twig/vendor/twig/twig/lib/Twig/Autoloader.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Autoloader.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Autoloader.php diff --git a/plugins/twig/vendor/twig/lib/Twig/BaseNodeVisitor.php b/plugins/twig/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/BaseNodeVisitor.php rename to plugins/twig/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Cache/Filesystem.php b/plugins/twig/vendor/twig/twig/lib/Twig/Cache/Filesystem.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Cache/Filesystem.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Cache/Filesystem.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Cache/Null.php b/plugins/twig/vendor/twig/twig/lib/Twig/Cache/Null.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Cache/Null.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Cache/Null.php diff --git a/plugins/twig/vendor/twig/lib/Twig/CacheInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/CacheInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/CacheInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/CacheInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Compiler.php b/plugins/twig/vendor/twig/twig/lib/Twig/Compiler.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Compiler.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Compiler.php diff --git a/plugins/twig/vendor/twig/lib/Twig/CompilerInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/CompilerInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/CompilerInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/CompilerInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Environment.php b/plugins/twig/vendor/twig/twig/lib/Twig/Environment.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Environment.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Environment.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Error.php b/plugins/twig/vendor/twig/twig/lib/Twig/Error.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Error.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Error.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Error/Loader.php b/plugins/twig/vendor/twig/twig/lib/Twig/Error/Loader.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Error/Loader.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Error/Loader.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Error/Runtime.php b/plugins/twig/vendor/twig/twig/lib/Twig/Error/Runtime.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Error/Runtime.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Error/Runtime.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Error/Syntax.php b/plugins/twig/vendor/twig/twig/lib/Twig/Error/Syntax.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Error/Syntax.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Error/Syntax.php diff --git a/plugins/twig/vendor/twig/lib/Twig/ExistsLoaderInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/ExistsLoaderInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/ExpressionParser.php b/plugins/twig/vendor/twig/twig/lib/Twig/ExpressionParser.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/ExpressionParser.php rename to plugins/twig/vendor/twig/twig/lib/Twig/ExpressionParser.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Core.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Core.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Core.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Core.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Debug.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Debug.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Debug.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Debug.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Escaper.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Escaper.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Escaper.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Escaper.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/GlobalsInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/GlobalsInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/InitRuntimeInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/InitRuntimeInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Optimizer.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Optimizer.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Optimizer.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Optimizer.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Profiler.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Profiler.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Profiler.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Profiler.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Sandbox.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Sandbox.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Sandbox.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Sandbox.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Staging.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Staging.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Staging.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Staging.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/StringLoader.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/StringLoader.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/StringLoader.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/StringLoader.php diff --git a/plugins/twig/vendor/twig/lib/Twig/ExtensionInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/ExtensionInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/ExtensionInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/ExtensionInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/FileExtensionEscapingStrategy.php b/plugins/twig/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/FileExtensionEscapingStrategy.php rename to plugins/twig/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Filter.php b/plugins/twig/vendor/twig/twig/lib/Twig/Filter.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Filter.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Filter.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Filter/Function.php b/plugins/twig/vendor/twig/twig/lib/Twig/Filter/Function.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Filter/Function.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Filter/Function.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Filter/Method.php b/plugins/twig/vendor/twig/twig/lib/Twig/Filter/Method.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Filter/Method.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Filter/Method.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Filter/Node.php b/plugins/twig/vendor/twig/twig/lib/Twig/Filter/Node.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Filter/Node.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Filter/Node.php diff --git a/plugins/twig/vendor/twig/lib/Twig/FilterCallableInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/FilterCallableInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/FilterCallableInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/FilterCallableInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/FilterInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/FilterInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/FilterInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/FilterInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Function.php b/plugins/twig/vendor/twig/twig/lib/Twig/Function.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Function.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Function.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Function/Function.php b/plugins/twig/vendor/twig/twig/lib/Twig/Function/Function.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Function/Function.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Function/Function.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Function/Method.php b/plugins/twig/vendor/twig/twig/lib/Twig/Function/Method.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Function/Method.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Function/Method.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Function/Node.php b/plugins/twig/vendor/twig/twig/lib/Twig/Function/Node.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Function/Node.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Function/Node.php diff --git a/plugins/twig/vendor/twig/lib/Twig/FunctionCallableInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/FunctionCallableInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/FunctionInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/FunctionInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/FunctionInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/FunctionInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Lexer.php b/plugins/twig/vendor/twig/twig/lib/Twig/Lexer.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Lexer.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Lexer.php diff --git a/plugins/twig/vendor/twig/lib/Twig/LexerInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/LexerInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/LexerInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/LexerInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Loader/Array.php b/plugins/twig/vendor/twig/twig/lib/Twig/Loader/Array.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Loader/Array.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Loader/Array.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Loader/Chain.php b/plugins/twig/vendor/twig/twig/lib/Twig/Loader/Chain.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Loader/Chain.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Loader/Chain.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Loader/Filesystem.php b/plugins/twig/vendor/twig/twig/lib/Twig/Loader/Filesystem.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Loader/Filesystem.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Loader/Filesystem.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Loader/String.php b/plugins/twig/vendor/twig/twig/lib/Twig/Loader/String.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Loader/String.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Loader/String.php diff --git a/plugins/twig/vendor/twig/lib/Twig/LoaderInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/LoaderInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/LoaderInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/LoaderInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Markup.php b/plugins/twig/vendor/twig/twig/lib/Twig/Markup.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Markup.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Markup.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/AutoEscape.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/AutoEscape.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/AutoEscape.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/AutoEscape.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Block.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Block.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Block.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Block.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/BlockReference.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/BlockReference.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/BlockReference.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/BlockReference.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Body.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Body.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Body.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Body.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/CheckSecurity.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/CheckSecurity.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Do.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Do.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Do.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Do.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Embed.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Embed.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Embed.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Embed.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Array.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Array.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Array.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Array.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/AssignName.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/AssignName.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Add.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Add.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/And.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/And.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Concat.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Concat.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Div.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Div.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/EndsWith.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/EndsWith.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Equal.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Equal.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Greater.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Greater.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/In.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/In.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Less.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Less.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/LessEqual.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/LessEqual.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Matches.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Matches.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Mod.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Mod.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Mul.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Mul.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/NotEqual.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/NotEqual.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/NotIn.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/NotIn.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Or.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Or.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Power.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Power.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Range.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Range.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/StartsWith.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/StartsWith.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Sub.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Sub.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/BlockReference.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/BlockReference.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Call.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Call.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Call.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Call.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Conditional.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Conditional.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Constant.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Constant.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/ExtensionReference.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/ExtensionReference.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Filter.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Filter.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Filter/Default.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Filter/Default.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Function.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Function.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Function.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Function.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/GetAttr.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/GetAttr.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/MethodCall.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/MethodCall.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Name.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Name.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Name.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Name.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/NullCoalesce.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/NullCoalesce.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Parent.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Parent.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/TempName.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/TempName.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Constant.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Constant.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Defined.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Defined.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Divisibleby.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Divisibleby.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Even.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Even.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Null.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Null.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Odd.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Odd.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Sameas.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Sameas.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary/Neg.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary/Neg.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary/Not.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary/Not.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary/Pos.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary/Pos.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Flush.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Flush.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Flush.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Flush.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/For.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/For.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/For.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/For.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/ForLoop.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/ForLoop.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/ForLoop.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/ForLoop.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/If.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/If.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/If.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/If.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Import.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Import.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Import.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Import.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Include.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Include.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Include.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Include.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Macro.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Macro.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Macro.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Macro.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Module.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Module.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Module.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Module.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Print.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Print.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Print.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Print.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Sandbox.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Sandbox.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Sandbox.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Sandbox.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/SandboxedPrint.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/SandboxedPrint.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Set.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Set.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Set.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Set.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/SetTemp.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/SetTemp.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/SetTemp.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/SetTemp.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Spaceless.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Spaceless.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Spaceless.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Spaceless.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Text.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Text.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Text.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Text.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeOutputInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeOutputInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeOutputInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeOutputInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeTraverser.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeTraverser.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeTraverser.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeTraverser.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeVisitor/Escaper.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeVisitor/Escaper.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeVisitor/Optimizer.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeVisitor/Optimizer.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeVisitor/SafeAnalysis.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeVisitor/SafeAnalysis.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeVisitor/Sandbox.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeVisitor/Sandbox.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeVisitorInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeVisitorInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Parser.php b/plugins/twig/vendor/twig/twig/lib/Twig/Parser.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Parser.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Parser.php diff --git a/plugins/twig/vendor/twig/lib/Twig/ParserInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/ParserInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/ParserInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/ParserInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/Dumper/Blackfire.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/Dumper/Blackfire.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/Dumper/Html.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/Dumper/Html.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/Dumper/Text.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/Dumper/Text.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/Node/EnterProfile.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/Node/EnterProfile.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/Node/LeaveProfile.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/Node/LeaveProfile.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/Profile.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Profile.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/Profile.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Profile.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityError.php b/plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityError.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php b/plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php b/plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php b/plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityPolicy.php b/plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityPolicy.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/SimpleFilter.php b/plugins/twig/vendor/twig/twig/lib/Twig/SimpleFilter.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/SimpleFilter.php rename to plugins/twig/vendor/twig/twig/lib/Twig/SimpleFilter.php diff --git a/plugins/twig/vendor/twig/lib/Twig/SimpleFunction.php b/plugins/twig/vendor/twig/twig/lib/Twig/SimpleFunction.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/SimpleFunction.php rename to plugins/twig/vendor/twig/twig/lib/Twig/SimpleFunction.php diff --git a/plugins/twig/vendor/twig/lib/Twig/SimpleTest.php b/plugins/twig/vendor/twig/twig/lib/Twig/SimpleTest.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/SimpleTest.php rename to plugins/twig/vendor/twig/twig/lib/Twig/SimpleTest.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Template.php b/plugins/twig/vendor/twig/twig/lib/Twig/Template.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Template.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Template.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TemplateInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/TemplateInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TemplateInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TemplateInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Test.php b/plugins/twig/vendor/twig/twig/lib/Twig/Test.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Test.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Test.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Test/Function.php b/plugins/twig/vendor/twig/twig/lib/Twig/Test/Function.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Test/Function.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Test/Function.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Test/IntegrationTestCase.php b/plugins/twig/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Test/IntegrationTestCase.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Test/Method.php b/plugins/twig/vendor/twig/twig/lib/Twig/Test/Method.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Test/Method.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Test/Method.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Test/Node.php b/plugins/twig/vendor/twig/twig/lib/Twig/Test/Node.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Test/Node.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Test/Node.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Test/NodeTestCase.php b/plugins/twig/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Test/NodeTestCase.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TestCallableInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/TestCallableInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TestCallableInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TestCallableInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TestInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/TestInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TestInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TestInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Token.php b/plugins/twig/vendor/twig/twig/lib/Twig/Token.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Token.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Token.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/AutoEscape.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/AutoEscape.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Block.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Block.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Block.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Block.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Do.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Do.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Do.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Do.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Embed.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Embed.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Embed.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Embed.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Extends.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Extends.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Extends.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Extends.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Filter.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Filter.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Filter.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Filter.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Flush.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Flush.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Flush.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Flush.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/For.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/For.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/For.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/For.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/From.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/From.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/From.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/From.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/If.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/If.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/If.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/If.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Import.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Import.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Import.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Import.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Include.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Include.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Include.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Include.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Macro.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Macro.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Macro.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Macro.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Sandbox.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Sandbox.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Set.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Set.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Set.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Set.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Spaceless.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Spaceless.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Use.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Use.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Use.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Use.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParserBroker.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParserBroker.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParserBroker.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParserBroker.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParserBrokerInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParserBrokerInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParserInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParserInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParserInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParserInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenStream.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenStream.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenStream.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenStream.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Util/DeprecationCollector.php b/plugins/twig/vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Util/DeprecationCollector.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Util/TemplateDirIterator.php b/plugins/twig/vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Util/TemplateDirIterator.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php diff --git a/plugins/twig/vendor/twig/twig/phpunit.xml.dist b/plugins/twig/vendor/twig/twig/phpunit.xml.dist new file mode 100644 index 00000000..6f6d1d25 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/phpunit.xml.dist @@ -0,0 +1,25 @@ + + + + + + ./test/Twig/ + + + + + + ./lib/Twig/ + + + diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php new file mode 100644 index 00000000..52107c0c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php @@ -0,0 +1,24 @@ +assertFalse(class_exists('FooBarFoo'), '->autoload() does not try to load classes that does not begin with Twig'); + + $autoloader = new Twig_Autoloader(); + $this->assertNull($autoloader->autoload('Foo'), '->autoload() returns false if it is not able to load a class'); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php new file mode 100644 index 00000000..93a92d93 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php @@ -0,0 +1,193 @@ +classname = '__Twig_Tests_Cache_FilesystemTest_Template_'.$nonce; + $this->directory = sys_get_temp_dir().'/twig-test'; + $this->cache = new Twig_Cache_Filesystem($this->directory); + } + + protected function tearDown() + { + if (file_exists($this->directory)) { + Twig_Tests_FilesystemHelper::removeDir($this->directory); + } + } + + public function testLoad() + { + $key = $this->directory.'/cache/cachefile.php'; + + $dir = dirname($key); + @mkdir($dir, 0777, true); + $this->assertTrue(is_dir($dir)); + $this->assertFalse(class_exists($this->classname, false)); + + $content = $this->generateSource(); + file_put_contents($key, $content); + + $this->cache->load($key); + + $this->assertTrue(class_exists($this->classname, false)); + } + + public function testLoadMissing() + { + $key = $this->directory.'/cache/cachefile.php'; + + $this->assertFalse(class_exists($this->classname, false)); + + $this->cache->load($key); + + $this->assertFalse(class_exists($this->classname, false)); + } + + public function testWrite() + { + $key = $this->directory.'/cache/cachefile.php'; + $content = $this->generateSource(); + + $this->assertFalse(file_exists($key)); + $this->assertFalse(file_exists($this->directory)); + + $this->cache->write($key, $content); + + $this->assertTrue(file_exists($this->directory)); + $this->assertTrue(file_exists($key)); + $this->assertSame(file_get_contents($key), $content); + } + + /** + * @expectedException RuntimeException + * @expectedExceptionMessage Unable to create the cache directory + */ + public function testWriteFailMkdir() + { + if (defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->markTestSkipped('Read-only directories not possible on Windows.'); + } + + $key = $this->directory.'/cache/cachefile.php'; + $content = $this->generateSource(); + + $this->assertFalse(file_exists($key)); + + // Create read-only root directory. + @mkdir($this->directory, 0555, true); + $this->assertTrue(is_dir($this->directory)); + + $this->cache->write($key, $content); + } + + /** + * @expectedException RuntimeException + * @expectedExceptionMessage Unable to write in the cache directory + */ + public function testWriteFailDirWritable() + { + if (defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->markTestSkipped('Read-only directories not possible on Windows.'); + } + + $key = $this->directory.'/cache/cachefile.php'; + $content = $this->generateSource(); + + $this->assertFalse(file_exists($key)); + + // Create root directory. + @mkdir($this->directory, 0777, true); + // Create read-only subdirectory. + @mkdir($this->directory.'/cache' , 0555); + $this->assertTrue(is_dir($this->directory.'/cache')); + + $this->cache->write($key, $content); + } + + /** + * @expectedException RuntimeException + * @expectedExceptionMessage Failed to write cache file + */ + public function testWriteFailWriteFile() + { + $key = $this->directory.'/cache/cachefile.php'; + $content = $this->generateSource(); + + $this->assertFalse(file_exists($key)); + + // Create a directory in the place of the cache file. + @mkdir($key, 0777, true); + $this->assertTrue(is_dir($key)); + + $this->cache->write($key, $content); + } + + public function testGetTimestamp() + { + $key = $this->directory.'/cache/cachefile.php'; + + $dir = dirname($key); + @mkdir($dir, 0777, true); + $this->assertTrue(is_dir($dir)); + + // Create the file with a specific modification time. + touch($key, 1234567890); + + $this->assertSame(1234567890, $this->cache->getTimestamp($key)); + } + + public function testGetTimestampMissingFile() + { + $key = $this->directory.'/cache/cachefile.php'; + $this->assertSame(0, $this->cache->getTimestamp($key)); + } + + /** + * Test file cache is tolerant towards trailing (back)slashes on the configured cache directory. + * + * @dataProvider provideDirectories + */ + public function testGenerateKey($expected, $input) + { + $cache = new Twig_Cache_Filesystem($input); + $this->assertRegExp($expected, $cache->generateKey('_test_', get_class($this))); + } + + public function provideDirectories() + { + $pattern = '#a/b/[a-zA-Z0-9]+/[a-zA-Z0-9]+.php$#'; + + return array( + array($pattern, 'a/b'), + array($pattern, 'a/b/'), + array($pattern, 'a/b\\'), + array($pattern, 'a/b\\/'), + array($pattern, 'a/b\\//'), + array('#/'.substr($pattern, 1), '/a/b'), + ); + } + + private function generateSource() + { + return strtr(' $this->classname, + )); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/CompilerTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/CompilerTest.php new file mode 100644 index 00000000..bc25f117 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/CompilerTest.php @@ -0,0 +1,33 @@ +getMock('Twig_LoaderInterface'))); + + $locale = setlocale(LC_NUMERIC, 0); + if (false === $locale) { + $this->markTestSkipped('Your platform does not support locales.'); + } + + $required_locales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'); + if (false === setlocale(LC_NUMERIC, $required_locales)) { + $this->markTestSkipped('Could not set any of required locales: '.implode(', ', $required_locales)); + } + + $this->assertEquals('1.2', $compiler->repr(1.2)->getSource()); + $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0))); + + setlocale(LC_NUMERIC, $locale); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php new file mode 100644 index 00000000..35f65bdd --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php @@ -0,0 +1,529 @@ +render('test'); + } + + public function testAutoescapeOption() + { + $loader = new Twig_Loader_Array(array( + 'html' => '{{ foo }} {{ foo }}', + 'js' => '{{ bar }} {{ bar }}', + )); + + $twig = new Twig_Environment($loader, array( + 'debug' => true, + 'cache' => false, + 'autoescape' => array($this, 'escapingStrategyCallback'), + )); + + $this->assertEquals('foo<br/ > foo<br/ >', $twig->render('html', array('foo' => 'foo
    '))); + $this->assertEquals('foo\x3Cbr\x2F\x20\x3E foo\x3Cbr\x2F\x20\x3E', $twig->render('js', array('bar' => 'foo
    '))); + } + + public function escapingStrategyCallback($filename) + { + return $filename; + } + + public function testGlobals() + { + // globals can be added after calling getGlobals + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->addGlobal('foo', 'bar'); + $globals = $twig->getGlobals(); + $this->assertEquals('bar', $globals['foo']); + + // globals can be modified after a template has been loaded + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->loadTemplate('index'); + $twig->addGlobal('foo', 'bar'); + $globals = $twig->getGlobals(); + $this->assertEquals('bar', $globals['foo']); + + // globals can be modified after extensions init + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->getFunctions(); + $twig->addGlobal('foo', 'bar'); + $globals = $twig->getGlobals(); + $this->assertEquals('bar', $globals['foo']); + + // globals can be modified after extensions and a template has been loaded + $twig = new Twig_Environment($loader = new Twig_Loader_Array(array('index' => '{{foo}}'))); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->getFunctions(); + $twig->loadTemplate('index'); + $twig->addGlobal('foo', 'bar'); + $globals = $twig->getGlobals(); + $this->assertEquals('bar', $globals['foo']); + + $twig = new Twig_Environment($loader); + $twig->getGlobals(); + $twig->addGlobal('foo', 'bar'); + $template = $twig->loadTemplate('index'); + $this->assertEquals('bar', $template->render(array())); + + /* to be uncomment in Twig 2.0 + // globals cannot be added after a template has been loaded + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->loadTemplate('index'); + try { + $twig->addGlobal('bar', 'bar'); + $this->fail(); + } catch (LogicException $e) { + $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); + } + + // globals cannot be added after extensions init + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->getFunctions(); + try { + $twig->addGlobal('bar', 'bar'); + $this->fail(); + } catch (LogicException $e) { + $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); + } + + // globals cannot be added after extensions and a template has been loaded + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->getFunctions(); + $twig->loadTemplate('index'); + try { + $twig->addGlobal('bar', 'bar'); + $this->fail(); + } catch (LogicException $e) { + $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); + } + + // test adding globals after a template has been loaded without call to getGlobals + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->loadTemplate('index'); + try { + $twig->addGlobal('bar', 'bar'); + $this->fail(); + } catch (LogicException $e) { + $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); + } + */ + } + + public function testCompileSourceInlinesSource() + { + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + + $source = "\r\nbar\n"; + $expected = "/* */\n/* bar*/\n/* */\n"; + $compiled = $twig->compileSource($source, 'index'); + + $this->assertContains($expected, $compiled); + $this->assertNotContains('/**', $compiled); + } + + public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate() + { + $cache = new Twig_Cache_Filesystem($dir = sys_get_temp_dir().'/twig'); + $options = array('cache' => $cache, 'auto_reload' => false, 'debug' => false); + + // force compilation + $twig = new Twig_Environment($loader = new Twig_Loader_Array(array('index' => '{{ foo }}')), $options); + + $key = $cache->generateKey('index', $twig->getTemplateClass('index')); + $cache->write($key, $twig->compileSource('{{ foo }}', 'index')); + + // check that extensions won't be initialized when rendering a template that is already in the cache + $twig = $this + ->getMockBuilder('Twig_Environment') + ->setConstructorArgs(array($loader, $options)) + ->setMethods(array('initExtensions')) + ->getMock() + ; + + $twig->expects($this->never())->method('initExtensions'); + + // render template + $output = $twig->render('index', array('foo' => 'bar')); + $this->assertEquals('bar', $output); + + Twig_Tests_FilesystemHelper::removeDir($dir); + } + + public function testAutoReloadCacheMiss() + { + $templateName = __FUNCTION__; + $templateContent = __FUNCTION__; + + $cache = $this->getMock('Twig_CacheInterface'); + $loader = $this->getMockLoader($templateName, $templateContent); + $twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false)); + + // Cache miss: getTimestamp returns 0 and as a result the load() is + // skipped. + $cache->expects($this->once()) + ->method('generateKey') + ->will($this->returnValue('key')); + $cache->expects($this->once()) + ->method('getTimestamp') + ->will($this->returnValue(0)); + $loader->expects($this->never()) + ->method('isFresh'); + $cache->expects($this->never()) + ->method('load'); + + $twig->loadTemplate($templateName); + } + + public function testAutoReloadCacheHit() + { + $templateName = __FUNCTION__; + $templateContent = __FUNCTION__; + + $cache = $this->getMock('Twig_CacheInterface'); + $loader = $this->getMockLoader($templateName, $templateContent); + $twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false)); + + $now = time(); + + // Cache hit: getTimestamp returns something > extension timestamps and + // the loader returns true for isFresh(). + $cache->expects($this->once()) + ->method('generateKey') + ->will($this->returnValue('key')); + $cache->expects($this->once()) + ->method('getTimestamp') + ->will($this->returnValue($now)); + $loader->expects($this->once()) + ->method('isFresh') + ->will($this->returnValue(true)); + $cache->expects($this->once()) + ->method('load'); + + $twig->loadTemplate($templateName); + } + + public function testAutoReloadOutdatedCacheHit() + { + $templateName = __FUNCTION__; + $templateContent = __FUNCTION__; + + $cache = $this->getMock('Twig_CacheInterface'); + $loader = $this->getMockLoader($templateName, $templateContent); + $twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false)); + + $now = time(); + + $cache->expects($this->once()) + ->method('generateKey') + ->will($this->returnValue('key')); + $cache->expects($this->once()) + ->method('getTimestamp') + ->will($this->returnValue($now)); + $loader->expects($this->once()) + ->method('isFresh') + ->will($this->returnValue(false)); + $cache->expects($this->never()) + ->method('load'); + + $twig->loadTemplate($templateName); + } + + public function testAddExtension() + { + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension()); + + $this->assertArrayHasKey('test', $twig->getTags()); + $this->assertArrayHasKey('foo_filter', $twig->getFilters()); + $this->assertArrayHasKey('foo_function', $twig->getFunctions()); + $this->assertArrayHasKey('foo_test', $twig->getTests()); + $this->assertArrayHasKey('foo_unary', $twig->getUnaryOperators()); + $this->assertArrayHasKey('foo_binary', $twig->getBinaryOperators()); + $this->assertArrayHasKey('foo_global', $twig->getGlobals()); + $visitors = $twig->getNodeVisitors(); + $this->assertEquals('Twig_Tests_EnvironmentTest_NodeVisitor', get_class($visitors[2])); + } + + /** + * @requires PHP 5.3 + */ + public function testAddExtensionWithDeprecatedGetGlobals() + { + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithGlobals()); + + $this->deprecations = array(); + set_error_handler(array($this, 'handleError')); + + $this->assertArrayHasKey('foo_global', $twig->getGlobals()); + + $this->assertCount(1, $this->deprecations); + $this->assertContains('Defining the getGlobals() method in the "environment_test" extension ', $this->deprecations[0]); + + restore_error_handler(); + } + + /** + * @group legacy + */ + public function testRemoveExtension() + { + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension()); + $twig->removeExtension('environment_test'); + + $this->assertFalse(array_key_exists('test', $twig->getTags())); + $this->assertFalse(array_key_exists('foo_filter', $twig->getFilters())); + $this->assertFalse(array_key_exists('foo_function', $twig->getFunctions())); + $this->assertFalse(array_key_exists('foo_test', $twig->getTests())); + $this->assertFalse(array_key_exists('foo_unary', $twig->getUnaryOperators())); + $this->assertFalse(array_key_exists('foo_binary', $twig->getBinaryOperators())); + $this->assertFalse(array_key_exists('foo_global', $twig->getGlobals())); + $this->assertCount(2, $twig->getNodeVisitors()); + } + + public function testAddMockExtension() + { + $extension = $this->getMock('Twig_ExtensionInterface'); + $extension->expects($this->once()) + ->method('getName') + ->will($this->returnValue('mock')); + + $loader = new Twig_Loader_Array(array('page' => 'hey')); + + $twig = new Twig_Environment($loader); + $twig->addExtension($extension); + + $this->assertInstanceOf('Twig_ExtensionInterface', $twig->getExtension('mock')); + $this->assertTrue($twig->isTemplateFresh('page', time())); + } + + public function testInitRuntimeWithAnExtensionUsingInitRuntimeNoDeprecation() + { + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime()); + + $twig->initRuntime(); + } + + /** + * @requires PHP 5.3 + */ + public function testInitRuntimeWithAnExtensionUsingInitRuntimeDeprecation() + { + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime()); + + $this->deprecations = array(); + set_error_handler(array($this, 'handleError')); + + $twig->initRuntime(); + + $this->assertCount(1, $this->deprecations); + $this->assertContains('Defining the initRuntime() method in the "with_deprecation" extension is deprecated since version 1.23.', $this->deprecations[0]); + + restore_error_handler(); + } + + public function handleError($type, $msg) + { + if (E_USER_DEPRECATED === $type) { + $this->deprecations[] = $msg; + } + } + + /** + * @requires PHP 5.3 + */ + public function testOverrideExtension() + { + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime()); + + $this->deprecations = array(); + set_error_handler(array($this, 'handleError')); + + $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension()); + $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension()); + + $this->assertCount(1, $this->deprecations); + $this->assertContains('The possibility to register the same extension twice', $this->deprecations[0]); + + restore_error_handler(); + } + + protected function getMockLoader($templateName, $templateContent) + { + $loader = $this->getMock('Twig_LoaderInterface'); + $loader->expects($this->any()) + ->method('getSource') + ->with($templateName) + ->will($this->returnValue($templateContent)); + $loader->expects($this->any()) + ->method('getCacheKey') + ->with($templateName) + ->will($this->returnValue($templateName)); + + return $loader; + } +} + +class Twig_Tests_EnvironmentTest_Extension_WithGlobals extends Twig_Extension +{ + public function getGlobals() + { + return array( + 'foo_global' => 'foo_global', + ); + } + + public function getName() + { + return 'environment_test'; + } +} + +class Twig_Tests_EnvironmentTest_Extension extends Twig_Extension implements Twig_Extension_GlobalsInterface +{ + public function getTokenParsers() + { + return array( + new Twig_Tests_EnvironmentTest_TokenParser(), + ); + } + + public function getNodeVisitors() + { + return array( + new Twig_Tests_EnvironmentTest_NodeVisitor(), + ); + } + + public function getFilters() + { + return array( + new Twig_SimpleFilter('foo_filter', 'foo_filter'), + ); + } + + public function getTests() + { + return array( + new Twig_SimpleTest('foo_test', 'foo_test'), + ); + } + + public function getFunctions() + { + return array( + new Twig_SimpleFunction('foo_function', 'foo_function'), + ); + } + + public function getOperators() + { + return array( + array('foo_unary' => array()), + array('foo_binary' => array()), + ); + } + + public function getGlobals() + { + return array( + 'foo_global' => 'foo_global', + ); + } + + public function getName() + { + return 'environment_test'; + } +} + +class Twig_Tests_EnvironmentTest_TokenParser extends Twig_TokenParser +{ + public function parse(Twig_Token $token) + { + } + + public function getTag() + { + return 'test'; + } +} + +class Twig_Tests_EnvironmentTest_NodeVisitor implements Twig_NodeVisitorInterface +{ + public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) + { + return $node; + } + + public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) + { + return $node; + } + + public function getPriority() + { + return 0; + } +} + +class Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime extends Twig_Extension +{ + public function initRuntime(Twig_Environment $env) + { + } + + public function getName() + { + return 'with_deprecation'; + } +} + +class Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime extends Twig_Extension implements Twig_Extension_InitRuntimeInterface +{ + public function initRuntime(Twig_Environment $env) + { + } + + public function getName() + { + return 'without_deprecation'; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/ErrorTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/ErrorTest.php new file mode 100644 index 00000000..d58c40b8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/ErrorTest.php @@ -0,0 +1,144 @@ +setTemplateFile(new SplFileInfo(__FILE__)); + + $this->assertContains('test'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Tests'.DIRECTORY_SEPARATOR.'ErrorTest.php', $error->getMessage()); + } + + public function testErrorWithArrayFilename() + { + $error = new Twig_Error('foo'); + $error->setTemplateFile(array('foo' => 'bar')); + + $this->assertEquals('foo in {"foo":"bar"}', $error->getMessage()); + } + + public function testTwigExceptionAddsFileAndLineWhenMissingWithInheritanceOnDisk() + { + $loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors'); + $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + + $template = $twig->loadTemplate('index.html'); + try { + $template->render(array()); + + $this->fail(); + } catch (Twig_Error_Runtime $e) { + $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()); + } + + try { + $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); + + $this->fail(); + } catch (Twig_Error_Runtime $e) { + $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index.html" at line 3.', $e->getMessage()); + $this->assertEquals(3, $e->getTemplateLine()); + $this->assertEquals('index.html', $e->getTemplateFile()); + } + } + + /** + * @dataProvider getErroredTemplates + */ + public function testTwigExceptionAddsFileAndLine($templates, $name, $line) + { + $loader = new Twig_Loader_Array($templates); + $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + + $template = $twig->loadTemplate('index'); + + try { + $template->render(array()); + + $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($line, $e->getTemplateLine()); + $this->assertEquals($name, $e->getTemplateFile()); + } + + try { + $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); + + $this->fail(); + } catch (Twig_Error_Runtime $e) { + $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()); + $this->assertEquals($line, $e->getTemplateLine()); + $this->assertEquals($name, $e->getTemplateFile()); + } + } + + public function getErroredTemplates() + { + return array( + // error occurs in a template + array( + array( + 'index' => "\n\n{{ foo.bar }}\n\n\n{{ 'foo' }}", + ), + 'index', 3, + ), + + // error occurs in an included template + array( + array( + 'index' => "{% include 'partial' %}", + 'partial' => '{{ foo.bar }}', + ), + 'partial', 1, + ), + + // error occurs in a parent block when called via parent() + array( + array( + 'index' => "{% extends 'base' %} + {% block content %} + {{ parent() }} + {% endblock %}", + 'base' => '{% block content %}{{ foo.bar }}{% endblock %}', + ), + 'base', 1, + ), + + // error occurs in a block from the child + array( + array( + 'index' => "{% extends 'base' %} + {% block content %} + {{ foo.bar }} + {% endblock %} + {% block foo %} + {{ foo.bar }} + {% endblock %}", + 'base' => '{% block content %}{% endblock %}', + ), + 'index', 3, + ), + ); + } +} + +class Twig_Tests_ErrorTest_Foo +{ + public function bar() + { + throw new Exception('Runtime error...'); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php new file mode 100644 index 00000000..33bf48be --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php @@ -0,0 +1,368 @@ +getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize($template, 'index')); + } + + public function getFailingTestsForAssignment() + { + return array( + array('{% set false = "foo" %}'), + array('{% set true = "foo" %}'), + array('{% set none = "foo" %}'), + array('{% set 3 = "foo" %}'), + array('{% set 1 + 2 = "foo" %}'), + array('{% set "bar" = "foo" %}'), + array('{% set %}{% endset %}'), + ); + } + + /** + * @dataProvider getTestsForArray + */ + public function testArrayExpression($template, $expected) + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $stream = $env->tokenize($template, 'index'); + $parser = new Twig_Parser($env); + + $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); + } + + /** + * @expectedException Twig_Error_Syntax + * @dataProvider getFailingTestsForArray + */ + public function testArraySyntaxError($template) + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize($template, 'index')); + } + + public function getFailingTestsForArray() + { + return array( + array('{{ [1, "a": "b"] }}'), + array('{{ {"a": "b", 2} }}'), + ); + } + + public function getTestsForArray() + { + return array( + // simple array + array('{{ [1, 2] }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant(0, 1), + new Twig_Node_Expression_Constant(1, 1), + + new Twig_Node_Expression_Constant(1, 1), + new Twig_Node_Expression_Constant(2, 1), + ), 1), + ), + + // array with trailing , + array('{{ [1, 2, ] }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant(0, 1), + new Twig_Node_Expression_Constant(1, 1), + + new Twig_Node_Expression_Constant(1, 1), + new Twig_Node_Expression_Constant(2, 1), + ), 1), + ), + + // simple hash + array('{{ {"a": "b", "b": "c"} }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant('a', 1), + new Twig_Node_Expression_Constant('b', 1), + + new Twig_Node_Expression_Constant('b', 1), + new Twig_Node_Expression_Constant('c', 1), + ), 1), + ), + + // hash with trailing , + array('{{ {"a": "b", "b": "c", } }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant('a', 1), + new Twig_Node_Expression_Constant('b', 1), + + new Twig_Node_Expression_Constant('b', 1), + new Twig_Node_Expression_Constant('c', 1), + ), 1), + ), + + // hash in an array + array('{{ [1, {"a": "b", "b": "c"}] }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant(0, 1), + new Twig_Node_Expression_Constant(1, 1), + + new Twig_Node_Expression_Constant(1, 1), + new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant('a', 1), + new Twig_Node_Expression_Constant('b', 1), + + new Twig_Node_Expression_Constant('b', 1), + new Twig_Node_Expression_Constant('c', 1), + ), 1), + ), 1), + ), + + // array in a hash + array('{{ {"a": [1, 2], "b": "c"} }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant('a', 1), + new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant(0, 1), + new Twig_Node_Expression_Constant(1, 1), + + new Twig_Node_Expression_Constant(1, 1), + new Twig_Node_Expression_Constant(2, 1), + ), 1), + new Twig_Node_Expression_Constant('b', 1), + new Twig_Node_Expression_Constant('c', 1), + ), 1), + ), + ); + } + + /** + * @expectedException Twig_Error_Syntax + */ + public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings() + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); + $stream = $env->tokenize('{{ "a" "b" }}', 'index'); + $parser = new Twig_Parser($env); + + $parser->parse($stream); + } + + /** + * @dataProvider getTestsForString + */ + public function testStringExpression($template, $expected) + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); + $stream = $env->tokenize($template, 'index'); + $parser = new Twig_Parser($env); + + $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); + } + + public function getTestsForString() + { + return array( + array( + '{{ "foo" }}', new Twig_Node_Expression_Constant('foo', 1), + ), + array( + '{{ "foo #{bar}" }}', new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Constant('foo ', 1), + new Twig_Node_Expression_Name('bar', 1), + 1 + ), + ), + array( + '{{ "foo #{bar} baz" }}', new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Constant('foo ', 1), + new Twig_Node_Expression_Name('bar', 1), + 1 + ), + new Twig_Node_Expression_Constant(' baz', 1), + 1 + ), + ), + + array( + '{{ "foo #{"foo #{bar} baz"} baz" }}', new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Constant('foo ', 1), + new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Constant('foo ', 1), + new Twig_Node_Expression_Name('bar', 1), + 1 + ), + new Twig_Node_Expression_Constant(' baz', 1), + 1 + ), + 1 + ), + new Twig_Node_Expression_Constant(' baz', 1), + 1 + ), + ), + ); + } + + /** + * @expectedException Twig_Error_Syntax + */ + public function testAttributeCallDoesNotSupportNamedArguments() + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize('{{ foo.bar(name="Foo") }}', 'index')); + } + + /** + * @expectedException Twig_Error_Syntax + */ + public function testMacroCallDoesNotSupportNamedArguments() + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize('{% from _self import foo %}{% macro foo() %}{% endmacro %}{{ foo(name="Foo") }}', 'index')); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage An argument must be a name. Unexpected token "string" of value "a" ("name" expected) in "index" at line 1. + */ + public function testMacroDefinitionDoesNotSupportNonNameVariableName() + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize('{% macro foo("a") %}{% endmacro %}', 'index')); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage A default value for an argument must be a constant (a boolean, a string, a number, or an array) in "index" at line 1 + * @dataProvider getMacroDefinitionDoesNotSupportNonConstantDefaultValues + */ + public function testMacroDefinitionDoesNotSupportNonConstantDefaultValues($template) + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize($template, 'index')); + } + + public function getMacroDefinitionDoesNotSupportNonConstantDefaultValues() + { + return array( + array('{% macro foo(name = "a #{foo} a") %}{% endmacro %}'), + array('{% macro foo(name = [["b", "a #{foo} a"]]) %}{% endmacro %}'), + ); + } + + /** + * @dataProvider getMacroDefinitionSupportsConstantDefaultValues + */ + public function testMacroDefinitionSupportsConstantDefaultValues($template) + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize($template, 'index')); + } + + public function getMacroDefinitionSupportsConstantDefaultValues() + { + return array( + array('{% macro foo(name = "aa") %}{% endmacro %}'), + array('{% macro foo(name = 12) %}{% endmacro %}'), + array('{% macro foo(name = true) %}{% endmacro %}'), + array('{% macro foo(name = ["a"]) %}{% endmacro %}'), + array('{% macro foo(name = [["a"]]) %}{% endmacro %}'), + array('{% macro foo(name = {a: "a"}) %}{% endmacro %}'), + array('{% macro foo(name = {a: {b: "a"}}) %}{% endmacro %}'), + ); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unknown "cycl" function. Did you mean "cycle" in "index" at line 1? + */ + public function testUnknownFunction() + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize('{{ cycl() }}', 'index')); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unknown "foobar" function in "index" at line 1. + */ + public function testUnknownFunctionWithoutSuggestions() + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize('{{ foobar() }}', 'index')); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unknown "lowe" filter. Did you mean "lower" in "index" at line 1? + */ + public function testUnknownFilter() + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize('{{ 1|lowe }}', 'index')); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unknown "foobar" filter in "index" at line 1. + */ + public function testUnknownFilterWithoutSuggestions() + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize('{{ 1|foobar }}', 'index')); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unknown "nul" test. Did you mean "null" in "index" at line 1 + */ + public function testUnknownTest() + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize('{{ 1 is nul }}', 'index')); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unknown "foobar" test in "index" at line 1. + */ + public function testUnknownTestWithoutSuggestions() + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize('{{ 1 is foobar }}', 'index')); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php new file mode 100644 index 00000000..cd49e2f5 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php @@ -0,0 +1,158 @@ +getMock('Twig_LoaderInterface')); + + for ($i = 0; $i < 100; ++$i) { + $this->assertTrue(in_array(twig_random($env, $value), $expectedInArray, true)); // assertContains() would not consider the type + } + } + + public function getRandomFunctionTestData() + { + return array( + array(// array + array('apple', 'orange', 'citrus'), + array('apple', 'orange', 'citrus'), + ), + array(// Traversable + new ArrayObject(array('apple', 'orange', 'citrus')), + array('apple', 'orange', 'citrus'), + ), + array(// unicode string + 'Ä€é', + array('Ä', '€', 'é'), + ), + array(// numeric but string + '123', + array('1', '2', '3'), + ), + array(// integer + 5, + range(0, 5, 1), + ), + array(// float + 5.9, + range(0, 5, 1), + ), + array(// negative + -2, + array(0, -1, -2), + ), + ); + } + + public function testRandomFunctionWithoutParameter() + { + $max = mt_getrandmax(); + + for ($i = 0; $i < 100; ++$i) { + $val = twig_random(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $this->assertTrue(is_int($val) && $val >= 0 && $val <= $max); + } + } + + public function testRandomFunctionReturnsAsIs() + { + $this->assertSame('', twig_random(new Twig_Environment($this->getMock('Twig_LoaderInterface')), '')); + $this->assertSame('', twig_random(new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('charset' => null)), '')); + + $instance = new stdClass(); + $this->assertSame($instance, twig_random(new Twig_Environment($this->getMock('Twig_LoaderInterface')), $instance)); + } + + /** + * @expectedException Twig_Error_Runtime + */ + public function testRandomFunctionOfEmptyArrayThrowsException() + { + twig_random(new Twig_Environment($this->getMock('Twig_LoaderInterface')), array()); + } + + public function testRandomFunctionOnNonUTF8String() + { + if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) { + $this->markTestSkipped('needs iconv or mbstring'); + } + + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->setCharset('ISO-8859-1'); + + $text = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8'); + for ($i = 0; $i < 30; ++$i) { + $rand = twig_random($twig, $text); + $this->assertTrue(in_array(twig_convert_encoding($rand, 'UTF-8', 'ISO-8859-1'), array('Ä', 'é'), true)); + } + } + + public function testReverseFilterOnNonUTF8String() + { + if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) { + $this->markTestSkipped('needs iconv or mbstring'); + } + + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->setCharset('ISO-8859-1'); + + $input = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8'); + $output = twig_convert_encoding(twig_reverse_filter($twig, $input), 'UTF-8', 'ISO-8859-1'); + + $this->assertEquals($output, 'éÄ'); + } + + public function testCustomEscaper() + { + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $twig->getExtension('core')->setEscaper('foo', 'foo_escaper_for_test'); + + $this->assertEquals('fooUTF-8', twig_escape_filter($twig, 'foo', 'foo')); + $this->assertEquals('UTF-8', twig_escape_filter($twig, null, 'foo')); + $this->assertEquals('42UTF-8', twig_escape_filter($twig, 42, 'foo')); + } + + /** + * @expectedException Twig_Error_Runtime + */ + public function testUnknownCustomEscaper() + { + twig_escape_filter(new Twig_Environment($this->getMock('Twig_LoaderInterface')), 'foo', 'bar'); + } + + public function testTwigFirst() + { + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $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->getMock('Twig_LoaderInterface')); + $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) +{ + return $string.$charset; +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php new file mode 100644 index 00000000..bfaa62b0 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php @@ -0,0 +1,220 @@ + 'Fabien', + 'obj' => new FooObject(), + 'arr' => array('obj' => new FooObject()), + ); + + self::$templates = array( + '1_basic1' => '{{ obj.foo }}', + '1_basic2' => '{{ name|upper }}', + '1_basic3' => '{% if name %}foo{% endif %}', + '1_basic4' => '{{ obj.bar }}', + '1_basic5' => '{{ obj }}', + '1_basic6' => '{{ arr.obj }}', + '1_basic7' => '{{ cycle(["foo","bar"], 1) }}', + '1_basic8' => '{{ obj.getfoobar }}{{ obj.getFooBar }}', + '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\" %}\n{% block content %}\n{{ \"a\"|json_encode }}\n{% endblock %}", + ); + } + + /** + * @expectedException Twig_Sandbox_SecurityError + * @expectedExceptionMessage Filter "json_encode" is not allowed in "1_child" at line 3. + */ + public function testSandboxWithInheritance() + { + $twig = $this->getEnvironment(true, array(), self::$templates, array('block')); + $twig->loadTemplate('1_child')->render(array()); + } + + public function testSandboxGloballySet() + { + $twig = $this->getEnvironment(false, array(), self::$templates); + $this->assertEquals('FOO', $twig->loadTemplate('1_basic')->render(self::$params), 'Sandbox does nothing if it is disabled globally'); + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic1')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed method is called'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic2')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed filter is called'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic3')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed tag is used in the template'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic4')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed property is called in the template'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic5')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic6')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic7')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed function is called in the template'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => 'foo')); + FooObject::reset(); + $this->assertEquals('foo', $twig->loadTemplate('1_basic1')->render(self::$params), 'Sandbox allow some methods'); + $this->assertEquals(1, FooObject::$called['foo'], 'Sandbox only calls method once'); + + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => '__toString')); + FooObject::reset(); + $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'); + + $twig = $this->getEnvironment(true, array(), self::$templates, array('if')); + $this->assertEquals('foo', $twig->loadTemplate('1_basic3')->render(self::$params), 'Sandbox allow some tags'); + + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array('FooObject' => 'bar')); + $this->assertEquals('bar', $twig->loadTemplate('1_basic4')->render(self::$params), 'Sandbox allow some properties'); + + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array(), array('cycle')); + $this->assertEquals('bar', $twig->loadTemplate('1_basic7')->render(self::$params), 'Sandbox allow some functions'); + + foreach (array('getfoobar', 'getFoobar', 'getFooBar') as $name) { + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => $name)); + FooObject::reset(); + $this->assertEquals('foobarfoobar', $twig->loadTemplate('1_basic8')->render(self::$params), 'Sandbox allow methods in a case-insensitive way'); + $this->assertEquals(2, FooObject::$called['getFooBar'], 'Sandbox only calls method once'); + + $this->assertEquals('foobarfoobar', $twig->loadTemplate('1_basic9')->render(self::$params), 'Sandbox allow methods via shortcut names (ie. without get/set)'); + } + } + + public function testSandboxLocallySetForAnInclude() + { + self::$templates = array( + '2_basic' => '{{ obj.foo }}{% include "2_included" %}{{ obj.foo }}', + '2_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', + ); + + $twig = $this->getEnvironment(false, array(), self::$templates); + $this->assertEquals('fooFOOfoo', $twig->loadTemplate('2_basic')->render(self::$params), 'Sandbox does nothing if disabled globally and sandboxed not used for the include'); + + self::$templates = array( + '3_basic' => '{{ obj.foo }}{% sandbox %}{% include "3_included" %}{% endsandbox %}{{ obj.foo }}', + '3_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', + ); + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('3_basic')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception when the included file is sandboxed'); + } catch (Twig_Sandbox_SecurityError $e) { + } + } + + public function testMacrosInASandbox() + { + $twig = $this->getEnvironment(true, array('autoescape' => 'html'), array('index' => <<{{ text }}

    {% endmacro %} + +{{- macros.test('username') }} +EOF + ), array('macro', 'import'), array('escape')); + + $this->assertEquals('

    username

    ', $twig->loadTemplate('index')->render(array())); + } + + protected function getEnvironment($sandboxed, $options, $templates, $tags = array(), $filters = array(), $methods = array(), $properties = array(), $functions = array()) + { + $loader = new Twig_Loader_Array($templates); + $twig = new Twig_Environment($loader, array_merge(array('debug' => true, 'cache' => false, 'autoescape' => false), $options)); + $policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions); + $twig->addExtension(new Twig_Extension_Sandbox($policy, $sandboxed)); + + return $twig; + } +} + +class FooObject +{ + public static $called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0); + + public $bar = 'bar'; + + public static function reset() + { + self::$called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0); + } + + public function __toString() + { + ++self::$called['__toString']; + + return 'foo'; + } + + public function foo() + { + ++self::$called['foo']; + + return 'foo'; + } + + public function getFooBar() + { + ++self::$called['getFooBar']; + + return 'foobar'; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php new file mode 100644 index 00000000..d9c02c07 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php @@ -0,0 +1,63 @@ +tmpDir = sys_get_temp_dir().'/TwigTests'; + if (!file_exists($this->tmpDir)) { + @mkdir($this->tmpDir, 0777, true); + } + + if (!is_writable($this->tmpDir)) { + $this->markTestSkipped(sprintf('Unable to run the tests as "%s" is not writable.', $this->tmpDir)); + } + + $this->env = new Twig_Environment(new Twig_Loader_Array(array('index' => 'index', 'index2' => 'index2')), array('cache' => $this->tmpDir)); + } + + protected function tearDown() + { + Twig_Tests_FilesystemHelper::removeDir($this->tmpDir); + } + + /** + * @group legacy + */ + public function testWritingCacheFiles() + { + $name = 'index'; + $this->env->loadTemplate($name); + $cacheFileName = $this->env->getCacheFilename($name); + + $this->assertTrue(file_exists($cacheFileName), 'Cache file does not exist.'); + } + + /** + * @group legacy + */ + public function testClearingCacheFiles() + { + $name = 'index2'; + $this->env->loadTemplate($name); + $cacheFileName = $this->env->getCacheFilename($name); + + $this->assertTrue(file_exists($cacheFileName), 'Cache file does not exist.'); + $this->env->clearCacheFiles(); + $this->assertFalse(file_exists($cacheFileName), 'Cache file was not cleared.'); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php new file mode 100644 index 00000000..b310a5be --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php @@ -0,0 +1,51 @@ +assertSame($strategy, Twig_FileExtensionEscapingStrategy::guess($filename)); + } + + public function getGuessData() + { + return array( + // default + array('html', 'foo.html'), + array('html', 'foo.html.twig'), + array('html', 'foo'), + array('html', 'foo.bar.twig'), + array('html', 'foo.txt/foo'), + array('html', 'foo.txt/foo.js/'), + + // css + array('css', 'foo.css'), + array('css', 'foo.css.twig'), + array('css', 'foo.twig.css'), + array('css', 'foo.js.css'), + array('css', 'foo.js.css.twig'), + + // js + array('js', 'foo.js'), + array('js', 'foo.js.twig'), + array('js', 'foo.txt/foo.js'), + array('js', 'foo.txt.twig/foo.js'), + + // txt + array(false, 'foo.txt'), + array(false, 'foo.txt.twig'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php new file mode 100644 index 00000000..0e315e8f --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php @@ -0,0 +1,30 @@ + $fileInfo) { + if ($iterator->isDot()) { + continue; + } + + if ($fileInfo->isDir()) { + rmdir($filename); + } else { + unlink($filename); + } + } + rmdir($dir); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/filename.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/filename.test new file mode 100644 index 00000000..b091ad34 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/filename.test @@ -0,0 +1,18 @@ +--TEST-- +"filename" autoescape strategy +--TEMPLATE-- +{{ br -}} +{{ include('index.html.twig') -}} +{{ include('index.txt.twig') -}} +--TEMPLATE(index.html.twig)-- +{{ br -}} +--TEMPLATE(index.txt.twig)-- +{{ br -}} +--DATA-- +return array('br' => '
    ') +--CONFIG-- +return array('autoescape' => 'filename') +--EXPECT-- +<br /> +<br /> +
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html new file mode 100644 index 00000000..cb0dbe44 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html @@ -0,0 +1 @@ +{% block content %}{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html new file mode 100644 index 00000000..df57c822 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} +{% block content %} + {{ foo.bar }} +{% endblock %} +{% block foo %} + {{ foo.bar }} +{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test new file mode 100644 index 00000000..ce49165d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test @@ -0,0 +1,18 @@ +--TEST-- +Exception for multiline array with undefined variable +--TEMPLATE-- +{% set foo = { + foo: 'foo', + bar: 'bar', + + + foobar: foobar, + + + + foo2: foo2, +} %} +--DATA-- +return array('foobar' => 'foobar') +--EXCEPTION-- +Twig_Error_Runtime: Variable "foo2" does not exist in "index.twig" at line 11 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test new file mode 100644 index 00000000..e3c040f9 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test @@ -0,0 +1,18 @@ +--TEST-- +Exception for multiline array with undefined variable +--TEMPLATE-- +{% set foo = { + foo: 'foo', + bar: 'bar', + + + foobar: foobar, + + + + foo2: foo2, +} %} +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Runtime: Variable "foobar" does not exist in "index.twig" at line 7 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test new file mode 100644 index 00000000..d799a390 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test @@ -0,0 +1,12 @@ +--TEST-- +Exception for multile function with undefined variable +--TEMPLATE-- +{{ include('foo', + with_context=with_context +) }} +--TEMPLATE(foo)-- +Foo +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Runtime: Variable "with_context" does not exist in "index.twig" at line 3 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test new file mode 100644 index 00000000..64761fcf --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test @@ -0,0 +1,9 @@ +--TEST-- +Exception for multiline function with unknown argument +--TEMPLATE-- +{{ include('foo', + with_context=True, + invalid=False +) }} +--EXCEPTION-- +Twig_Error_Syntax: Unknown argument "invalid" for function "include(template, variables, with_context, ignore_missing, sandboxed)" in "index.twig" at line 4. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test new file mode 100644 index 00000000..096a5dbf --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test @@ -0,0 +1,12 @@ +--TEST-- +Exception for multiline tag with undefined variable +--TEMPLATE-- +{% include 'foo' + with vars +%} +--TEMPLATE(foo)-- +Foo +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Runtime: Variable "vars" does not exist in "index.twig" at line 3 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test new file mode 100644 index 00000000..9ca418b2 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test @@ -0,0 +1,10 @@ +--TEST-- +Exception for syntax error in reused template +--TEMPLATE-- +{% use 'foo.twig' %} +--TEMPLATE(foo.twig)-- +{% block bar %} + {% do node.data = 5 %} +{% endblock %} +--EXCEPTION-- +Twig_Error_Syntax: Unexpected token "operator" of value "=" ("end of statement block" expected) in "foo.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test new file mode 100644 index 00000000..2c35ad56 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test @@ -0,0 +1,20 @@ +--TEST-- +Exception for an unclosed tag +--TEMPLATE-- +{% block foo %} + {% if foo %} + + + + + {% for i in fo %} + + + + {% endfor %} + + + +{% endblock %} +--EXCEPTION-- +Twig_Error_Syntax: Unexpected "endblock" tag (expecting closing tag for the "if" tag defined near line 4) in "index.twig" at line 16. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test new file mode 100644 index 00000000..c8e7a097 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test @@ -0,0 +1,8 @@ +--TEST-- +Exception for an undefined parent +--TEMPLATE-- +{% extends 'foo.html' %} + +{% set foo = "foo" %} +--EXCEPTION-- +Twig_Error_Loader: Template "foo.html" is not defined in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test new file mode 100644 index 00000000..1992510b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test @@ -0,0 +1,15 @@ +--TEST-- +Exception for an undefined template in a child template +--TEMPLATE-- +{% extends 'base.twig' %} + +{% block sidebar %} + {{ include('include.twig') }} +{% endblock %} +--TEMPLATE(base.twig)-- +{% block sidebar %} +{% endblock %} +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Loader: Template "include.twig" is not defined in "index.twig" at line 5. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test new file mode 100644 index 00000000..6679fbe1 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test @@ -0,0 +1,9 @@ +--TEST-- +Exception for an undefined trait +--TEMPLATE-- +{% use 'foo' with foobar as bar %} +--TEMPLATE(foo)-- +{% block bar %} +{% endblock %} +--EXCEPTION-- +Twig_Error_Runtime: Block "foobar" is not defined in trait "foo" in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test new file mode 100644 index 00000000..c69b1192 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test @@ -0,0 +1,61 @@ +--TEST-- +Twig supports array notation +--TEMPLATE-- +{# empty array #} +{{ []|join(',') }} + +{{ [1, 2]|join(',') }} +{{ ['foo', "bar"]|join(',') }} +{{ {0: 1, 'foo': 'bar'}|join(',') }} +{{ {0: 1, 'foo': 'bar'}|keys|join(',') }} + +{{ {0: 1, foo: 'bar'}|join(',') }} +{{ {0: 1, foo: 'bar'}|keys|join(',') }} + +{# nested arrays #} +{% set a = [1, 2, [1, 2], {'foo': {'foo': 'bar'}}] %} +{{ a[2]|join(',') }} +{{ a[3]["foo"]|join(',') }} + +{# works even if [] is used inside the array #} +{{ [foo[bar]]|join(',') }} + +{# elements can be any expression #} +{{ ['foo'|upper, bar|upper, bar == foo]|join(',') }} + +{# arrays can have a trailing , like in PHP #} +{{ + [ + 1, + 2, + ]|join(',') +}} + +{# keys can be any expression #} +{% set a = 1 %} +{% set b = "foo" %} +{% set ary = { (a): 'a', (b): 'b', 'c': 'c', (a ~ b): 'd' } %} +{{ ary|keys|join(',') }} +{{ ary|join(',') }} +--DATA-- +return array('bar' => 'bar', 'foo' => array('bar' => 'bar')) +--EXPECT-- +1,2 +foo,bar +1,bar +0,foo + +1,bar +0,foo + +1,2 +bar + +bar + +FOO,BAR, + +1,2 + +1,foo,c,1foo +a,b,c,d diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test new file mode 100644 index 00000000..f3df328f --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test @@ -0,0 +1,14 @@ +--TEST-- +Twig supports method calls +--TEMPLATE-- +{{ items.foo }} +{{ items['foo'] }} +{{ items[foo] }} +{{ items[items[foo]] }} +--DATA-- +return array('foo' => 'bar', 'items' => array('foo' => 'bar', 'bar' => 'foo')) +--EXPECT-- +bar +bar +foo +bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test new file mode 100644 index 00000000..f5e68456 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test @@ -0,0 +1,46 @@ +--TEST-- +Twig supports binary operations (+, -, *, /, ~, %, and, or) +--TEMPLATE-- +{{ 1 + 1 }} +{{ 2 - 1 }} +{{ 2 * 2 }} +{{ 2 / 2 }} +{{ 3 % 2 }} +{{ 1 and 1 }} +{{ 1 and 0 }} +{{ 0 and 1 }} +{{ 0 and 0 }} +{{ 1 or 1 }} +{{ 1 or 0 }} +{{ 0 or 1 }} +{{ 0 or 0 }} +{{ 0 or 1 and 0 }} +{{ 1 or 0 and 1 }} +{{ "foo" ~ "bar" }} +{{ foo ~ "bar" }} +{{ "foo" ~ bar }} +{{ foo ~ bar }} +{{ 20 // 7 }} +--DATA-- +return array('foo' => 'bar', 'bar' => 'foo') +--EXPECT-- +2 +1 +4 +1 +1 +1 + + + +1 +1 +1 + + +1 +foobar +barbar +foofoo +barfoo +2 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test new file mode 100644 index 00000000..74fe6cab --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test @@ -0,0 +1,14 @@ +--TEST-- +Twig supports bitwise operations +--TEMPLATE-- +{{ 1 b-and 5 }} +{{ 1 b-or 5 }} +{{ 1 b-xor 5 }} +{{ (1 and 0 b-or 0) is same as(1 and (0 b-or 0)) ? 'ok' : 'ko' }} +--DATA-- +return array() +--EXPECT-- +1 +5 +4 +ok diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test new file mode 100644 index 00000000..726b8507 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test @@ -0,0 +1,14 @@ +--TEST-- +Twig supports comparison operators (==, !=, <, >, >=, <=) +--TEMPLATE-- +{{ 1 > 2 }}/{{ 1 > 1 }}/{{ 1 >= 2 }}/{{ 1 >= 1 }} +{{ 1 < 2 }}/{{ 1 < 1 }}/{{ 1 <= 2 }}/{{ 1 <= 1 }} +{{ 1 == 1 }}/{{ 1 == 2 }} +{{ 1 != 1 }}/{{ 1 != 2 }} +--DATA-- +return array() +--EXPECT-- +///1 +1//1/1 +1/ +/1 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test new file mode 100644 index 00000000..238dd279 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test @@ -0,0 +1,17 @@ +--TEST-- +Twig supports the "divisible by" operator +--TEMPLATE-- +{{ 8 is divisible by(2) ? 'OK' }} +{{ 8 is not divisible by(3) ? 'OK' }} +{{ 8 is divisible by (2) ? 'OK' }} +{{ 8 is not + divisible + by + (3) ? 'OK' }} +--DATA-- +return array() +--EXPECT-- +OK +OK +OK +OK diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test new file mode 100644 index 00000000..9cd0676c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test @@ -0,0 +1,20 @@ +--TEST-- +Twig supports the .. operator +--TEMPLATE-- +{% for i in 0..10 %}{{ i }} {% endfor %} + +{% for letter in 'a'..'z' %}{{ letter }} {% endfor %} + +{% for letter in 'a'|upper..'z'|upper %}{{ letter }} {% endfor %} + +{% for i in foo[0]..foo[1] %}{{ i }} {% endfor %} + +{% for i in 0 + 1 .. 10 - 1 %}{{ i }} {% endfor %} +--DATA-- +return array('foo' => array(1, 10)) +--EXPECT-- +0 1 2 3 4 5 6 7 8 9 10 +a b c d e f g h i j k l m n o p q r s t u v w x y z +A B C D E F G H I J K L M N O P Q R S T U V W X Y Z +1 2 3 4 5 6 7 8 9 10 +1 2 3 4 5 6 7 8 9 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test new file mode 100644 index 00000000..9ad5e5e8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test @@ -0,0 +1,26 @@ +--TEST-- +Twig supports the "ends with" operator +--TEMPLATE-- +{{ '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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test new file mode 100644 index 00000000..79f8e0b0 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test @@ -0,0 +1,8 @@ +--TEST-- +Twig supports grouping of expressions +--TEMPLATE-- +{{ (2 + 2) / 2 }} +--DATA-- +return array() +--EXPECT-- +2 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test new file mode 100644 index 00000000..7ae3bae9 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test @@ -0,0 +1,22 @@ +--TEST-- +Twig supports literals +--TEMPLATE-- +1 {{ true }} +2 {{ TRUE }} +3 {{ false }} +4 {{ FALSE }} +5 {{ none }} +6 {{ NONE }} +7 {{ null }} +8 {{ NULL }} +--DATA-- +return array() +--EXPECT-- +1 1 +2 1 +3 +4 +5 +6 +7 +8 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test new file mode 100644 index 00000000..159db96f --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test @@ -0,0 +1,27 @@ +--TEST-- +Twig supports __call() for attributes +--TEMPLATE-- +{{ foo.foo }} +{{ foo.bar }} +--DATA-- +class TestClassForMagicCallAttributes +{ + public function getBar() + { + return 'bar_from_getbar'; + } + + public function __call($method, $arguments) + { + if ('foo' === $method) + { + return 'foo_from_call'; + } + + return false; + } +} +return array('foo' => new TestClassForMagicCallAttributes()) +--EXPECT-- +foo_from_call +bar_from_getbar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test new file mode 100644 index 00000000..b6c77165 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test @@ -0,0 +1,12 @@ +--TEST-- +Twig supports the "matches" operator +--TEMPLATE-- +{{ 'foo' matches '/o/' ? 'OK' : 'KO' }} +{{ 'foo' matches '/^fo/' ? 'OK' : 'KO' }} +{{ 'foo' matches '/O/i' ? 'OK' : 'KO' }} +--DATA-- +return array() +--EXPECT-- +OK +OK +OK diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test new file mode 100644 index 00000000..5f801e63 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test @@ -0,0 +1,28 @@ +--TEST-- +Twig supports method calls +--TEMPLATE-- +{{ items.foo.foo }} +{{ items.foo.getFoo() }} +{{ items.foo.bar }} +{{ items.foo['bar'] }} +{{ items.foo.bar('a', 43) }} +{{ items.foo.bar(foo) }} +{{ items.foo.self.foo() }} +{{ items.foo.is }} +{{ items.foo.in }} +{{ items.foo.not }} +--DATA-- +return array('foo' => 'bar', 'items' => array('foo' => new TwigTestFoo(), 'bar' => 'foo')) +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- +foo +foo +bar + +bar_a-43 +bar_bar +foo +is +in +not diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test new file mode 100644 index 00000000..1853b1b0 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test @@ -0,0 +1,18 @@ +--TEST-- +Twig manages negative numbers correctly +--TEMPLATE-- +{{ -1 }} +{{ - 1 }} +{{ 5 - 1 }} +{{ 5-1 }} +{{ 5 + -1 }} +{{ 5 + - 1 }} +--DATA-- +return array() +--EXPECT-- +-1 +-1 +4 +4 +4 +4 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test new file mode 100644 index 00000000..fe29d08b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test @@ -0,0 +1,16 @@ +--TEST-- +Twig allows to use named operators as variable names +--TEMPLATE-- +{% for match in matches %} + {{- match }} +{% endfor %} +{{ in }} +{{ is }} +--DATA-- +return array('matches' => array(1, 2, 3), 'in' => 'in', 'is' => 'is') +--EXPECT-- +1 +2 +3 +in +is diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test new file mode 100644 index 00000000..542c3504 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test @@ -0,0 +1,22 @@ +--TEST-- +Twig parses postfix expressions +--TEMPLATE-- +{% import _self as macros %} + +{% macro foo() %}foo{% endmacro %} + +{{ 'a' }} +{{ 'a'|upper }} +{{ ('a')|upper }} +{{ -1|upper }} +{{ macros.foo() }} +{{ (macros).foo() }} +--DATA-- +return array(); +--EXPECT-- +a +A +A +-1 +foo +foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test new file mode 100644 index 00000000..601201de --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test @@ -0,0 +1,21 @@ +--TEST-- +Twig supports the "same as" operator +--TEMPLATE-- +{{ 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' }} +{{ 1 is not + same + as + (true) ? 'OK' }} +--DATA-- +return array() +--EXPECT-- +OK +OK +OK +OK +OK +OK diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test new file mode 100644 index 00000000..75d331e9 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test @@ -0,0 +1,27 @@ +--TEST-- +Twig supports the "starts with" operator +--TEMPLATE-- +{{ 'foo' starts with 'f' ? 'OK' : 'KO' }} +{{ not ('foo' starts with 'oo') ? 'OK' : 'KO' }} +{{ not ('foo' starts with 'foowaytoolong') ? 'OK' : 'KO' }} +{{ '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-- +OK +OK +OK +OK +OK +OK +KO +KO +KO +KO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test new file mode 100644 index 00000000..a9116613 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test @@ -0,0 +1,10 @@ +--TEST-- +Twig supports string interpolation +--TEMPLATE-- +{{ "foo #{"foo #{bar} baz"} baz" }} +{{ "foo #{bar}#{bar} baz" }} +--DATA-- +return array('bar' => 'BAR'); +--EXPECT-- +foo foo BAR baz baz +foo BARBAR baz diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test new file mode 100644 index 00000000..0e6fa96e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test @@ -0,0 +1,18 @@ +--TEST-- +Twig supports the ternary operator +--TEMPLATE-- +{{ 1 ? 'YES' : 'NO' }} +{{ 0 ? 'YES' : 'NO' }} +{{ 0 ? 'YES' : (1 ? 'YES1' : 'NO1') }} +{{ 0 ? 'YES' : (0 ? 'YES1' : 'NO1') }} +{{ 1 == 1 ? 'foo
    ':'' }} +{{ foo ~ (bar ? ('-' ~ bar) : '') }} +--DATA-- +return array('foo' => 'foo', 'bar' => 'bar') +--EXPECT-- +YES +NO +YES1 +NO1 +foo
    +foo-bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test new file mode 100644 index 00000000..fdc660fc --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test @@ -0,0 +1,10 @@ +--TEST-- +Twig supports the ternary operator +--TEMPLATE-- +{{ 1 ? 'YES' }} +{{ 0 ? 'YES' }} +--DATA-- +return array() +--EXPECT-- +YES + diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test new file mode 100644 index 00000000..9057e837 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test @@ -0,0 +1,10 @@ +--TEST-- +Twig supports the ternary operator +--TEMPLATE-- +{{ 'YES' ?: 'NO' }} +{{ 0 ?: 'NO' }} +--DATA-- +return array() +--EXPECT-- +YES +NO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test new file mode 100644 index 00000000..0eaabb44 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test @@ -0,0 +1,8 @@ +--TEST-- +Twig does not allow to use two-word named operators as variable names +--TEMPLATE-- +{{ starts with }} +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Syntax: Unexpected token "operator" of value "starts with" in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test new file mode 100644 index 00000000..b79219a2 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test @@ -0,0 +1,12 @@ +--TEST-- +Twig supports unary operators (not, -, +) +--TEMPLATE-- +{{ not 1 }}/{{ not 0 }} +{{ +1 + 1 }}/{{ -1 - 1 }} +{{ not (false or true) }} +--DATA-- +return array() +--EXPECT-- +/1 +2/-2 + diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test new file mode 100644 index 00000000..ad84a9c2 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test @@ -0,0 +1,22 @@ +--TEST-- +Twig manages negative numbers as default parameters +--TEMPLATE-- +{% import _self as macros %} +{{ macros.negative_number1() }} +{{ macros.negative_number2() }} +{{ macros.negative_number3() }} +{{ macros.positive_number1() }} +{{ macros.positive_number2() }} +{% macro negative_number1(nb=-1) %}{{ nb }}{% endmacro %} +{% macro negative_number2(nb = --1) %}{{ nb }}{% endmacro %} +{% macro negative_number3(nb = - 1) %}{{ nb }}{% endmacro %} +{% macro positive_number1(nb = +1) %}{{ nb }}{% endmacro %} +{% macro positive_number2(nb = ++1) %}{{ nb }}{% endmacro %} +--DATA-- +return array() +--EXPECT-- +-1 +1 +-1 +1 +1 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test new file mode 100644 index 00000000..cc6eef8d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test @@ -0,0 +1,14 @@ +--TEST-- +Twig unary operators precedence +--TEMPLATE-- +{{ -1 - 1 }} +{{ -1 - -1 }} +{{ -1 * -1 }} +{{ 4 / -1 * 5 }} +--DATA-- +return array() +--EXPECT-- +-2 +0 +1 +-20 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test new file mode 100644 index 00000000..27e93fd6 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test @@ -0,0 +1,30 @@ +--TEST-- +"abs" filter +--TEMPLATE-- +{{ (-5.5)|abs }} +{{ (-5)|abs }} +{{ (-0)|abs }} +{{ 0|abs }} +{{ 5|abs }} +{{ 5.5|abs }} +{{ number1|abs }} +{{ number2|abs }} +{{ number3|abs }} +{{ number4|abs }} +{{ number5|abs }} +{{ number6|abs }} +--DATA-- +return array('number1' => -5.5, 'number2' => -5, 'number3' => -0, 'number4' => 0, 'number5' => 5, 'number6' => 5.5) +--EXPECT-- +5.5 +5 +0 +0 +5 +5.5 +5.5 +5 +0 +0 +5 +5.5 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test new file mode 100644 index 00000000..cb6de7f9 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test @@ -0,0 +1,31 @@ +--TEST-- +"batch" filter +--TEMPLATE-- +{% for row in items|batch(3) %} +
    + {% for column in row %} +
    {{ column }}
    + {% endfor %} +
    +{% endfor %} +--DATA-- +return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) +--EXPECT-- +
    +
    a
    +
    b
    +
    c
    +
    +
    +
    d
    +
    e
    +
    f
    +
    +
    +
    g
    +
    h
    +
    i
    +
    +
    +
    j
    +
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test new file mode 100644 index 00000000..e2ec4beb --- /dev/null +++ b/plugins/twig/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-- +
    +
    a
    +
    b
    +
    c
    +
    d
    +
    +
    +
    e
    +
    f
    +
    g
    +
    h
    +
    +
    +
    i
    +
    j
    +
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test new file mode 100644 index 00000000..af996f24 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test @@ -0,0 +1,37 @@ +--TEST-- +"batch" filter +--TEMPLATE-- + +{% for row in items|batch(3, '') %} + + {% for column in row %} + + {% endfor %} + +{% endfor %} +
    {{ column }}
    +--DATA-- +return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) +--EXPECT-- + + + + + + + + + + + + + + + + + + + + + +
    abc
    def
    ghi
    j
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test new file mode 100644 index 00000000..72483f4b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test @@ -0,0 +1,33 @@ +--TEST-- +"batch" filter +--TEMPLATE-- +{% for row in items|batch(3, 'fill') %} +
    + {% for column in row %} +
    {{ column }}
    + {% endfor %} +
    +{% endfor %} +--DATA-- +return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l')) +--EXPECT-- +
    +
    a
    +
    b
    +
    c
    +
    +
    +
    d
    +
    e
    +
    f
    +
    +
    +
    g
    +
    h
    +
    i
    +
    +
    +
    j
    +
    k
    +
    l
    +
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test new file mode 100644 index 00000000..746295f1 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test @@ -0,0 +1,37 @@ +--TEST-- +"batch" filter +--TEMPLATE-- + +{% for row in items|batch(3, 'fill') %} + + {% for column in row %} + + {% endfor %} + +{% endfor %} +
    {{ column }}
    +--DATA-- +return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) +--EXPECT-- + + + + + + + + + + + + + + + + + + + + + +
    abc
    def
    ghi
    jfillfill
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test new file mode 100644 index 00000000..6015380e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test @@ -0,0 +1,10 @@ +--TEST-- +"batch" filter preserves array keys +--TEMPLATE-- +{{ {'foo': 'bar', 'key': 'value'}|batch(4)|first|keys|join(',') }} +{{ {'foo': 'bar', 'key': 'value'}|batch(4, 'fill')|first|keys|join(',') }} +--DATA-- +return array() +--EXPECT-- +foo,key +foo,key,0,1 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test new file mode 100644 index 00000000..b9c058d6 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test @@ -0,0 +1,10 @@ +--TEST-- +"batch" filter with zero elements +--TEMPLATE-- +{{ []|batch(3)|length }} +{{ []|batch(3, 'fill')|length }} +--DATA-- +return array() +--EXPECT-- +0 +0 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test new file mode 100644 index 00000000..380b04bb --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test @@ -0,0 +1,10 @@ +--TEST-- +"convert_encoding" filter +--CONDITION-- +function_exists('iconv') || function_exists('mb_convert_encoding') +--TEMPLATE-- +{{ "愛していますか?"|convert_encoding('ISO-2022-JP', 'UTF-8')|convert_encoding('UTF-8', 'ISO-2022-JP') }} +--DATA-- +return array() +--EXPECT-- +愛していますか? diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test new file mode 100644 index 00000000..d17e5e2f --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test @@ -0,0 +1,90 @@ +--TEST-- +"date" filter +--TEMPLATE-- +{{ date1|date }} +{{ date1|date('d/m/Y') }} +{{ date1|date('d/m/Y H:i:s', 'Asia/Hong_Kong') }} +{{ date1|date('d/m/Y H:i:s P', 'Asia/Hong_Kong') }} +{{ date1|date('d/m/Y H:i:s P', 'America/Chicago') }} +{{ date1|date('e') }} +{{ date1|date('d/m/Y H:i:s') }} + +{{ date2|date }} +{{ date2|date('d/m/Y') }} +{{ date2|date('d/m/Y H:i:s', 'Asia/Hong_Kong') }} +{{ date2|date('d/m/Y H:i:s', timezone1) }} +{{ date2|date('d/m/Y H:i:s') }} + +{{ date3|date }} +{{ date3|date('d/m/Y') }} + +{{ date4|date }} +{{ date4|date('d/m/Y') }} + +{{ date5|date }} +{{ date5|date('d/m/Y') }} + +{{ date6|date('d/m/Y H:i:s P', 'Europe/Paris') }} +{{ date6|date('d/m/Y H:i:s P', 'Asia/Hong_Kong') }} +{{ date6|date('d/m/Y H:i:s P', false) }} +{{ date6|date('e', 'Europe/Paris') }} +{{ 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( + 'date1' => mktime(13, 45, 0, 10, 4, 2010), + 'date2' => new DateTime('2010-10-04 13:45'), + 'date3' => '2010-10-04 13:45', + '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+04:00', + 'timezone1' => new DateTimeZone('America/New_York'), +) +--EXPECT-- +October 4, 2010 13:45 +04/10/2010 +04/10/2010 19:45:00 +04/10/2010 19:45:00 +08:00 +04/10/2010 06:45:00 -05:00 +Europe/Paris +04/10/2010 13:45:00 + +October 4, 2010 13:45 +04/10/2010 +04/10/2010 19:45:00 +04/10/2010 07:45:00 +04/10/2010 13:45:00 + +October 4, 2010 13:45 +04/10/2010 + +October 4, 2010 15:45 +04/10/2010 + +January 2, 1964 04:04 +02/01/1964 + +04/10/2010 19:45:00 +02:00 +05/10/2010 01:45:00 +08:00 +04/10/2010 13:45:00 -04:00 +Europe/Paris +America/New_York + +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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test new file mode 100644 index 00000000..11a1ef4b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test @@ -0,0 +1,14 @@ +--TEST-- +"date" filter +--TEMPLATE-- +{{ date1|date }} +{{ date1|date('d/m/Y') }} +--DATA-- +date_default_timezone_set('UTC'); +$twig->getExtension('core')->setDateFormat('Y-m-d', '%d days %h hours'); +return array( + 'date1' => mktime(13, 45, 0, 10, 4, 2010), +) +--EXPECT-- +2010-10-04 +04/10/2010 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test new file mode 100644 index 00000000..e6d3707d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test @@ -0,0 +1,16 @@ +--TEST-- +"date" filter (interval support as of PHP 5.3) +--CONDITION-- +version_compare(phpversion(), '5.3.0', '>=') +--TEMPLATE-- +{{ date2|date }} +{{ date2|date('%d days') }} +--DATA-- +date_default_timezone_set('UTC'); +$twig->getExtension('core')->setDateFormat('Y-m-d', '%d days %h hours'); +return array( + 'date2' => new DateInterval('P2D'), +) +--EXPECT-- +2 days 0 hours +2 days diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test new file mode 100644 index 00000000..4e183256 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test @@ -0,0 +1,37 @@ +--TEST-- +"date" filter +--CONDITION-- +version_compare(phpversion(), '5.5.0', '>=') +--TEMPLATE-- +{{ date1|date }} +{{ date1|date('d/m/Y') }} +{{ 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') }} +{{ date2|date('d/m/Y H:i:s P', false) }} +{{ date2|date('e', 'Europe/Paris') }} +{{ date2|date('e', false) }} +--DATA-- +date_default_timezone_set('Europe/Paris'); +return array( + 'date1' => new DateTimeImmutable('2010-10-04 13:45'), + 'date2' => new DateTimeImmutable('2010-10-04 13:45', new DateTimeZone('America/New_York')), + 'timezone1' => new DateTimeZone('America/New_York'), +) +--EXPECT-- +October 4, 2010 13:45 +04/10/2010 +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 +04/10/2010 13:45:00 -04:00 +Europe/Paris +America/New_York diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test new file mode 100644 index 00000000..0c8c6f1a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test @@ -0,0 +1,19 @@ +--TEST-- +"date" filter (interval support as of PHP 5.3) +--CONDITION-- +version_compare(phpversion(), '5.3.0', '>=') +--TEMPLATE-- +{{ date1|date }} +{{ date1|date('%d days %h hours') }} +{{ date1|date('%d days %h hours', timezone1) }} +--DATA-- +date_default_timezone_set('UTC'); +return array( + 'date1' => new DateInterval('P2D'), + // This should have no effect on DateInterval formatting + 'timezone1' => new DateTimeZone('America/New_York'), +) +--EXPECT-- +2 days +2 days 0 hours +2 days 0 hours diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test new file mode 100644 index 00000000..53d3a69c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test @@ -0,0 +1,14 @@ +--TEST-- +"date_modify" filter +--TEMPLATE-- +{{ date1|date_modify('-1day')|date('Y-m-d H:i:s') }} +{{ date2|date_modify('-1day')|date('Y-m-d H:i:s') }} +--DATA-- +date_default_timezone_set('UTC'); +return array( + 'date1' => '2010-10-04 13:45', + 'date2' => new DateTime('2010-10-04 13:45'), +) +--EXPECT-- +2010-10-03 13:45:00 +2010-10-03 13:45:00 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test new file mode 100644 index 00000000..4ecde8a1 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test @@ -0,0 +1,13 @@ +--TEST-- +"date" filter +--TEMPLATE-- +{{ date|date(format='d/m/Y H:i:s P', timezone='America/Chicago') }} +{{ date|date(timezone='America/Chicago', format='d/m/Y H:i:s P') }} +{{ date|date('d/m/Y H:i:s P', timezone='America/Chicago') }} +--DATA-- +date_default_timezone_set('UTC'); +return array('date' => mktime(13, 45, 0, 10, 4, 2010)) +--EXPECT-- +04/10/2010 08:45:00 -05:00 +04/10/2010 08:45:00 -05:00 +04/10/2010 08:45:00 -05:00 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test new file mode 100644 index 00000000..b8d1d66f --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test @@ -0,0 +1,150 @@ +--TEST-- +"default" filter +--TEMPLATE-- +Variable: +{{ 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 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 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 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 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', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'nested' => array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'definedArray' => array(0), + ), + 'object' => new TwigTestFoo(), +) +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- +Variable: +ok +ok +ok +ok +ok +Array access: +ok +ok +ok +ok +ok +ok +ok +ok +Plain values: +ok +ok +ok +ok +Precedence: +ok +ok +Object methods: +ok +ok +ok +ok +ok +ok +Deep nested: +ok +ok +ok +ok +ok +ok +--DATA-- +return array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'nested' => array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'definedArray' => array(0), + ), + 'object' => new TwigTestFoo(), +) +--CONFIG-- +return array('strict_variables' => true) +--EXPECT-- +Variable: +ok +ok +ok +ok +ok +Array access: +ok +ok +ok +ok +ok +ok +ok +ok +Plain values: +ok +ok +ok +ok +Precedence: +ok +ok +Object methods: +ok +ok +ok +ok +ok +ok +Deep nested: +ok +ok +ok +ok +ok +ok diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test new file mode 100644 index 00000000..93c5913f --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test @@ -0,0 +1,10 @@ +--TEST-- +dynamic filter +--TEMPLATE-- +{{ 'bar'|foo_path }} +{{ 'bar'|a_foo_b_bar }} +--DATA-- +return array() +--EXPECT-- +foo/bar +a/b/bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test new file mode 100644 index 00000000..a606c106 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test @@ -0,0 +1,8 @@ +--TEST-- +"escape" filter +--TEMPLATE-- +{{ "foo
    "|e }} +--DATA-- +return array() +--EXPECT-- +foo <br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test new file mode 100644 index 00000000..009a2453 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test @@ -0,0 +1,8 @@ +--TEST-- +"escape" filter does not escape with the html strategy when using the html_attr strategy +--TEMPLATE-- +{{ '
    '|escape('html_attr') }} +--DATA-- +return array() +--EXPECT-- +<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test new file mode 100644 index 00000000..bba26a0d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test @@ -0,0 +1,8 @@ +--TEST-- +"escape" filter +--TEMPLATE-- +{{ "愛していますか?
    "|e }} +--DATA-- +return array() +--EXPECT-- +愛していますか? <br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test new file mode 100644 index 00000000..aa54645c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test @@ -0,0 +1,17 @@ +--TEST-- +"first" filter +--TEMPLATE-- +{{ [1, 2, 3, 4]|first }} +{{ {a: 1, b: 2, c: 3, d: 4}|first }} +{{ '1234'|first }} +{{ arr|first }} +{{ 'Ä€é'|first }} +{{ ''|first }} +--DATA-- +return array('arr' => new ArrayObject(array(1, 2, 3, 4))) +--EXPECT-- +1 +1 +1 +1 +Ä diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test new file mode 100644 index 00000000..85a9b717 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test @@ -0,0 +1,18 @@ +--TEST-- +"escape" filter +--TEMPLATE-- +{% set foo %} + foo
    +{% endset %} + +{{ foo|e('html') -}} +{{ foo|e('js') }} +{% autoescape true %} + {{ foo }} +{% endautoescape %} +--DATA-- +return array() +--EXPECT-- + foo<br /> +\x20\x20\x20\x20foo\x3Cbr\x20\x2F\x3E\x0A + foo
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test new file mode 100644 index 00000000..97221ff8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test @@ -0,0 +1,8 @@ +--TEST-- +"format" filter +--TEMPLATE-- +{{ string|format(foo, 3) }} +--DATA-- +return array('string' => '%s/%d', 'foo' => 'bar') +--EXPECT-- +bar/3 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test new file mode 100644 index 00000000..b342c174 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test @@ -0,0 +1,12 @@ +--TEST-- +"join" filter +--TEMPLATE-- +{{ ["foo", "bar"]|join(', ') }} +{{ foo|join(', ') }} +{{ bar|join(', ') }} +--DATA-- +return array('foo' => new TwigTestFoo(), 'bar' => new ArrayObject(array(3, 4))) +--EXPECT-- +foo, bar +1, 2 +3, 4 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test new file mode 100644 index 00000000..1738d40c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test @@ -0,0 +1,12 @@ +--TEST-- +"json_encode" filter +--TEMPLATE-- +{{ "foo"|json_encode|raw }} +{{ foo|json_encode|raw }} +{{ [foo, "foo"]|json_encode|raw }} +--DATA-- +return array('foo' => new Twig_Markup('foo', 'UTF-8')) +--EXPECT-- +"foo" +"foo" +["foo","foo"] diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test new file mode 100644 index 00000000..1b8031ee --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test @@ -0,0 +1,17 @@ +--TEST-- +"last" filter +--TEMPLATE-- +{{ [1, 2, 3, 4]|last }} +{{ {a: 1, b: 2, c: 3, d: 4}|last }} +{{ '1234'|last }} +{{ arr|last }} +{{ 'Ä€é'|last }} +{{ ''|last }} +--DATA-- +return array('arr' => new ArrayObject(array(1, 2, 3, 4))) +--EXPECT-- +4 +4 +4 +4 +é diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test new file mode 100644 index 00000000..3347474d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test @@ -0,0 +1,14 @@ +--TEST-- +"length" filter +--TEMPLATE-- +{{ array|length }} +{{ string|length }} +{{ number|length }} +{{ markup|length }} +--DATA-- +return array('array' => array(1, 4), 'string' => 'foo', 'number' => 1000, 'markup' => new Twig_Markup('foo', 'UTF-8')) +--EXPECT-- +2 +3 +4 +3 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test new file mode 100644 index 00000000..5d5e2436 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test @@ -0,0 +1,12 @@ +--TEST-- +"length" filter +--CONDITION-- +function_exists('mb_get_info') +--TEMPLATE-- +{{ string|length }} +{{ markup|length }} +--DATA-- +return array('string' => 'été', 'markup' => new Twig_Markup('foo', 'UTF-8')) +--EXPECT-- +3 +3 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test new file mode 100644 index 00000000..81371a41 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test @@ -0,0 +1,18 @@ +--TEST-- +"merge" filter +--TEMPLATE-- +{{ items|merge({'bar': 'foo'})|join }} +{{ items|merge({'bar': 'foo'})|keys|join }} +{{ {'bar': 'foo'}|merge(items)|join }} +{{ {'bar': 'foo'}|merge(items)|keys|join }} +{{ numerics|merge([4, 5, 6])|join }} +{{ traversable.a|merge(traversable.b)|join }} +--DATA-- +return array('items' => array('foo' => 'bar'), 'numerics' => array(1, 2, 3), 'traversable' => array('a' => new ArrayObject(array(0 => 1, 1 => 2, 2 => 3)), 'b' => new ArrayObject(array('a' => 'b')))) +--EXPECT-- +barfoo +foobar +foobar +barfoo +123456 +123b diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test new file mode 100644 index 00000000..6545a9bb --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test @@ -0,0 +1,14 @@ +--TEST-- +"nl2br" filter +--TEMPLATE-- +{{ "I like Twig.\nYou will like it too.\n\nEverybody like it!"|nl2br }} +{{ text|nl2br }} +--DATA-- +return array('text' => "If you have some HTML\nit will be escaped.") +--EXPECT-- +I like Twig.
    +You will like it too.
    +
    +Everybody like it! +If you have some <strong>HTML</strong>
    +it will be escaped. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test new file mode 100644 index 00000000..639a8659 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test @@ -0,0 +1,18 @@ +--TEST-- +"number_format" filter +--TEMPLATE-- +{{ 20|number_format }} +{{ 20.25|number_format }} +{{ 20.25|number_format(2) }} +{{ 20.25|number_format(2, ',') }} +{{ 1020.25|number_format(2, ',') }} +{{ 1020.25|number_format(2, ',', '.') }} +--DATA-- +return array(); +--EXPECT-- +20 +20 +20.25 +20,25 +1,020,25 +1.020,25 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test new file mode 100644 index 00000000..c6903cc7 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test @@ -0,0 +1,21 @@ +--TEST-- +"number_format" filter with defaults. +--TEMPLATE-- +{{ 20|number_format }} +{{ 20.25|number_format }} +{{ 20.25|number_format(1) }} +{{ 20.25|number_format(2, ',') }} +{{ 1020.25|number_format }} +{{ 1020.25|number_format(2, ',') }} +{{ 1020.25|number_format(2, ',', '.') }} +--DATA-- +$twig->getExtension('core')->setNumberFormat(2, '!', '='); +return array(); +--EXPECT-- +20!00 +20!25 +20!3 +20,25 +1=020!25 +1=020,25 +1.020,25 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test new file mode 100644 index 00000000..06be7e27 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test @@ -0,0 +1,12 @@ +--TEST-- +"replace" filter +--TEMPLATE-- +{{ "I liké %this% and %that%."|replace({'%this%': "foo", '%that%': "bar"}) }} +{{ 'I like single replace operation only %that%'|replace({'%that%' : '%that%1'}) }} +{{ 'I like %this% and %that%.'|replace(traversable) }} +--DATA-- +return array('traversable' => new ArrayObject(array('%this%' => 'foo', '%that%' => 'bar'))) +--EXPECT-- +I liké foo and bar. +I like single replace operation only %that%1 +I like foo and bar. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test new file mode 100644 index 00000000..2143a869 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test @@ -0,0 +1,8 @@ +--TEST-- +Exception for invalid argument type in replace call +--TEMPLATE-- +{{ 'test %foo%'|replace(stdClass) }} +--DATA-- +return array('stdClass' => new stdClass()) +--EXCEPTION-- +Twig_Error_Runtime: The "replace" filter expects an array or "Traversable" as replace values, got "stdClass" in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test new file mode 100644 index 00000000..7948ac45 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test @@ -0,0 +1,18 @@ +--TEST-- +"reverse" filter +--TEMPLATE-- +{{ [1, 2, 3, 4]|reverse|join('') }} +{{ '1234évènement'|reverse }} +{{ arr|reverse|join('') }} +{{ {'a': 'c', 'b': 'a'}|reverse()|join(',') }} +{{ {'a': 'c', 'b': 'a'}|reverse(preserveKeys=true)|join(glue=',') }} +{{ {'a': 'c', 'b': 'a'}|reverse(preserve_keys=true)|join(glue=',') }} +--DATA-- +return array('arr' => new ArrayObject(array(1, 2, 3, 4))) +--EXPECT-- +4321 +tnemenèvé4321 +4321 +a,c +a,c +a,c diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test new file mode 100644 index 00000000..57806b61 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test @@ -0,0 +1,22 @@ +--TEST-- +"round" filter +--TEMPLATE-- +{{ 2.7|round }} +{{ 2.1|round }} +{{ 2.1234|round(3, 'floor') }} +{{ 2.1|round(0, 'ceil') }} + +{{ 21.3|round(-1)}} +{{ 21.3|round(-1, 'ceil')}} +{{ 21.3|round(-1, 'floor')}} +--DATA-- +return array() +--EXPECT-- +3 +2 +2.123 +3 + +20 +30 +20 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test new file mode 100644 index 00000000..b49b89fe --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test @@ -0,0 +1,54 @@ +--TEST-- +"slice" filter +--TEMPLATE-- +{{ [1, 2, 3, 4][1:2]|join('') }} +{{ {a: 1, b: 2, c: 3, d: 4}[1:2]|join('') }} +{{ [1, 2, 3, 4][start:length]|join('') }} +{{ [1, 2, 3, 4]|slice(1, 2)|join('') }} +{{ [1, 2, 3, 4]|slice(1, 2)|keys|join('') }} +{{ [1, 2, 3, 4]|slice(1, 2, true)|keys|join('') }} +{{ {a: 1, b: 2, c: 3, d: 4}|slice(1, 2)|join('') }} +{{ {a: 1, b: 2, c: 3, d: 4}|slice(1, 2)|keys|join('') }} +{{ '1234'|slice(1, 2) }} +{{ '1234'[1:2] }} +{{ arr|slice(1, 2)|join('') }} +{{ arr[1:2]|join('') }} +{{ arr[4:1]|join('') }} +{{ arr[3:2]|join('') }} + +{{ [1, 2, 3, 4]|slice(1)|join('') }} +{{ [1, 2, 3, 4][1:]|join('') }} +{{ '1234'|slice(1) }} +{{ '1234'[1:] }} +{{ '1234'[:1] }} + +{{ arr|slice(3)|join('') }} +{{ arr[2:]|join('') }} +{{ xml|slice(1)|join('')}} +--DATA-- +return array('start' => 1, 'length' => 2, 'arr' => new ArrayObject(array(1, 2, 3, 4)), 'xml' => new SimpleXMLElement('12')) +--EXPECT-- +23 +23 +23 +23 +01 +12 +23 +bc +23 +23 +23 +23 + +4 + +234 +234 +234 +234 +1 + +4 +34 +2 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test new file mode 100644 index 00000000..c67c18ea --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test @@ -0,0 +1,12 @@ +--TEST-- +"sort" filter +--TEMPLATE-- +{{ array1|sort|join }} +{{ array2|sort|join }} +{{ traversable|sort|join }} +--DATA-- +return array('array1' => array(4, 1), 'array2' => array('foo', 'bar'), 'traversable' => new ArrayObject(array(0 => 3, 1 => 2, 2 => 1))) +--EXPECT-- +14 +barfoo +123 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test new file mode 100644 index 00000000..dbaf7dc9 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test @@ -0,0 +1,8 @@ +--TEST-- +"§" custom filter +--TEMPLATE-- +{{ 'foo'|§ }} +--DATA-- +return array() +--EXPECT-- +§foo§ diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test new file mode 100644 index 00000000..a093ed79 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test @@ -0,0 +1,20 @@ +--TEST-- +"split" filter +--TEMPLATE-- +{{ "one,two,three,four,five"|split(',')|join('-') }} +{{ foo|split(',')|join('-') }} +{{ foo|split(',', 3)|join('-') }} +{{ baz|split('')|join('-') }} +{{ baz|split('', 1)|join('-') }} +{{ baz|split('', 2)|join('-') }} +{{ foo|split(',', -2)|join('-') }} +--DATA-- +return array('foo' => "one,two,three,four,five", 'baz' => '12345',) +--EXPECT-- +one-two-three-four-five +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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test new file mode 100644 index 00000000..305e162f --- /dev/null +++ b/plugins/twig/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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test new file mode 100644 index 00000000..31920625 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test @@ -0,0 +1,12 @@ +--TEST-- +"trim" filter +--TEMPLATE-- +{{ " I like Twig. "|trim }} +{{ text|trim }} +{{ " foo/"|trim("/") }} +--DATA-- +return array('text' => " If you have some HTML it will be escaped. ") +--EXPECT-- +I like Twig. +If you have some <strong>HTML</strong> it will be escaped. + foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test new file mode 100644 index 00000000..8726159d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test @@ -0,0 +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%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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test new file mode 100644 index 00000000..11800e9c --- /dev/null +++ b/plugins/twig/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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test new file mode 100644 index 00000000..71b2038a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test @@ -0,0 +1,18 @@ +--TEST-- +"attribute" function +--TEMPLATE-- +{{ 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', 'arguments' => array('a', 'b')) +--EXPECT-- +foo +bar +bar_a-b +bar_a-b +ok +ko diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test new file mode 100644 index 00000000..8e54059a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test @@ -0,0 +1,12 @@ +--TEST-- +"block" function +--TEMPLATE-- +{% extends 'base.twig' %} +{% block bar %}BAR{% endblock %} +--TEMPLATE(base.twig)-- +{% block foo %}{{ block('bar') }}{% endblock %} +{% block bar %}BAR_BASE{% endblock %} +--DATA-- +return array() +--EXPECT-- +BARBAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test new file mode 100644 index 00000000..63128791 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test @@ -0,0 +1,10 @@ +--TEST-- +"constant" function +--TEMPLATE-- +{{ constant('DATE_W3C') == expect ? 'true' : 'false' }} +{{ constant('ARRAY_AS_PROPS', object) }} +--DATA-- +return array('expect' => DATE_W3C, 'object' => new ArrayObject(array('hi'))); +--EXPECT-- +true +2 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test new file mode 100644 index 00000000..522a63b8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test @@ -0,0 +1,16 @@ +--TEST-- +"cycle" function +--TEMPLATE-- +{% for i in 0..6 %} +{{ cycle(array1, i) }}-{{ cycle(array2, i) }} +{% endfor %} +--DATA-- +return array('array1' => array('odd', 'even'), 'array2' => array('apple', 'orange', 'citrus')) +--EXPECT-- +odd-apple +even-orange +odd-citrus +even-apple +odd-orange +even-citrus +odd-apple diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test new file mode 100644 index 00000000..8be9c0c4 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test @@ -0,0 +1,25 @@ +--TEST-- +"date" function +--TEMPLATE-- +{{ date() == date('now') ? 'OK' : 'KO' }} +{{ date(date1) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} +{{ date(date2) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} +{{ date(date3) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} +{{ date(date4) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} +{{ date(date5) == date('1964-01-02 03:04') ? 'OK' : 'KO' }} +--DATA-- +date_default_timezone_set('UTC'); +return array( + 'date1' => mktime(13, 45, 0, 10, 4, 2010), + 'date2' => new DateTime('2010-10-04 13:45'), + 'date3' => '2010-10-04 13:45', + '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(), +) +--EXPECT-- +OK +OK +OK +OK +OK +OK diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test new file mode 100644 index 00000000..b9dd9e38 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test @@ -0,0 +1,11 @@ +--TEST-- +"date" function +--TEMPLATE-- +{{ date(date, "America/New_York")|date('d/m/Y H:i:s P', false) }} +{{ date(timezone="America/New_York", date=date)|date('d/m/Y H:i:s P', false) }} +--DATA-- +date_default_timezone_set('UTC'); +return array('date' => mktime(13, 45, 0, 10, 4, 2010)) +--EXPECT-- +04/10/2010 09:45:00 -04:00 +04/10/2010 09:45:00 -04:00 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test new file mode 100644 index 00000000..f4072375 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test @@ -0,0 +1,16 @@ +--TEST-- +"dump" function +--CONDITION-- +!extension_loaded('xdebug') +--TEMPLATE-- +{{ dump('foo') }} +{{ dump('foo', 'bar') }} +--DATA-- +return array('foo' => 'foo', 'bar' => 'bar') +--CONFIG-- +return array('debug' => true, 'autoescape' => false); +--EXPECT-- +string(3) "foo" + +string(3) "foo" +string(3) "bar" diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test new file mode 100644 index 00000000..889b7a92 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test @@ -0,0 +1,19 @@ +--TEST-- +"dump" function, xdebug is not loaded or xdebug <2.2-dev is loaded +--CONDITION-- +!extension_loaded('xdebug') || (($r = new ReflectionExtension('xdebug')) && version_compare($r->getVersion(), '2.2-dev', '<')) +--TEMPLATE-- +{{ dump() }} +--DATA-- +return array('foo' => 'foo', 'bar' => 'bar') +--CONFIG-- +return array('debug' => true, 'autoescape' => false); +--EXPECT-- +array(3) { + ["foo"]=> + string(3) "foo" + ["bar"]=> + string(3) "bar" + ["global"]=> + string(6) "global" +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test new file mode 100644 index 00000000..913fbc99 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test @@ -0,0 +1,10 @@ +--TEST-- +dynamic function +--TEMPLATE-- +{{ foo_path('bar') }} +{{ a_foo_b_bar('bar') }} +--DATA-- +return array() +--EXPECT-- +foo/bar +a/b/bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test new file mode 100644 index 00000000..b7653b4e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test @@ -0,0 +1,13 @@ +--TEST-- +"include" function +--TEMPLATE-- +{% set tmp = include("foo.twig") %} + +FOO{{ tmp }}BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return array() +--EXPECT-- +FOO +FOOBARBAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test new file mode 100644 index 00000000..56f8f3b5 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test @@ -0,0 +1,10 @@ +--TEST-- +"include" function is safe for auto-escaping +--TEMPLATE-- +{{ include("foo.twig") }} +--TEMPLATE(foo.twig)-- +

    Test

    +--DATA-- +return array() +--EXPECT-- +

    Test

    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test new file mode 100644 index 00000000..a434182a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test @@ -0,0 +1,17 @@ +--TEST-- +"include" function +--TEMPLATE-- +FOO +{{ include("foo.twig") }} + +BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return array() +--EXPECT-- +FOO + +FOOBAR + +BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test new file mode 100644 index 00000000..aba30ce3 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test @@ -0,0 +1,17 @@ +--TEST-- +"include" function allows expressions for the template to include +--TEMPLATE-- +FOO +{{ include(foo) }} + +BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return array('foo' => 'foo.twig') +--EXPECT-- +FOO + +FOOBAR + +BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test new file mode 100644 index 00000000..43a2ccc2 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test @@ -0,0 +1,10 @@ +--TEST-- +"include" function +--TEMPLATE-- +{{ include(["foo.twig", "bar.twig"], ignore_missing = true) }} +{{ include("foo.twig", ignore_missing = true) }} +{{ include("foo.twig", ignore_missing = true, variables = {}) }} +{{ include("foo.twig", ignore_missing = true, variables = {}, with_context = true) }} +--DATA-- +return array() +--EXPECT-- diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test new file mode 100644 index 00000000..4d2f6cf1 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test @@ -0,0 +1,8 @@ +--TEST-- +"include" function +--TEMPLATE-- +{{ include("foo.twig") }} +--DATA-- +return array(); +--EXCEPTION-- +Twig_Error_Loader: Template "foo.twig" is not defined in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test new file mode 100644 index 00000000..78fddc7a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test @@ -0,0 +1,16 @@ +--TEST-- +"include" function +--TEMPLATE-- +{% extends "base.twig" %} + +{% block content %} + {{ parent() }} +{% endblock %} +--TEMPLATE(base.twig)-- +{% block content %} + {{ include("foo.twig") }} +{% endblock %} +--DATA-- +return array(); +--EXCEPTION-- +Twig_Error_Loader: Template "foo.twig" is not defined in "base.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test new file mode 100644 index 00000000..7b9ccaca --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test @@ -0,0 +1,13 @@ +--TEST-- +"include" tag sandboxed +--TEMPLATE-- +{{ include("foo.twig", sandboxed = true) }} +--TEMPLATE(foo.twig)-- + + +{{ foo|e }} +{{ foo|e }} +--DATA-- +return array() +--EXCEPTION-- +Twig_Sandbox_SecurityNotAllowedFilterError: Filter "e" is not allowed in "foo.twig" at line 4. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test new file mode 100644 index 00000000..8ffc4922 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag sandboxed +--TEMPLATE-- +{{ include("foo.twig", sandboxed = true) }} +{{ include("bar.twig") }} +--TEMPLATE(foo.twig)-- +foo +--TEMPLATE(bar.twig)-- +{{ foo|e }} +--DATA-- +return array('foo' => 'bar
    ') +--EXPECT-- +foo + + +bar<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test new file mode 100644 index 00000000..8bf6e102 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test @@ -0,0 +1,13 @@ +--TEST-- +"include" tag sandboxed +--TEMPLATE-- +{{ include("unknown.twig", sandboxed = true, ignore_missing = true) }} +{{ include("bar.twig") }} +--TEMPLATE(bar.twig)-- +{{ foo|e }} +--DATA-- +return array('foo' => 'bar
    ') +--EXPECT-- + + +bar<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test new file mode 100644 index 00000000..18d405a0 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test @@ -0,0 +1,10 @@ +--TEST-- +"include" function accepts Twig_Template instance +--TEMPLATE-- +{{ include(foo) }} FOO +--TEMPLATE(foo.twig)-- +BAR +--DATA-- +return array('foo' => $twig->loadTemplate('foo.twig')) +--EXPECT-- +BAR FOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test new file mode 100644 index 00000000..1a810068 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test @@ -0,0 +1,12 @@ +--TEST-- +"include" function +--TEMPLATE-- +{{ include(["foo.twig", "bar.twig"]) }} +{{- include(["bar.twig", "foo.twig"]) }} +--TEMPLATE(foo.twig)-- +foo +--DATA-- +return array() +--EXPECT-- +foo +foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test new file mode 100644 index 00000000..35611fbb --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test @@ -0,0 +1,16 @@ +--TEST-- +"include" function accept variables and with_context +--TEMPLATE-- +{{ include("foo.twig") }} +{{- include("foo.twig", with_context = false) }} +{{- include("foo.twig", {'foo1': 'bar'}) }} +{{- include("foo.twig", {'foo1': 'bar'}, with_context = false) }} +--TEMPLATE(foo.twig)-- +{% for k, v in _context %}{{ k }},{% endfor %} +--DATA-- +return array('foo' => 'bar') +--EXPECT-- +foo,global,_parent, +global,_parent, +foo,global,foo1,_parent, +foo1,global,_parent, diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test new file mode 100644 index 00000000..b2ace940 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test @@ -0,0 +1,12 @@ +--TEST-- +"include" function accept variables +--TEMPLATE-- +{{ include("foo.twig", {'foo': 'bar'}) }} +{{- include("foo.twig", vars) }} +--TEMPLATE(foo.twig)-- +{{ foo }} +--DATA-- +return array('vars' => array('foo' => 'bar')) +--EXPECT-- +bar +bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test new file mode 100644 index 00000000..e6c94af6 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test @@ -0,0 +1,12 @@ +--TEST-- +"max" function +--TEMPLATE-- +{{ max([2, 1, 3, 5, 4]) }} +{{ max(2, 1, 3, 5, 4) }} +{{ max({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} +--DATA-- +return array() +--EXPECT-- +5 +5 +two diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test new file mode 100644 index 00000000..660471c0 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test @@ -0,0 +1,12 @@ +--TEST-- +"min" function +--TEMPLATE-- +{{ min(2, 1, 3, 5, 4) }} +{{ min([2, 1, 3, 5, 4]) }} +{{ min({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} +--DATA-- +return array() +--EXPECT-- +1 +1 +five diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test new file mode 100644 index 00000000..e0377c8d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test @@ -0,0 +1,8 @@ +--TEST-- +"range" function +--TEMPLATE-- +{{ range(low=0+1, high=10+0, step=2)|join(',') }} +--DATA-- +return array() +--EXPECT-- +1,3,5,7,9 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test new file mode 100644 index 00000000..f39712da --- /dev/null +++ b/plugins/twig/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 %}
      {{ block('children') }}
    {% 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. "1"
    2. "2"
      1. "3.1"
        1. "3.2.1"
        2. "3.2.2"
      2. "3.4"
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test new file mode 100644 index 00000000..0e094c3b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test @@ -0,0 +1,17 @@ +--TEST-- +"source" function +--TEMPLATE-- +FOO +{{ source("foo.twig") }} + +BAR +--TEMPLATE(foo.twig)-- +{{ foo }}
    +--DATA-- +return array() +--EXPECT-- +FOO + +{{ foo }}
    + +BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test new file mode 100644 index 00000000..30c3df51 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test @@ -0,0 +1,8 @@ +--TEST-- +"§" custom function +--TEMPLATE-- +{{ §('foo') }} +--DATA-- +return array() +--EXPECT-- +§foo§ diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test new file mode 100644 index 00000000..3d3b9587 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test @@ -0,0 +1,15 @@ +--TEST-- +"template_from_string" function +--TEMPLATE-- +{% include template_from_string(template) %} + +{% include template_from_string("Hello {{ name }}") %} +{% include template_from_string('{% extends "parent.twig" %}{% block content %}Hello {{ name }}{% endblock %}') %} +--TEMPLATE(parent.twig)-- +{% block content %}{% endblock %} +--DATA-- +return array('name' => 'Fabien', 'template' => "Hello {{ name }}") +--EXPECT-- +Hello Fabien +Hello Fabien +Hello Fabien diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test new file mode 100644 index 00000000..4ccff7b6 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test @@ -0,0 +1,16 @@ +--TEST-- +macro +--TEMPLATE-- +{% from _self import test %} + +{% macro test(a, b = 'bar') -%} +{{ a }}{{ b }} +{%- endmacro %} + +{{ test('foo') }} +{{ test('bar', 'foo') }} +--DATA-- +return array(); +--EXPECT-- +foobar +barfoo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test new file mode 100644 index 00000000..cd254281 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test @@ -0,0 +1,18 @@ +--TEST-- +macro +--TEMPLATE-- +{% import _self as macros %} + +{% macro foo(data) %} + {{ data }} +{% endmacro %} + +{% macro bar() %} +
    +{% endmacro %} + +{{ macros.foo(macros.bar()) }} +--DATA-- +return array(); +--EXPECT-- +
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test new file mode 100644 index 00000000..cbfb921b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test @@ -0,0 +1,14 @@ +--TEST-- +macro +--TEMPLATE-- +{% from _self import test %} + +{% macro test(this) -%} + {{ this }} +{%- endmacro %} + +{{ test(this) }} +--DATA-- +return array('this' => 'foo'); +--EXPECT-- +foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test new file mode 100644 index 00000000..6a366cdf --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test @@ -0,0 +1,22 @@ +--TEST-- +macro +--TEMPLATE-- +{% import _self as test %} +{% from _self import test %} + +{% macro test(a, b) -%} + {{ a|default('a') }}
    + {{- b|default('b') }}
    +{%- endmacro %} + +{{ test.test() }} +{{ test() }} +{{ test.test(1, "c") }} +{{ test(1, "c") }} +--DATA-- +return array(); +--EXPECT-- +a
    b
    +a
    b
    +1
    c
    +1
    c
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test new file mode 100644 index 00000000..412c90fa --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test @@ -0,0 +1,21 @@ +--TEST-- +macro with arbitrary arguments +--TEMPLATE-- +{% from _self import test1, test2 %} + +{% macro test1(var) %} + {{- var }}: {{ varargs|join(", ") }} +{% endmacro %} + +{% macro test2() %} + {{- varargs|join(", ") }} +{% endmacro %} + +{{ test1("foo", "bar", "foobar") }} +{{ test2("foo", "bar", "foobar") }} +--DATA-- +return array(); +--EXPECT-- +foo: bar, foobar + +foo, bar, foobar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test new file mode 100644 index 00000000..9cfbbd20 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test @@ -0,0 +1,8 @@ +--TEST-- +macro with varargs argument +--TEMPLATE-- +{% macro test(varargs) %} +{% 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. + diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test new file mode 100644 index 00000000..685626f2 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test @@ -0,0 +1,14 @@ +--TEST-- +macro with a filter +--TEMPLATE-- +{% import _self as test %} + +{% macro test() %} + {% filter escape %}foo
    {% endfilter %} +{% endmacro %} + +{{ test.test() }} +--DATA-- +return array(); +--EXPECT-- +foo<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test new file mode 100644 index 00000000..df485783 --- /dev/null +++ b/plugins/twig/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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test new file mode 100644 index 00000000..65f6cd2b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test @@ -0,0 +1,8 @@ +--TEST-- +Twig outputs 0 nodes correctly +--TEMPLATE-- +{{ foo }}0{{ foo }} +--DATA-- +return array('foo' => 'foo') +--EXPECT-- +foo0foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test new file mode 100644 index 00000000..ff7c8bb7 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test @@ -0,0 +1,23 @@ +--TEST-- +error in twig extension +--TEMPLATE-- +{{ object.region is not null ? object.regionChoices[object.region] }} +--DATA-- +class House +{ + const REGION_S = 1; + const REGION_P = 2; + + public static $regionChoices = array(self::REGION_S => 'house.region.s', self::REGION_P => 'house.region.p'); + + public function getRegionChoices() + { + return self::$regionChoices; + } +} + +$object = new House(); +$object->region = 1; +return array('object' => $object) +--EXPECT-- +house.region.s diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test new file mode 100644 index 00000000..269a3057 --- /dev/null +++ b/plugins/twig/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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test new file mode 100644 index 00000000..60c3c51d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test @@ -0,0 +1,19 @@ +--TEST-- +Twig is able to deal with SimpleXMLElement instances as variables +--CONDITION-- +version_compare(phpversion(), '5.3.0', '>=') +--TEMPLATE-- +Hello '{{ images.image.0.group }}'! +{{ images.image.0.group.attributes.myattr }} +{{ images.children().image.count() }} +{% for image in images %} + - {{ image.group }} +{% endfor %} +--DATA-- +return array('images' => new SimpleXMLElement('foobar')) +--EXPECT-- +Hello 'foo'! +example +2 + - foo + - bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test new file mode 100644 index 00000000..e18e1107 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test @@ -0,0 +1,8 @@ +--TEST-- +Twig does not confuse strings with integers in getAttribute() +--TEMPLATE-- +{{ hash['2e2'] }} +--DATA-- +return array('hash' => array('2e2' => 'works')) +--EXPECT-- +works diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test new file mode 100644 index 00000000..2f6a3e1a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test @@ -0,0 +1,26 @@ +--TEST-- +"autoescape" tag applies escaping on its children +--TEMPLATE-- +{% autoescape %} +{{ var }}
    +{% endautoescape %} +{% autoescape 'html' %} +{{ var }}
    +{% endautoescape %} +{% autoescape false %} +{{ var }}
    +{% endautoescape %} +{% autoescape true %} +{{ var }}
    +{% endautoescape %} +{% autoescape false %} +{{ var }}
    +{% endautoescape %} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +<br />
    +<br />
    +

    +<br />
    +

    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test new file mode 100644 index 00000000..05ab83ce --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test @@ -0,0 +1,12 @@ +--TEST-- +"autoescape" tag applies escaping on embedded blocks +--TEMPLATE-- +{% autoescape 'html' %} + {% block foo %} + {{ var }} + {% endblock %} +{% endautoescape %} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test new file mode 100644 index 00000000..9c097246 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test @@ -0,0 +1,10 @@ +--TEST-- +"autoescape" tag does not double-escape +--TEMPLATE-- +{% autoescape 'html' %} +{{ var|escape }} +{% endautoescape %} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test new file mode 100644 index 00000000..ce7ea789 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test @@ -0,0 +1,83 @@ +--TEST-- +"autoescape" tag applies escaping after calling functions +--TEMPLATE-- + +autoescape false +{% autoescape false %} + +safe_br +{{ safe_br() }} + +unsafe_br +{{ unsafe_br() }} + +{% endautoescape %} + +autoescape 'html' +{% autoescape 'html' %} + +safe_br +{{ safe_br() }} + +unsafe_br +{{ unsafe_br() }} + +unsafe_br()|raw +{{ (unsafe_br())|raw }} + +safe_br()|escape +{{ (safe_br())|escape }} + +safe_br()|raw +{{ (safe_br())|raw }} + +unsafe_br()|escape +{{ (unsafe_br())|escape }} + +{% endautoescape %} + +autoescape js +{% autoescape 'js' %} + +safe_br +{{ safe_br() }} + +{% endautoescape %} +--DATA-- +return array() +--EXPECT-- + +autoescape false + +safe_br +
    + +unsafe_br +
    + + +autoescape 'html' + +safe_br +
    + +unsafe_br +<br /> + +unsafe_br()|raw +
    + +safe_br()|escape +<br /> + +safe_br()|raw +
    + +unsafe_br()|escape +<br /> + + +autoescape js + +safe_br +\x3Cbr\x20\x2F\x3E diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test new file mode 100644 index 00000000..e389d4dd --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test @@ -0,0 +1,45 @@ +--TEST-- +"autoescape" tag does not apply escaping on literals +--TEMPLATE-- +{% autoescape 'html' %} + +1. Simple literal +{{ "
    " }} + +2. Conditional expression with only literals +{{ true ? "
    " : "
    " }} + +3. Conditional expression with a variable +{{ true ? "
    " : someVar }} + +4. Nested conditionals with only literals +{{ true ? (true ? "
    " : "
    ") : "\n" }} + +5. Nested conditionals with a variable +{{ true ? (true ? "
    " : someVar) : "\n" }} + +6. Nested conditionals with a variable marked safe +{{ true ? (true ? "
    " : someVar|raw) : "\n" }} + +{% endautoescape %} +--DATA-- +return array() +--EXPECT-- + +1. Simple literal +
    + +2. Conditional expression with only literals +
    + +3. Conditional expression with a variable +<br /> + +4. Nested conditionals with only literals +
    + +5. Nested conditionals with a variable +<br /> + +6. Nested conditionals with a variable marked safe +
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test new file mode 100644 index 00000000..798e6fea --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test @@ -0,0 +1,26 @@ +--TEST-- +"autoescape" tags can be nested at will +--TEMPLATE-- +{{ var }} +{% autoescape 'html' %} + {{ var }} + {% autoescape false %} + {{ var }} + {% autoescape 'html' %} + {{ var }} + {% endautoescape %} + {{ var }} + {% endautoescape %} + {{ var }} +{% endautoescape %} +{{ var }} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +<br /> + <br /> +
    + <br /> +
    + <br /> +<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test new file mode 100644 index 00000000..e896aa41 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test @@ -0,0 +1,26 @@ +--TEST-- +"autoescape" tag applies escaping to object method calls +--TEMPLATE-- +{% autoescape 'html' %} +{{ user.name }} +{{ user.name|lower }} +{{ user }} +{% endautoescape %} +--DATA-- +class UserForAutoEscapeTest +{ + public function getName() + { + return 'Fabien
    '; + } + + public function __toString() + { + return 'Fabien
    '; + } +} +return array('user' => new UserForAutoEscapeTest()) +--EXPECT-- +Fabien<br /> +fabien<br /> +Fabien<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test new file mode 100644 index 00000000..9f1cedd3 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test @@ -0,0 +1,10 @@ +--TEST-- +"autoescape" tag does not escape when raw is used as a filter +--TEMPLATE-- +{% autoescape 'html' %} +{{ var|raw }} +{% endautoescape %} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test new file mode 100644 index 00000000..bbf1356e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test @@ -0,0 +1,11 @@ +--TEST-- +"autoescape" tag accepts an escaping strategy +--TEMPLATE-- +{% autoescape true js %}{{ var }}{% endautoescape %} + +{% autoescape true html %}{{ var }}{% endautoescape %} +--DATA-- +return array('var' => '
    "') +--EXPECT-- +\x3Cbr\x20\x2F\x3E\x22 +<br />" diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test new file mode 100644 index 00000000..e496f608 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test @@ -0,0 +1,11 @@ +--TEST-- +"autoescape" tag accepts an escaping strategy +--TEMPLATE-- +{% autoescape 'js' %}{{ var }}{% endautoescape %} + +{% autoescape 'html' %}{{ var }}{% endautoescape %} +--DATA-- +return array('var' => '
    "') +--EXPECT-- +\x3Cbr\x20\x2F\x3E\x22 +<br />" diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test new file mode 100644 index 00000000..4f415201 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test @@ -0,0 +1,69 @@ +--TEST-- +escape types +--TEMPLATE-- + +1. autoescape 'html' |escape('js') + +{% autoescape 'html' %} + +{% endautoescape %} + +2. autoescape 'html' |escape('js') + +{% autoescape 'html' %} + +{% endautoescape %} + +3. autoescape 'js' |escape('js') + +{% autoescape 'js' %} + +{% endautoescape %} + +4. no escape + +{% autoescape false %} + +{% endautoescape %} + +5. |escape('js')|escape('html') + +{% autoescape false %} + +{% endautoescape %} + +6. autoescape 'html' |escape('js')|escape('html') + +{% autoescape 'html' %} + +{% endautoescape %} + +--DATA-- +return array('msg' => "<>\n'\"") +--EXPECT-- + +1. autoescape 'html' |escape('js') + + + +2. autoescape 'html' |escape('js') + + + +3. autoescape 'js' |escape('js') + + + +4. no escape + + + +5. |escape('js')|escape('html') + + + +6. autoescape 'html' |escape('js')|escape('html') + + + diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test new file mode 100644 index 00000000..7821a9aa --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test @@ -0,0 +1,131 @@ +--TEST-- +"autoescape" tag applies escaping after calling filters +--TEMPLATE-- +{% autoescape 'html' %} + +(escape_and_nl2br is an escaper filter) + +1. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped ) +{{ var|escape_and_nl2br }} + +2. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped, |raw is redundant ) +{{ var|escape_and_nl2br|raw }} + +3. Explicit escape +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is explicitly escaped by |escape ) +{{ var|escape_and_nl2br|escape }} + +4. Escape non-escaper filter output +( var is upper-cased by |upper, + the output is auto-escaped ) +{{ var|upper }} + +5. Escape if last filter is not an escaper +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is upper-cased by |upper, + the output is auto-escaped as |upper is not an escaper ) +{{ var|escape_and_nl2br|upper }} + +6. Don't escape escaper filter output +( var is upper cased by upper, + the output is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped as |escape_and_nl2br is an escaper ) +{{ var|upper|escape_and_nl2br }} + +7. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + the output is auto-escaped ) +{{ "%s"|format(var) }} + +8. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + |raw is redundant, + the output is auto-escaped ) +{{ "%s"|raw|format(var) }} + +9. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end ) +{{ "%s"|format(var)|raw }} + +10. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end, + the |raw filter on var is redundant ) +{{ "%s"|format(var|raw)|raw }} + +{% endautoescape %} +--DATA-- +return array('var' => "\nTwig") +--EXPECT-- + +(escape_and_nl2br is an escaper filter) + +1. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped ) +<Fabien>
    +Twig + +2. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped, |raw is redundant ) +<Fabien>
    +Twig + +3. Explicit escape +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is explicitly escaped by |escape ) +&lt;Fabien&gt;<br /> +Twig + +4. Escape non-escaper filter output +( var is upper-cased by |upper, + the output is auto-escaped ) +<FABIEN> +TWIG + +5. Escape if last filter is not an escaper +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is upper-cased by |upper, + the output is auto-escaped as |upper is not an escaper ) +&LT;FABIEN&GT;<BR /> +TWIG + +6. Don't escape escaper filter output +( var is upper cased by upper, + the output is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped as |escape_and_nl2br is an escaper ) +<FABIEN>
    +TWIG + +7. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + the output is auto-escaped ) +<b><Fabien> +Twig</b> + +8. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + |raw is redundant, + the output is auto-escaped ) +<b><Fabien> +Twig</b> + +9. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end ) + +Twig + +10. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end, + the |raw filter on var is redundant ) + +Twig diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test new file mode 100644 index 00000000..f58a1e09 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test @@ -0,0 +1,23 @@ +--TEST-- +"autoescape" tag do not applies escaping on filter arguments +--TEMPLATE-- +{% autoescape 'html' %} +{{ var|nl2br("
    ") }} +{{ var|nl2br("
    "|escape) }} +{{ var|nl2br(sep) }} +{{ var|nl2br(sep|raw) }} +{{ var|nl2br(sep|escape) }} +{% endautoescape %} +--DATA-- +return array('var' => "\nTwig", 'sep' => '
    ') +--EXPECT-- +<Fabien>
    +Twig +<Fabien><br /> +Twig +<Fabien>
    +Twig +<Fabien>
    +Twig +<Fabien><br /> +Twig diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test new file mode 100644 index 00000000..134c77ea --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test @@ -0,0 +1,68 @@ +--TEST-- +"autoescape" tag applies escaping after calling filters, and before calling pre_escape filters +--TEMPLATE-- +{% autoescape 'html' %} + +(nl2br is pre_escaped for "html" and declared safe for "html") + +1. Pre-escape and don't post-escape +( var|escape|nl2br ) +{{ var|nl2br }} + +2. Don't double-pre-escape +( var|escape|nl2br ) +{{ var|escape|nl2br }} + +3. Don't escape safe values +( var|raw|nl2br ) +{{ var|raw|nl2br }} + +4. Don't escape safe values +( var|escape|nl2br|nl2br ) +{{ var|nl2br|nl2br }} + +5. Re-escape values that are escaped for an other contexts +( var|escape_something|escape|nl2br ) +{{ var|escape_something|nl2br }} + +6. Still escape when using filters not declared safe +( var|escape|nl2br|upper|escape ) +{{ var|nl2br|upper }} + +{% endautoescape %} +--DATA-- +return array('var' => "\nTwig") +--EXPECT-- + +(nl2br is pre_escaped for "html" and declared safe for "html") + +1. Pre-escape and don't post-escape +( var|escape|nl2br ) +<Fabien>
    +Twig + +2. Don't double-pre-escape +( var|escape|nl2br ) +<Fabien>
    +Twig + +3. Don't escape safe values +( var|raw|nl2br ) +
    +Twig + +4. Don't escape safe values +( var|escape|nl2br|nl2br ) +<Fabien>

    +Twig + +5. Re-escape values that are escaped for an other contexts +( var|escape_something|escape|nl2br ) +<FABIEN>
    +TWIG + +6. Still escape when using filters not declared safe +( var|escape|nl2br|upper|escape ) +&LT;FABIEN&GT;<BR /> +TWIG + diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test new file mode 100644 index 00000000..32d3943b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test @@ -0,0 +1,50 @@ +--TEST-- +"autoescape" tag handles filters preserving the safety +--TEMPLATE-- +{% autoescape 'html' %} + +(preserves_safety is preserving safety for "html") + +1. Unsafe values are still unsafe +( var|preserves_safety|escape ) +{{ var|preserves_safety }} + +2. Safe values are still safe +( var|escape|preserves_safety ) +{{ var|escape|preserves_safety }} + +3. Re-escape values that are escaped for an other contexts +( var|escape_something|preserves_safety|escape ) +{{ var|escape_something|preserves_safety }} + +4. Still escape when using filters not declared safe +( var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'})|escape ) +{{ var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'}) }} + +{% endautoescape %} +--DATA-- +return array('var' => "\nTwig") +--EXPECT-- + +(preserves_safety is preserving safety for "html") + +1. Unsafe values are still unsafe +( var|preserves_safety|escape ) +<FABIEN> +TWIG + +2. Safe values are still safe +( var|escape|preserves_safety ) +<FABIEN> +TWIG + +3. Re-escape values that are escaped for an other contexts +( var|escape_something|preserves_safety|escape ) +<FABIEN> +TWIG + +4. Still escape when using filters not declared safe +( var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'})|escape ) +&LT;FABPOT&GT; +TWIG + diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test new file mode 100644 index 00000000..360dcf03 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test @@ -0,0 +1,11 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% block title1 %}FOO{% endblock %} +{% block title2 foo|lower %} +--TEMPLATE(foo.twig)-- +{% block content %}{% endblock %} +--DATA-- +return array('foo' => 'bar') +--EXPECT-- +FOObar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test new file mode 100644 index 00000000..bc89ec82 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test @@ -0,0 +1,11 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% block content %} + {% block content %} + {% endblock %} +{% endblock %} +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Syntax: The block 'content' has already been defined line 2 in "index.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test new file mode 100644 index 00000000..be17fedf --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test @@ -0,0 +1,10 @@ +--TEST-- +"§" special chars in a block name +--TEMPLATE-- +{% block § %} +§ +{% endblock § %} +--DATA-- +return array() +--EXPECT-- +§ diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test new file mode 100644 index 00000000..f44296ea --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test @@ -0,0 +1,35 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +FOO +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +BAR +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return array() +--EXPECT-- +FOO + +A + block1 + + block1extended + B + block2 +C +BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test new file mode 100644 index 00000000..71ab2e01 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test @@ -0,0 +1,16 @@ +--TEST-- +"embed" tag +--TEMPLATE(index.twig)-- +FOO +{% embed "foo.twig" %} + {% block c1 %} + {{ nothing }} + {% endblock %} +{% endembed %} +BAR +--TEMPLATE(foo.twig)-- +{% block c1 %}{% endblock %} +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Runtime: Variable "nothing" does not exist in "index.twig" at line 5 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test new file mode 100644 index 00000000..da161e6d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test @@ -0,0 +1,50 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +FOO +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +BAR +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return array() +--EXPECT-- +FOO + +A + block1 + + block1extended + B + block2 +C + +A + block1 + + block1extended + B + block2 +C +BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test new file mode 100644 index 00000000..81563dce --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test @@ -0,0 +1,42 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + {% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} + {% endembed %} + + {% endblock %} +{% endembed %} +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return array() +--EXPECT-- +A + block1 + + +A + block1 + + block1extended + B + block2 +C + B + block2 +C diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test new file mode 100644 index 00000000..2c1dd584 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test @@ -0,0 +1,60 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +{% extends "base.twig" %} + +{% block c1 %} + {{ parent() }} + blockc1baseextended +{% endblock %} + +{% block c2 %} + {{ parent() }} + + {% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} + {% endembed %} + {{ parent() }} +{% endblock %} +--TEMPLATE(base.twig)-- +A +{% block c1 %} + blockc1base +{% endblock %} +{% block c2 %} + blockc2base +{% endblock %} +B +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return array() +--EXPECT-- +A + blockc1base + + blockc1baseextended + blockc2base + + + +A + block1 + + block1extended + B + block2 +C blockc2base + +B \ No newline at end of file diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test new file mode 100644 index 00000000..82094f2f --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test @@ -0,0 +1,10 @@ +--TEST-- +"filter" tag applies a filter on its children +--TEMPLATE-- +{% filter upper %} +Some text with a {{ var }} +{% endfilter %} +--DATA-- +return array('var' => 'var') +--EXPECT-- +SOME TEXT WITH A VAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test new file mode 100644 index 00000000..3e7148bf --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test @@ -0,0 +1,8 @@ +--TEST-- +"filter" tag applies a filter on its children +--TEMPLATE-- +{% filter json_encode|raw %}test{% endfilter %} +--DATA-- +return array() +--EXPECT-- +"test" diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test new file mode 100644 index 00000000..75512ef9 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test @@ -0,0 +1,10 @@ +--TEST-- +"filter" tags accept multiple chained filters +--TEMPLATE-- +{% filter lower|title %} + {{ var }} +{% endfilter %} +--DATA-- +return array('var' => 'VAR') +--EXPECT-- + Var diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test new file mode 100644 index 00000000..7e4e4eb3 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test @@ -0,0 +1,16 @@ +--TEST-- +"filter" tags can be nested at will +--TEMPLATE-- +{% filter lower|title %} + {{ var }} + {% filter upper %} + {{ var }} + {% endfilter %} + {{ var }} +{% endfilter %} +--DATA-- +return array('var' => 'var') +--EXPECT-- + Var + Var + Var diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test new file mode 100644 index 00000000..22745ead --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test @@ -0,0 +1,13 @@ +--TEST-- +"filter" tag applies the filter on "for" tags +--TEMPLATE-- +{% filter upper %} +{% for item in items %} +{{ item }} +{% endfor %} +{% endfilter %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- +A +B diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test new file mode 100644 index 00000000..afd95b29 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test @@ -0,0 +1,29 @@ +--TEST-- +"filter" tag applies the filter on "if" tags +--TEMPLATE-- +{% filter upper %} +{% if items %} +{{ items|join(', ') }} +{% endif %} + +{% if items.3 is defined %} +FOO +{% else %} +{{ items.1 }} +{% endif %} + +{% if items.3 is defined %} +FOO +{% elseif items.1 %} +{{ items.0 }} +{% endif %} + +{% endfilter %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- +A, B + +B + +A diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test new file mode 100644 index 00000000..380531f7 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test @@ -0,0 +1,14 @@ +--TEST-- +"for" tag takes a condition +--TEMPLATE-- +{% for i in 1..5 if i is odd -%} + {{ loop.index }}.{{ i }}{{ foo.bar }} +{% endfor %} +--DATA-- +return array('foo' => array('bar' => 'X')) +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- +1.1X +2.3X +3.5X diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test new file mode 100644 index 00000000..ddc69307 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test @@ -0,0 +1,18 @@ +--TEST-- +"for" tag keeps the context safe +--TEMPLATE-- +{% for item in items %} + {% for item in items %} + * {{ item }} + {% endfor %} + * {{ item }} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * a + * b + * a + * a + * b + * b diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test new file mode 100644 index 00000000..20ccc880 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test @@ -0,0 +1,23 @@ +--TEST-- +"for" tag can use an "else" clause +--TEMPLATE-- +{% for item in items %} + * {{ item }} +{% else %} + no item +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * a + * b +--DATA-- +return array('items' => array()) +--EXPECT-- + no item +--DATA-- +return array() +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- + no item diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test new file mode 100644 index 00000000..49fb9ca6 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test @@ -0,0 +1,17 @@ +--TEST-- +"for" tag does not reset inner variables +--TEMPLATE-- +{% for i in 1..2 %} + {% for j in 0..2 %} + {{k}}{% set k = k+1 %} {{ loop.parent.loop.index }} + {% endfor %} +{% endfor %} +--DATA-- +return array('k' => 0) +--EXPECT-- + 0 1 + 1 1 + 2 1 + 3 2 + 4 2 + 5 2 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test new file mode 100644 index 00000000..4e22cb47 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test @@ -0,0 +1,11 @@ +--TEST-- +"for" tag can iterate over keys +--TEMPLATE-- +{% for key in items|keys %} + * {{ key }} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * 0 + * 1 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test new file mode 100644 index 00000000..4c211689 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test @@ -0,0 +1,11 @@ +--TEST-- +"for" tag can iterate over keys and values +--TEMPLATE-- +{% for key, item in items %} + * {{ key }}/{{ item }} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * 0/a + * 1/b diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test new file mode 100644 index 00000000..93bc76a1 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test @@ -0,0 +1,19 @@ +--TEST-- +"for" tag adds a loop variable to the context +--TEMPLATE-- +{% for item in items %} + * {{ loop.index }}/{{ loop.index0 }} + * {{ loop.revindex }}/{{ loop.revindex0 }} + * {{ loop.first }}/{{ loop.last }}/{{ loop.length }} + +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * 1/0 + * 2/1 + * 1//2 + + * 2/1 + * 1/0 + * /1/2 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test new file mode 100644 index 00000000..58af2c32 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test @@ -0,0 +1,10 @@ +--TEST-- +"for" tag adds a loop variable to the context locally +--TEMPLATE-- +{% for item in items %} +{% endfor %} +{% if loop is not defined %}WORKS{% endif %} +--DATA-- +return array('items' => array()) +--EXPECT-- +WORKS diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test new file mode 100644 index 00000000..6a2af63b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test @@ -0,0 +1,10 @@ +--TEST-- +"for" tag +--TEMPLATE-- +{% for i, item in items if i > 0 %} + {{ loop.last }} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXCEPTION-- +Twig_Error_Syntax: The "loop.last" variable is not defined when looping with a condition in "index.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test new file mode 100644 index 00000000..1e819ca0 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test @@ -0,0 +1,9 @@ +--TEST-- +"for" tag +--TEMPLATE-- +{% for i, item in items if loop.last > 0 %} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXCEPTION-- +Twig_Error_Syntax: The "loop" variable cannot be used in a looping condition in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test new file mode 100644 index 00000000..f8b9f6bc --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test @@ -0,0 +1,17 @@ +--TEST-- +"for" tag can use an "else" clause +--TEMPLATE-- +{% for item in items %} + {% for item in items1 %} + * {{ item }} + {% else %} + no {{ item }} + {% endfor %} +{% else %} + no item1 +{% endfor %} +--DATA-- +return array('items' => array('a', 'b'), 'items1' => array()) +--EXPECT-- +no a + no b diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test new file mode 100644 index 00000000..50344379 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test @@ -0,0 +1,43 @@ +--TEST-- +"for" tag iterates over iterable objects +--TEMPLATE-- +{% for item in items %} + * {{ item }} + * {{ loop.index }}/{{ loop.index0 }} + * {{ loop.first }} + +{% endfor %} + +{% for key, value in items %} + * {{ key }}/{{ value }} +{% endfor %} + +{% for key in items|keys %} + * {{ key }} +{% endfor %} +--DATA-- +class ItemsIterator implements Iterator +{ + protected $values = array('foo' => 'bar', 'bar' => 'foo'); + public function current() { return current($this->values); } + public function key() { return key($this->values); } + public function next() { return next($this->values); } + public function rewind() { return reset($this->values); } + public function valid() { return false !== current($this->values); } +} +return array('items' => new ItemsIterator()) +--EXPECT-- + * bar + * 1/0 + * 1 + + * foo + * 2/1 + * + + + * foo/bar + * bar/foo + + * foo + * bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test new file mode 100644 index 00000000..4a1ff611 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test @@ -0,0 +1,47 @@ +--TEST-- +"for" tag iterates over iterable and countable objects +--TEMPLATE-- +{% for item in items %} + * {{ item }} + * {{ loop.index }}/{{ loop.index0 }} + * {{ loop.revindex }}/{{ loop.revindex0 }} + * {{ loop.first }}/{{ loop.last }}/{{ loop.length }} + +{% endfor %} + +{% for key, value in items %} + * {{ key }}/{{ value }} +{% endfor %} + +{% for key in items|keys %} + * {{ key }} +{% endfor %} +--DATA-- +class ItemsIteratorCountable implements Iterator, Countable +{ + protected $values = array('foo' => 'bar', 'bar' => 'foo'); + public function current() { return current($this->values); } + public function key() { return key($this->values); } + public function next() { return next($this->values); } + public function rewind() { return reset($this->values); } + public function valid() { return false !== current($this->values); } + public function count() { return count($this->values); } +} +return array('items' => new ItemsIteratorCountable()) +--EXPECT-- + * bar + * 1/0 + * 2/1 + * 1//2 + + * foo + * 2/1 + * 1/0 + * /1/2 + + + * foo/bar + * bar/foo + + * foo + * bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test new file mode 100644 index 00000000..17b2e222 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test @@ -0,0 +1,18 @@ +--TEST-- +"for" tags can be nested +--TEMPLATE-- +{% for key, item in items %} +* {{ key }} ({{ loop.length }}): +{% for value in item %} + * {{ value }} ({{ loop.length }}) +{% endfor %} +{% endfor %} +--DATA-- +return array('items' => array('a' => array('a1', 'a2', 'a3'), 'b' => array('b1'))) +--EXPECT-- +* a (2): + * a1 (3) + * a2 (3) + * a3 (3) +* b (2): + * b1 (1) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test new file mode 100644 index 00000000..82f2ae8a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test @@ -0,0 +1,11 @@ +--TEST-- +"for" tag iterates over item values +--TEMPLATE-- +{% for item in items %} + * {{ item }} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * a + * b diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test new file mode 100644 index 00000000..5f5da0ec --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test @@ -0,0 +1,14 @@ +--TEST-- +global variables +--TEMPLATE-- +{% include "included.twig" %} +{% from "included.twig" import foobar %} +{{ foobar() }} +--TEMPLATE(included.twig)-- +{% macro foobar() %} +called foobar +{% endmacro %} +--DATA-- +return array(); +--EXPECT-- +called foobar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test new file mode 100644 index 00000000..c1c3d276 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test @@ -0,0 +1,22 @@ +--TEST-- +"if" creates a condition +--TEMPLATE-- +{% if a is defined %} + {{ a }} +{% elseif b is defined %} + {{ b }} +{% else %} + NOTHING +{% endif %} +--DATA-- +return array('a' => 'a') +--EXPECT-- + a +--DATA-- +return array('b' => 'b') +--EXPECT-- + b +--DATA-- +return array() +--EXPECT-- + NOTHING diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test new file mode 100644 index 00000000..edfb73df --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test @@ -0,0 +1,22 @@ +--TEST-- +"if" takes an expression as a test +--TEMPLATE-- +{% if a < 2 %} + A1 +{% elseif a > 10 %} + A2 +{% else %} + A3 +{% endif %} +--DATA-- +return array('a' => 1) +--EXPECT-- + A1 +--DATA-- +return array('a' => 12) +--EXPECT-- + A2 +--DATA-- +return array('a' => 7) +--EXPECT-- + A3 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test new file mode 100644 index 00000000..8fe1a6c1 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag +--TEMPLATE-- +FOO +{% include "foo.twig" %} + +BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return array() +--EXPECT-- +FOO + +FOOBAR +BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test new file mode 100644 index 00000000..eaeeb112 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag allows expressions for the template to include +--TEMPLATE-- +FOO +{% include foo %} + +BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return array('foo' => 'foo.twig') +--EXPECT-- +FOO + +FOOBAR +BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test new file mode 100644 index 00000000..24aed06d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test @@ -0,0 +1,10 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% include ["foo.twig", "bar.twig"] ignore missing %} +{% include "foo.twig" ignore missing %} +{% include "foo.twig" ignore missing with {} %} +{% include "foo.twig" ignore missing with {} only %} +--DATA-- +return array() +--EXPECT-- diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test new file mode 100644 index 00000000..f25e8715 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test @@ -0,0 +1,8 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% include "foo.twig" %} +--DATA-- +return array(); +--EXCEPTION-- +Twig_Error_Loader: Template "foo.twig" is not defined in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test new file mode 100644 index 00000000..86c18644 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% extends "base.twig" %} + +{% block content %} + {{ parent() }} +{% endblock %} +--TEMPLATE(base.twig)-- +{% block content %} + {% include "foo.twig" %} +{% endblock %} +--DATA-- +return array(); +--EXCEPTION-- +Twig_Error_Loader: Template "foo.twig" is not defined in "base.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test new file mode 100644 index 00000000..77760a09 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag accept variables and only +--TEMPLATE-- +{% include "foo.twig" %} +{% include "foo.twig" only %} +{% include "foo.twig" with {'foo1': 'bar'} %} +{% include "foo.twig" with {'foo1': 'bar'} only %} +--TEMPLATE(foo.twig)-- +{% for k, v in _context %}{{ k }},{% endfor %} +--DATA-- +return array('foo' => 'bar') +--EXPECT-- +foo,global,_parent, +global,_parent, +foo,global,foo1,_parent, +foo1,global,_parent, diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test new file mode 100644 index 00000000..6ba064a3 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test @@ -0,0 +1,10 @@ +--TEST-- +"include" tag accepts Twig_Template instance +--TEMPLATE-- +{% include foo %} FOO +--TEMPLATE(foo.twig)-- +BAR +--DATA-- +return array('foo' => $twig->loadTemplate('foo.twig')) +--EXPECT-- +BAR FOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test new file mode 100644 index 00000000..ab670ee0 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test @@ -0,0 +1,12 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% include ["foo.twig", "bar.twig"] %} +{% include ["bar.twig", "foo.twig"] %} +--TEMPLATE(foo.twig)-- +foo +--DATA-- +return array() +--EXPECT-- +foo +foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test new file mode 100644 index 00000000..41384ac7 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test @@ -0,0 +1,12 @@ +--TEST-- +"include" tag accept variables +--TEMPLATE-- +{% include "foo.twig" with {'foo': 'bar'} %} +{% include "foo.twig" with vars %} +--TEMPLATE(foo.twig)-- +{{ foo }} +--DATA-- +return array('vars' => array('foo' => 'bar')) +--EXPECT-- +bar +bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test new file mode 100644 index 00000000..0778a4b4 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %} +FOO +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}{% endblock %} +--DATA-- +return array() +--EXPECT-- +FOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test new file mode 100644 index 00000000..9a81499a --- /dev/null +++ b/plugins/twig/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:
    Element:
    Element:
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test new file mode 100644 index 00000000..3e868c0d --- /dev/null +++ b/plugins/twig/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:
    Element:
    Element:
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test new file mode 100644 index 00000000..8576e773 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends standalone ? foo : 'bar.twig' %} + +{% block content %}{{ parent() }}FOO{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}FOO{% endblock %} +--TEMPLATE(bar.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return array('foo' => 'foo.twig', 'standalone' => true) +--EXPECT-- +FOOFOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test new file mode 100644 index 00000000..ee06ddce --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends foo %} + +{% block content %} +FOO +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}{% endblock %} +--DATA-- +return array('foo' => 'foo.twig') +--EXPECT-- +FOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test new file mode 100644 index 00000000..784f3571 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test @@ -0,0 +1,10 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} +--TEMPLATE(foo.twig)-- +{% block content %}FOO{% endblock %} +--DATA-- +return array() +--EXPECT-- +FOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test new file mode 100644 index 00000000..a1cb1ce8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends ["foo.twig", "bar.twig"] %} +--TEMPLATE(bar.twig)-- +{% block content %} +foo +{% endblock %} +--DATA-- +return array() +--EXPECT-- +foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test new file mode 100644 index 00000000..acc74f6a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends ["", "bar.twig"] %} +--TEMPLATE(bar.twig)-- +{% block content %} +foo +{% endblock %} +--DATA-- +return array() +--EXPECT-- +foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test new file mode 100644 index 00000000..cfa648d4 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends [null, "bar.twig"] %} +--TEMPLATE(bar.twig)-- +{% block content %} +foo +{% endblock %} +--DATA-- +return array() +--EXPECT-- +foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test new file mode 100644 index 00000000..dfc2b6c4 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "layout.twig" %}{% block content %}{{ parent() }}index {% endblock %} +--TEMPLATE(layout.twig)-- +{% extends "base.twig" %}{% block content %}{{ parent() }}layout {% endblock %} +--TEMPLATE(base.twig)-- +{% block content %}base {% endblock %} +--DATA-- +return array() +--EXPECT-- +base layout index diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test new file mode 100644 index 00000000..1d3e639c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test @@ -0,0 +1,22 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% set foo = 1 %} +{{ include('parent.twig') }} +{{ include('parent.twig') }} +{% set foo = 2 %} +{{ include('parent.twig') }} +--TEMPLATE(parent.twig)-- +{% extends foo~'_parent.twig' %}{% block content %}{{ parent() }} parent{% endblock %} +--TEMPLATE(1_parent.twig)-- +{% block content %}1{% endblock %} +--TEMPLATE(2_parent.twig)-- +{% block content %}2{% endblock %} +--DATA-- +return array() +--EXPECT-- +1 parent + +1 parent + +2 parent diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test new file mode 100644 index 00000000..faca9259 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test @@ -0,0 +1,22 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %} + {% block subcontent %} + {% block subsubcontent %} + SUBSUBCONTENT + {% endblock %} + {% endblock %} +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %} + {% block subcontent %} + SUBCONTENT + {% endblock %} +{% endblock %} +--DATA-- +return array() +--EXPECT-- +SUBSUBCONTENT diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test new file mode 100644 index 00000000..0ad11d0c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test @@ -0,0 +1,15 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% block content %} + CONTENT + {%- block subcontent -%} + SUBCONTENT + {%- endblock -%} + ENDCONTENT +{% endblock %} +--TEMPLATE(foo.twig)-- +--DATA-- +return array() +--EXPECT-- +CONTENTSUBCONTENTENDCONTENT diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test new file mode 100644 index 00000000..71e3cdfd --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test @@ -0,0 +1,16 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "layout.twig" %} +{% block inside %}INSIDE{% endblock inside %} +--TEMPLATE(layout.twig)-- +{% extends "base.twig" %} +{% block body %} + {% block inside '' %} +{% endblock body %} +--TEMPLATE(base.twig)-- +{% block body '' %} +--DATA-- +return array() +--EXPECT-- +INSIDE diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test new file mode 100644 index 00000000..4f975db8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %}{{ parent() }}FOO{{ parent() }}{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return array() +--EXPECT-- +BARFOOBAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test new file mode 100644 index 00000000..a8bc90ce --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test @@ -0,0 +1,16 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends foo ? 'foo.twig' : 'bar.twig' %} +--TEMPLATE(foo.twig)-- +FOO +--TEMPLATE(bar.twig)-- +BAR +--DATA-- +return array('foo' => true) +--EXPECT-- +FOO +--DATA-- +return array('foo' => false) +--EXPECT-- +BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test new file mode 100644 index 00000000..cca6dbc9 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test @@ -0,0 +1,8 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% block content %} + {% extends "foo.twig" %} +{% endblock %} +--EXCEPTION-- +Twig_Error_Syntax: Cannot extend from a block in "index.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test new file mode 100644 index 00000000..62816713 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test @@ -0,0 +1,20 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "base.twig" %} +{% block content %}{% include "included.twig" %}{% endblock %} + +{% block footer %}Footer{% endblock %} +--TEMPLATE(included.twig)-- +{% extends "base.twig" %} +{% block content %}Included Content{% endblock %} +--TEMPLATE(base.twig)-- +{% block content %}Default Content{% endblock %} + +{% block footer %}Default Footer{% endblock %} +--DATA-- +return array() +--EXPECT-- +Included Content +Default Footer +Footer diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test new file mode 100644 index 00000000..71e7c208 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test @@ -0,0 +1,28 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %} + {% block inside %} + INSIDE OVERRIDDEN + {% endblock %} + + BEFORE + {{ parent() }} + AFTER +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %} + BAR +{% endblock %} +--DATA-- +return array() +--EXPECT-- + +INSIDE OVERRIDDEN + + BEFORE + BAR + + AFTER diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test new file mode 100644 index 00000000..e29b1ac4 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test @@ -0,0 +1,8 @@ +--TEST-- +"parent" tag +--TEMPLATE-- +{% block content %} + {{ parent() }} +{% endblock %} +--EXCEPTION-- +Twig_Error_Syntax: Calling "parent" on a template that does not extend nor "use" another template is forbidden in "index.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test new file mode 100644 index 00000000..63c73055 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test @@ -0,0 +1,14 @@ +--TEST-- +"parent" tag +--TEMPLATE-- +{% use 'foo.twig' %} + +{% block content %} + {{ parent() }} +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return array() +--EXPECT-- +BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test new file mode 100644 index 00000000..d1876a52 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag accepts Twig_Template instance +--TEMPLATE-- +{% extends foo %} + +{% block content %} +{{ parent() }}FOO +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return array('foo' => $twig->loadTemplate('foo.twig')) +--EXPECT-- +BARFOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test new file mode 100644 index 00000000..8f9ece7c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test @@ -0,0 +1,44 @@ +--TEST-- +"parent" function +--TEMPLATE-- +{% extends "parent.twig" %} + +{% use "use1.twig" %} +{% use "use2.twig" %} + +{% block content_parent %} + {{ parent() }} +{% endblock %} + +{% block content_use1 %} + {{ parent() }} +{% endblock %} + +{% block content_use2 %} + {{ parent() }} +{% endblock %} + +{% block content %} + {{ block('content_use1_only') }} + {{ block('content_use2_only') }} +{% endblock %} +--TEMPLATE(parent.twig)-- +{% block content_parent 'content_parent' %} +{% block content_use1 'content_parent' %} +{% block content_use2 'content_parent' %} +{% block content '' %} +--TEMPLATE(use1.twig)-- +{% block content_use1 'content_use1' %} +{% block content_use2 'content_use1' %} +{% block content_use1_only 'content_use1_only' %} +--TEMPLATE(use2.twig)-- +{% block content_use2 'content_use2' %} +{% block content_use2_only 'content_use2_only' %} +--DATA-- +return array() +--EXPECT-- + content_parent + content_use1 + content_use2 + content_use1_only + content_use2_only diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test new file mode 100644 index 00000000..eef0c10d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test @@ -0,0 +1,17 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% import _self as macros %} + +{{ macros.input('username') }} +{{ macros.input('password', null, 'password', 1) }} + +{% macro input(name, value, type, size) %} + +{% endmacro %} +--DATA-- +return array() +--EXPECT-- + + + diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test new file mode 100644 index 00000000..ae6203bb --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test @@ -0,0 +1,16 @@ +--TEST-- +"macro" tag supports name for endmacro +--TEMPLATE-- +{% import _self as macros %} + +{{ macros.foo() }} +{{ macros.bar() }} + +{% macro foo() %}foo{% endmacro %} +{% macro bar() %}bar{% endmacro bar %} +--DATA-- +return array() +--EXPECT-- +foo +bar + diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test new file mode 100644 index 00000000..5cd3dae6 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test @@ -0,0 +1,17 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% import 'forms.twig' as forms %} + +{{ forms.input('username') }} +{{ forms.input('password', null, 'password', 1) }} +--TEMPLATE(forms.twig)-- +{% macro input(name, value, type, size) %} + +{% endmacro %} +--DATA-- +return array() +--EXPECT-- + + + diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test new file mode 100644 index 00000000..205f5918 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test @@ -0,0 +1,18 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% from 'forms.twig' import foo %} +{% from 'forms.twig' import foo as foobar, bar %} + +{{ foo('foo') }} +{{ foobar('foo') }} +{{ bar('foo') }} +--TEMPLATE(forms.twig)-- +{% macro foo(name) %}foo{{ name }}{% endmacro %} +{% macro bar(name) %}bar{{ name }}{% endmacro %} +--DATA-- +return array() +--EXPECT-- +foofoo +foofoo +barfoo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test new file mode 100644 index 00000000..2de9765f --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test @@ -0,0 +1,9 @@ +--TEST-- +"from" tag with reserved name +--TEMPLATE-- +{% from 'forms.twig' import templateName %} +--TEMPLATE(forms.twig)-- +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Syntax: "templateName" cannot be an imported macro as it is a reserved keyword in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test new file mode 100644 index 00000000..6b371768 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test @@ -0,0 +1,14 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% from 'forms.twig' import foo %} + +{{ foo('foo') }} +{{ foo() }} +--TEMPLATE(forms.twig)-- +{% macro foo(name) %}{{ name|default('foo') }}{{ global }}{% endmacro %} +--DATA-- +return array() +--EXPECT-- +fooglobal +fooglobal diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test new file mode 100644 index 00000000..7bd93c62 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test @@ -0,0 +1,11 @@ +--TEST-- +"from" tag with reserved name +--TEMPLATE-- +{% import 'forms.twig' as macros %} + +{{ macros.parent() }} +--TEMPLATE(forms.twig)-- +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Syntax: "parent" cannot be called as macro as it is a reserved keyword in "index.twig" at line 4. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test new file mode 100644 index 00000000..f7c102f0 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test @@ -0,0 +1,10 @@ +--TEST-- +"macro" tag with reserved name +--TEMPLATE-- +{% macro parent(arg1, arg2) %} + parent +{% endmacro %} +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Syntax: "parent" cannot be used as a macro name as it is a reserved keyword in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test new file mode 100644 index 00000000..17756cb6 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test @@ -0,0 +1,17 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% import _self as forms %} + +{{ forms.input('username') }} +{{ forms.input('password', null, 'password', 1) }} + +{% macro input(name, value, type, size) %} + +{% endmacro %} +--DATA-- +return array() +--EXPECT-- + + + diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test new file mode 100644 index 00000000..37217707 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test @@ -0,0 +1,14 @@ +--TEST-- +"§" as a macro name +--TEMPLATE-- +{% import _self as macros %} + +{{ macros.§('foo') }} + +{% macro §(foo) %} + §{{ foo }}§ +{% endmacro %} +--DATA-- +return array() +--EXPECT-- +§foo§ diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test new file mode 100644 index 00000000..56794628 --- /dev/null +++ b/plugins/twig/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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test new file mode 100644 index 00000000..0445e853 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test @@ -0,0 +1,10 @@ +--TEST-- +"raw" tag +--TEMPLATE-- +{% raw %} +{{ foo }} +{% endraw %} +--DATA-- +return array() +--EXPECT-- +{{ foo }} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test new file mode 100644 index 00000000..99deefc3 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test @@ -0,0 +1,10 @@ +--TEST-- +"raw" tag +--TEMPLATE-- +{% raw %} +{{ foo }} +{% endverbatim %} +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Syntax: Unexpected end of file: Unclosed "raw" block in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test new file mode 100644 index 00000000..352bb187 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test @@ -0,0 +1,56 @@ +--TEST-- +"raw" tag +--TEMPLATE-- +1*** + +{%- raw %} + {{ 'bla' }} +{% endraw %} + +1*** +2*** + +{%- raw -%} + {{ 'bla' }} +{% endraw %} + +2*** +3*** + +{%- raw -%} + {{ 'bla' }} +{% endraw -%} + +3*** +4*** + +{%- raw -%} + {{ 'bla' }} +{%- endraw %} + +4*** +5*** + +{%- raw -%} + {{ 'bla' }} +{%- endraw -%} + +5*** +--DATA-- +return array() +--EXPECT-- +1*** + {{ 'bla' }} + + +1*** +2***{{ 'bla' }} + + +2*** +3***{{ 'bla' }} +3*** +4***{{ 'bla' }} + +4*** +5***{{ 'bla' }}5*** diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test new file mode 100644 index 00000000..dfddc151 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test @@ -0,0 +1,11 @@ +--TEST-- +sandbox tag +--TEMPLATE-- +{%- sandbox %} + {%- include "foo.twig" %} + a +{%- endsandbox %} +--TEMPLATE(foo.twig)-- +foo +--EXCEPTION-- +Twig_Error_Syntax: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 4. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test new file mode 100644 index 00000000..a33a13ee --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test @@ -0,0 +1,14 @@ +--TEST-- +sandbox tag +--TEMPLATE-- +{%- sandbox %} + {%- include "foo.twig" %} + + {% if 1 %} + {%- include "foo.twig" %} + {% endif %} +{%- endsandbox %} +--TEMPLATE(foo.twig)-- +foo +--EXCEPTION-- +Twig_Error_Syntax: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 5. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test new file mode 100644 index 00000000..de20f3db --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test @@ -0,0 +1,22 @@ +--TEST-- +sandbox tag +--TEMPLATE-- +{%- sandbox %} + {%- include "foo.twig" %} +{%- endsandbox %} + +{%- sandbox %} + {%- include "foo.twig" %} + {%- include "foo.twig" %} +{%- endsandbox %} + +{%- sandbox %}{% include "foo.twig" %}{% endsandbox %} +--TEMPLATE(foo.twig)-- +foo +--DATA-- +return array() +--EXPECT-- +foo +foo +foo +foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test new file mode 100644 index 00000000..a5a9f830 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test @@ -0,0 +1,20 @@ +--TEST-- +"set" tag +--TEMPLATE-- +{% set foo = 'foo' %} +{% set bar = 'foo
    ' %} + +{{ foo }} +{{ bar }} + +{% set foo, bar = 'foo', 'bar' %} + +{{ foo }}{{ bar }} +--DATA-- +return array() +--EXPECT-- +foo +foo<br /> + + +foobar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test new file mode 100644 index 00000000..ec657f00 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test @@ -0,0 +1,9 @@ +--TEST-- +"set" tag block empty capture +--TEMPLATE-- +{% set foo %}{% endset %} + +{% if foo %}FAIL{% endif %} +--DATA-- +return array() +--EXPECT-- diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test new file mode 100644 index 00000000..f156a1a7 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test @@ -0,0 +1,10 @@ +--TEST-- +"set" tag block capture +--TEMPLATE-- +{% set foo %}f
    o
    o{% endset %} + +{{ foo }} +--DATA-- +return array() +--EXPECT-- +f
    o
    o diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test new file mode 100644 index 00000000..8ff434a0 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test @@ -0,0 +1,12 @@ +--TEST-- +"set" tag +--TEMPLATE-- +{% set foo, bar = 'foo' ~ 'bar', 'bar' ~ 'foo' %} + +{{ foo }} +{{ bar }} +--DATA-- +return array() +--EXPECT-- +foobar +barfoo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test new file mode 100644 index 00000000..dd06dec2 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test @@ -0,0 +1,12 @@ +--TEST-- +"spaceless" tag removes whites between HTML tags +--TEMPLATE-- +{% spaceless %} + +
    foo
    + +{% endspaceless %} +--DATA-- +return array() +--EXPECT-- +
    foo
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test new file mode 100644 index 00000000..789b4ba8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test @@ -0,0 +1,8 @@ +--TEST-- +"§" custom tag +--TEMPLATE-- +{% § %} +--DATA-- +return array() +--EXPECT-- +§ diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test new file mode 100644 index 00000000..1d2273f8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test @@ -0,0 +1,74 @@ +--TEST-- +Whitespace trimming on tags. +--TEMPLATE-- +{{ 5 * '{#-'|length }} +{{ '{{-'|length * 5 + '{%-'|length }} + +Trim on control tag: +{% for i in range(1, 9) -%} + {{ i }} +{%- endfor %} + + +Trim on output tag: +{% for i in range(1, 9) %} + {{- i -}} +{% endfor %} + + +Trim comments: + +{#- Invisible -#} + +After the comment. + +Trim leading space: +{% if leading %} + + {{- leading }} +{% endif %} + +{%- if leading %} + {{- leading }} + +{%- endif %} + + +Trim trailing space: +{% if trailing -%} + {{ trailing -}} + +{% endif -%} + +Combined: + +{%- if both -%} +
      +
    • {{- both -}}
    • +
    + +{%- endif -%} + +end +--DATA-- +return array('leading' => 'leading space', 'trailing' => 'trailing space', 'both' => 'both') +--EXPECT-- +15 +18 + +Trim on control tag: +123456789 + +Trim on output tag: +123456789 + +Trim comments:After the comment. + +Trim leading space: +leading space +leading space + +Trim trailing space: +trailing spaceCombined:
      +
    • both
    • +
    end diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test new file mode 100644 index 00000000..f887006f --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test @@ -0,0 +1,12 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "blocks.twig" with content as foo %} + +{{ block('foo') }} +--TEMPLATE(blocks.twig)-- +{% block content 'foo' %} +--DATA-- +return array() +--EXPECT-- +foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test new file mode 100644 index 00000000..7364d76d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test @@ -0,0 +1,12 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "blocks.twig" %} + +{{ block('content') }} +--TEMPLATE(blocks.twig)-- +{% block content 'foo' %} +--DATA-- +return array() +--EXPECT-- +foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test new file mode 100644 index 00000000..b551a1e6 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test @@ -0,0 +1,22 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "foo.twig" %} + +{{ block('content') }} +{{ block('foo') }} +{{ block('bar') }} +--TEMPLATE(foo.twig)-- +{% use "bar.twig" %} + +{% block content 'foo' %} +{% block foo 'foo' %} +--TEMPLATE(bar.twig)-- +{% block content 'bar' %} +{% block bar 'bar' %} +--DATA-- +return array() +--EXPECT-- +foo +foo +bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test new file mode 100644 index 00000000..05cca682 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test @@ -0,0 +1,10 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "foo.twig" %} +--TEMPLATE(foo.twig)-- +{% use "bar.twig" %} +--TEMPLATE(bar.twig)-- +--DATA-- +return array() +--EXPECT-- diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test new file mode 100644 index 00000000..0d0d470e --- /dev/null +++ b/plugins/twig/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 %} +
    overridden sub_container
    +{% endblock %} +--TEMPLATE(ancestor.twig)-- +{% block container %} +
    {{ block('sub_container') }}
    +{% endblock %} + +{% block sub_container %} +
    sub_container
    +{% endblock %} +--DATA-- +return array() +--EXPECT-- +
    overridden sub_container
    +
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test new file mode 100644 index 00000000..df95599c --- /dev/null +++ b/plugins/twig/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 %} +
    overridden sub_container
    +{% endblock %} +--TEMPLATE(ancestor.twig)-- +{% block container %} +
    {{ block('sub_container') }}
    +{% endblock %} + +{% block sub_container %} +
    sub_container
    +{% endblock %} +--DATA-- +return array() +--EXPECT-- +
    overridden sub_container
    +
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test new file mode 100644 index 00000000..198be0c5 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test @@ -0,0 +1,21 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "foo.twig" %} +{% use "bar.twig" %} + +{{ block('content') }} +{{ block('foo') }} +{{ block('bar') }} +--TEMPLATE(foo.twig)-- +{% block content 'foo' %} +{% block foo 'foo' %} +--TEMPLATE(bar.twig)-- +{% block content 'bar' %} +{% block bar 'bar' %} +--DATA-- +return array() +--EXPECT-- +bar +foo +bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test new file mode 100644 index 00000000..8de871a8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test @@ -0,0 +1,23 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "foo.twig" with content as foo_content %} +{% use "bar.twig" %} + +{{ block('content') }} +{{ block('foo') }} +{{ block('bar') }} +{{ block('foo_content') }} +--TEMPLATE(foo.twig)-- +{% block content 'foo' %} +{% block foo 'foo' %} +--TEMPLATE(bar.twig)-- +{% block content 'bar' %} +{% block bar 'bar' %} +--DATA-- +return array() +--EXPECT-- +bar +foo +bar +foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test new file mode 100644 index 00000000..59db23d9 --- /dev/null +++ b/plugins/twig/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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test new file mode 100644 index 00000000..d3f302df --- /dev/null +++ b/plugins/twig/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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test new file mode 100644 index 00000000..95b55a46 --- /dev/null +++ b/plugins/twig/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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test new file mode 100644 index 00000000..a95be557 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test @@ -0,0 +1,10 @@ +--TEST-- +"verbatim" tag +--TEMPLATE-- +{% verbatim %} +{{ foo }} +{% endverbatim %} +--DATA-- +return array() +--EXPECT-- +{{ foo }} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test new file mode 100644 index 00000000..28626a81 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test @@ -0,0 +1,10 @@ +--TEST-- +"verbatim" tag +--TEMPLATE-- +{% verbatim %} +{{ foo }} +{% endraw %} +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Syntax: Unexpected end of file: Unclosed "verbatim" block in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test new file mode 100644 index 00000000..eb610444 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test @@ -0,0 +1,56 @@ +--TEST-- +"verbatim" tag +--TEMPLATE-- +1*** + +{%- verbatim %} + {{ 'bla' }} +{% endverbatim %} + +1*** +2*** + +{%- verbatim -%} + {{ 'bla' }} +{% endverbatim %} + +2*** +3*** + +{%- verbatim -%} + {{ 'bla' }} +{% endverbatim -%} + +3*** +4*** + +{%- verbatim -%} + {{ 'bla' }} +{%- endverbatim %} + +4*** +5*** + +{%- verbatim -%} + {{ 'bla' }} +{%- endverbatim -%} + +5*** +--DATA-- +return array() +--EXPECT-- +1*** + {{ 'bla' }} + + +1*** +2***{{ 'bla' }} + + +2*** +3***{{ 'bla' }} +3*** +4***{{ 'bla' }} + +4*** +5***{{ 'bla' }}5*** diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test new file mode 100644 index 00000000..1429d375 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test @@ -0,0 +1,24 @@ +--TEST-- +array index test +--TEMPLATE-- +{% for key, value in days %} +{{ key }} +{% endfor %} +--DATA-- +return array('days' => array( + 1 => array('money' => 9), + 2 => array('money' => 21), + 3 => array('money' => 38), + 4 => array('money' => 6), + 18 => array('money' => 6), + 19 => array('money' => 3), + 31 => array('money' => 11), +)); +--EXPECT-- +1 +2 +3 +4 +18 +19 +31 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test new file mode 100644 index 00000000..60218ac0 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test @@ -0,0 +1,14 @@ +--TEST-- +"const" test +--TEMPLATE-- +{{ 8 is constant('E_NOTICE') ? 'ok' : 'no' }} +{{ 'bar' is constant('TwigTestFoo::BAR_NAME') ? 'ok' : 'no' }} +{{ value is constant('TwigTestFoo::BAR_NAME') ? 'ok' : 'no' }} +{{ 2 is constant('ARRAY_AS_PROPS', object) ? 'ok' : 'no' }} +--DATA-- +return array('value' => 'bar', 'object' => new ArrayObject(array('hi'))); +--EXPECT-- +ok +ok +ok +ok \ No newline at end of file diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test new file mode 100644 index 00000000..d4e204ef --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test @@ -0,0 +1,129 @@ +--TEST-- +"defined" test +--TEMPLATE-- +{{ definedVar is defined ? 'ok' : 'ko' }} +{{ definedVar is not defined ? 'ko' : 'ok' }} +{{ undefinedVar is defined ? 'ko' : 'ok' }} +{{ undefinedVar is not defined ? 'ok' : 'ko' }} +{{ zeroVar is defined ? 'ok' : 'ko' }} +{{ nullVar is defined ? 'ok' : 'ko' }} +{{ nested.definedVar is defined ? 'ok' : 'ko' }} +{{ nested['definedVar'] is defined ? 'ok' : 'ko' }} +{{ nested.definedVar is not defined ? 'ko' : 'ok' }} +{{ nested.undefinedVar is defined ? 'ko' : 'ok' }} +{{ nested['undefinedVar'] is defined ? 'ko' : 'ok' }} +{{ nested.undefinedVar is not defined ? 'ok' : 'ko' }} +{{ nested.zeroVar is defined ? 'ok' : 'ko' }} +{{ nested.nullVar is defined ? 'ok' : 'ko' }} +{{ nested.definedArray.0 is defined ? 'ok' : 'ko' }} +{{ nested['definedArray'][0] is defined ? 'ok' : 'ko' }} +{{ object.foo is defined ? 'ok' : 'ko' }} +{{ object.undefinedMethod is defined ? 'ko' : 'ok' }} +{{ object.getFoo() is defined ? 'ok' : 'ko' }} +{{ object.getFoo('a') is defined ? 'ok' : 'ko' }} +{{ object.undefinedMethod() is defined ? 'ko' : 'ok' }} +{{ object.undefinedMethod('a') is defined ? 'ko' : 'ok' }} +{{ object.self.foo is defined ? 'ok' : 'ko' }} +{{ object.self.undefinedMethod is defined ? 'ko' : 'ok' }} +{{ object.undefinedMethod.self is defined ? 'ko' : 'ok' }} +{{ 0 is defined ? 'ok' : 'ko' }} +{{ "foo" is defined ? 'ok' : 'ko' }} +{{ true is defined ? 'ok' : 'ko' }} +{{ false is defined ? 'ok' : 'ko' }} +{{ null is defined ? 'ok' : 'ko' }} +{{ [1, 2] is defined ? 'ok' : 'ko' }} +{{ { foo: "bar" } is defined ? 'ok' : 'ko' }} +--DATA-- +return array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'nested' => array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'definedArray' => array(0), + ), + 'object' => new TwigTestFoo(), +); +--EXPECT-- +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +--DATA-- +return array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'nested' => array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'definedArray' => array(0), + ), + 'object' => new TwigTestFoo(), +); +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test new file mode 100644 index 00000000..a776d032 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test @@ -0,0 +1,45 @@ +--TEST-- +"empty" test +--TEMPLATE-- +{{ foo is empty ? 'ok' : 'ko' }} +{{ bar is empty ? 'ok' : 'ko' }} +{{ foobar is empty ? 'ok' : 'ko' }} +{{ array is empty ? 'ok' : 'ko' }} +{{ zero is empty ? 'ok' : 'ko' }} +{{ string is empty ? 'ok' : 'ko' }} +{{ countable_empty is empty ? 'ok' : 'ko' }} +{{ countable_not_empty is empty ? 'ok' : 'ko' }} +{{ markup_empty is empty ? 'ok' : 'ko' }} +{{ markup_not_empty is empty ? 'ok' : 'ko' }} +--DATA-- + +class CountableStub implements Countable +{ + private $items; + + public function __construct(array $items) + { + $this->items = $items; + } + + public function count() + { + return count($this->items); + } +} +return array( + 'foo' => '', 'bar' => null, 'foobar' => false, 'array' => array(), 'zero' => 0, 'string' => '0', + 'countable_empty' => new CountableStub(array()), 'countable_not_empty' => new CountableStub(array(1, 2)), + 'markup_empty' => new Twig_Markup('', 'UTF-8'), 'markup_not_empty' => new Twig_Markup('test', 'UTF-8'), +); +--EXPECT-- +ok +ok +ok +ok +ko +ko +ok +ko +ok +ko diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test new file mode 100644 index 00000000..695b4c2f --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test @@ -0,0 +1,14 @@ +--TEST-- +"even" test +--TEMPLATE-- +{{ 1 is even ? 'ko' : 'ok' }} +{{ 2 is even ? 'ok' : 'ko' }} +{{ 1 is not even ? 'ok' : 'ko' }} +{{ 2 is not even ? 'ko' : 'ok' }} +--DATA-- +return array() +--EXPECT-- +ok +ok +ok +ok diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test new file mode 100644 index 00000000..545f51f8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test @@ -0,0 +1,128 @@ +--TEST-- +Twig supports the in operator +--TEMPLATE-- +{% if bar in foo %} +TRUE +{% endif %} +{% if not (bar in foo) %} +{% else %} +TRUE +{% endif %} +{% if bar not in foo %} +{% else %} +TRUE +{% endif %} +{% if 'a' in bar %} +TRUE +{% endif %} +{% if 'c' not in bar %} +TRUE +{% endif %} +{% if '' in bar %} +TRUE +{% endif %} +{% if '' in '' %} +TRUE +{% endif %} +{% if '0' not in '' %} +TRUE +{% endif %} +{% if 'a' not in '0' %} +TRUE +{% endif %} +{% if '0' in '0' %} +TRUE +{% endif %} + +{{ false in [0, 1] ? 'TRUE' : 'FALSE' }} +{{ true in [0, 1] ? 'TRUE' : 'FALSE' }} +{{ '0' in [0, 1] ? 'TRUE' : 'FALSE' }} +{{ '' in [0, 1] ? 'TRUE' : 'FALSE' }} +{{ 0 in ['', 1] ? 'TRUE' : 'FALSE' }} + +{{ '' in 'foo' ? 'TRUE' : 'FALSE' }} +{{ 0 in 'foo' ? 'TRUE' : 'FALSE' }} +{{ false in 'foo' ? 'TRUE' : 'FALSE' }} +{{ false in '100' ? 'TRUE' : 'FALSE' }} +{{ true in '100' ? 'TRUE' : 'FALSE' }} + +{{ [] in [true, false] ? 'TRUE' : 'FALSE' }} +{{ [] in [true, ''] ? 'TRUE' : 'FALSE' }} +{{ [] in [true, []] ? 'TRUE' : 'FALSE' }} + +{{ resource ? 'TRUE' : 'FALSE' }} +{{ resource in 'foo'~resource ? 'TRUE' : 'FALSE' }} +{{ object in 'stdClass' ? 'TRUE' : 'FALSE' }} +{{ [] in 'Array' ? 'TRUE' : 'FALSE' }} +{{ dir_object in 'foo'~dir_object ? 'TRUE' : 'FALSE' }} + +{{ ''~resource in resource ? 'TRUE' : 'FALSE' }} +{{ 'stdClass' in object ? 'TRUE' : 'FALSE' }} +{{ 'Array' in [] ? 'TRUE' : 'FALSE' }} +{{ ''~dir_object in dir_object ? 'TRUE' : 'FALSE' }} + +{{ resource in [''~resource] ? 'TRUE' : 'FALSE' }} +{{ resource in [resource + 1 - 1] ? 'TRUE' : 'FALSE' }} +{{ dir_object in [''~dir_object] ? 'TRUE' : 'FALSE' }} + +{{ 5 in 125 ? 'TRUE' : 'FALSE' }} +{{ 5 in '125' ? 'TRUE' : 'FALSE' }} +{{ '5' in 125 ? 'TRUE' : 'FALSE' }} +{{ '5' in '125' ? 'TRUE' : 'FALSE' }} + +{{ 5.5 in 125.5 ? 'TRUE' : 'FALSE' }} +{{ 5.5 in '125.5' ? 'TRUE' : 'FALSE' }} +{{ '5.5' in 125.5 ? 'TRUE' : 'FALSE' }} +--DATA-- +return array('bar' => 'bar', 'foo' => array('bar' => 'bar'), 'dir_object' => new SplFileInfo(dirname(__FILE__)), 'object' => new stdClass(), 'resource' => opendir(dirname(__FILE__))) +--EXPECT-- +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE + +TRUE +TRUE +TRUE +TRUE +TRUE + +TRUE +FALSE +FALSE +FALSE +FALSE + +TRUE +FALSE +TRUE + +TRUE +FALSE +FALSE +FALSE +FALSE + +FALSE +FALSE +FALSE +FALSE + +FALSE +FALSE +FALSE + +FALSE +TRUE +FALSE +TRUE + +FALSE +TRUE +FALSE diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test new file mode 100644 index 00000000..8e08061b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test @@ -0,0 +1,19 @@ +--TEST-- +Twig supports the in operator when using objects +--TEMPLATE-- +{% if object in object_list %} +TRUE +{% endif %} +--DATA-- +$foo = new TwigTestFoo(); +$foo1 = new TwigTestFoo(); + +$foo->position = $foo1; +$foo1->position = $foo; + +return array( + 'object' => $foo, + 'object_list' => array($foo1, $foo), +); +--EXPECT-- +TRUE diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test new file mode 100644 index 00000000..ec525501 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test @@ -0,0 +1,19 @@ +--TEST-- +"iterable" test +--TEMPLATE-- +{{ foo is iterable ? 'ok' : 'ko' }} +{{ traversable is iterable ? 'ok' : 'ko' }} +{{ obj is iterable ? 'ok' : 'ko' }} +{{ val is iterable ? 'ok' : 'ko' }} +--DATA-- +return array( + 'foo' => array(), + 'traversable' => new ArrayIterator(array()), + 'obj' => new stdClass(), + 'val' => 'test', +); +--EXPECT-- +ok +ok +ko +ko \ No newline at end of file diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test new file mode 100644 index 00000000..3d148c89 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test @@ -0,0 +1,30 @@ +--TEST-- +Twig supports the ?? operator +--TEMPLATE-- +{{ 'OK' ?? 'KO' }} +{{ null ?? 'OK' }} +{{ bar ?? 'KO' }} +{{ baz ?? 'OK' }} +{{ foo.bar ?? 'KO' }} +{{ foo.missing ?? 'OK' }} +{{ foo.bar.baz.missing ?? 'OK' }} +{{ foo['bar'] ?? 'KO' }} +{{ foo['missing'] ?? 'OK' }} +{{ nope ?? nada ?? 'OK' }} +{{ 1 + nope ?? nada ?? 2 }} +{{ 1 + nope ?? 3 + nada ?? 2 }} +--DATA-- +return array('bar' => 'OK', 'foo' => array('bar' => 'OK')) +--EXPECT-- +OK +OK +OK +OK +OK +OK +OK +OK +OK +OK +3 +6 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test new file mode 100644 index 00000000..1b8311e3 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test @@ -0,0 +1,10 @@ +--TEST-- +"odd" test +--TEMPLATE-- +{{ 1 is odd ? 'ok' : 'ko' }} +{{ 2 is odd ? 'ko' : 'ok' }} +--DATA-- +return array() +--EXPECT-- +ok +ok \ No newline at end of file diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php new file mode 100644 index 00000000..1908bcdf --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php @@ -0,0 +1,229 @@ +position = 0; + } + + public function current() + { + return $this->array[$this->position]; + } + + public function key() + { + return 'a'; + } + + public function next() + { + ++$this->position; + } + + public function valid() + { + return isset($this->array[$this->position]); + } +} + +class TwigTestTokenParser_§ extends Twig_TokenParser +{ + public function parse(Twig_Token $token) + { + $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + + return new Twig_Node_Print(new Twig_Node_Expression_Constant('§', -1), -1); + } + + public function getTag() + { + return '§'; + } +} + +class TwigTestExtension extends Twig_Extension +{ + public function getTokenParsers() + { + return array( + new TwigTestTokenParser_§(), + ); + } + + public function getFilters() + { + return array( + new Twig_SimpleFilter('§', array($this, '§Filter')), + new Twig_SimpleFilter('escape_and_nl2br', array($this, 'escape_and_nl2br'), array('needs_environment' => true, 'is_safe' => array('html'))), + new Twig_SimpleFilter('nl2br', array($this, 'nl2br'), array('pre_escape' => 'html', 'is_safe' => array('html'))), + new Twig_SimpleFilter('escape_something', array($this, 'escape_something'), array('is_safe' => array('something'))), + new Twig_SimpleFilter('preserves_safety', array($this, 'preserves_safety'), array('preserves_safety' => array('html'))), + new Twig_SimpleFilter('*_path', array($this, 'dynamic_path')), + new Twig_SimpleFilter('*_foo_*_bar', array($this, 'dynamic_foo')), + ); + } + + public function getFunctions() + { + return array( + new Twig_SimpleFunction('§', array($this, '§Function')), + new Twig_SimpleFunction('safe_br', array($this, 'br'), array('is_safe' => array('html'))), + new Twig_SimpleFunction('unsafe_br', array($this, 'br')), + new Twig_SimpleFunction('*_path', array($this, 'dynamic_path')), + new Twig_SimpleFunction('*_foo_*_bar', array($this, 'dynamic_foo')), + ); + } + + public function getTests() + { + return array( + new Twig_SimpleTest('multi word', array($this, 'is_multi_word')), + ); + } + + public function §Filter($value) + { + return "§{$value}§"; + } + + public function §Function($value) + { + return "§{$value}§"; + } + + /** + * nl2br which also escapes, for testing escaper filters. + */ + public function escape_and_nl2br($env, $value, $sep = '
    ') + { + return $this->nl2br(twig_escape_filter($env, $value, 'html'), $sep); + } + + /** + * nl2br only, for testing filters with pre_escape. + */ + public function nl2br($value, $sep = '
    ') + { + // not secure if $value contains html tags (not only entities) + // don't use + return str_replace("\n", "$sep\n", $value); + } + + public function dynamic_path($element, $item) + { + return $element.'/'.$item; + } + + public function dynamic_foo($foo, $bar, $item) + { + return $foo.'/'.$bar.'/'.$item; + } + + public function escape_something($value) + { + return strtoupper($value); + } + + public function preserves_safety($value) + { + return strtoupper($value); + } + + public function br() + { + return '
    '; + } + + public function is_multi_word($value) + { + return false !== strpos($value, ' '); + } + + public function getName() + { + return 'integration_test'; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test new file mode 100644 index 00000000..d9c1d508 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test @@ -0,0 +1,8 @@ +--TEST-- +Old test classes usage +--TEMPLATE-- +{{ 'foo' is multi word ? 'yes' : 'no' }} +--DATA-- +return array() +--EXPECT-- +no diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php new file mode 100644 index 00000000..055a6170 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php @@ -0,0 +1,54 @@ + new Twig_Test_Method($this, 'is_multi_word'), + ); + } + + public function is_multi_word($value) + { + return false !== strpos($value, ' '); + } + + public function getName() + { + return 'legacy_integration_test'; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/LexerTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/LexerTest.php new file mode 100644 index 00000000..4945d224 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/LexerTest.php @@ -0,0 +1,300 @@ +getMock('Twig_LoaderInterface'))); + $stream = $lexer->tokenize($template); + + $stream->expect(Twig_Token::BLOCK_START_TYPE); + $this->assertSame('§', $stream->expect(Twig_Token::NAME_TYPE)->getValue()); + } + + public function testNameLabelForFunction() + { + $template = '{{ §() }}'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $stream = $lexer->tokenize($template); + + $stream->expect(Twig_Token::VAR_START_TYPE); + $this->assertSame('§', $stream->expect(Twig_Token::NAME_TYPE)->getValue()); + } + + public function testBracketsNesting() + { + $template = '{{ {"a":{"b":"c"}} }}'; + + $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '{')); + $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '}')); + } + + protected function countToken($template, $type, $value = null) + { + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $stream = $lexer->tokenize($template); + + $count = 0; + while (!$stream->isEOF()) { + $token = $stream->next(); + if ($type === $token->getType()) { + if (null === $value || $value === $token->getValue()) { + ++$count; + } + } + } + + return $count; + } + + public function testLineDirective() + { + $template = "foo\n" + ."bar\n" + ."{% line 10 %}\n" + ."{{\n" + ."baz\n" + ."}}\n"; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $stream = $lexer->tokenize($template); + + // foo\nbar\n + $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); + // \n (after {% line %}) + $this->assertSame(10, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); + // {{ + $this->assertSame(11, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine()); + // baz + $this->assertSame(12, $stream->expect(Twig_Token::NAME_TYPE)->getLine()); + } + + public function testLineDirectiveInline() + { + $template = "foo\n" + ."bar{% line 10 %}{{\n" + ."baz\n" + ."}}\n"; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $stream = $lexer->tokenize($template); + + // foo\nbar + $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); + // {{ + $this->assertSame(10, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine()); + // baz + $this->assertSame(11, $stream->expect(Twig_Token::NAME_TYPE)->getLine()); + } + + public function testLongComments() + { + $template = '{# '.str_repeat('*', 100000).' #}'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $lexer->tokenize($template); + + // should not throw an exception + } + + public function testLongVerbatim() + { + $template = '{% verbatim %}'.str_repeat('*', 100000).'{% endverbatim %}'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $lexer->tokenize($template); + + // should not throw an exception + } + + public function testLongVar() + { + $template = '{{ '.str_repeat('x', 100000).' }}'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $lexer->tokenize($template); + + // should not throw an exception + } + + public function testLongBlock() + { + $template = '{% '.str_repeat('x', 100000).' %}'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $lexer->tokenize($template); + + // should not throw an exception + } + + public function testBigNumbers() + { + $template = '{{ 922337203685477580700 }}'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $stream = $lexer->tokenize($template); + $stream->next(); + $node = $stream->next(); + $this->assertEquals('922337203685477580700', $node->getValue()); + } + + public function testStringWithEscapedDelimiter() + { + $tests = array( + "{{ 'foo \' bar' }}" => 'foo \' bar', + '{{ "foo \" bar" }}' => 'foo " bar', + ); + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + foreach ($tests as $template => $expected) { + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, $expected); + } + } + + public function testStringWithInterpolation() + { + $template = 'foo {{ "bar #{ baz + 1 }" }}'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::TEXT_TYPE, 'foo '); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'bar '); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::NAME_TYPE, 'baz'); + $stream->expect(Twig_Token::OPERATOR_TYPE, '+'); + $stream->expect(Twig_Token::NUMBER_TYPE, '1'); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::VAR_END_TYPE); + } + + public function testStringWithEscapedInterpolation() + { + $template = '{{ "bar \#{baz+1}" }}'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'bar #{baz+1}'); + $stream->expect(Twig_Token::VAR_END_TYPE); + } + + public function testStringWithHash() + { + $template = '{{ "bar # baz" }}'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'bar # baz'); + $stream->expect(Twig_Token::VAR_END_TYPE); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unclosed """ + */ + public function testStringWithUnterminatedInterpolation() + { + $template = '{{ "bar #{x" }}'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $lexer->tokenize($template); + } + + public function testStringWithNestedInterpolations() + { + $template = '{{ "bar #{ "foo#{bar}" }" }}'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'bar '); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'foo'); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::NAME_TYPE, 'bar'); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::VAR_END_TYPE); + } + + public function testStringWithNestedInterpolationsInBlock() + { + $template = '{% foo "bar #{ "foo#{bar}" }" %}'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::BLOCK_START_TYPE); + $stream->expect(Twig_Token::NAME_TYPE, 'foo'); + $stream->expect(Twig_Token::STRING_TYPE, 'bar '); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'foo'); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::NAME_TYPE, 'bar'); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); + } + + public function testOperatorEndingWithALetterAtTheEndOfALine() + { + $template = "{{ 1 and\n0}}"; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::NUMBER_TYPE, 1); + $stream->expect(Twig_Token::OPERATOR_TYPE, 'and'); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unclosed "variable" at line 3 + */ + public function testUnterminatedVariable() + { + $template = ' + +{{ + +bar + + +'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $lexer->tokenize($template); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unclosed "block" at line 3 + */ + public function testUnterminatedBlock() + { + $template = ' + +{% + +bar + + +'; + + $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $lexer->tokenize($template); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php new file mode 100644 index 00000000..1369a6bd --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php @@ -0,0 +1,97 @@ + 'bar')); + + $this->assertEquals('bar', $loader->getSource('foo')); + } + + /** + * @expectedException Twig_Error_Loader + */ + public function testGetSourceWhenTemplateDoesNotExist() + { + $loader = new Twig_Loader_Array(array()); + + $loader->getSource('foo'); + } + + public function testGetCacheKey() + { + $loader = new Twig_Loader_Array(array('foo' => 'bar')); + + $this->assertEquals('bar', $loader->getCacheKey('foo')); + } + + /** + * @expectedException Twig_Error_Loader + */ + public function testGetCacheKeyWhenTemplateDoesNotExist() + { + $loader = new Twig_Loader_Array(array()); + + $loader->getCacheKey('foo'); + } + + public function testSetTemplate() + { + $loader = new Twig_Loader_Array(array()); + $loader->setTemplate('foo', 'bar'); + + $this->assertEquals('bar', $loader->getSource('foo')); + } + + public function testIsFresh() + { + $loader = new Twig_Loader_Array(array('foo' => 'bar')); + $this->assertTrue($loader->isFresh('foo', time())); + } + + /** + * @expectedException Twig_Error_Loader + */ + public function testIsFreshWhenTemplateDoesNotExist() + { + $loader = new Twig_Loader_Array(array()); + + $loader->isFresh('foo', time()); + } + + public function testTemplateReference() + { + $name = new Twig_Test_Loader_TemplateReference('foo'); + $loader = new Twig_Loader_Array(array('foo' => 'bar')); + + $loader->getCacheKey($name); + $loader->getSource($name); + $loader->isFresh($name, time()); + $loader->setTemplate($name, 'foobar'); + } +} + +class Twig_Test_Loader_TemplateReference +{ + private $name; + + public function __construct($name) + { + $this->name = $name; + } + + public function __toString() + { + return $this->name; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php new file mode 100644 index 00000000..4fe0db94 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php @@ -0,0 +1,79 @@ + 'bar')), + new Twig_Loader_Array(array('foo' => 'foobar', 'bar' => 'foo')), + )); + + $this->assertEquals('bar', $loader->getSource('foo')); + $this->assertEquals('foo', $loader->getSource('bar')); + } + + /** + * @expectedException Twig_Error_Loader + */ + public function testGetSourceWhenTemplateDoesNotExist() + { + $loader = new Twig_Loader_Chain(array()); + + $loader->getSource('foo'); + } + + public function testGetCacheKey() + { + $loader = new Twig_Loader_Chain(array( + new Twig_Loader_Array(array('foo' => 'bar')), + new Twig_Loader_Array(array('foo' => 'foobar', 'bar' => 'foo')), + )); + + $this->assertEquals('bar', $loader->getCacheKey('foo')); + $this->assertEquals('foo', $loader->getCacheKey('bar')); + } + + /** + * @expectedException Twig_Error_Loader + */ + public function testGetCacheKeyWhenTemplateDoesNotExist() + { + $loader = new Twig_Loader_Chain(array()); + + $loader->getCacheKey('foo'); + } + + public function testAddLoader() + { + $loader = new Twig_Loader_Chain(); + $loader->addLoader(new Twig_Loader_Array(array('foo' => 'bar'))); + + $this->assertEquals('bar', $loader->getSource('foo')); + } + + public function testExists() + { + $loader1 = $this->getMock('Twig_Loader_Array', array('exists', 'getSource'), array(), '', false); + $loader1->expects($this->once())->method('exists')->will($this->returnValue(false)); + $loader1->expects($this->never())->method('getSource'); + + $loader2 = $this->getMock('Twig_LoaderInterface'); + $loader2->expects($this->once())->method('getSource')->will($this->returnValue('content')); + + $loader = new Twig_Loader_Chain(); + $loader->addLoader($loader1); + $loader->addLoader($loader2); + + $this->assertTrue($loader->exists('foo')); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php new file mode 100644 index 00000000..e07f374a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php @@ -0,0 +1,175 @@ +getCacheKey($template); + $this->fail(); + } catch (Twig_Error_Loader $e) { + $this->assertNotContains('Unable to find template', $e->getMessage()); + } + } + + public function getSecurityTests() + { + return array( + array("AutoloaderTest\0.php"), + array('..\\AutoloaderTest.php'), + array('..\\\\\\AutoloaderTest.php'), + array('../AutoloaderTest.php'), + array('..////AutoloaderTest.php'), + array('./../AutoloaderTest.php'), + array('.\\..\\AutoloaderTest.php'), + array('././././././../AutoloaderTest.php'), + array('.\\./.\\./.\\./../AutoloaderTest.php'), + array('foo/../../AutoloaderTest.php'), + array('foo\\..\\..\\AutoloaderTest.php'), + array('foo/../bar/../../AutoloaderTest.php'), + array('foo/bar/../../../AutoloaderTest.php'), + array('filters/../../AutoloaderTest.php'), + array('filters//..//..//AutoloaderTest.php'), + array('filters\\..\\..\\AutoloaderTest.php'), + array('filters\\\\..\\\\..\\\\AutoloaderTest.php'), + array('filters\\//../\\/\\..\\AutoloaderTest.php'), + array('/../AutoloaderTest.php'), + ); + } + + public function testPaths() + { + $basePath = dirname(__FILE__).'/Fixtures'; + + $loader = new Twig_Loader_Filesystem(array($basePath.'/normal', $basePath.'/normal_bis')); + $loader->setPaths(array($basePath.'/named', $basePath.'/named_bis'), 'named'); + $loader->addPath($basePath.'/named_ter', 'named'); + $loader->addPath($basePath.'/normal_ter'); + $loader->prependPath($basePath.'/normal_final'); + $loader->prependPath($basePath.'/named/../named_quater', 'named'); + $loader->prependPath($basePath.'/named_final', 'named'); + + $this->assertEquals(array( + $basePath.'/normal_final', + $basePath.'/normal', + $basePath.'/normal_bis', + $basePath.'/normal_ter', + ), $loader->getPaths()); + $this->assertEquals(array( + $basePath.'/named_final', + $basePath.'/named/../named_quater', + $basePath.'/named', + $basePath.'/named_bis', + $basePath.'/named_ter', + ), $loader->getPaths('named')); + + $this->assertEquals( + realpath($basePath.'/named_quater/named_absolute.html'), + realpath($loader->getCacheKey('@named/named_absolute.html')) + ); + $this->assertEquals("path (final)\n", $loader->getSource('index.html')); + $this->assertEquals("path (final)\n", $loader->getSource('@__main__/index.html')); + $this->assertEquals("named path (final)\n", $loader->getSource('@named/index.html')); + } + + public function testEmptyConstructor() + { + $loader = new Twig_Loader_Filesystem(); + $this->assertEquals(array(), $loader->getPaths()); + } + + public function testGetNamespaces() + { + $loader = new Twig_Loader_Filesystem(sys_get_temp_dir()); + $this->assertEquals(array(Twig_Loader_Filesystem::MAIN_NAMESPACE), $loader->getNamespaces()); + + $loader->addPath(sys_get_temp_dir(), 'named'); + $this->assertEquals(array(Twig_Loader_Filesystem::MAIN_NAMESPACE, 'named'), $loader->getNamespaces()); + } + + public function testFindTemplateExceptionNamespace() + { + $basePath = dirname(__FILE__).'/Fixtures'; + + $loader = new Twig_Loader_Filesystem(array($basePath.'/normal')); + $loader->addPath($basePath.'/named', 'named'); + + try { + $loader->getSource('@named/nowhere.html'); + } catch (Exception $e) { + $this->assertInstanceof('Twig_Error_Loader', $e); + $this->assertContains('Unable to find template "@named/nowhere.html"', $e->getMessage()); + } + } + + public function testFindTemplateWithCache() + { + $basePath = dirname(__FILE__).'/Fixtures'; + + $loader = new Twig_Loader_Filesystem(array($basePath.'/normal')); + $loader->addPath($basePath.'/named', 'named'); + + // prime the cache for index.html in the named namespace + $namedSource = $loader->getSource('@named/index.html'); + $this->assertEquals("named path\n", $namedSource); + + // get index.html from the main namespace + $this->assertEquals("path\n", $loader->getSource('index.html')); + } + + public function testLoadTemplateAndRenderBlockWithCache() + { + $loader = new Twig_Loader_Filesystem(array()); + $loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme2'); + $loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme1'); + $loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme1', 'default_theme'); + + $twig = new Twig_Environment($loader); + + $template = $twig->loadTemplate('blocks.html.twig'); + $this->assertSame('block from theme 1', $template->renderBlock('b1', array())); + + $template = $twig->loadTemplate('blocks.html.twig'); + $this->assertSame('block from theme 2', $template->renderBlock('b2', array())); + } + + public function getArrayInheritanceTests() + { + return array( + 'valid array inheritance' => array('array_inheritance_valid_parent.html.twig'), + 'array inheritance with null first template' => array('array_inheritance_null_parent.html.twig'), + 'array inheritance with empty first template' => array('array_inheritance_empty_parent.html.twig'), + 'array inheritance with non-existent first template' => array('array_inheritance_nonexistent_parent.html.twig'), + ); + } + + /** + * @dataProvider getArrayInheritanceTests + * + * @param $templateName string Template name with array inheritance + */ + public function testArrayInheritance($templateName) + { + $loader = new Twig_Loader_Filesystem(array()); + $loader->addPath(dirname(__FILE__).'/Fixtures/inheritance'); + + $twig = new Twig_Environment($loader); + + $template = $twig->loadTemplate($templateName); + $this->assertSame('VALID Child', $template->renderBlock('body', array())); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig new file mode 100644 index 00000000..6977ebf6 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig @@ -0,0 +1,3 @@ +{% extends ['','parent.html.twig'] %} + +{% block body %}{{ parent() }} Child{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig new file mode 100644 index 00000000..5b50a8b2 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig @@ -0,0 +1,3 @@ +{% extends ['nonexistent.html.twig','parent.html.twig'] %} + +{% block body %}{{ parent() }} Child{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig new file mode 100644 index 00000000..a16b3ade --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig @@ -0,0 +1,3 @@ +{% extends [null,'parent.html.twig'] %} + +{% block body %}{{ parent() }} Child{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig new file mode 100644 index 00000000..4940dad4 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig @@ -0,0 +1,3 @@ +{% extends ['parent.html.twig','spare_parent.html.twig'] %} + +{% block body %}{{ parent() }} Child{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig new file mode 100644 index 00000000..d594c0ed --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig @@ -0,0 +1 @@ +{% block body %}VALID{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig new file mode 100644 index 00000000..70b7360a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig @@ -0,0 +1 @@ +{% block body %}SPARE PARENT{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html new file mode 100644 index 00000000..9e5449c7 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html @@ -0,0 +1 @@ +named path diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html new file mode 100644 index 00000000..d3a272b1 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html @@ -0,0 +1 @@ +named path (bis) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html new file mode 100644 index 00000000..9f05d150 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html @@ -0,0 +1 @@ +named path (final) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html new file mode 100644 index 00000000..b1fb5f5d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html @@ -0,0 +1 @@ +named path (quater) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html new file mode 100644 index 00000000..24fb68ad --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html @@ -0,0 +1 @@ +named path (ter) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html new file mode 100644 index 00000000..e7a8fd4d --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html @@ -0,0 +1 @@ +path diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html new file mode 100644 index 00000000..bfa91604 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html @@ -0,0 +1 @@ +path (bis) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html new file mode 100644 index 00000000..73a089bb --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html @@ -0,0 +1 @@ +path (final) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html new file mode 100644 index 00000000..b7ad97d8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html @@ -0,0 +1 @@ +path (ter) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig new file mode 100644 index 00000000..dd0cbc2e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig @@ -0,0 +1,3 @@ +{% block b1 %}block from theme 1{% endblock %} + +{% block b2 %}block from theme 1{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig new file mode 100644 index 00000000..07cf9db0 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig @@ -0,0 +1,3 @@ +{% use '@default_theme/blocks.html.twig' %} + +{% block b2 %}block from theme 2{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php new file mode 100644 index 00000000..942aff9e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php @@ -0,0 +1,33 @@ +markTestSkipped('Skip under HHVM as the behavior is not the same as plain PHP (which is an edge case anyway)'); + } + + $twig = new Twig_Environment(new Twig_Loader_Array(array('index' => '{{ d1.date }}{{ d2.date }}')), array( + 'debug' => true, + 'cache' => false, + 'autoescape' => false, + )); + + $d1 = new DateTime(); + $d2 = new DateTime(); + $output = $twig->render('index', compact('d1', 'd2')); + + // If it fails, PHP will crash. + $this->assertEquals($output, $d1->date.$d2->date); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php new file mode 100644 index 00000000..25d16023 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php @@ -0,0 +1,32 @@ +assertEquals($body, $node->getNode('body')); + $this->assertTrue($node->getAttribute('value')); + } + + public function getTests() + { + $body = new Twig_Node(array(new Twig_Node_Text('foo', 1))); + $node = new Twig_Node_AutoEscape(true, $body, 1); + + return array( + array($node, "// line 1\necho \"foo\";"), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php new file mode 100644 index 00000000..84dac9bf --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php @@ -0,0 +1,31 @@ +assertEquals('foo', $node->getAttribute('name')); + } + + public function getTests() + { + return array( + array(new Twig_Node_BlockReference('foo', 1), <<displayBlock('foo', \$context, \$blocks); +EOF + ), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php new file mode 100644 index 00000000..e7246dcc --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php @@ -0,0 +1,39 @@ +assertEquals($body, $node->getNode('body')); + $this->assertEquals('foo', $node->getAttribute('name')); + } + + public function getTests() + { + $body = new Twig_Node_Text('foo', 1); + $node = new Twig_Node_Block('foo', $body, 1); + + return array( + array($node, <<assertEquals($expr, $node->getNode('expr')); + } + + public function getTests() + { + $tests = array(); + + $expr = new Twig_Node_Expression_Constant('foo', 1); + $node = new Twig_Node_Do($expr, 1); + $tests[] = array($node, "// line 1\n\"foo\";"); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php new file mode 100644 index 00000000..4f83ab17 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php @@ -0,0 +1,37 @@ +assertEquals($foo, $node->getNode(1)); + } + + public function getTests() + { + $elements = array( + new Twig_Node_Expression_Constant('foo', 1), + new Twig_Node_Expression_Constant('bar', 1), + + new Twig_Node_Expression_Constant('bar', 1), + new Twig_Node_Expression_Constant('foo', 1), + ); + $node = new Twig_Node_Expression_Array($elements, 1); + + return array( + array($node, 'array("foo" => "bar", "bar" => "foo")'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php new file mode 100644 index 00000000..bf365de4 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php @@ -0,0 +1,29 @@ +assertEquals('foo', $node->getAttribute('name')); + } + + public function getTests() + { + $node = new Twig_Node_Expression_AssignName('foo', 1); + + return array( + array($node, '$context["foo"]'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php new file mode 100644 index 00000000..02310a1b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php @@ -0,0 +1,34 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 1); + $right = new Twig_Node_Expression_Constant(2, 1); + $node = new Twig_Node_Expression_Binary_Add($left, $right, 1); + + return array( + array($node, '(1 + 2)'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php new file mode 100644 index 00000000..2df3c8e4 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php @@ -0,0 +1,34 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 1); + $right = new Twig_Node_Expression_Constant(2, 1); + $node = new Twig_Node_Expression_Binary_And($left, $right, 1); + + return array( + array($node, '(1 && 2)'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php new file mode 100644 index 00000000..759e4828 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php @@ -0,0 +1,34 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 1); + $right = new Twig_Node_Expression_Constant(2, 1); + $node = new Twig_Node_Expression_Binary_Concat($left, $right, 1); + + return array( + array($node, '(1 . 2)'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php new file mode 100644 index 00000000..0e54b10a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php @@ -0,0 +1,34 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 1); + $right = new Twig_Node_Expression_Constant(2, 1); + $node = new Twig_Node_Expression_Binary_Div($left, $right, 1); + + return array( + array($node, '(1 / 2)'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php new file mode 100644 index 00000000..602888fd --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php @@ -0,0 +1,34 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 1); + $right = new Twig_Node_Expression_Constant(2, 1); + $node = new Twig_Node_Expression_Binary_FloorDiv($left, $right, 1); + + return array( + array($node, 'intval(floor((1 / 2)))'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php new file mode 100644 index 00000000..4c663c78 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php @@ -0,0 +1,34 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 1); + $right = new Twig_Node_Expression_Constant(2, 1); + $node = new Twig_Node_Expression_Binary_Mod($left, $right, 1); + + return array( + array($node, '(1 % 2)'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php new file mode 100644 index 00000000..e92c95e6 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php @@ -0,0 +1,34 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 1); + $right = new Twig_Node_Expression_Constant(2, 1); + $node = new Twig_Node_Expression_Binary_Mul($left, $right, 1); + + return array( + array($node, '(1 * 2)'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php new file mode 100644 index 00000000..ec37c83e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php @@ -0,0 +1,34 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 1); + $right = new Twig_Node_Expression_Constant(2, 1); + $node = new Twig_Node_Expression_Binary_Or($left, $right, 1); + + return array( + array($node, '(1 || 2)'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php new file mode 100644 index 00000000..061cb270 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php @@ -0,0 +1,34 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 1); + $right = new Twig_Node_Expression_Constant(2, 1); + $node = new Twig_Node_Expression_Binary_Sub($left, $right, 1); + + return array( + array($node, '(1 - 2)'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php new file mode 100644 index 00000000..43afcd29 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php @@ -0,0 +1,116 @@ + 'function', 'name' => 'date')); + $this->assertEquals(array('U', null), $node->getArguments('date', array('format' => 'U', 'timestamp' => null))); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Positional arguments cannot be used after named arguments for function "date". + */ + public function testGetArgumentsWhenPositionalArgumentsAfterNamedArguments() + { + $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); + $node->getArguments('date', array('timestamp' => 123456, 'Y-m-d')); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Argument "format" is defined twice for function "date". + */ + public function testGetArgumentsWhenArgumentIsDefinedTwice() + { + $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); + $node->getArguments('date', array('Y-m-d', 'format' => 'U')); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unknown argument "unknown" for function "date(format, timestamp)". + */ + public function testGetArgumentsWithWrongNamedArgumentName() + { + $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); + $node->getArguments('date', array('Y-m-d', 'timestamp' => null, 'unknown' => '')); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unknown arguments "unknown1", "unknown2" for function "date(format, timestamp)". + */ + public function testGetArgumentsWithWrongNamedArgumentNames() + { + $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); + $node->getArguments('date', array('Y-m-d', 'timestamp' => null, 'unknown1' => '', 'unknown2' => '')); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Argument "case_sensitivity" could not be assigned for function "substr_compare(main_str, str, offset, length, case_sensitivity)" because it is mapped to an internal PHP function which cannot determine default value for optional argument "length". + */ + public function testResolveArgumentsWithMissingValueForOptionalArgument() + { + 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)'); + } + + $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'substr_compare')); + $node->getArguments('substr_compare', array('abcd', 'bc', 'offset' => 1, 'case_sensitivity' => true)); + } + + public function testResolveArgumentsOnlyNecessaryArgumentsForCustomFunction() + { + $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'custom_function')); + + $this->assertEquals(array('arg1'), $node->getArguments(array($this, 'customFunction'), array('arg1' => 'arg1'))); + } + + public function testGetArgumentsForStaticMethod() + { + $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'custom_static_function')); + $this->assertEquals(array('arg1'), $node->getArguments(__CLASS__.'::customStaticFunction', array('arg1' => 'arg1'))); + } + + /** + * @expectedException LogicException + * @expectedExceptionMessage The last parameter of "Twig_Tests_Node_Expression_CallTest::customFunctionWithArbitraryArguments" for function "foo" must be an array with default value, eg. "array $arg = array()". + */ + public function testResolveArgumentsWithMissingParameterForArbitraryArguments() + { + $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'foo', 'is_variadic' => true)); + $node->getArguments(array($this, 'customFunctionWithArbitraryArguments'), array()); + } + + public static function customStaticFunction($arg1, $arg2 = 'default', $arg3 = array()) + { + } + + public function customFunction($arg1, $arg2 = 'default', $arg3 = array()) + { + } + + public function customFunctionWithArbitraryArguments() + { + } +} + +class Twig_Tests_Node_Expression_Call extends Twig_Node_Expression_Call +{ + public function getArguments($callable, $arguments) + { + return parent::getArguments($callable, $arguments); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php new file mode 100644 index 00000000..a3e8badf --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php @@ -0,0 +1,38 @@ +assertEquals($expr1, $node->getNode('expr1')); + $this->assertEquals($expr2, $node->getNode('expr2')); + $this->assertEquals($expr3, $node->getNode('expr3')); + } + + public function getTests() + { + $tests = array(); + + $expr1 = new Twig_Node_Expression_Constant(1, 1); + $expr2 = new Twig_Node_Expression_Constant(2, 1); + $expr3 = new Twig_Node_Expression_Constant(3, 1); + $node = new Twig_Node_Expression_Conditional($expr1, $expr2, $expr3, 1); + $tests[] = array($node, '((1) ? (2) : (3))'); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php new file mode 100644 index 00000000..2ff93182 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php @@ -0,0 +1,30 @@ +assertEquals('foo', $node->getAttribute('value')); + } + + public function getTests() + { + $tests = array(); + + $node = new Twig_Node_Expression_Constant('foo', 1); + $tests[] = array($node, '"foo"'); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php new file mode 100644 index 00000000..d5ffb244 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php @@ -0,0 +1,154 @@ +assertEquals($expr, $node->getNode('node')); + $this->assertEquals($name, $node->getNode('filter')); + $this->assertEquals($args, $node->getNode('arguments')); + } + + public function getTests() + { + $environment = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $environment->addFilter(new Twig_SimpleFilter('bar', 'bar', array('needs_environment' => true))); + $environment->addFilter(new Twig_SimpleFilter('barbar', 'twig_tests_filter_barbar', array('needs_context' => true, 'is_variadic' => true))); + + $tests = array(); + + $expr = new Twig_Node_Expression_Constant('foo', 1); + $node = $this->createFilter($expr, 'upper'); + $node = $this->createFilter($node, 'number_format', array(new Twig_Node_Expression_Constant(2, 1), new Twig_Node_Expression_Constant('.', 1), new Twig_Node_Expression_Constant(',', 1))); + + if (function_exists('mb_get_info')) { + $tests[] = array($node, 'twig_number_format_filter($this->env, twig_upper_filter($this->env, "foo"), 2, ".", ",")'); + } else { + $tests[] = array($node, 'twig_number_format_filter($this->env, strtoupper("foo"), 2, ".", ",")'); + } + + // named arguments + $date = new Twig_Node_Expression_Constant(0, 1); + $node = $this->createFilter($date, 'date', array( + 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), + 'format' => new Twig_Node_Expression_Constant('d/m/Y H:i:s P', 1), + )); + $tests[] = array($node, 'twig_date_format_filter($this->env, 0, "d/m/Y H:i:s P", "America/Chicago")'); + + // skip an optional argument + $date = new Twig_Node_Expression_Constant(0, 1); + $node = $this->createFilter($date, 'date', array( + 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), + )); + $tests[] = array($node, 'twig_date_format_filter($this->env, 0, null, "America/Chicago")'); + + // underscores vs camelCase for named arguments + $string = new Twig_Node_Expression_Constant('abc', 1); + $node = $this->createFilter($string, 'reverse', array( + 'preserve_keys' => new Twig_Node_Expression_Constant(true, 1), + )); + $tests[] = array($node, 'twig_reverse_filter($this->env, "abc", true)'); + $node = $this->createFilter($string, 'reverse', array( + 'preserveKeys' => new Twig_Node_Expression_Constant(true, 1), + )); + $tests[] = array($node, 'twig_reverse_filter($this->env, "abc", true)'); + + // filter as an anonymous function + if (PHP_VERSION_ID >= 50300) { + $node = $this->createFilter(new Twig_Node_Expression_Constant('foo', 1), 'anonymous'); + $tests[] = array($node, 'call_user_func_array($this->env->getFilter(\'anonymous\')->getCallable(), array("foo"))'); + } + + // needs environment + $node = $this->createFilter($string, 'bar'); + $tests[] = array($node, 'bar($this->env, "abc")', $environment); + + $node = $this->createFilter($string, 'bar', array(new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'bar($this->env, "abc", "bar")', $environment); + + // arbitrary named arguments + $node = $this->createFilter($string, 'barbar'); + $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc")', $environment); + + $node = $this->createFilter($string, 'barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", null, null, array("foo" => "bar"))', $environment); + + $node = $this->createFilter($string, 'barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", null, "bar")', $environment); + + $node = $this->createFilter($string, 'barbar', array( + new Twig_Node_Expression_Constant('1', 1), + new Twig_Node_Expression_Constant('2', 1), + new Twig_Node_Expression_Constant('3', 1), + 'foo' => new Twig_Node_Expression_Constant('bar', 1), + )); + $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", "1", "2", array(0 => "3", "foo" => "bar"))', $environment); + + return $tests; + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unknown argument "foobar" for filter "date(format, timezone)" at line 1. + */ + public function testCompileWithWrongNamedArgumentName() + { + $date = new Twig_Node_Expression_Constant(0, 1); + $node = $this->createFilter($date, 'date', array( + 'foobar' => new Twig_Node_Expression_Constant('America/Chicago', 1), + )); + + $compiler = $this->getCompiler(); + $compiler->compile($node); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Value for argument "from" is required for filter "replace". + */ + public function testCompileWithMissingNamedArgument() + { + $value = new Twig_Node_Expression_Constant(0, 1); + $node = $this->createFilter($value, 'replace', array( + 'to' => new Twig_Node_Expression_Constant('foo', 1), + )); + + $compiler = $this->getCompiler(); + $compiler->compile($node); + } + + protected function createFilter($node, $name, array $arguments = array()) + { + $name = new Twig_Node_Expression_Constant($name, 1); + $arguments = new Twig_Node($arguments); + + return new Twig_Node_Expression_Filter($node, $name, $arguments, 1); + } + + protected function getEnvironment() + { + if (PHP_VERSION_ID >= 50300) { + return include 'PHP53/FilterInclude.php'; + } + + return parent::getEnvironment(); + } +} + +function twig_tests_filter_barbar($context, $string, $arg1 = null, $arg2 = null, array $args = array()) +{ +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php new file mode 100644 index 00000000..de2e0f8e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php @@ -0,0 +1,110 @@ +assertEquals($name, $node->getAttribute('name')); + $this->assertEquals($args, $node->getNode('arguments')); + } + + public function getTests() + { + $environment = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $environment->addFunction(new Twig_SimpleFunction('foo', 'foo', array())); + $environment->addFunction(new Twig_SimpleFunction('bar', 'bar', array('needs_environment' => true))); + $environment->addFunction(new Twig_SimpleFunction('foofoo', 'foofoo', array('needs_context' => true))); + $environment->addFunction(new Twig_SimpleFunction('foobar', 'foobar', array('needs_environment' => true, 'needs_context' => true))); + $environment->addFunction(new Twig_SimpleFunction('barbar', 'twig_tests_function_barbar', array('is_variadic' => true))); + + $tests = array(); + + $node = $this->createFunction('foo'); + $tests[] = array($node, 'foo()', $environment); + + $node = $this->createFunction('foo', array(new Twig_Node_Expression_Constant('bar', 1), new Twig_Node_Expression_Constant('foobar', 1))); + $tests[] = array($node, 'foo("bar", "foobar")', $environment); + + $node = $this->createFunction('bar'); + $tests[] = array($node, 'bar($this->env)', $environment); + + $node = $this->createFunction('bar', array(new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'bar($this->env, "bar")', $environment); + + $node = $this->createFunction('foofoo'); + $tests[] = array($node, 'foofoo($context)', $environment); + + $node = $this->createFunction('foofoo', array(new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'foofoo($context, "bar")', $environment); + + $node = $this->createFunction('foobar'); + $tests[] = array($node, 'foobar($this->env, $context)', $environment); + + $node = $this->createFunction('foobar', array(new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'foobar($this->env, $context, "bar")', $environment); + + // named arguments + $node = $this->createFunction('date', array( + 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), + 'date' => new Twig_Node_Expression_Constant(0, 1), + )); + $tests[] = array($node, 'twig_date_converter($this->env, 0, "America/Chicago")'); + + // arbitrary named arguments + $node = $this->createFunction('barbar'); + $tests[] = array($node, 'twig_tests_function_barbar()', $environment); + + $node = $this->createFunction('barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'twig_tests_function_barbar(null, null, array("foo" => "bar"))', $environment); + + $node = $this->createFunction('barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'twig_tests_function_barbar(null, "bar")', $environment); + + $node = $this->createFunction('barbar', array( + new Twig_Node_Expression_Constant('1', 1), + new Twig_Node_Expression_Constant('2', 1), + new Twig_Node_Expression_Constant('3', 1), + 'foo' => new Twig_Node_Expression_Constant('bar', 1), + )); + $tests[] = array($node, 'twig_tests_function_barbar("1", "2", array(0 => "3", "foo" => "bar"))', $environment); + + // function as an anonymous function + if (PHP_VERSION_ID >= 50300) { + $node = $this->createFunction('anonymous', array(new Twig_Node_Expression_Constant('foo', 1))); + $tests[] = array($node, 'call_user_func_array($this->env->getFunction(\'anonymous\')->getCallable(), array("foo"))'); + } + + return $tests; + } + + protected function createFunction($name, array $arguments = array()) + { + return new Twig_Node_Expression_Function($name, new Twig_Node($arguments), 1); + } + + protected function getEnvironment() + { + if (PHP_VERSION_ID >= 50300) { + return include 'PHP53/FunctionInclude.php'; + } + + return parent::getEnvironment(); + } +} + +function twig_tests_function_barbar($arg1 = null, $arg2 = null, array $args = array()) +{ +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php new file mode 100644 index 00000000..2764478c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php @@ -0,0 +1,50 @@ +addElement(new Twig_Node_Expression_Name('foo', 1)); + $args->addElement(new Twig_Node_Expression_Constant('bar', 1)); + $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ARRAY_CALL, 1); + + $this->assertEquals($expr, $node->getNode('node')); + $this->assertEquals($attr, $node->getNode('attribute')); + $this->assertEquals($args, $node->getNode('arguments')); + $this->assertEquals(Twig_Template::ARRAY_CALL, $node->getAttribute('type')); + } + + public function getTests() + { + $tests = array(); + + $expr = new Twig_Node_Expression_Name('foo', 1); + $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", array())', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))); + + $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', 1))); + + $args = new Twig_Node_Expression_Array(array(), 1); + $args->addElement(new Twig_Node_Expression_Name('foo', 1)); + $args->addElement(new Twig_Node_Expression_Constant('bar', 1)); + $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::METHOD_CALL, 1); + $tests[] = array($node, sprintf('%s%s, "bar", array(0 => %s, 1 => "bar"), "method")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1), $this->getVariableGetter('foo'))); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php new file mode 100644 index 00000000..8cbb2f76 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php @@ -0,0 +1,35 @@ +assertEquals('foo', $node->getAttribute('name')); + } + + public function getTests() + { + $node = new Twig_Node_Expression_Name('foo', 1); + $context = new Twig_Node_Expression_Name('_context', 1); + + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('strict_variables' => true)); + $env1 = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('strict_variables' => false)); + + return array( + array($node, "// line 1\n".(PHP_VERSION_ID >= 50400 ? '(isset($context["foo"]) ? $context["foo"] : $this->getContext($context, "foo"))' : '$this->getContext($context, "foo")'), $env), + array($node, $this->getVariableGetter('foo', 1), $env1), + array($context, "// line 1\n\$context"), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php new file mode 100644 index 00000000..b5394bcf --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php @@ -0,0 +1,6 @@ +addFilter(new Twig_SimpleFilter('anonymous', function () {})); + +return $env; diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php new file mode 100644 index 00000000..e8f68c72 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php @@ -0,0 +1,6 @@ +addFunction(new Twig_SimpleFunction('anonymous', function () {})); + +return $env; diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php new file mode 100644 index 00000000..9f818bc4 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php @@ -0,0 +1,6 @@ +addTest(new Twig_SimpleTest('anonymous', function () {})); + +return $env; diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php new file mode 100644 index 00000000..ab2bbe07 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php @@ -0,0 +1,28 @@ +assertEquals('foo', $node->getAttribute('name')); + } + + public function getTests() + { + $tests = array(); + $tests[] = array(new Twig_Node_Expression_Parent('foo', 1), '$this->renderParentBlock("foo", $context, $blocks)'); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php new file mode 100644 index 00000000..55d3fcbf --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php @@ -0,0 +1,82 @@ +assertEquals($expr, $node->getNode('node')); + $this->assertEquals($args, $node->getNode('arguments')); + $this->assertEquals($name, $node->getAttribute('name')); + } + + public function getTests() + { + $environment = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $environment->addTest(new Twig_SimpleTest('barbar', 'twig_tests_test_barbar', array('is_variadic' => true, 'need_context' => true))); + + $tests = array(); + + $expr = new Twig_Node_Expression_Constant('foo', 1); + $node = new Twig_Node_Expression_Test_Null($expr, 'null', new Twig_Node(array()), 1); + $tests[] = array($node, '(null === "foo")'); + + // test as an anonymous function + if (PHP_VERSION_ID >= 50300) { + $node = $this->createTest(new Twig_Node_Expression_Constant('foo', 1), 'anonymous', array(new Twig_Node_Expression_Constant('foo', 1))); + $tests[] = array($node, 'call_user_func_array($this->env->getTest(\'anonymous\')->getCallable(), array("foo", "foo"))'); + } + + // arbitrary named arguments + $string = new Twig_Node_Expression_Constant('abc', 1); + $node = $this->createTest($string, 'barbar'); + $tests[] = array($node, 'twig_tests_test_barbar("abc")', $environment); + + $node = $this->createTest($string, 'barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'twig_tests_test_barbar("abc", null, null, array("foo" => "bar"))', $environment); + + $node = $this->createTest($string, 'barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'twig_tests_test_barbar("abc", null, "bar")', $environment); + + $node = $this->createTest($string, 'barbar', array( + new Twig_Node_Expression_Constant('1', 1), + new Twig_Node_Expression_Constant('2', 1), + new Twig_Node_Expression_Constant('3', 1), + 'foo' => new Twig_Node_Expression_Constant('bar', 1), + )); + $tests[] = array($node, 'twig_tests_test_barbar("abc", "1", "2", array(0 => "3", "foo" => "bar"))', $environment); + + return $tests; + } + + protected function createTest($node, $name, array $arguments = array()) + { + return new Twig_Node_Expression_Test($node, $name, new Twig_Node($arguments), 1); + } + + protected function getEnvironment() + { + if (PHP_VERSION_ID >= 50300) { + return include 'PHP53/TestInclude.php'; + } + + return parent::getEnvironment(); + } +} + +function twig_tests_test_barbar($string, $arg1 = null, $arg2 = null, array $args = array()) +{ +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php new file mode 100644 index 00000000..b6333711 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php @@ -0,0 +1,32 @@ +assertEquals($expr, $node->getNode('node')); + } + + public function getTests() + { + $node = new Twig_Node_Expression_Constant(1, 1); + $node = new Twig_Node_Expression_Unary_Neg($node, 1); + + return array( + array($node, '-1'), + array(new Twig_Node_Expression_Unary_Neg($node, 1), '- -1'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php new file mode 100644 index 00000000..d7c6f85e --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php @@ -0,0 +1,31 @@ +assertEquals($expr, $node->getNode('node')); + } + + public function getTests() + { + $node = new Twig_Node_Expression_Constant(1, 1); + $node = new Twig_Node_Expression_Unary_Not($node, 1); + + return array( + array($node, '!1'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php new file mode 100644 index 00000000..057250f3 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php @@ -0,0 +1,31 @@ +assertEquals($expr, $node->getNode('node')); + } + + public function getTests() + { + $node = new Twig_Node_Expression_Constant(1, 1); + $node = new Twig_Node_Expression_Unary_Pos($node, 1); + + return array( + array($node, '+1'), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php new file mode 100644 index 00000000..b2c6fa42 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php @@ -0,0 +1,191 @@ +setAttribute('with_loop', false); + + $this->assertEquals($keyTarget, $node->getNode('key_target')); + $this->assertEquals($valueTarget, $node->getNode('value_target')); + $this->assertEquals($seq, $node->getNode('seq')); + $this->assertTrue($node->getAttribute('ifexpr')); + $this->assertEquals('Twig_Node_If', get_class($node->getNode('body'))); + $this->assertEquals($body, $node->getNode('body')->getNode('tests')->getNode(1)->getNode(0)); + $this->assertNull($node->getNode('else')); + + $else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1); + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node->setAttribute('with_loop', false); + $this->assertEquals($else, $node->getNode('else')); + } + + public function getTests() + { + $tests = array(); + + $keyTarget = new Twig_Node_Expression_AssignName('key', 1); + $valueTarget = new Twig_Node_Expression_AssignName('item', 1); + $seq = new Twig_Node_Expression_Name('items', 1); + $ifexpr = null; + $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); + $else = null; + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node->setAttribute('with_loop', false); + + $tests[] = array($node, <<getVariableGetter('items')}); +foreach (\$context['_seq'] as \$context["key"] => \$context["item"]) { + echo {$this->getVariableGetter('foo')}; +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['key'], \$context['item'], \$context['_parent'], \$context['loop']); +\$context = array_intersect_key(\$context, \$_parent) + \$_parent; +EOF + ); + + $keyTarget = new Twig_Node_Expression_AssignName('k', 1); + $valueTarget = new Twig_Node_Expression_AssignName('v', 1); + $seq = new Twig_Node_Expression_Name('values', 1); + $ifexpr = null; + $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); + $else = null; + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node->setAttribute('with_loop', true); + + $tests[] = array($node, <<getVariableGetter('values')}); +\$context['loop'] = array( + 'parent' => \$context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, +); +if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) { + \$length = count(\$context['_seq']); + \$context['loop']['revindex0'] = \$length - 1; + \$context['loop']['revindex'] = \$length; + \$context['loop']['length'] = \$length; + \$context['loop']['last'] = 1 === \$length; +} +foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { + echo {$this->getVariableGetter('foo')}; + ++\$context['loop']['index0']; + ++\$context['loop']['index']; + \$context['loop']['first'] = false; + if (isset(\$context['loop']['length'])) { + --\$context['loop']['revindex0']; + --\$context['loop']['revindex']; + \$context['loop']['last'] = 0 === \$context['loop']['revindex0']; + } +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); +\$context = array_intersect_key(\$context, \$_parent) + \$_parent; +EOF + ); + + $keyTarget = new Twig_Node_Expression_AssignName('k', 1); + $valueTarget = new Twig_Node_Expression_AssignName('v', 1); + $seq = new Twig_Node_Expression_Name('values', 1); + $ifexpr = new Twig_Node_Expression_Constant(true, 1); + $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); + $else = null; + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node->setAttribute('with_loop', true); + + $tests[] = array($node, <<getVariableGetter('values')}); +\$context['loop'] = array( + 'parent' => \$context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, +); +foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { + if (true) { + echo {$this->getVariableGetter('foo')}; + ++\$context['loop']['index0']; + ++\$context['loop']['index']; + \$context['loop']['first'] = false; + } +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); +\$context = array_intersect_key(\$context, \$_parent) + \$_parent; +EOF + ); + + $keyTarget = new Twig_Node_Expression_AssignName('k', 1); + $valueTarget = new Twig_Node_Expression_AssignName('v', 1); + $seq = new Twig_Node_Expression_Name('values', 1); + $ifexpr = null; + $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); + $else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1); + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node->setAttribute('with_loop', true); + + $tests[] = array($node, <<getVariableGetter('values')}); +\$context['_iterated'] = false; +\$context['loop'] = array( + 'parent' => \$context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, +); +if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) { + \$length = count(\$context['_seq']); + \$context['loop']['revindex0'] = \$length - 1; + \$context['loop']['revindex'] = \$length; + \$context['loop']['length'] = \$length; + \$context['loop']['last'] = 1 === \$length; +} +foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { + echo {$this->getVariableGetter('foo')}; + \$context['_iterated'] = true; + ++\$context['loop']['index0']; + ++\$context['loop']['index']; + \$context['loop']['first'] = false; + if (isset(\$context['loop']['length'])) { + --\$context['loop']['revindex0']; + --\$context['loop']['revindex']; + \$context['loop']['last'] = 0 === \$context['loop']['revindex0']; + } +} +if (!\$context['_iterated']) { + echo {$this->getVariableGetter('foo')}; +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); +\$context = array_intersect_key(\$context, \$_parent) + \$_parent; +EOF + ); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php new file mode 100644 index 00000000..e47dd654 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php @@ -0,0 +1,88 @@ +assertEquals($t, $node->getNode('tests')); + $this->assertNull($node->getNode('else')); + + $else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1); + $node = new Twig_Node_If($t, $else, 1); + $this->assertEquals($else, $node->getNode('else')); + } + + public function getTests() + { + $tests = array(); + + $t = new Twig_Node(array( + new Twig_Node_Expression_Constant(true, 1), + new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1), + ), array(), 1); + $else = null; + $node = new Twig_Node_If($t, $else, 1); + + $tests[] = array($node, <<getVariableGetter('foo')}; +} +EOF + ); + + $t = new Twig_Node(array( + new Twig_Node_Expression_Constant(true, 1), + new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1), + new Twig_Node_Expression_Constant(false, 1), + new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1), + ), array(), 1); + $else = null; + $node = new Twig_Node_If($t, $else, 1); + + $tests[] = array($node, <<getVariableGetter('foo')}; +} elseif (false) { + echo {$this->getVariableGetter('bar')}; +} +EOF + ); + + $t = new Twig_Node(array( + new Twig_Node_Expression_Constant(true, 1), + new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1), + ), array(), 1); + $else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1); + $node = new Twig_Node_If($t, $else, 1); + + $tests[] = array($node, <<getVariableGetter('foo')}; +} else { + echo {$this->getVariableGetter('bar')}; +} +EOF + ); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php new file mode 100644 index 00000000..36525b25 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php @@ -0,0 +1,40 @@ +assertEquals($macro, $node->getNode('expr')); + $this->assertEquals($var, $node->getNode('var')); + } + + public function getTests() + { + $tests = array(); + + $macro = new Twig_Node_Expression_Constant('foo.twig', 1); + $var = new Twig_Node_Expression_AssignName('macro', 1); + $node = new Twig_Node_Import($macro, $var, 1); + + $tests[] = array($node, <<loadTemplate("foo.twig", null, 1); +EOF + ); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php new file mode 100644 index 00000000..6fe5c17b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php @@ -0,0 +1,83 @@ +assertNull($node->getNode('variables')); + $this->assertEquals($expr, $node->getNode('expr')); + $this->assertFalse($node->getAttribute('only')); + + $vars = new Twig_Node_Expression_Array(array(new Twig_Node_Expression_Constant('foo', 1), new Twig_Node_Expression_Constant(true, 1)), 1); + $node = new Twig_Node_Include($expr, $vars, true, false, 1); + $this->assertEquals($vars, $node->getNode('variables')); + $this->assertTrue($node->getAttribute('only')); + } + + public function getTests() + { + $tests = array(); + + $expr = new Twig_Node_Expression_Constant('foo.twig', 1); + $node = new Twig_Node_Include($expr, null, false, false, 1); + $tests[] = array($node, <<loadTemplate("foo.twig", null, 1)->display(\$context); +EOF + ); + + $expr = new Twig_Node_Expression_Conditional( + new Twig_Node_Expression_Constant(true, 1), + new Twig_Node_Expression_Constant('foo', 1), + new Twig_Node_Expression_Constant('foo', 1), + 0 + ); + $node = new Twig_Node_Include($expr, null, false, false, 1); + $tests[] = array($node, <<loadTemplate(((true) ? ("foo") : ("foo")), null, 1)->display(\$context); +EOF + ); + + $expr = new Twig_Node_Expression_Constant('foo.twig', 1); + $vars = new Twig_Node_Expression_Array(array(new Twig_Node_Expression_Constant('foo', 1), new Twig_Node_Expression_Constant(true, 1)), 1); + $node = new Twig_Node_Include($expr, $vars, false, false, 1); + $tests[] = array($node, <<loadTemplate("foo.twig", null, 1)->display(array_merge(\$context, array("foo" => true))); +EOF + ); + + $node = new Twig_Node_Include($expr, $vars, true, false, 1); + $tests[] = array($node, <<loadTemplate("foo.twig", null, 1)->display(array("foo" => true)); +EOF + ); + + $node = new Twig_Node_Include($expr, $vars, true, true, 1); + $tests[] = array($node, <<loadTemplate("foo.twig", null, 1)->display(array("foo" => true)); +} catch (Twig_Error_Loader \$e) { + // ignore missing template +} +EOF + ); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php new file mode 100644 index 00000000..901e57b9 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php @@ -0,0 +1,70 @@ +assertEquals($body, $node->getNode('body')); + $this->assertEquals($arguments, $node->getNode('arguments')); + $this->assertEquals('foo', $node->getAttribute('name')); + } + + public function getTests() + { + $body = new Twig_Node_Text('foo', 1); + $arguments = new Twig_Node(array( + 'foo' => new Twig_Node_Expression_Constant(null, 1), + 'bar' => new Twig_Node_Expression_Constant('Foo', 1), + ), array(), 1); + $node = new Twig_Node_Macro('foo', $body, $arguments, 1); + + if (PHP_VERSION_ID >= 50600) { + $declaration = ', ...$__varargs__'; + $varargs = '$__varargs__'; + } else { + $declaration = ''; + $varargs = 'func_num_args() > 2 ? array_slice(func_get_args(), 2) : array()'; + } + + return array( + array($node, <<env->mergeGlobals(array( + "foo" => \$__foo__, + "bar" => \$__bar__, + "varargs" => $varargs, + )); + + \$blocks = array(); + + ob_start(); + try { + echo "foo"; + } catch (Exception \$e) { + ob_end_clean(); + + throw \$e; + } + + return ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset()); +} +EOF + ), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php new file mode 100644 index 00000000..35b3e2e8 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php @@ -0,0 +1,183 @@ +assertEquals($body, $node->getNode('body')); + $this->assertEquals($blocks, $node->getNode('blocks')); + $this->assertEquals($macros, $node->getNode('macros')); + $this->assertEquals($parent, $node->getNode('parent')); + $this->assertEquals($filename, $node->getAttribute('filename')); + } + + public function getTests() + { + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + + $tests = array(); + + $body = new Twig_Node_Text('foo', 1); + $extends = null; + $blocks = new Twig_Node(); + $macros = new Twig_Node(); + $traits = new Twig_Node(); + $filename = 'foo.twig'; + + $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $tests[] = array($node, <<parent = false; + + \$this->blocks = array( + ); + } + + protected function doDisplay(array \$context, array \$blocks = array()) + { + // line 1 + echo "foo"; + } + + public function getTemplateName() + { + return "foo.twig"; + } + + public function getDebugInfo() + { + return array ( 19 => 1,); + } +} +EOF + , $twig, true); + + $import = new Twig_Node_Import(new Twig_Node_Expression_Constant('foo.twig', 1), new Twig_Node_Expression_AssignName('macro', 1), 2); + + $body = new Twig_Node(array($import)); + $extends = new Twig_Node_Expression_Constant('layout.twig', 1); + + $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $tests[] = array($node, <<parent = \$this->loadTemplate("layout.twig", "foo.twig", 1); + \$this->blocks = array( + ); + } + + protected function doGetParent(array \$context) + { + return "layout.twig"; + } + + protected function doDisplay(array \$context, array \$blocks = array()) + { + // line 2 + \$context["macro"] = \$this->loadTemplate("foo.twig", "foo.twig", 2); + // line 1 + \$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks)); + } + + public function getTemplateName() + { + return "foo.twig"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 26 => 1, 24 => 2, 11 => 1,); + } +} +EOF + , $twig, true); + + $set = new Twig_Node_Set(false, new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 4))), new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 4))), 4); + $body = new Twig_Node(array($set)); + $extends = new Twig_Node_Expression_Conditional( + new Twig_Node_Expression_Constant(true, 2), + new Twig_Node_Expression_Constant('foo', 2), + new Twig_Node_Expression_Constant('foo', 2), + 2 + ); + + $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $tests[] = array($node, <<loadTemplate(((true) ? ("foo") : ("foo")), "foo.twig", 2); + } + + protected function doDisplay(array \$context, array \$blocks = array()) + { + // line 4 + \$context["foo"] = "foo"; + // line 2 + \$this->getParent(\$context)->display(\$context, array_merge(\$this->blocks, \$blocks)); + } + + public function getTemplateName() + { + return "foo.twig"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 17 => 2, 15 => 4, 9 => 2,); + } +} +EOF + , $twig, true); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php new file mode 100644 index 00000000..4e0990fa --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php @@ -0,0 +1,29 @@ +assertEquals($expr, $node->getNode('expr')); + } + + public function getTests() + { + $tests = array(); + $tests[] = array(new Twig_Node_Print(new Twig_Node_Expression_Constant('foo', 1), 1), "// line 1\necho \"foo\";"); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php new file mode 100644 index 00000000..46ecf973 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php @@ -0,0 +1,44 @@ +assertEquals($body, $node->getNode('body')); + } + + public function getTests() + { + $tests = array(); + + $body = new Twig_Node_Text('foo', 1); + $node = new Twig_Node_Sandbox($body, 1); + + $tests[] = array($node, <<env->getExtension('sandbox'); +if (!\$alreadySandboxed = \$sandbox->isSandboxed()) { + \$sandbox->enableSandbox(); +} +echo "foo"; +if (!\$alreadySandboxed) { + \$sandbox->disableSandbox(); +} +EOF + ); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php new file mode 100644 index 00000000..05e1854c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php @@ -0,0 +1,33 @@ +assertEquals($expr, $node->getNode('expr')); + } + + public function getTests() + { + $tests = array(); + + $tests[] = array(new Twig_Node_SandboxedPrint(new Twig_Node_Expression_Constant('foo', 1), 1), <<env->getExtension('sandbox')->ensureToStringAllowed("foo"); +EOF + ); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php new file mode 100644 index 00000000..62ad2803 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php @@ -0,0 +1,69 @@ +assertEquals($names, $node->getNode('names')); + $this->assertEquals($values, $node->getNode('values')); + $this->assertFalse($node->getAttribute('capture')); + } + + public function getTests() + { + $tests = array(); + + $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1); + $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 1)), array(), 1); + $node = new Twig_Node_Set(false, $names, $values, 1); + $tests[] = array($node, <<env->getCharset()); +EOF + ); + + $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1); + $values = new Twig_Node_Text('foo', 1); + $node = new Twig_Node_Set(true, $names, $values, 1); + $tests[] = array($node, <<env->getCharset()); +EOF + ); + + $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1), new Twig_Node_Expression_AssignName('bar', 1)), array(), 1); + $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 1), new Twig_Node_Expression_Name('bar', 1)), array(), 1); + $node = new Twig_Node_Set(false, $names, $values, 1); + $tests[] = array($node, <<getVariableGetter('bar')}); +EOF + ); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php new file mode 100644 index 00000000..222ca092 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php @@ -0,0 +1,37 @@ +
    foo
    ', 1))); + $node = new Twig_Node_Spaceless($body, 1); + + $this->assertEquals($body, $node->getNode('body')); + } + + public function getTests() + { + $body = new Twig_Node(array(new Twig_Node_Text('
    foo
    ', 1))); + $node = new Twig_Node_Spaceless($body, 1); + + return array( + array($node, <<
    foo
    "; +echo trim(preg_replace('/>\s+<', ob_get_clean())); +EOF + ), + ); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php new file mode 100644 index 00000000..ceaf67f4 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php @@ -0,0 +1,28 @@ +assertEquals('foo', $node->getAttribute('data')); + } + + public function getTests() + { + $tests = array(); + $tests[] = array(new Twig_Node_Text('foo', 1), "// line 1\necho \"foo\";"); + + return $tests; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php new file mode 100644 index 00000000..b5ea7aac --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php @@ -0,0 +1,124 @@ +getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + + $stream = $env->parse($env->tokenize('{{ block("foo") }}', 'index')); + + $node = $stream->getNode('body')->getNode(0); + + $this->assertEquals('Twig_Node_Expression_BlockReference', get_class($node)); + $this->assertTrue($node->getAttribute('output')); + } + + public function testRenderParentBlockOptimizer() + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + + $stream = $env->parse($env->tokenize('{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}', 'index')); + + $node = $stream->getNode('blocks')->getNode('content')->getNode(0)->getNode('body'); + + $this->assertEquals('Twig_Node_Expression_Parent', get_class($node)); + $this->assertTrue($node->getAttribute('output')); + } + + public function testRenderVariableBlockOptimizer() + { + if (PHP_VERSION_ID >= 50400) { + return; + } + + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); + $stream = $env->parse($env->tokenize('{{ block(name|lower) }}', 'index')); + + $node = $stream->getNode('body')->getNode(0)->getNode(1); + + $this->assertEquals('Twig_Node_Expression_BlockReference', get_class($node)); + $this->assertTrue($node->getAttribute('output')); + } + + /** + * @dataProvider getTestsForForOptimizer + */ + public function testForOptimizer($template, $expected) + { + $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false)); + + $stream = $env->parse($env->tokenize($template, 'index')); + + foreach ($expected as $target => $withLoop) { + $this->assertTrue($this->checkForConfiguration($stream, $target, $withLoop), sprintf('variable %s is %soptimized', $target, $withLoop ? 'not ' : '')); + } + } + + public function getTestsForForOptimizer() + { + return array( + array('{% for i in foo %}{% endfor %}', array('i' => false)), + + array('{% for i in foo %}{{ loop.index }}{% endfor %}', array('i' => true)), + + array('{% for i in foo %}{% for j in foo %}{% endfor %}{% endfor %}', array('i' => false, 'j' => false)), + + array('{% for i in foo %}{% include "foo" %}{% endfor %}', array('i' => true)), + + array('{% for i in foo %}{% include "foo" only %}{% endfor %}', array('i' => false)), + + array('{% for i in foo %}{% include "foo" with { "foo": "bar" } only %}{% endfor %}', array('i' => false)), + + array('{% for i in foo %}{% include "foo" with { "foo": loop.index } only %}{% endfor %}', array('i' => true)), + + array('{% for i in foo %}{% for j in foo %}{{ loop.index }}{% endfor %}{% endfor %}', array('i' => false, 'j' => true)), + + array('{% for i in foo %}{% for j in foo %}{{ loop.parent.loop.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => true)), + + array('{% for i in foo %}{% set l = loop %}{% for j in foo %}{{ l.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => false)), + + array('{% for i in foo %}{% for j in foo %}{{ foo.parent.loop.index }}{% endfor %}{% endfor %}', array('i' => false, 'j' => false)), + + array('{% for i in foo %}{% for j in foo %}{{ loop["parent"].loop.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => true)), + + array('{% for i in foo %}{{ include("foo") }}{% endfor %}', array('i' => true)), + + array('{% for i in foo %}{{ include("foo", with_context = false) }}{% endfor %}', array('i' => false)), + + array('{% for i in foo %}{{ include("foo", with_context = true) }}{% endfor %}', array('i' => true)), + + array('{% for i in foo %}{{ include("foo", { "foo": "bar" }, with_context = false) }}{% endfor %}', array('i' => false)), + + array('{% for i in foo %}{{ include("foo", { "foo": loop.index }, with_context = false) }}{% endfor %}', array('i' => true)), + ); + } + + public function checkForConfiguration(Twig_NodeInterface $node = null, $target, $withLoop) + { + if (null === $node) { + return; + } + + foreach ($node as $n) { + if ($n instanceof Twig_Node_For) { + if ($target === $n->getNode('value_target')->getAttribute('name')) { + return $withLoop == $n->getAttribute('with_loop'); + } + } + + $ret = $this->checkForConfiguration($n, $target, $withLoop); + if (null !== $ret) { + return $ret; + } + } + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/ParserTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/ParserTest.php new file mode 100644 index 00000000..01daf309 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/ParserTest.php @@ -0,0 +1,196 @@ +getParser(); + $parser->setMacro('parent', $this->getMock('Twig_Node_Macro', array(), array(), '', null)); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unknown "foo" tag. Did you mean "for" at line 1? + */ + public function testUnknownTag() + { + $stream = new Twig_TokenStream(array( + new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), + new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 1), + new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), + new Twig_Token(Twig_Token::EOF_TYPE, '', 1), + )); + $parser = new Twig_Parser(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $parser->parse($stream); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unknown "foobar" tag at line 1. + */ + public function testUnknownTagWithoutSuggestions() + { + $stream = new Twig_TokenStream(array( + new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), + new Twig_Token(Twig_Token::NAME_TYPE, 'foobar', 1), + new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), + new Twig_Token(Twig_Token::EOF_TYPE, '', 1), + )); + $parser = new Twig_Parser(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); + $parser->parse($stream); + } + + /** + * @dataProvider getFilterBodyNodesData + */ + public function testFilterBodyNodes($input, $expected) + { + $parser = $this->getParser(); + + $this->assertEquals($expected, $parser->filterBodyNodes($input)); + } + + public function getFilterBodyNodesData() + { + return array( + array( + new Twig_Node(array(new Twig_Node_Text(' ', 1))), + new Twig_Node(array()), + ), + array( + $input = new Twig_Node(array(new Twig_Node_Set(false, new Twig_Node(), new Twig_Node(), 1))), + $input, + ), + array( + $input = new Twig_Node(array(new Twig_Node_Set(true, new Twig_Node(), new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 1))))), 1))), + $input, + ), + ); + } + + /** + * @dataProvider getFilterBodyNodesDataThrowsException + * @expectedException Twig_Error_Syntax + */ + public function testFilterBodyNodesThrowsException($input) + { + $parser = $this->getParser(); + + $parser->filterBodyNodes($input); + } + + public function getFilterBodyNodesDataThrowsException() + { + return array( + array(new Twig_Node_Text('foo', 1)), + array(new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 1)))))), + ); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage A template that extends another one cannot have a body but a byte order mark (BOM) has been detected; it must be removed at line 1. + */ + public function testFilterBodyNodesWithBOM() + { + $parser = $this->getParser(); + $parser->filterBodyNodes(new Twig_Node_Text(chr(0xEF).chr(0xBB).chr(0xBF), 1)); + } + + public function testParseIsReentrant() + { + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array( + 'autoescape' => false, + 'optimizations' => 0, + )); + $twig->addTokenParser(new TestTokenParser()); + + $parser = new Twig_Parser($twig); + + $parser->parse(new Twig_TokenStream(array( + new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), + new Twig_Token(Twig_Token::NAME_TYPE, 'test', 1), + new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), + new Twig_Token(Twig_Token::VAR_START_TYPE, '', 1), + new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 1), + new Twig_Token(Twig_Token::VAR_END_TYPE, '', 1), + new Twig_Token(Twig_Token::EOF_TYPE, '', 1), + ))); + + $this->assertNull($parser->getParent()); + } + + // The getVarName() must not depend on the template loaders, + // If this test does not throw any exception, that's good. + // see https://github.com/symfony/symfony/issues/4218 + public function testGetVarName() + { + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array( + 'autoescape' => false, + 'optimizations' => 0, + )); + + $twig->parse($twig->tokenize(<<getMock('Twig_LoaderInterface'))); + $parser->setParent(new Twig_Node()); + $parser->stream = $this->getMockBuilder('Twig_TokenStream')->disableOriginalConstructor()->getMock(); + + return $parser; + } +} + +class TestParser extends Twig_Parser +{ + public $stream; + + public function filterBodyNodes(Twig_NodeInterface $node) + { + return parent::filterBodyNodes($node); + } +} + +class TestTokenParser extends Twig_TokenParser +{ + public function parse(Twig_Token $token) + { + // simulate the parsing of another template right in the middle of the parsing of the current template + $this->parser->parse(new Twig_TokenStream(array( + new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), + new Twig_Token(Twig_Token::NAME_TYPE, 'extends', 1), + new Twig_Token(Twig_Token::STRING_TYPE, 'base', 1), + new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), + new Twig_Token(Twig_Token::EOF_TYPE, '', 1), + ))); + + $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + + return new Twig_Node(array()); + } + + public function getTag() + { + return 'test'; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php new file mode 100644 index 00000000..da97f478 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php @@ -0,0 +1,101 @@ +getMockBuilder('Twig_Profiler_Profile')->disableOriginalConstructor()->getMock(); + + $profile->expects($this->any())->method('isRoot')->will($this->returnValue(true)); + $profile->expects($this->any())->method('getName')->will($this->returnValue('main')); + $profile->expects($this->any())->method('getDuration')->will($this->returnValue(1)); + $profile->expects($this->any())->method('getMemoryUsage')->will($this->returnValue(0)); + $profile->expects($this->any())->method('getPeakMemoryUsage')->will($this->returnValue(0)); + + $subProfiles = array( + $this->getIndexProfile( + array( + $this->getEmbeddedBlockProfile(), + $this->getEmbeddedTemplateProfile( + array( + $this->getIncludedTemplateProfile(), + ) + ), + $this->getMacroProfile(), + $this->getEmbeddedTemplateProfile( + array( + $this->getIncludedTemplateProfile(), + ) + ), + ) + ), + ); + + $profile->expects($this->any())->method('getProfiles')->will($this->returnValue($subProfiles)); + $profile->expects($this->any())->method('getIterator')->will($this->returnValue(new ArrayIterator($subProfiles))); + + return $profile; + } + + private function getIndexProfile(array $subProfiles = array()) + { + return $this->generateProfile('main', 1, true, 'template', 'index.twig', $subProfiles); + } + + private function getEmbeddedBlockProfile(array $subProfiles = array()) + { + return $this->generateProfile('body', 0.0001, false, 'block', 'embedded.twig', $subProfiles); + } + + private function getEmbeddedTemplateProfile(array $subProfiles = array()) + { + return $this->generateProfile('main', 0.0001, true, 'template', 'embedded.twig', $subProfiles); + } + + private function getIncludedTemplateProfile(array $subProfiles = array()) + { + return $this->generateProfile('main', 0.0001, true, 'template', 'included.twig', $subProfiles); + } + + private function getMacroProfile(array $subProfiles = array()) + { + return $this->generateProfile('foo', 0.0001, false, 'macro', 'index.twig', $subProfiles); + } + + /** + * @param string $name + * @param float $duration + * @param bool $isTemplate + * @param string $type + * @param string $templateName + * @param array $subProfiles + * + * @return Twig_Profiler_Profile + */ + private function generateProfile($name, $duration, $isTemplate, $type, $templateName, array $subProfiles = array()) + { + $profile = $this->getMockBuilder('Twig_Profiler_Profile')->disableOriginalConstructor()->getMock(); + + $profile->expects($this->any())->method('isRoot')->will($this->returnValue(false)); + $profile->expects($this->any())->method('getName')->will($this->returnValue($name)); + $profile->expects($this->any())->method('getDuration')->will($this->returnValue($duration)); + $profile->expects($this->any())->method('getMemoryUsage')->will($this->returnValue(0)); + $profile->expects($this->any())->method('getPeakMemoryUsage')->will($this->returnValue(0)); + $profile->expects($this->any())->method('isTemplate')->will($this->returnValue($isTemplate)); + $profile->expects($this->any())->method('getType')->will($this->returnValue($type)); + $profile->expects($this->any())->method('getTemplate')->will($this->returnValue($templateName)); + $profile->expects($this->any())->method('getProfiles')->will($this->returnValue($subProfiles)); + $profile->expects($this->any())->method('getIterator')->will($this->returnValue(new ArrayIterator($subProfiles))); + + return $profile; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php new file mode 100644 index 00000000..1a1b9d29 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php @@ -0,0 +1,32 @@ +assertStringMatchesFormat(<<index.twig//1 %d %d %d +index.twig==>embedded.twig::block(body)//1 %d %d 0 +index.twig==>embedded.twig//2 %d %d %d +embedded.twig==>included.twig//2 %d %d %d +index.twig==>index.twig::macro(foo)//1 %d %d %d +EOF + , $dumper->dump($this->getProfile())); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php new file mode 100644 index 00000000..66a68c4b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php @@ -0,0 +1,30 @@ +assertStringMatchesFormat(<<main %d.%dms/%d% +└ index.twig %d.%dms/%d% + └ embedded.twig::block(body) + └ embedded.twig + │ └ included.twig + └ index.twig::macro(foo) + └ embedded.twig + └ included.twig + +EOF + , $dumper->dump($this->getProfile())); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php new file mode 100644 index 00000000..e2ea165a --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php @@ -0,0 +1,30 @@ +assertStringMatchesFormat(<<dump($this->getProfile())); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php new file mode 100644 index 00000000..f786f06c --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php @@ -0,0 +1,100 @@ +assertEquals('template', $profile->getTemplate()); + $this->assertEquals('type', $profile->getType()); + $this->assertEquals('name', $profile->getName()); + } + + public function testIsRoot() + { + $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); + $this->assertTrue($profile->isRoot()); + + $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::TEMPLATE); + $this->assertFalse($profile->isRoot()); + } + + public function testIsTemplate() + { + $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::TEMPLATE); + $this->assertTrue($profile->isTemplate()); + + $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); + $this->assertFalse($profile->isTemplate()); + } + + public function testIsBlock() + { + $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::BLOCK); + $this->assertTrue($profile->isBlock()); + + $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); + $this->assertFalse($profile->isBlock()); + } + + public function testIsMacro() + { + $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::MACRO); + $this->assertTrue($profile->isMacro()); + + $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); + $this->assertFalse($profile->isMacro()); + } + + public function testGetAddProfile() + { + $profile = new Twig_Profiler_Profile(); + $profile->addProfile($a = new Twig_Profiler_Profile()); + $profile->addProfile($b = new Twig_Profiler_Profile()); + + $this->assertSame(array($a, $b), $profile->getProfiles()); + $this->assertSame(array($a, $b), iterator_to_array($profile)); + } + + public function testGetDuration() + { + $profile = new Twig_Profiler_Profile(); + usleep(1); + $profile->leave(); + + $this->assertTrue($profile->getDuration() > 0, sprintf('Expected duration > 0, got: %f', $profile->getDuration())); + } + + public function testSerialize() + { + $profile = new Twig_Profiler_Profile('template', 'type', 'name'); + $profile1 = new Twig_Profiler_Profile('template1', 'type1', 'name1'); + $profile->addProfile($profile1); + $profile->leave(); + $profile1->leave(); + + $profile2 = unserialize(serialize($profile)); + $profiles = $profile->getProfiles(); + $this->assertCount(1, $profiles); + $profile3 = $profiles[0]; + + $this->assertEquals($profile->getTemplate(), $profile2->getTemplate()); + $this->assertEquals($profile->getType(), $profile2->getType()); + $this->assertEquals($profile->getName(), $profile2->getName()); + $this->assertEquals($profile->getDuration(), $profile2->getDuration()); + + $this->assertEquals($profile1->getTemplate(), $profile3->getTemplate()); + $this->assertEquals($profile1->getType(), $profile3->getType()); + $this->assertEquals($profile1->getName(), $profile3->getName()); + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/TemplateTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/TemplateTest.php new file mode 100644 index 00000000..f0146649 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/TemplateTest.php @@ -0,0 +1,693 @@ +getMockForAbstractClass('Twig_Template', array(), '', false); + $template->displayBlock('foo', array(), array('foo' => array(new stdClass(), 'foo'))); + } + + /** + * @dataProvider getAttributeExceptions + */ + public function testGetAttributeExceptions($template, $message, $useExt) + { + $name = 'index_'.($useExt ? 1 : 0); + $templates = array( + $name => $template.$useExt, // appending $useExt makes the template content unique + ); + + $env = new Twig_Environment(new Twig_Loader_Array($templates), array('strict_variables' => true)); + if (!$useExt) { + $env->addNodeVisitor(new CExtDisablingNodeVisitor()); + } + $template = $env->loadTemplate($name); + + $context = array( + 'string' => 'foo', + 'null' => null, + 'empty_array' => array(), + 'array' => array('foo' => 'foo'), + 'array_access' => new Twig_TemplateArrayAccessObject(), + 'magic_exception' => new Twig_TemplateMagicPropertyObjectWithException(), + 'object' => new stdClass(), + ); + + try { + $template->render($context); + $this->fail('Accessing an invalid attribute should throw an exception.'); + } catch (Twig_Error_Runtime $e) { + $this->assertSame(sprintf($message, $name), $e->getMessage()); + } + } + + 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 }}', 'Method "a" for object "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1', false), + array('{% from _self import foo %}{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ foo(array_access) }}', 'Method "missing_method" for object "Twig_TemplateArrayAccessObject" does not exist 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), + ); + + if (function_exists('twig_template_get_attributes')) { + foreach (array_slice($tests, 0) as $test) { + $test[2] = true; + $tests[] = $test; + } + } + + return $tests; + } + + public function testGetSource() + { + $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), false); + + $this->assertSame("\n", $template->getSource()); + } + + /** + * @dataProvider getGetAttributeWithSandbox + */ + public function testGetAttributeWithSandbox($object, $item, $allowed, $useExt) + { + $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + $policy = new Twig_Sandbox_SecurityPolicy(array(), array(), array(/*method*/), array(/*prop*/), array()); + $twig->addExtension(new Twig_Extension_Sandbox($policy, !$allowed)); + $template = new Twig_TemplateTest($twig, $useExt); + + try { + $template->getAttribute($object, $item, array(), 'any'); + + if (!$allowed) { + $this->fail(); + } + } catch (Twig_Sandbox_SecurityError $e) { + if ($allowed) { + $this->fail(); + } + + $this->assertContains('is not allowed', $e->getMessage()); + } + } + + public function getGetAttributeWithSandbox() + { + $tests = array( + array(new Twig_TemplatePropertyObject(), 'defined', false, false), + array(new Twig_TemplatePropertyObject(), 'defined', true, false), + array(new Twig_TemplateMethodObject(), 'defined', false, false), + array(new Twig_TemplateMethodObject(), 'defined', true, false), + ); + + if (function_exists('twig_template_get_attributes')) { + foreach (array_slice($tests, 0) as $test) { + $test[3] = true; + $tests[] = $test; + } + } + + return $tests; + } + + /** + * @dataProvider getGetAttributeWithTemplateAsObject + */ + public function testGetAttributeWithTemplateAsObject($useExt) + { + $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), $useExt); + $template1 = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), false); + + $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string')); + $this->assertEquals('some_string', $template->getAttribute($template1, 'string')); + + $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'true')); + $this->assertEquals('1', $template->getAttribute($template1, 'true')); + + $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'zero')); + $this->assertEquals('0', $template->getAttribute($template1, 'zero')); + + $this->assertNotInstanceof('Twig_Markup', $template->getAttribute($template1, 'empty')); + $this->assertSame('', $template->getAttribute($template1, 'empty')); + + $this->assertFalse($template->getAttribute($template1, 'env', array(), Twig_Template::ANY_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'environment', array(), Twig_Template::ANY_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'getEnvironment', array(), Twig_Template::METHOD_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', array(), Twig_Template::METHOD_CALL, true)); + } + + public function getGetAttributeWithTemplateAsObject() + { + $bools = array( + array(false), + ); + + if (function_exists('twig_template_get_attributes')) { + $bools[] = array(true); + } + + return $bools; + } + + /** + * @dataProvider getTestsDependingOnExtensionAvailability + */ + public function testGetAttributeOnArrayWithConfusableKey($useExt = false) + { + $template = new Twig_TemplateTest( + new Twig_Environment($this->getMock('Twig_LoaderInterface')), + $useExt + ); + + $array = array('Zero', 'One', -1 => 'MinusOne', '' => 'EmptyString', '1.5' => 'FloatButString', '01' => 'IntegerButStringWithLeadingZeros'); + + $this->assertSame('Zero', $array[false]); + $this->assertSame('One', $array[true]); + $this->assertSame('One', $array[1.5]); + $this->assertSame('One', $array['1']); + $this->assertSame('MinusOne', $array[-1.5]); + $this->assertSame('FloatButString', $array['1.5']); + $this->assertSame('IntegerButStringWithLeadingZeros', $array['01']); + $this->assertSame('EmptyString', $array[null]); + + $this->assertSame('Zero', $template->getAttribute($array, false), 'false is treated as 0 when accessing an array (equals PHP behavior)'); + $this->assertSame('One', $template->getAttribute($array, true), 'true is treated as 1 when accessing an array (equals PHP behavior)'); + $this->assertSame('One', $template->getAttribute($array, 1.5), 'float is casted to int when accessing an array (equals PHP behavior)'); + $this->assertSame('One', $template->getAttribute($array, '1'), '"1" is treated as integer 1 when accessing an array (equals PHP behavior)'); + $this->assertSame('MinusOne', $template->getAttribute($array, -1.5), 'negative float is casted to int when accessing an array (equals PHP behavior)'); + $this->assertSame('FloatButString', $template->getAttribute($array, '1.5'), '"1.5" is treated as-is when accessing an array (equals PHP behavior)'); + $this->assertSame('IntegerButStringWithLeadingZeros', $template->getAttribute($array, '01'), '"01" is treated as-is when accessing an array (equals PHP behavior)'); + $this->assertSame('EmptyString', $template->getAttribute($array, null), 'null is treated as "" when accessing an array (equals PHP behavior)'); + } + + public function getTestsDependingOnExtensionAvailability() + { + if (function_exists('twig_template_get_attributes')) { + return array(array(false), array(true)); + } + + return array(array(false)); + } + + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttribute($defined, $value, $object, $item, $arguments, $type, $useExt = false) + { + $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), $useExt); + + $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); + } + + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttributeStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false, $exceptionMessage = null) + { + $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('strict_variables' => true)), $useExt); + + if ($defined) { + $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); + } else { + try { + $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); + + throw new Exception('Expected Twig_Error_Runtime exception.'); + } catch (Twig_Error_Runtime $e) { + if (null !== $exceptionMessage) { + $this->assertSame($exceptionMessage, $e->getMessage()); + } + } + } + } + + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttributeDefined($defined, $value, $object, $item, $arguments, $type, $useExt = false) + { + $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), $useExt); + + $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true)); + } + + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttributeDefinedStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false) + { + $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('strict_variables' => true)), $useExt); + + $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true)); + } + + /** + * @dataProvider getTestsDependingOnExtensionAvailability + */ + public function testGetAttributeCallExceptions($useExt = false) + { + $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), $useExt); + + $object = new Twig_TemplateMagicMethodExceptionObject(); + + $this->assertNull($template->getAttribute($object, 'foo')); + } + + public function getGetAttributeTests() + { + $array = array( + 'defined' => 'defined', + 'zero' => 0, + 'null' => null, + '1' => 1, + 'bar' => true, + '09' => '09', + '+4' => '+4', + ); + + $objectArray = new Twig_TemplateArrayAccessObject(); + $stdObject = (object) $array; + $magicPropertyObject = new Twig_TemplateMagicPropertyObject(); + $propertyObject = new Twig_TemplatePropertyObject(); + $propertyObject1 = new Twig_TemplatePropertyObjectAndIterator(); + $propertyObject2 = new Twig_TemplatePropertyObjectAndArrayAccess(); + $propertyObject3 = new Twig_TemplatePropertyObjectDefinedWithUndefinedValue(); + $methodObject = new Twig_TemplateMethodObject(); + $magicMethodObject = new Twig_TemplateMagicMethodObject(); + + $anyType = Twig_Template::ANY_CALL; + $methodType = Twig_Template::METHOD_CALL; + $arrayType = Twig_Template::ARRAY_CALL; + + $basicTests = array( + // array(defined, value, property to fetch) + array(true, 'defined', 'defined'), + array(false, null, 'undefined'), + array(false, null, 'protected'), + array(true, 0, 'zero'), + array(true, 1, 1), + array(true, 1, 1.0), + array(true, null, 'null'), + array(true, true, 'bar'), + array(true, '09', '09'), + array(true, '+4', '+4'), + ); + $testObjects = array( + // array(object, type of fetch) + array($array, $arrayType), + array($objectArray, $arrayType), + array($stdObject, $anyType), + array($magicPropertyObject, $anyType), + array($methodObject, $methodType), + array($methodObject, $anyType), + array($propertyObject, $anyType), + array($propertyObject1, $anyType), + array($propertyObject2, $anyType), + ); + + $tests = array(); + foreach ($testObjects as $testObject) { + foreach ($basicTests as $test) { + // properties cannot be numbers + if (($testObject[0] instanceof stdClass || $testObject[0] instanceof Twig_TemplatePropertyObject) && is_numeric($test[2])) { + continue; + } + + if ('+4' === $test[2] && $methodObject === $testObject[0]) { + continue; + } + + $tests[] = array($test[0], $test[1], $testObject[0], $test[2], array(), $testObject[1]); + } + } + + // additional properties tests + $tests = array_merge($tests, array( + array(true, null, $propertyObject3, 'foo', array(), $anyType), + )); + + // additional method tests + $tests = array_merge($tests, array( + array(true, 'defined', $methodObject, 'defined', array(), $methodType), + array(true, 'defined', $methodObject, 'DEFINED', array(), $methodType), + array(true, 'defined', $methodObject, 'getDefined', array(), $methodType), + array(true, 'defined', $methodObject, 'GETDEFINED', array(), $methodType), + array(true, 'static', $methodObject, 'static', array(), $methodType), + array(true, 'static', $methodObject, 'getStatic', array(), $methodType), + + array(true, '__call_undefined', $magicMethodObject, 'undefined', array(), $methodType), + array(true, '__call_UNDEFINED', $magicMethodObject, 'UNDEFINED', array(), $methodType), + )); + + // add the same tests for the any type + foreach ($tests as $test) { + if ($anyType !== $test[5]) { + $test[5] = $anyType; + $tests[] = $test; + } + } + + $methodAndPropObject = new Twig_TemplateMethodAndPropObject(); + + // additional method tests + $tests = array_merge($tests, array( + array(true, 'a', $methodAndPropObject, 'a', array(), $anyType), + array(true, 'a', $methodAndPropObject, 'a', array(), $methodType), + array(false, null, $methodAndPropObject, 'a', array(), $arrayType), + + array(true, 'b_prop', $methodAndPropObject, 'b', array(), $anyType), + array(true, 'b', $methodAndPropObject, 'B', array(), $anyType), + array(true, 'b', $methodAndPropObject, 'b', array(), $methodType), + array(true, 'b', $methodAndPropObject, 'B', array(), $methodType), + array(false, null, $methodAndPropObject, 'b', array(), $arrayType), + + array(false, null, $methodAndPropObject, 'c', array(), $anyType), + array(false, null, $methodAndPropObject, 'c', array(), $methodType), + array(false, null, $methodAndPropObject, 'c', array(), $arrayType), + + )); + + // 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'), + )); + + // add twig_template_get_attributes tests + + if (function_exists('twig_template_get_attributes')) { + foreach (array_slice($tests, 0) as $test) { + $test = array_pad($test, 7, null); + $test[6] = true; + $tests[] = $test; + } + } + + return $tests; + } +} + +class Twig_TemplateTest extends Twig_Template +{ + protected $useExtGetAttribute = false; + + public function __construct(Twig_Environment $env, $useExtGetAttribute = false) + { + parent::__construct($env); + $this->useExtGetAttribute = $useExtGetAttribute; + self::$cache = array(); + } + + public function getZero() + { + return 0; + } + + public function getEmpty() + { + return ''; + } + + public function getString() + { + return 'some_string'; + } + + public function getTrue() + { + return true; + } + + public function getTemplateName() + { + } + + public function getDebugInfo() + { + return array(); + } + + protected function doGetParent(array $context) + { + } + + protected function doDisplay(array $context, array $blocks = array()) + { + } + + public function getAttribute($object, $item, array $arguments = array(), $type = Twig_Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) + { + if ($this->useExtGetAttribute) { + return twig_template_get_attributes($this, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); + } else { + return parent::getAttribute($object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); + } + } +} +/* */ +/* */ + +class Twig_TemplateArrayAccessObject implements ArrayAccess +{ + protected $protected = 'protected'; + + public $attributes = array( + 'defined' => 'defined', + 'zero' => 0, + 'null' => null, + '1' => 1, + 'bar' => true, + '09' => '09', + '+4' => '+4', + ); + + public function offsetExists($name) + { + return array_key_exists($name, $this->attributes); + } + + public function offsetGet($name) + { + return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; + } + + public function offsetSet($name, $value) + { + } + + public function offsetUnset($name) + { + } +} + +class Twig_TemplateMagicPropertyObject +{ + public $defined = 'defined'; + + public $attributes = array( + 'zero' => 0, + 'null' => null, + '1' => 1, + 'bar' => true, + '09' => '09', + '+4' => '+4', + ); + + protected $protected = 'protected'; + + public function __isset($name) + { + return array_key_exists($name, $this->attributes); + } + + public function __get($name) + { + return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; + } +} + +class Twig_TemplateMagicPropertyObjectWithException +{ + public function __isset($key) + { + throw new Exception('Hey! Don\'t try to isset me!'); + } +} + +class Twig_TemplatePropertyObject +{ + public $defined = 'defined'; + public $zero = 0; + public $null = null; + public $bar = true; + + protected $protected = 'protected'; +} + +class Twig_TemplatePropertyObjectAndIterator extends Twig_TemplatePropertyObject implements IteratorAggregate +{ + public function getIterator() + { + return new ArrayIterator(array('foo', 'bar')); + } +} + +class Twig_TemplatePropertyObjectAndArrayAccess extends Twig_TemplatePropertyObject implements ArrayAccess +{ + private $data = array(); + + public function offsetExists($offset) + { + return array_key_exists($offset, $this->data); + } + + public function offsetGet($offset) + { + return $this->offsetExists($offset) ? $this->data[$offset] : 'n/a'; + } + + public function offsetSet($offset, $value) + { + } + + public function offsetUnset($offset) + { + } +} + +class Twig_TemplatePropertyObjectDefinedWithUndefinedValue +{ + public $foo; + + public function __construct() + { + $this->foo = @$notExist; + } +} + +class Twig_TemplateMethodObject +{ + public function getDefined() + { + return 'defined'; + } + + public function get1() + { + return 1; + } + + public function get09() + { + return '09'; + } + + public function getZero() + { + return 0; + } + + public function getNull() + { + } + + public function isBar() + { + return true; + } + + protected function getProtected() + { + return 'protected'; + } + + public static function getStatic() + { + return 'static'; + } +} + +class Twig_TemplateMethodAndPropObject +{ + private $a = 'a_prop'; + public function getA() + { + return 'a'; + } + + public $b = 'b_prop'; + public function getB() + { + return 'b'; + } + + private $c = 'c_prop'; + private function getC() + { + return 'c'; + } +} + +class Twig_TemplateMagicMethodObject +{ + public function __call($method, $arguments) + { + return '__call_'.$method; + } +} + +class Twig_TemplateMagicMethodExceptionObject +{ + public function __call($method, $arguments) + { + throw new BadMethodCallException(sprintf('Unknown method "%s".', $method)); + } +} + +class CExtDisablingNodeVisitor implements Twig_NodeVisitorInterface +{ + public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) + { + if ($node instanceof Twig_Node_Expression_GetAttr) { + $node->setAttribute('disable_c_ext', true); + } + + return $node; + } + + public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) + { + return $node; + } + + public function getPriority() + { + return 0; + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php new file mode 100644 index 00000000..5ac3a286 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php @@ -0,0 +1,70 @@ +isEOF()) { + $token = $stream->next(); + + $repr[] = $token->getValue(); + } + $this->assertEquals('1, 2, 3, 4, 5, 6, 7', implode(', ', $repr), '->next() advances the pointer and returns the current token'); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedMessage Unexpected end of template + */ + public function testEndOfTemplateNext() + { + $stream = new Twig_TokenStream(array( + new Twig_Token(Twig_Token::BLOCK_START_TYPE, 1, 1), + )); + while (!$stream->isEOF()) { + $stream->next(); + } + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedMessage Unexpected end of template + */ + public function testEndOfTemplateLook() + { + $stream = new Twig_TokenStream(array( + new Twig_Token(Twig_Token::BLOCK_START_TYPE, 1, 1), + )); + while (!$stream->isEOF()) { + $stream->look(); + $stream->next(); + } + } +} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/escapingTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/escapingTest.php new file mode 100644 index 00000000..abf62364 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/Twig/Tests/escapingTest.php @@ -0,0 +1,320 @@ + ''', + '"' => '"', + '<' => '<', + '>' => '>', + '&' => '&', + ); + + protected $htmlAttrSpecialChars = array( + '\'' => ''', + /* Characters beyond ASCII value 255 to unicode escape */ + 'Ā' => 'Ā', + /* Immune chars excluded */ + ',' => ',', + '.' => '.', + '-' => '-', + '_' => '_', + /* Basic alnums excluded */ + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', + /* Basic control characters and null */ + "\r" => ' ', + "\n" => ' ', + "\t" => ' ', + "\0" => '�', // should use Unicode replacement char + /* Encode chars as named entities where possible */ + '<' => '<', + '>' => '>', + '&' => '&', + '"' => '"', + /* Encode spaces for quoteless attribute protection */ + ' ' => ' ', + ); + + protected $jsSpecialChars = array( + /* HTML special chars - escape without exception to hex */ + '<' => '\\x3C', + '>' => '\\x3E', + '\'' => '\\x27', + '"' => '\\x22', + '&' => '\\x26', + /* Characters beyond ASCII value 255 to unicode escape */ + 'Ā' => '\\u0100', + /* Immune chars excluded */ + ',' => ',', + '.' => '.', + '_' => '_', + /* Basic alnums excluded */ + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', + /* Basic control characters and null */ + "\r" => '\\x0D', + "\n" => '\\x0A', + "\t" => '\\x09', + "\0" => '\\x00', + /* Encode spaces for quoteless attribute protection */ + ' ' => '\\x20', + ); + + protected $urlSpecialChars = array( + /* HTML special chars - escape without exception to percent encoding */ + '<' => '%3C', + '>' => '%3E', + '\'' => '%27', + '"' => '%22', + '&' => '%26', + /* Characters beyond ASCII value 255 to hex sequence */ + 'Ā' => '%C4%80', + /* Punctuation and unreserved check */ + ',' => '%2C', + '.' => '.', + '_' => '_', + '-' => '-', + ':' => '%3A', + ';' => '%3B', + '!' => '%21', + /* Basic alnums excluded */ + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', + /* Basic control characters and null */ + "\r" => '%0D', + "\n" => '%0A', + "\t" => '%09', + "\0" => '%00', + /* PHP quirks from the past */ + ' ' => '%20', + '~' => '~', + '+' => '%2B', + ); + + protected $cssSpecialChars = array( + /* HTML special chars - escape without exception to hex */ + '<' => '\\3C ', + '>' => '\\3E ', + '\'' => '\\27 ', + '"' => '\\22 ', + '&' => '\\26 ', + /* Characters beyond ASCII value 255 to unicode escape */ + 'Ā' => '\\100 ', + /* Immune chars excluded */ + ',' => '\\2C ', + '.' => '\\2E ', + '_' => '\\5F ', + /* Basic alnums excluded */ + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', + /* Basic control characters and null */ + "\r" => '\\D ', + "\n" => '\\A ', + "\t" => '\\9 ', + "\0" => '\\0 ', + /* Encode spaces for quoteless attribute protection */ + ' ' => '\\20 ', + ); + + protected $env; + + protected function setUp() + { + $this->env = new Twig_Environment($this->getMock('Twig_LoaderInterface')); + } + + public function testHtmlEscapingConvertsSpecialChars() + { + foreach ($this->htmlSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html'), 'Failed to escape: '.$key); + } + } + + public function testHtmlAttributeEscapingConvertsSpecialChars() + { + foreach ($this->htmlAttrSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html_attr'), 'Failed to escape: '.$key); + } + } + + public function testJavascriptEscapingConvertsSpecialChars() + { + foreach ($this->jsSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'js'), 'Failed to escape: '.$key); + } + } + + public function testJavascriptEscapingReturnsStringIfZeroLength() + { + $this->assertEquals('', twig_escape_filter($this->env, '', 'js')); + } + + public function testJavascriptEscapingReturnsStringIfContainsOnlyDigits() + { + $this->assertEquals('123', twig_escape_filter($this->env, '123', 'js')); + } + + public function testCssEscapingConvertsSpecialChars() + { + foreach ($this->cssSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'css'), 'Failed to escape: '.$key); + } + } + + public function testCssEscapingReturnsStringIfZeroLength() + { + $this->assertEquals('', twig_escape_filter($this->env, '', 'css')); + } + + public function testCssEscapingReturnsStringIfContainsOnlyDigits() + { + $this->assertEquals('123', twig_escape_filter($this->env, '123', 'css')); + } + + public function testUrlEscapingConvertsSpecialChars() + { + foreach ($this->urlSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'url'), 'Failed to escape: '.$key); + } + } + + /** + * Range tests to confirm escaped range of characters is within OWASP recommendation. + */ + + /** + * Only testing the first few 2 ranges on this prot. function as that's all these + * other range tests require. + */ + public function testUnicodeCodepointConversionToUtf8() + { + $expected = ' ~ޙ'; + $codepoints = array(0x20, 0x7e, 0x799); + $result = ''; + foreach ($codepoints as $value) { + $result .= $this->codepointToUtf8($value); + } + $this->assertEquals($expected, $result); + } + + /** + * Convert a Unicode Codepoint to a literal UTF-8 character. + * + * @param int $codepoint Unicode codepoint in hex notation + * + * @return string UTF-8 literal string + */ + protected function codepointToUtf8($codepoint) + { + if ($codepoint < 0x80) { + return chr($codepoint); + } + if ($codepoint < 0x800) { + return chr($codepoint >> 6 & 0x3f | 0xc0) + .chr($codepoint & 0x3f | 0x80); + } + if ($codepoint < 0x10000) { + return chr($codepoint >> 12 & 0x0f | 0xe0) + .chr($codepoint >> 6 & 0x3f | 0x80) + .chr($codepoint & 0x3f | 0x80); + } + if ($codepoint < 0x110000) { + return chr($codepoint >> 18 & 0x07 | 0xf0) + .chr($codepoint >> 12 & 0x3f | 0x80) + .chr($codepoint >> 6 & 0x3f | 0x80) + .chr($codepoint & 0x3f | 0x80); + } + throw new Exception('Codepoint requested outside of Unicode range'); + } + + public function testJavascriptEscapingEscapesOwaspRecommendedRanges() + { + $immune = array(',', '.', '_'); // Exceptions to escaping ranges + for ($chr = 0; $chr < 0xFF; ++$chr) { + if ($chr >= 0x30 && $chr <= 0x39 + || $chr >= 0x41 && $chr <= 0x5A + || $chr >= 0x61 && $chr <= 0x7A) { + $literal = $this->codepointToUtf8($chr); + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js')); + } else { + $literal = $this->codepointToUtf8($chr); + if (in_array($literal, $immune)) { + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js')); + } else { + $this->assertNotEquals( + $literal, + twig_escape_filter($this->env, $literal, 'js'), + "$literal should be escaped!"); + } + } + } + } + + public function testHtmlAttributeEscapingEscapesOwaspRecommendedRanges() + { + $immune = array(',', '.', '-', '_'); // Exceptions to escaping ranges + for ($chr = 0; $chr < 0xFF; ++$chr) { + if ($chr >= 0x30 && $chr <= 0x39 + || $chr >= 0x41 && $chr <= 0x5A + || $chr >= 0x61 && $chr <= 0x7A) { + $literal = $this->codepointToUtf8($chr); + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr')); + } else { + $literal = $this->codepointToUtf8($chr); + if (in_array($literal, $immune)) { + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr')); + } else { + $this->assertNotEquals( + $literal, + twig_escape_filter($this->env, $literal, 'html_attr'), + "$literal should be escaped!"); + } + } + } + } + + public function testCssEscapingEscapesOwaspRecommendedRanges() + { + // CSS has no exceptions to escaping ranges + for ($chr = 0; $chr < 0xFF; ++$chr) { + if ($chr >= 0x30 && $chr <= 0x39 + || $chr >= 0x41 && $chr <= 0x5A + || $chr >= 0x61 && $chr <= 0x7A) { + $literal = $this->codepointToUtf8($chr); + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'css')); + } else { + $literal = $this->codepointToUtf8($chr); + $this->assertNotEquals( + $literal, + twig_escape_filter($this->env, $literal, 'css'), + "$literal should be escaped!"); + } + } + } +} diff --git a/plugins/twig/vendor/twig/twig/test/bootstrap.php b/plugins/twig/vendor/twig/twig/test/bootstrap.php new file mode 100644 index 00000000..aecb976f --- /dev/null +++ b/plugins/twig/vendor/twig/twig/test/bootstrap.php @@ -0,0 +1,13 @@ + Date: Thu, 3 Mar 2016 12:52:42 +0100 Subject: [PATCH 02/17] [BUGFIX] SensioLabsInsight: Files should not be executable Your project contains files with permissive permissions. In order to avoid opening a security breach, you should restrict execution rights on following files: system/Http/Request.php system/Http/Response.php --- system/Http/Request.php | 0 system/Http/Response.php | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 system/Http/Request.php mode change 100755 => 100644 system/Http/Response.php diff --git a/system/Http/Request.php b/system/Http/Request.php old mode 100755 new mode 100644 diff --git a/system/Http/Response.php b/system/Http/Response.php old mode 100755 new mode 100644 From 649510de472584bf3a09c51ed4d72a0cf0f7c1c7 Mon Sep 17 00:00:00 2001 From: Netzweberei Date: Thu, 3 Mar 2016 17:49:37 +0100 Subject: [PATCH 03/17] [CHANGE] camelCasedMethodNames, psr1 As suggested by SensioLabsInsight --- plugins/shortcode/shortcode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/shortcode/shortcode.php b/plugins/shortcode/shortcode.php index 010fed9a..0882d935 100644 --- a/plugins/shortcode/shortcode.php +++ b/plugins/shortcode/shortcode.php @@ -387,13 +387,13 @@ protected function getFileInfo($path) return ''; } $replace = [ - '{size}' => $this->human_filesize(filesize($path)), + '{size}' => $this->humanFilesize(filesize($path)), '{extension}' => strtoupper(pathinfo($path, PATHINFO_EXTENSION)) ]; return strtr(' ({extension}, {size})', $replace); } - protected function human_filesize($bytes, $decimals = 0) + protected function humanFilesize($bytes, $decimals = 0) { $sz = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB']; $factor = floor((strlen($bytes) - 1) / 3); From 525701b15125a1920f2f338b31ddad87848bdde1 Mon Sep 17 00:00:00 2001 From: Andreas Neumann Date: Fri, 4 Mar 2016 08:28:59 +0100 Subject: [PATCH 04/17] [CHANGE] SensioLabsInsight: Object parameters should be type hinted --- plugins/markdown/markdown.php | 4 ++-- plugins/shortcode/shortcode.php | 2 +- plugins/textile/textile.php | 8 ++++---- plugins/twig/classes/HerbieExtension.php | 4 ++-- plugins/twig/twig.php | 2 +- system/Menu/CollectionTrait.php | 4 ++-- system/Menu/Page/Iterator/FilterCallback.php | 2 +- system/Menu/Page/Iterator/SortableIterator.php | 10 +++++----- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index a09c5480..7e4d5f47 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php @@ -12,7 +12,7 @@ public static function install() // add twig function / filter if ((bool)$config->get('plugins.config.markdown.twig', false)) { - Hook::attach('twigInitialized', function($twig) { + Hook::attach('twigInitialized', function(\Twig_Environment $twig) { $options = ['is_safe' => ['html']]; $twig->addFunction( new \Twig_SimpleFunction('markdown', ['MarkdownPlugin', 'parseMarkdown'], $options) @@ -40,7 +40,7 @@ public static function install() }); } - public static function addShortcode($shortcode) + public static function addShortcode(\herbie\sysplugin\shortcode\classes\Shortcode $shortcode) { $shortcode->add('markdown', ['MarkdownPlugin', 'markdownShortcode']); } diff --git a/plugins/shortcode/shortcode.php b/plugins/shortcode/shortcode.php index 54f009d9..6eb79bc5 100644 --- a/plugins/shortcode/shortcode.php +++ b/plugins/shortcode/shortcode.php @@ -163,7 +163,7 @@ protected function addListingTag() } // filter pages with empty title - $collection = $collection->filter(function ($page) { + $collection = $collection->filter(function (\Herbie\Page $page) { return !empty($page->title); }); diff --git a/plugins/textile/textile.php b/plugins/textile/textile.php index 3c937573..5d5967e1 100644 --- a/plugins/textile/textile.php +++ b/plugins/textile/textile.php @@ -20,7 +20,7 @@ public function install() Hook::attach('renderContent', [$this, 'renderContent']); } - public function addTwigFunctionAndFilter($twig) + public function addTwigFunctionAndFilter(\Twig_Environment $twig) { $options = ['is_safe' => ['html']]; $twig->addFunction( @@ -31,17 +31,17 @@ public function addTwigFunctionAndFilter($twig) ); } - public function addSortcode($shortcode) + public function addSortcode(herbie\sysplugin\shortcode\classes\Shortcode $shortcode) { $shortcode->add('textile', [$this, 'textileShortcode']); } - public function renderContent($segment, array $attributes) + public function renderContent( $segment, array $attributes) { if(!in_array($attributes['format'], ['textile'])) { return $segment; } - return $this->parseTextile($segment->string); + return $this->parseTextile($segment); } public function parseTextile($value) diff --git a/plugins/twig/classes/HerbieExtension.php b/plugins/twig/classes/HerbieExtension.php index b54fd4e3..592d2423 100644 --- a/plugins/twig/classes/HerbieExtension.php +++ b/plugins/twig/classes/HerbieExtension.php @@ -443,7 +443,7 @@ public function functionMenu(array $options = []) $htmlTree = new Menu\Page\Renderer\HtmlTree($filterIterator); $htmlTree->setMaxDepth($maxDepth); $htmlTree->setClass($class); - $htmlTree->itemCallback = function ($node) { + $htmlTree->itemCallback = function (\Herbie\Node $node) { $menuItem = $node->getMenuItem(); $href = $this->urlGenerator->generate($menuItem->route); return sprintf('%s', $href, $menuItem->getMenuTitle()); @@ -594,7 +594,7 @@ public function functionSitemap(array $options = []) $htmlTree = new Menu\Page\Renderer\HtmlTree($filterIterator); $htmlTree->setMaxDepth($maxDepth); $htmlTree->setClass($class); - $htmlTree->itemCallback = function ($node) { + $htmlTree->itemCallback = function (\Herbie\Node $node) { $menuItem = $node->getMenuItem(); $href = $this->urlGenerator->generate($menuItem->route); return sprintf('%s', $href, $menuItem->getMenuTitle()); diff --git a/plugins/twig/twig.php b/plugins/twig/twig.php index bbffabf4..eeb974b7 100644 --- a/plugins/twig/twig.php +++ b/plugins/twig/twig.php @@ -39,7 +39,7 @@ public function twigifyContent($content, array $attributes) return $this->twig->renderString($content); } - public function twigifyLayout($page) + public function twigifyLayout(\Herbie\Page $page) { $this->twig->getEnvironment()->getExtension('herbie')->setPage($page); return $this->twig->render($page->layout); diff --git a/system/Menu/CollectionTrait.php b/system/Menu/CollectionTrait.php index 584ed373..4216b6de 100644 --- a/system/Menu/CollectionTrait.php +++ b/system/Menu/CollectionTrait.php @@ -107,7 +107,7 @@ public function filter($key = null, $value = null) return new static(array_filter($this->items, $key)); } if (is_string($key) && is_scalar($value)) { - return new static(array_filter($this->items, function($val) use ($key, $value) { + return new static(array_filter($this->items, function(\stdClass $val) use ($key, $value) { if ($val->{$key} == $value) { return true; } @@ -149,7 +149,7 @@ public function sort($mixed = null, $direction = 'asc') } $field = is_string($mixed) ? $mixed : 'title'; - uasort($items, function($a, $b) use ($field, $direction) { + uasort($items, function(\stdClass $a, \stdClass $b) use ($field, $direction) { if ($a->{$field} == $b->{$field}) { return 0; } diff --git a/system/Menu/Page/Iterator/FilterCallback.php b/system/Menu/Page/Iterator/FilterCallback.php index 867bb311..893ff8f2 100644 --- a/system/Menu/Page/Iterator/FilterCallback.php +++ b/system/Menu/Page/Iterator/FilterCallback.php @@ -24,7 +24,7 @@ public function __construct(array $routeLine) $this->routeLine = $routeLine; } - public function call($current, $key, $iterator) + public function call(\Herbie\Menu\Page\Node $current, $key, $iterator) { $menuItem = $current->getMenuItem(); diff --git a/system/Menu/Page/Iterator/SortableIterator.php b/system/Menu/Page/Iterator/SortableIterator.php index 56e03891..03079a03 100644 --- a/system/Menu/Page/Iterator/SortableIterator.php +++ b/system/Menu/Page/Iterator/SortableIterator.php @@ -39,11 +39,11 @@ public function __construct(\Traversable $iterator, $sort) $this->iterator = $iterator; if (self::SORT_BY_NAME === $sort) { - $this->sort = function ($a, $b) { + $this->sort = function (\Herbie\Iterator\SplFileInfo $a, \Herbie\Iterator\SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); }; } elseif (self::SORT_BY_TYPE === $sort) { - $this->sort = function ($a, $b) { + $this->sort = function (\Herbie\Iterator\SplFileInfo $a, \Herbie\Iterator\SplFileInfo $b) { if ($a->isDir() && $b->isFile()) { return -1; } elseif ($a->isFile() && $b->isDir()) { @@ -52,15 +52,15 @@ public function __construct(\Traversable $iterator, $sort) return strcmp($a->getRealpath(), $b->getRealpath()); }; } elseif (self::SORT_BY_ACCESSED_TIME === $sort) { - $this->sort = function ($a, $b) { + $this->sort = function (\Herbie\Iterator\SplFileInfo $a, \Herbie\Iterator\SplFileInfo $b) { return ($a->getATime() - $b->getATime()); }; } elseif (self::SORT_BY_CHANGED_TIME === $sort) { - $this->sort = function ($a, $b) { + $this->sort = function (\Herbie\Iterator\SplFileInfo $a, \Herbie\Iterator\SplFileInfo $b) { return ($a->getCTime() - $b->getCTime()); }; } elseif (self::SORT_BY_MODIFIED_TIME === $sort) { - $this->sort = function ($a, $b) { + $this->sort = function (\Herbie\Iterator\SplFileInfo $a, \Herbie\Iterator\SplFileInfo $b) { return ($a->getMTime() - $b->getMTime()); }; } elseif (is_callable($sort)) { From 75751cdc855410d5b43b71640d7f23cf98be3167 Mon Sep 17 00:00:00 2001 From: Andreas Neumann Date: Fri, 4 Mar 2016 08:59:41 +0100 Subject: [PATCH 05/17] [CHANGE] Removed duplicate code from DataCache and FilesystemCache to AbstractCache --- system/Cache/AbstractCache.php | 93 ++++++++++++++++++++++++++++++++ system/Cache/DataCache.php | 78 +-------------------------- system/Cache/FilesystemCache.php | 80 +-------------------------- 3 files changed, 96 insertions(+), 155 deletions(-) create mode 100644 system/Cache/AbstractCache.php diff --git a/system/Cache/AbstractCache.php b/system/Cache/AbstractCache.php new file mode 100644 index 00000000..c43876eb --- /dev/null +++ b/system/Cache/AbstractCache.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Herbie\Cache; + +abstract class AbstractCache implements CacheInterface +{ + + /** + * @var boolean + */ + protected $enable; + + /** + * @var string + */ + protected $dir; + + /** + * @var int + */ + protected $expire; + + /** + * @param array $options + */ + public function __construct(array $options = []) + { + $this->enable = null; + $this->dir = null; + $this->expire = 60 * 60 * 24; + $this->setOptions($options); + } + + /** + * @param array $options + */ + public function setOptions(array $options) + { + foreach ($options as $key => $value) { + $this->$key = $value; + } + } + + /** + * @param string $id + * @return mixed|boolean + */ + public function get($id) + { + $filename = $this->makeFilename($id); + if (file_exists($filename) && (time() - $this->expire < filemtime($filename))) { + $serialized = file_get_contents($filename); + return unserialize($serialized); + } + return false; + } + + /** + * @param string $id + * @param mixed $value + * @return boolean + * @throws \Exception + */ + public function set($id, $value) + { + $filename = $this->makeFilename($id); + $written = file_put_contents($filename, serialize($value)); + if ($written === false) { + throw new \Exception('Could not write to data cache file', 500); + } + return true; + } + + /** + * @param string $id + * @return string + */ + protected function makeFilename($id) + { + $id = md5($id); + return sprintf('%s/%s.%s', $this->dir, $id, 'cache'); + } + +} diff --git a/system/Cache/DataCache.php b/system/Cache/DataCache.php index 3e51e174..b81e3e9a 100644 --- a/system/Cache/DataCache.php +++ b/system/Cache/DataCache.php @@ -11,83 +11,7 @@ namespace Herbie\Cache; -class DataCache implements CacheInterface +class DataCache extends AbstractCache implements CacheInterface { - /** - * @var boolean - */ - protected $enable; - - /** - * @var string - */ - protected $dir; - - /** - * @var int - */ - protected $expire; - - /** - * @param array $options - */ - public function __construct(array $options = []) - { - $this->enable = null; - $this->dir = null; - $this->expire = 60 * 60 * 24; - $this->setOptions($options); - } - - /** - * @param array $options - */ - public function setOptions(array $options) - { - foreach ($options as $key => $value) { - $this->$key = $value; - } - } - - /** - * @param string $id - * @return mixed|boolean - */ - public function get($id) - { - $filename = $this->makeFilename($id); - if (file_exists($filename) && (time() - $this->expire < filemtime($filename))) { - $serialized = file_get_contents($filename); - return unserialize($serialized); - } - return false; - } - - /** - * @param string $id - * @param mixed $value - * @return boolean - * @throws \Exception - */ - public function set($id, $value) - { - $filename = $this->makeFilename($id); - $written = file_put_contents($filename, serialize($value)); - if ($written === false) { - throw new \Exception('Could not write to data cache file', 500); - } - return true; - } - - /** - * @param string $id - * @return string - */ - protected function makeFilename($id) - { - $id = md5($id); - return sprintf('%s/%s.%s', $this->dir, $id, 'cache'); - } - } diff --git a/system/Cache/FilesystemCache.php b/system/Cache/FilesystemCache.php index 8f427882..bf158709 100644 --- a/system/Cache/FilesystemCache.php +++ b/system/Cache/FilesystemCache.php @@ -11,83 +11,7 @@ namespace Herbie\Cache; -class FilesystemCache implements CacheInterface +class FilesystemCache extends AbstractCache implements CacheInterface { - - /** - * @var boolean - */ - protected $enable; - - /** - * @var string - */ - protected $dir; - - /** - * @var int - */ - protected $expire; - - /** - * @param array $options - */ - public function __construct(array $options = []) - { - $this->enable = null; - $this->dir = null; - $this->expire = 60 * 60 * 24; - $this->setOptions($options); - } - - /** - * @param array $options - */ - public function setOptions(array $options) - { - foreach ($options as $key => $value) { - $this->$key = $value; - } - } - - /** - * @param string $id - * @return mixed|boolean - */ - public function get($id) - { - $filename = $this->makeFilename($id); - if (file_exists($filename) && (time() - $this->expire < filemtime($filename))) { - $serialized = file_get_contents($filename); - return unserialize($serialized); - } - return false; - } - - /** - * @param string $id - * @param mixed $value - * @return boolean - * @throws \Exception - */ - public function set($id, $value) - { - $filename = $this->makeFilename($id); - $written = file_put_contents($filename, serialize($value)); - if ($written === false) { - throw new \Exception('Could not write to data cache file', 500); - } - return true; - } - - /** - * @param string $id - * @return string - */ - protected function makeFilename($id) - { - $id = md5($id); - return sprintf('%s/%s.%s', $this->dir, $id, 'cache'); - } - + } From eb068cdae6c8e6dd7fb4d19a26acfa66b2784892 Mon Sep 17 00:00:00 2001 From: Andreas Neumann Date: Fri, 4 Mar 2016 09:07:30 +0100 Subject: [PATCH 06/17] [CHANGE] Moved duplicate code from system/Cache/SplFileInfo and system/Iterator/SplFileInfo to system/SplFileInfo --- system/Cache/FilesystemCache.php | 2 +- system/Finder/SplFileInfo.php | 67 +------------------------- system/Iterator/SplFileInfo.php | 65 +------------------------- system/SplFileInfo.php | 80 ++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 130 deletions(-) create mode 100644 system/SplFileInfo.php diff --git a/system/Cache/FilesystemCache.php b/system/Cache/FilesystemCache.php index bf158709..0de34063 100644 --- a/system/Cache/FilesystemCache.php +++ b/system/Cache/FilesystemCache.php @@ -13,5 +13,5 @@ class FilesystemCache extends AbstractCache implements CacheInterface { - + } diff --git a/system/Finder/SplFileInfo.php b/system/Finder/SplFileInfo.php index b887e635..cf05f775 100644 --- a/system/Finder/SplFileInfo.php +++ b/system/Finder/SplFileInfo.php @@ -11,70 +11,7 @@ namespace Herbie\Finder; -class SplFileInfo extends \SplFileInfo +class SplFileInfo extends \Herbie\SplFileInfo { - private $relativePath; - private $relativePathname; - - /** - * Constructor - * - * @param string $file - * @param string $relativePath - * @param string $relativePathname - */ - public function __construct($file, $relativePath, $relativePathname) - { - parent::__construct($file); - $this->relativePath = $relativePath; - $this->relativePathname = $relativePathname; - } - - /** - * Returns the relative path - * - * @return string - */ - public function getRelativePath() - { - return $this->relativePath; - } - - /** - * Returns the relative path name - * - * @return string - */ - public function getRelativePathname() - { - return $this->relativePathname; - } - - /** - * @return bool - */ - public function isDot() - { - return in_array($this->getBasename(), ['.', '..']); - } - - /** - * Returns the contents of the file - * - * @return string - * - * @throws \RuntimeException - */ - public function getContents() - { - $level = error_reporting(0); - $content = file_get_contents($this->getPathname()); - error_reporting($level); - if (false === $content) { - $error = error_get_last(); - throw new \RuntimeException($error['message']); - } - - return $content; - } + } diff --git a/system/Iterator/SplFileInfo.php b/system/Iterator/SplFileInfo.php index 32feec4f..6dc12a78 100644 --- a/system/Iterator/SplFileInfo.php +++ b/system/Iterator/SplFileInfo.php @@ -11,70 +11,7 @@ namespace Herbie\Iterator; -class SplFileInfo extends \SplFileInfo +class SplFileInfo extends \Herbie\SplFileInfo { - private $relativePath; - private $relativePathname; - /** - * Constructor - * - * @param string $file The file name - * @param string $relativePath The relative path - * @param string $relativePathname The relative path name - */ - public function __construct($file, $relativePath, $relativePathname) - { - parent::__construct($file); - $this->relativePath = $relativePath; - $this->relativePathname = $relativePathname; - } - - /** - * Returns the relative path - * - * @return string the relative path - */ - public function getRelativePath() - { - return $this->relativePath; - } - - /** - * Returns the relative path name - * - * @return string the relative path name - */ - public function getRelativePathname() - { - return $this->relativePathname; - } - - /** - * @return bool - */ - public function isDot() - { - return in_array($this->getBasename(), ['.', '..']); - } - - /** - * Returns the contents of the file - * - * @return string the contents of the file - * - * @throws \RuntimeException - */ - public function getContents() - { - $level = error_reporting(0); - $content = file_get_contents($this->getPathname()); - error_reporting($level); - if (false === $content) { - $error = error_get_last(); - throw new \RuntimeException($error['message']); - } - - return $content; - } } diff --git a/system/SplFileInfo.php b/system/SplFileInfo.php new file mode 100644 index 00000000..34f5576a --- /dev/null +++ b/system/SplFileInfo.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Herbie; + +class SplFileInfo extends \SplFileInfo +{ + private $relativePath; + private $relativePathname; + + /** + * Constructor + * + * @param string $file The file name + * @param string $relativePath The relative path + * @param string $relativePathname The relative path name + */ + public function __construct($file, $relativePath, $relativePathname) + { + parent::__construct($file); + $this->relativePath = $relativePath; + $this->relativePathname = $relativePathname; + } + + /** + * Returns the relative path + * + * @return string the relative path + */ + public function getRelativePath() + { + return $this->relativePath; + } + + /** + * Returns the relative path name + * + * @return string the relative path name + */ + public function getRelativePathname() + { + return $this->relativePathname; + } + + /** + * @return bool + */ + public function isDot() + { + return in_array($this->getBasename(), ['.', '..']); + } + + /** + * Returns the contents of the file + * + * @return string the contents of the file + * + * @throws \RuntimeException + */ + public function getContents() + { + $level = error_reporting(0); + $content = file_get_contents($this->getPathname()); + error_reporting($level); + if (false === $content) { + $error = error_get_last(); + throw new \RuntimeException($error['message']); + } + + return $content; + } +} From 44268fb9ae2b642198ef1eb6d0bd5e704c04d1cb Mon Sep 17 00:00:00 2001 From: Andreas Neumann Date: Fri, 4 Mar 2016 11:25:42 +0100 Subject: [PATCH 07/17] [CHANGE] SensioLabsInsight: Usage of a function in loops should be avoided --- system/Loader/PageLoader.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/Loader/PageLoader.php b/system/Loader/PageLoader.php index 76d4c0a1..c0edb3cc 100644 --- a/system/Loader/PageLoader.php +++ b/system/Loader/PageLoader.php @@ -119,7 +119,8 @@ protected function parseContent($content) } $segments[] = array_shift($splitted); - for ($i=0; $i Date: Fri, 4 Mar 2016 12:01:32 +0100 Subject: [PATCH 08/17] [CHANGE] SensioLabsInsight: Source code should not contain TODO comments (I changed it at least in master-, but left them in develop-branch) --- plugins/twig/classes/Twig.php | 1 - .../twig/classes/widgets/blog/archives.html | 1 - .../twig/classes/widgets/blog/categories.html | 2 -- plugins/twig/classes/widgets/blog/tags.html | 2 -- system/Helper/PathHelper.php | 26 +++++++++++++++++++ system/Loader/PageLoader.php | 16 +----------- system/Menu/Post/Builder.php | 14 +--------- 7 files changed, 28 insertions(+), 34 deletions(-) create mode 100644 system/Helper/PathHelper.php diff --git a/plugins/twig/classes/Twig.php b/plugins/twig/classes/Twig.php index fbdb4e9c..eb545565 100644 --- a/plugins/twig/classes/Twig.php +++ b/plugins/twig/classes/Twig.php @@ -179,7 +179,6 @@ public function renderString($string) */ private function getContext() { - // @todo Inject request object or refactor code return [ 'route' => Application::getService('Request')->getRoute(), 'baseUrl' => Application::getService('Request')->getBasePath(), diff --git a/plugins/twig/classes/widgets/blog/archives.html b/plugins/twig/classes/widgets/blog/archives.html index 9fcb82ef..434d697e 100644 --- a/plugins/twig/classes/widgets/blog/archives.html +++ b/plugins/twig/classes/widgets/blog/archives.html @@ -1,6 +1,5 @@ {% set title = title ? title : 'Archives' %} {% set showCount = showCount ? showCount : false %} -{# @todo: option dropdown (Display as dropdown) #} {% if site.posts.months|length > 0 %}
    diff --git a/plugins/twig/classes/widgets/blog/categories.html b/plugins/twig/classes/widgets/blog/categories.html index c2e8f0f8..6c7bc2ea 100644 --- a/plugins/twig/classes/widgets/blog/categories.html +++ b/plugins/twig/classes/widgets/blog/categories.html @@ -1,7 +1,5 @@ {% set title = title ? title : 'Categories' %} {% set showCount = showCount ? showCount : false %} -{# @todo: option dropdown (Display as dropdown) #} -{# @todo: option hierarchical (Show hierarchy) #} {% if site.posts.categories|length > 0 %}
    diff --git a/plugins/twig/classes/widgets/blog/tags.html b/plugins/twig/classes/widgets/blog/tags.html index e575e2ff..14ce4587 100644 --- a/plugins/twig/classes/widgets/blog/tags.html +++ b/plugins/twig/classes/widgets/blog/tags.html @@ -1,7 +1,5 @@ {% set title = title ? title : 'Tags' %} {% set showCount = showCount ? showCount : false %} -{# @todo: option dropdown (Display as dropdown) #} -{# @todo: option hierarchical (Show hierarchy) #} {% if site.posts.tags|length > 0 %}
    diff --git a/system/Helper/PathHelper.php b/system/Helper/PathHelper.php new file mode 100644 index 00000000..cf80144f --- /dev/null +++ b/system/Helper/PathHelper.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Herbie\Helper; + +class PathHelper +{ + /** + * @param string $path + * @return string + */ + public static function extractDateFromPath($path) + { + $filename = basename($path); + preg_match('/^([0-9]{4}-[0-9]{2}-[0-9]{2}).*$/', $filename, $matches); + return $matches[1]; + } +} diff --git a/system/Loader/PageLoader.php b/system/Loader/PageLoader.php index c0edb3cc..de55c422 100644 --- a/system/Loader/PageLoader.php +++ b/system/Loader/PageLoader.php @@ -45,7 +45,7 @@ public function load($alias, $addDefFields = true) $data = (array) Yaml::parse($yaml); if ($addDefFields) { $data['format'] = isset($data['format']) ? $data['format'] : pathinfo($alias, PATHINFO_EXTENSION); - $data['date'] = isset($data['date']) ? $data['date'] : $this->extractDateFromPath($alias); + $data['date'] = isset($data['date']) ? $data['date'] : \Herbie\Helper\PathHelper::extractDateFromPath($alias); $data['path'] = isset($data['path']) ? $data['path'] : $alias; } return [ @@ -156,18 +156,4 @@ protected function readFile($alias) } return $contents; } - - /** - * @param string $alias - * @return string - * @todo Duplicate code in Herbie\Menu\Post\Builder - */ - protected function extractDateFromPath($alias) - { - $filename = basename($alias); - if (preg_match('/^([0-9]{4}-[0-9]{2}-[0-9]{2}).*$/', $filename, $matches)) { - return $matches[1]; - } - return null; - } } diff --git a/system/Menu/Post/Builder.php b/system/Menu/Post/Builder.php index 4902bb22..e509b380 100644 --- a/system/Menu/Post/Builder.php +++ b/system/Menu/Post/Builder.php @@ -78,7 +78,7 @@ public function build($path = null) $data['modified'] = date('c', filemtime($realpath.'/'.$filename)); } if (empty($data['date'])) { - $data['date'] = $this->extractDateFromPath($filename); + $data['date'] = \Herbie\Helper\PathHelper::extractDateFromPath($filename); } $data['path'] = '@post/'.$filename; $data['blogRoute'] = $this->blogRoute; @@ -91,16 +91,4 @@ public function build($path = null) #echo"
    ";print_r($collection);echo"
    "; return $collection; } - - /** - * @param string $path - * @return string - * @todo Duplicate code in Herbie\Loader\PageLoader - */ - protected function extractDateFromPath($path) - { - $filename = basename($path); - preg_match('/^([0-9]{4}-[0-9]{2}-[0-9]{2}).*$/', $filename, $matches); - return $matches[1]; - } } From 55cc663924c6f3b0135806bf2ca13bb48b2f3e46 Mon Sep 17 00:00:00 2001 From: Andreas Neumann Date: Fri, 4 Mar 2016 12:14:14 +0100 Subject: [PATCH 09/17] [BUGFIX] "Undefined index"-error in PathHelper --- system/Helper/PathHelper.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/system/Helper/PathHelper.php b/system/Helper/PathHelper.php index cf80144f..9e5c40fa 100644 --- a/system/Helper/PathHelper.php +++ b/system/Helper/PathHelper.php @@ -20,7 +20,9 @@ class PathHelper public static function extractDateFromPath($path) { $filename = basename($path); - preg_match('/^([0-9]{4}-[0-9]{2}-[0-9]{2}).*$/', $filename, $matches); - return $matches[1]; + if(preg_match('/^([0-9]{4}-[0-9]{2}-[0-9]{2}).*$/', $filename, $matches)) { + return $matches[1]; + } + return null; } } From 3996ffef8abb79a31984aeacd5a0660416a11e40 Mon Sep 17 00:00:00 2001 From: Andreas Neumann Date: Fri, 4 Mar 2016 12:20:58 +0100 Subject: [PATCH 10/17] [CHANGE] SensioLabsInsight: With booleans, only strict comparison (with === operator) should be used to lower bug risks and to improve performances. Changed from 'true' to '1' --- plugins/shortcode/shortcode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/shortcode/shortcode.php b/plugins/shortcode/shortcode.php index d2fbdc73..674f6fdd 100644 --- a/plugins/shortcode/shortcode.php +++ b/plugins/shortcode/shortcode.php @@ -164,7 +164,7 @@ protected function addListingTag() $collection = $collection->sort($field, $direction); } - if (true == (int)$options['shuffle']) { + if (1 == (int)$options['shuffle']) { $collection = $collection->shuffle(); } From 3dedb45b6fdd5c6454bef5c533740fb84aeae38a Mon Sep 17 00:00:00 2001 From: Andreas Neumann Date: Fri, 4 Mar 2016 12:31:02 +0100 Subject: [PATCH 11/17] [CHANGE] Various proposals from SensioLabsInsight (netzweberei / herbie #3): - Unused method, property, variable or parameter - Commented code should not be committed --- plugins/markdown/markdown.php | 3 --- plugins/shortcode/shortcode.php | 5 ----- plugins/twig/classes/HerbieExtension.php | 5 ----- system/Application.php | 6 +----- system/Config.php | 3 --- system/Finder/Finder.php | 4 ---- system/Helper/PageHelper.php | 3 --- system/Menu/Page/FileFilterCallback.php | 2 +- system/Menu/Page/Iterator/FilterCallback.php | 2 +- system/Menu/Post/Builder.php | 1 - 10 files changed, 3 insertions(+), 31 deletions(-) diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index 7e4d5f47..0f535bf8 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php @@ -25,9 +25,6 @@ public static function install() // add shortcode if ((bool)$config->get('plugins.config.markdown.shortcode', true)) { - #Hook::attach('shortcodeInitialized', function($shortcode) { - # $shortcode->add('markdown', ['MarkdownPlugin', 'markdownShortcode']); - #}); Hook::attach('shortcodeInitialized', ['MarkdownPlugin', 'addShortcode']); } diff --git a/plugins/shortcode/shortcode.php b/plugins/shortcode/shortcode.php index 674f6fdd..94389c57 100644 --- a/plugins/shortcode/shortcode.php +++ b/plugins/shortcode/shortcode.php @@ -360,11 +360,6 @@ protected function addFileTag() $attributes = $this->extractValuesFromArray(['title', 'text', 'alt', 'class'], $options); $attributes['alt'] = isset($attributes['alt']) ? $attributes['alt'] : ''; - // Interne Ressource - if (strpos($options['path'], 'http') !== 0) { - #$options['path'] = $this->config->get('web.url') . '/' . $options['src']; - } - $info = ''; if (!empty($options['info'])) { $info = $this->getFileInfo($options['path']); diff --git a/plugins/twig/classes/HerbieExtension.php b/plugins/twig/classes/HerbieExtension.php index 36e8371a..9543936c 100644 --- a/plugins/twig/classes/HerbieExtension.php +++ b/plugins/twig/classes/HerbieExtension.php @@ -482,7 +482,6 @@ public function functionPagetitle(array $options = []) $titles[] = $item->title; } - #$page = Application::getPage(); if ($this->testIsPost($this->page)) { $titles[] = $this->page->title; } @@ -549,10 +548,6 @@ public function functionPager($limit = '', $template = '{prev}{next}', $linkClas } $replacements['{prev}'] = $this->createLink($prev->route, $label, $attribs); } - /*if(isset($cur)) { - $label = empty($curPageLabel) ? $cur->getMenuTitle() : $curPageLabel; - $replacements['{cur}'] = $this->createLink($cur->route, $label, $attribs); - }*/ if (isset($next)) { $label = empty($nextPageLabel) ? $next->getMenuTitle() : $nextPageLabel; $label = sprintf('%s', $label); diff --git a/system/Application.php b/system/Application.php index 1161beff..76f72c5b 100644 --- a/system/Application.php +++ b/system/Application.php @@ -156,7 +156,7 @@ private function init() $route = $DI['Request']->getRoute(); - $page = false; ##$DI['Cache\PageCache']->get($route); + $page = false; if (false === $page) { @@ -168,10 +168,6 @@ private function init() $page->load($path); Hook::trigger(Hook::ACTION, 'pageLoaded', $page); - - if (empty($menuItem->nocache)) { - ##$DI['Cache\PageCache']->set($path, $page); - } } } catch (\Exception $e) { diff --git a/system/Config.php b/system/Config.php index 6e386a8a..dae09e8b 100644 --- a/system/Config.php +++ b/system/Config.php @@ -57,15 +57,12 @@ public function __construct($sitePath, $webPath, $webUrl) private function loadConfig($useCache = true) { if ($useCache) { - #$cacheFile = $this->sitePath . '/cache/config.json'; $cacheFile = $this->sitePath . '/cache/config.php'; if (is_file($cacheFile)) { - #$this->items = json_decode(file_get_contents($cacheFile), true); $this->items = require($cacheFile); } else { $this->loadMainFile(); $this->loadPluginFiles(); - #file_put_contents($cacheFile, json_encode($this->items)); file_put_contents($cacheFile, 'items, true).';'); } } else { diff --git a/system/Finder/Finder.php b/system/Finder/Finder.php index b1c2f2e1..8dade5fc 100644 --- a/system/Finder/Finder.php +++ b/system/Finder/Finder.php @@ -117,10 +117,6 @@ public function getIterator() $iterator = new ExtensionFilterIterator($iterator, $this->extensions); } - if ($this->minDepth > -1 || $this->maxDepth < PHP_INT_MAX) { - #$iterator = new DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth); - } - return $iterator; } diff --git a/system/Helper/PageHelper.php b/system/Helper/PageHelper.php index 7880e7b1..a1453f3d 100644 --- a/system/Helper/PageHelper.php +++ b/system/Helper/PageHelper.php @@ -46,19 +46,16 @@ public static function updateSegments($filepath, array $segments) if (array_key_exists(0, $segments)) { $newContent .= PHP_EOL; $newContent .= $segments[0]; - #$newContent .= PHP_EOL; unset($segments[0]); } if (array_key_exists('', $segments)) { $newContent .= PHP_EOL; $newContent .= $segments['']; - #$newContent .= PHP_EOL; unset($segments['']); } foreach ($segments as $key => $value) { $newContent .= PHP_EOL . '--- ' . $key . ' ---' . PHP_EOL; $newContent .= $value; - #$newContent .= PHP_EOL; } return file_put_contents($filepath, $newContent); diff --git a/system/Menu/Page/FileFilterCallback.php b/system/Menu/Page/FileFilterCallback.php index 0a5ddc87..7d819627 100644 --- a/system/Menu/Page/FileFilterCallback.php +++ b/system/Menu/Page/FileFilterCallback.php @@ -34,7 +34,7 @@ public function __construct($extensions) * @param \RecursiveDirectoryIterator $iterator * @return boolean */ - public function call(\SplFileInfo $file, $path, \RecursiveDirectoryIterator $iterator) + public function call(\SplFileInfo $file) { $firstChar = substr($file->getFileName(), 0, 1); if (in_array($firstChar, ['.', '_'])) { diff --git a/system/Menu/Page/Iterator/FilterCallback.php b/system/Menu/Page/Iterator/FilterCallback.php index 893ff8f2..dcdecb1c 100644 --- a/system/Menu/Page/Iterator/FilterCallback.php +++ b/system/Menu/Page/Iterator/FilterCallback.php @@ -24,7 +24,7 @@ public function __construct(array $routeLine) $this->routeLine = $routeLine; } - public function call(\Herbie\Menu\Page\Node $current, $key, $iterator) + public function call(\Herbie\Menu\Page\Node $current) { $menuItem = $current->getMenuItem(); diff --git a/system/Menu/Post/Builder.php b/system/Menu/Post/Builder.php index e509b380..fe4c1ae6 100644 --- a/system/Menu/Post/Builder.php +++ b/system/Menu/Post/Builder.php @@ -88,7 +88,6 @@ public function build($path = null) } $this->cache->set(__CLASS__, $collection); } - #echo"
    ";print_r($collection);echo"
    "; return $collection; } } From 74317dd3f82c49300ef0651f83cf08fbc2794879 Mon Sep 17 00:00:00 2001 From: Andreas Neumann Date: Fri, 4 Mar 2016 13:06:07 +0100 Subject: [PATCH 12/17] [CHANGE] SensioLabsInsight (netzweberei / herbie #3): Text files should end with a newline character --- .gitignore | 2 +- README.md | 2 +- log/.gitignore | 2 +- plugins/markdown/composer.json | 2 +- plugins/textile/composer.json | 2 +- plugins/twig/classes/widgets/listing.twig | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index da9562f3..b294f429 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,4 @@ cache/twig/ /apps # Tests -/src/Tests \ No newline at end of file +/src/Tests diff --git a/README.md b/README.md index 7dd9699a..4aa72b63 100644 --- a/README.md +++ b/README.md @@ -42,4 +42,4 @@ Weitere Informationen findest du unter [www.getherbie.org](http://www.getherbie. [packagist]: https://packagist.org [symfony]: http://symfony.com/doc/current/components/ [phpunit]: http://phpunit.de -[imagine]: https://github.com/avalanche123/Imagine \ No newline at end of file +[imagine]: https://github.com/avalanche123/Imagine diff --git a/log/.gitignore b/log/.gitignore index 86d0cb27..5e7d2734 100644 --- a/log/.gitignore +++ b/log/.gitignore @@ -1,4 +1,4 @@ # Ignore everything in this directory * # Except this file -!.gitignore \ No newline at end of file +!.gitignore diff --git a/plugins/markdown/composer.json b/plugins/markdown/composer.json index bdacc0cd..89894905 100644 --- a/plugins/markdown/composer.json +++ b/plugins/markdown/composer.json @@ -5,4 +5,4 @@ "keywords": ["herbie", "plugin", "markdown"], "type": "herbie-plugin", "license": "BSD-3-Clause" -} \ No newline at end of file +} diff --git a/plugins/textile/composer.json b/plugins/textile/composer.json index 2e19afd6..5be35f86 100644 --- a/plugins/textile/composer.json +++ b/plugins/textile/composer.json @@ -5,4 +5,4 @@ "keywords": ["herbie", "plugin", "textile"], "type": "herbie-plugin", "license": "BSD-3-Clause" -} \ No newline at end of file +} diff --git a/plugins/twig/classes/widgets/listing.twig b/plugins/twig/classes/widgets/listing.twig index 2bf07060..9a579cd0 100644 --- a/plugins/twig/classes/widgets/listing.twig +++ b/plugins/twig/classes/widgets/listing.twig @@ -22,4 +22,4 @@ Nächste Seite {% endif %} -
    \ No newline at end of file +
    From 05555a459ba9160ff84d50ab411952893e1e0676 Mon Sep 17 00:00:00 2001 From: Andreas Neumann Date: Fri, 4 Mar 2016 17:30:43 +0100 Subject: [PATCH 13/17] [CHANGE] SensioLabsInsight: Don't silence errors by the at sign (@) Adding "@" before list($name, $callable, $options) = $function prevents warning and errors during this function execution from being displayed. If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions. --- plugins/twig/classes/Twig.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/twig/classes/Twig.php b/plugins/twig/classes/Twig.php index eb545565..de4eb71b 100644 --- a/plugins/twig/classes/Twig.php +++ b/plugins/twig/classes/Twig.php @@ -64,18 +64,24 @@ public function init() $this->addTwigPlugins(); foreach(Hook::trigger(Hook::CONFIG, 'addTwigFunction') as $function) { - @list($name, $callable, $options) = $function; - $this->environment->addFunction(new \Twig_SimpleFunction($name, $callable, (array)$options)); + try { + list($name, $callable, $options) = $function; + $this->environment->addFunction(new \Twig_SimpleFunction($name, $callable, (array)$options)); + } catch (\Exception $e) {;/*do nothing else yet*/} } foreach(Hook::trigger(Hook::CONFIG, 'addTwigFilter') as $filter) { - @list($name, $callable, $options) = $filter; - $this->environment->addFilter(new \Twig_SimpleFilter($name, $callable, (array)$options)); + try { + list($name, $callable, $options) = $filter; + $this->environment->addFilter(new \Twig_SimpleFilter($name, $callable, (array)$options)); + } catch (\Exception $e) {;/*do nothing else yet*/} } foreach(Hook::trigger(Hook::CONFIG, 'addTwigTest') as $test) { - @list($name, $callable, $options) = $test; - $this->environment->addTest(new \Twig_SimpleTest($name, $callable, (array)$options)); + try { + list($name, $callable, $options) = $test; + $this->environment->addTest(new \Twig_SimpleTest($name, $callable, (array)$options)); + } catch (\Exception $e) {;/*do nothing else yet*/} } $this->initialized = true; From bfa2bdf369a17b620ee27a4bdf189613f6bc72a8 Mon Sep 17 00:00:00 2001 From: Andreas Neumann Date: Fri, 4 Mar 2016 17:36:07 +0100 Subject: [PATCH 14/17] [CHANGE] User specific files should not appear in .gitignore - moved 'nbproject' and '.DS_Store' to global ignore-file --- .gitignore | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitignore b/.gitignore index da9562f3..1a62abe6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ -# netbeans project files -nbproject - # apigen docs dir /docs @@ -13,9 +10,6 @@ composer.phar # composer lock files composer.lock -# mac DS_Store files -.DS_Store - # cache folders cache/data/ cache/page/ From 79fa92c44b458e59bf34a29d64d5f5a32b7f2ee2 Mon Sep 17 00:00:00 2001 From: Andreas Neumann Date: Fri, 4 Mar 2016 17:57:58 +0100 Subject: [PATCH 15/17] [FEATURE] SensioLabsInsight: Remove unused code -> Didn't remove unused properties 'minDepth' and 'maxDepth', but used them in the getIterator()-method (i.e. uncommented line #121) --- system/Finder/Finder.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/system/Finder/Finder.php b/system/Finder/Finder.php index 8dade5fc..35eca1ef 100644 --- a/system/Finder/Finder.php +++ b/system/Finder/Finder.php @@ -117,6 +117,10 @@ public function getIterator() $iterator = new ExtensionFilterIterator($iterator, $this->extensions); } + if ($this->minDepth > -1 || $this->maxDepth < PHP_INT_MAX) { + $iterator = new DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth); + } + return $iterator; } From a25f2990db4d0eb9b6f27338d8174e3d1635084d Mon Sep 17 00:00:00 2001 From: Thomas Breuss Date: Tue, 8 Mar 2016 18:53:42 +0100 Subject: [PATCH 16/17] Delete twig doc & test folders --- .../twig/vendor/twig/twig/doc/advanced.rst | 872 ----------------- .../vendor/twig/twig/doc/advanced_legacy.rst | 887 ----------------- plugins/twig/vendor/twig/twig/doc/api.rst | 552 ----------- .../vendor/twig/twig/doc/coding_standards.rst | 101 -- .../twig/vendor/twig/twig/doc/deprecated.rst | 162 ---- .../twig/vendor/twig/twig/doc/filters/abs.rst | 18 - .../vendor/twig/twig/doc/filters/batch.rst | 51 - .../twig/twig/doc/filters/capitalize.rst | 11 - .../twig/doc/filters/convert_encoding.rst | 28 - .../vendor/twig/twig/doc/filters/date.rst | 94 -- .../twig/twig/doc/filters/date_modify.rst | 23 - .../vendor/twig/twig/doc/filters/default.rst | 33 - .../vendor/twig/twig/doc/filters/escape.rst | 116 --- .../vendor/twig/twig/doc/filters/first.rst | 25 - .../vendor/twig/twig/doc/filters/format.rst | 16 - .../vendor/twig/twig/doc/filters/index.rst | 37 - .../vendor/twig/twig/doc/filters/join.rst | 23 - .../twig/twig/doc/filters/json_encode.rst | 21 - .../vendor/twig/twig/doc/filters/keys.rst | 11 - .../vendor/twig/twig/doc/filters/last.rst | 25 - .../vendor/twig/twig/doc/filters/length.rst | 11 - .../vendor/twig/twig/doc/filters/lower.rst | 10 - .../vendor/twig/twig/doc/filters/merge.rst | 48 - .../vendor/twig/twig/doc/filters/nl2br.rst | 22 - .../twig/twig/doc/filters/number_format.rst | 45 - .../twig/vendor/twig/twig/doc/filters/raw.rst | 36 - .../vendor/twig/twig/doc/filters/replace.rst | 19 - .../vendor/twig/twig/doc/filters/reverse.rst | 47 - .../vendor/twig/twig/doc/filters/round.rst | 37 - .../vendor/twig/twig/doc/filters/slice.rst | 71 -- .../vendor/twig/twig/doc/filters/sort.rst | 18 - .../vendor/twig/twig/doc/filters/split.rst | 53 - .../twig/twig/doc/filters/striptags.rst | 15 - .../vendor/twig/twig/doc/filters/title.rst | 11 - .../vendor/twig/twig/doc/filters/trim.rst | 29 - .../vendor/twig/twig/doc/filters/upper.rst | 10 - .../twig/twig/doc/filters/url_encode.rst | 34 - .../twig/twig/doc/functions/attribute.rst | 26 - .../vendor/twig/twig/doc/functions/block.rst | 15 - .../twig/twig/doc/functions/constant.rst | 18 - .../vendor/twig/twig/doc/functions/cycle.rst | 28 - .../vendor/twig/twig/doc/functions/date.rst | 52 - .../vendor/twig/twig/doc/functions/dump.rst | 69 -- .../twig/twig/doc/functions/include.rst | 80 -- .../vendor/twig/twig/doc/functions/index.rst | 20 - .../vendor/twig/twig/doc/functions/max.rst | 20 - .../vendor/twig/twig/doc/functions/min.rst | 20 - .../vendor/twig/twig/doc/functions/parent.rst | 20 - .../vendor/twig/twig/doc/functions/random.rst | 29 - .../vendor/twig/twig/doc/functions/range.rst | 45 - .../vendor/twig/twig/doc/functions/source.rst | 32 - .../doc/functions/template_from_string.rst | 32 - plugins/twig/vendor/twig/twig/doc/index.rst | 19 - .../vendor/twig/twig/doc/installation.rst | 116 --- .../twig/vendor/twig/twig/doc/internals.rst | 138 --- plugins/twig/vendor/twig/twig/doc/intro.rst | 85 -- plugins/twig/vendor/twig/twig/doc/recipes.rst | 518 ---------- .../vendor/twig/twig/doc/tags/autoescape.rst | 83 -- .../twig/vendor/twig/twig/doc/tags/block.rst | 11 - plugins/twig/vendor/twig/twig/doc/tags/do.rst | 12 - .../twig/vendor/twig/twig/doc/tags/embed.rst | 178 ---- .../vendor/twig/twig/doc/tags/extends.rst | 268 ------ .../twig/vendor/twig/twig/doc/tags/filter.rst | 21 - .../twig/vendor/twig/twig/doc/tags/flush.rst | 17 - .../twig/vendor/twig/twig/doc/tags/for.rst | 172 ---- .../twig/vendor/twig/twig/doc/tags/from.rst | 8 - plugins/twig/vendor/twig/twig/doc/tags/if.rst | 76 -- .../twig/vendor/twig/twig/doc/tags/import.rst | 57 -- .../vendor/twig/twig/doc/tags/include.rst | 86 -- .../twig/vendor/twig/twig/doc/tags/index.rst | 24 - .../twig/vendor/twig/twig/doc/tags/macro.rst | 86 -- .../vendor/twig/twig/doc/tags/sandbox.rst | 30 - .../twig/vendor/twig/twig/doc/tags/set.rst | 78 -- .../vendor/twig/twig/doc/tags/spaceless.rst | 37 - .../twig/vendor/twig/twig/doc/tags/use.rst | 124 --- .../vendor/twig/twig/doc/tags/verbatim.rst | 24 - .../twig/vendor/twig/twig/doc/templates.rst | 907 ------------------ .../vendor/twig/twig/doc/tests/constant.rst | 22 - .../vendor/twig/twig/doc/tests/defined.rst | 30 - .../twig/twig/doc/tests/divisibleby.rst | 14 - .../twig/vendor/twig/twig/doc/tests/empty.rst | 11 - .../twig/vendor/twig/twig/doc/tests/even.rst | 10 - .../twig/vendor/twig/twig/doc/tests/index.rst | 15 - .../vendor/twig/twig/doc/tests/iterable.rst | 19 - .../twig/vendor/twig/twig/doc/tests/null.rst | 12 - .../twig/vendor/twig/twig/doc/tests/odd.rst | 10 - .../vendor/twig/twig/doc/tests/sameas.rst | 14 - .../twig/test/Twig/Tests/AutoloaderTest.php | 24 - .../test/Twig/Tests/Cache/FilesystemTest.php | 193 ---- .../twig/test/Twig/Tests/CompilerTest.php | 33 - .../twig/test/Twig/Tests/EnvironmentTest.php | 529 ---------- .../twig/twig/test/Twig/Tests/ErrorTest.php | 144 --- .../test/Twig/Tests/ExpressionParserTest.php | 368 ------- .../test/Twig/Tests/Extension/CoreTest.php | 158 --- .../test/Twig/Tests/Extension/SandboxTest.php | 220 ----- .../twig/test/Twig/Tests/FileCachingTest.php | 63 -- .../FileExtensionEscapingStrategyTest.php | 51 - .../twig/test/Twig/Tests/FilesystemHelper.php | 30 - .../Tests/Fixtures/autoescape/filename.test | 18 - .../test/Twig/Tests/Fixtures/errors/base.html | 1 - .../Twig/Tests/Fixtures/errors/index.html | 7 - ...ltiline_array_with_undefined_variable.test | 18 - ...e_array_with_undefined_variable_again.test | 18 - ...line_function_with_undefined_variable.test | 12 - ...tiline_function_with_unknown_argument.test | 9 - ...multiline_tag_with_undefined_variable.test | 12 - .../syntax_error_in_reused_template.test | 10 - .../Fixtures/exceptions/unclosed_tag.test | 20 - .../Fixtures/exceptions/undefined_parent.test | 8 - .../undefined_template_in_child_template.test | 15 - .../Fixtures/exceptions/undefined_trait.test | 9 - .../Tests/Fixtures/expressions/array.test | 61 -- .../Fixtures/expressions/array_call.test | 14 - .../Tests/Fixtures/expressions/binary.test | 46 - .../Tests/Fixtures/expressions/bitwise.test | 14 - .../Fixtures/expressions/comparison.test | 14 - .../Fixtures/expressions/divisibleby.test | 17 - .../Tests/Fixtures/expressions/dotdot.test | 20 - .../Tests/Fixtures/expressions/ends_with.test | 26 - .../Tests/Fixtures/expressions/grouping.test | 8 - .../Tests/Fixtures/expressions/literals.test | 22 - .../Fixtures/expressions/magic_call.test | 27 - .../Tests/Fixtures/expressions/matches.test | 12 - .../Fixtures/expressions/method_call.test | 28 - .../expressions/negative_numbers.test | 18 - .../expressions/operators_as_variables.test | 16 - .../Tests/Fixtures/expressions/postfix.test | 22 - .../Tests/Fixtures/expressions/sameas.test | 21 - .../Fixtures/expressions/starts_with.test | 27 - .../Tests/Fixtures/expressions/strings.test | 10 - .../expressions/ternary_operator.test | 18 - .../expressions/ternary_operator_noelse.test | 10 - .../expressions/ternary_operator_nothen.test | 10 - .../two_word_operators_as_variables.test | 8 - .../Tests/Fixtures/expressions/unary.test | 12 - .../expressions/unary_macro_arguments.test | 22 - .../expressions/unary_precedence.test | 14 - .../test/Twig/Tests/Fixtures/filters/abs.test | 30 - .../Twig/Tests/Fixtures/filters/batch.test | 31 - .../Tests/Fixtures/filters/batch_float.test | 29 - .../filters/batch_with_empty_fill.test | 37 - .../filters/batch_with_exact_elements.test | 33 - .../Fixtures/filters/batch_with_fill.test | 37 - .../Fixtures/filters/batch_with_keys.test | 10 - .../filters/batch_with_zero_elements.test | 10 - .../Fixtures/filters/convert_encoding.test | 10 - .../Twig/Tests/Fixtures/filters/date.test | 90 -- .../Fixtures/filters/date_default_format.test | 14 - .../filters/date_default_format_interval.test | 16 - .../Fixtures/filters/date_immutable.test | 37 - .../Tests/Fixtures/filters/date_interval.test | 19 - .../Tests/Fixtures/filters/date_modify.test | 14 - .../Fixtures/filters/date_namedargs.test | 13 - .../Twig/Tests/Fixtures/filters/default.test | 150 --- .../Fixtures/filters/dynamic_filter.test | 10 - .../Twig/Tests/Fixtures/filters/escape.test | 8 - .../Fixtures/filters/escape_html_attr.test | 8 - .../filters/escape_non_supported_charset.test | 8 - .../Twig/Tests/Fixtures/filters/first.test | 17 - .../Tests/Fixtures/filters/force_escape.test | 18 - .../Twig/Tests/Fixtures/filters/format.test | 8 - .../Twig/Tests/Fixtures/filters/join.test | 12 - .../Tests/Fixtures/filters/json_encode.test | 12 - .../Twig/Tests/Fixtures/filters/last.test | 17 - .../Twig/Tests/Fixtures/filters/length.test | 14 - .../Tests/Fixtures/filters/length_utf8.test | 12 - .../Twig/Tests/Fixtures/filters/merge.test | 18 - .../Twig/Tests/Fixtures/filters/nl2br.test | 14 - .../Tests/Fixtures/filters/number_format.test | 18 - .../filters/number_format_default.test | 21 - .../Twig/Tests/Fixtures/filters/replace.test | 12 - .../Fixtures/filters/replace_invalid_arg.test | 8 - .../Twig/Tests/Fixtures/filters/reverse.test | 18 - .../Twig/Tests/Fixtures/filters/round.test | 22 - .../Twig/Tests/Fixtures/filters/slice.test | 54 -- .../Twig/Tests/Fixtures/filters/sort.test | 12 - .../Tests/Fixtures/filters/special_chars.test | 8 - .../Twig/Tests/Fixtures/filters/split.test | 20 - .../Tests/Fixtures/filters/split_utf8.test | 24 - .../Twig/Tests/Fixtures/filters/trim.test | 12 - .../Tests/Fixtures/filters/urlencode.test | 16 - .../filters/urlencode_deprecated.test | 16 - .../Tests/Fixtures/functions/attribute.test | 18 - .../Twig/Tests/Fixtures/functions/block.test | 12 - .../Tests/Fixtures/functions/constant.test | 10 - .../Twig/Tests/Fixtures/functions/cycle.test | 16 - .../Twig/Tests/Fixtures/functions/date.test | 25 - .../Fixtures/functions/date_namedargs.test | 11 - .../Twig/Tests/Fixtures/functions/dump.test | 16 - .../Tests/Fixtures/functions/dump_array.test | 19 - .../Fixtures/functions/dynamic_function.test | 10 - .../functions/include/assignment.test | 13 - .../functions/include/autoescaping.test | 10 - .../Fixtures/functions/include/basic.test | 17 - .../functions/include/expression.test | 17 - .../functions/include/ignore_missing.test | 10 - .../Fixtures/functions/include/missing.test | 8 - .../functions/include/missing_nested.test | 16 - .../Fixtures/functions/include/sandbox.test | 13 - .../functions/include/sandbox_disabling.test | 16 - .../sandbox_disabling_ignore_missing.test | 13 - .../functions/include/template_instance.test | 10 - .../functions/include/templates_as_array.test | 12 - .../functions/include/with_context.test | 16 - .../functions/include/with_variables.test | 12 - .../Twig/Tests/Fixtures/functions/max.test | 12 - .../Twig/Tests/Fixtures/functions/min.test | 12 - .../Twig/Tests/Fixtures/functions/range.test | 8 - .../recursive_block_with_inheritance.test | 21 - .../Twig/Tests/Fixtures/functions/source.test | 17 - .../Fixtures/functions/special_chars.test | 8 - .../functions/template_from_string.test | 15 - .../Tests/Fixtures/macros/default_values.test | 16 - .../Tests/Fixtures/macros/nested_calls.test | 18 - .../Fixtures/macros/reserved_variables.test | 14 - .../Twig/Tests/Fixtures/macros/simple.test | 22 - .../Twig/Tests/Fixtures/macros/varargs.test | 21 - .../Fixtures/macros/varargs_argument.test | 8 - .../Tests/Fixtures/macros/with_filters.test | 14 - .../regression/combined_debug_info.test | 15 - .../Fixtures/regression/empty_token.test | 8 - .../Tests/Fixtures/regression/issue_1143.test | 23 - .../Fixtures/regression/multi_word_tests.test | 10 - .../regression/simple_xml_element.test | 19 - .../regression/strings_like_numbers.test | 8 - .../Tests/Fixtures/tags/autoescape/basic.test | 26 - .../Fixtures/tags/autoescape/blocks.test | 12 - .../tags/autoescape/double_escaping.test | 10 - .../Fixtures/tags/autoescape/functions.test | 83 -- .../Fixtures/tags/autoescape/literal.test | 45 - .../Fixtures/tags/autoescape/nested.test | 26 - .../Fixtures/tags/autoescape/objects.test | 26 - .../Tests/Fixtures/tags/autoescape/raw.test | 10 - .../tags/autoescape/strategy.legacy.test | 11 - .../Fixtures/tags/autoescape/strategy.test | 11 - .../Tests/Fixtures/tags/autoescape/type.test | 69 -- .../tags/autoescape/with_filters.test | 131 --- .../autoescape/with_filters_arguments.test | 23 - .../autoescape/with_pre_escape_filters.test | 68 -- .../with_preserves_safety_filters.test | 50 - .../Twig/Tests/Fixtures/tags/block/basic.test | 11 - .../tags/block/block_unique_name.test | 11 - .../Fixtures/tags/block/special_chars.test | 10 - .../Twig/Tests/Fixtures/tags/embed/basic.test | 35 - .../Tests/Fixtures/tags/embed/error_line.test | 16 - .../Tests/Fixtures/tags/embed/multiple.test | 50 - .../Tests/Fixtures/tags/embed/nested.test | 42 - .../Fixtures/tags/embed/with_extends.test | 60 -- .../Tests/Fixtures/tags/filter/basic.test | 10 - .../Fixtures/tags/filter/json_encode.test | 8 - .../Tests/Fixtures/tags/filter/multiple.test | 10 - .../Tests/Fixtures/tags/filter/nested.test | 16 - .../Fixtures/tags/filter/with_for_tag.test | 13 - .../Fixtures/tags/filter/with_if_tag.test | 29 - .../Tests/Fixtures/tags/for/condition.test | 14 - .../Twig/Tests/Fixtures/tags/for/context.test | 18 - .../Twig/Tests/Fixtures/tags/for/else.test | 23 - .../Fixtures/tags/for/inner_variables.test | 17 - .../Twig/Tests/Fixtures/tags/for/keys.test | 11 - .../Fixtures/tags/for/keys_and_values.test | 11 - .../Tests/Fixtures/tags/for/loop_context.test | 19 - .../Fixtures/tags/for/loop_context_local.test | 10 - .../Fixtures/tags/for/loop_not_defined.test | 10 - .../tags/for/loop_not_defined_cond.test | 9 - .../Tests/Fixtures/tags/for/nested_else.test | 17 - .../Twig/Tests/Fixtures/tags/for/objects.test | 43 - .../Fixtures/tags/for/objects_countable.test | 47 - .../Tests/Fixtures/tags/for/recursive.test | 18 - .../Twig/Tests/Fixtures/tags/for/values.test | 11 - .../test/Twig/Tests/Fixtures/tags/from.test | 14 - .../Twig/Tests/Fixtures/tags/if/basic.test | 22 - .../Tests/Fixtures/tags/if/expression.test | 22 - .../Tests/Fixtures/tags/include/basic.test | 16 - .../Fixtures/tags/include/expression.test | 16 - .../Fixtures/tags/include/ignore_missing.test | 10 - .../Tests/Fixtures/tags/include/missing.test | 8 - .../Fixtures/tags/include/missing_nested.test | 16 - .../Tests/Fixtures/tags/include/only.test | 16 - .../tags/include/template_instance.test | 10 - .../tags/include/templates_as_array.test | 12 - .../Fixtures/tags/include/with_variables.test | 12 - .../Fixtures/tags/inheritance/basic.test | 14 - .../Fixtures/tags/inheritance/block_expr.test | 32 - .../tags/inheritance/block_expr2.test | 34 - .../tags/inheritance/conditional.test | 14 - .../Fixtures/tags/inheritance/dynamic.test | 14 - .../Fixtures/tags/inheritance/empty.test | 10 - .../tags/inheritance/extends_as_array.test | 12 - .../extends_as_array_with_empty_name.test | 12 - .../extends_as_array_with_null_name.test | 12 - .../Fixtures/tags/inheritance/multiple.test | 12 - .../tags/inheritance/multiple_dynamic.test | 22 - .../tags/inheritance/nested_blocks.test | 22 - .../nested_blocks_parent_only.test | 15 - .../tags/inheritance/nested_inheritance.test | 16 - .../Fixtures/tags/inheritance/parent.test | 12 - .../tags/inheritance/parent_change.test | 16 - .../tags/inheritance/parent_in_a_block.test | 8 - .../tags/inheritance/parent_isolation.test | 20 - .../tags/inheritance/parent_nested.test | 28 - .../inheritance/parent_without_extends.test | 8 - .../parent_without_extends_but_traits.test | 14 - .../tags/inheritance/template_instance.test | 14 - .../Tests/Fixtures/tags/inheritance/use.test | 44 - .../Twig/Tests/Fixtures/tags/macro/basic.test | 17 - .../Fixtures/tags/macro/endmacro_name.test | 16 - .../Tests/Fixtures/tags/macro/external.test | 17 - .../Twig/Tests/Fixtures/tags/macro/from.test | 18 - .../tags/macro/from_with_reserved_name.test | 9 - .../Tests/Fixtures/tags/macro/global.test | 14 - .../tags/macro/import_with_reserved_nam.test | 11 - .../Fixtures/tags/macro/reserved_name.test | 10 - .../Fixtures/tags/macro/self_import.test | 17 - .../Fixtures/tags/macro/special_chars.test | 14 - .../Fixtures/tags/macro/super_globals.test | 14 - .../Tests/Fixtures/tags/raw/basic.legacy.test | 10 - .../tags/raw/mixed_usage_with_raw.legacy.test | 10 - .../tags/raw/whitespace_control.legacy.test | 56 -- .../Fixtures/tags/sandbox/not_valid1.test | 11 - .../Fixtures/tags/sandbox/not_valid2.test | 14 - .../Tests/Fixtures/tags/sandbox/simple.test | 22 - .../Twig/Tests/Fixtures/tags/set/basic.test | 20 - .../Fixtures/tags/set/capture-empty.test | 9 - .../Twig/Tests/Fixtures/tags/set/capture.test | 10 - .../Tests/Fixtures/tags/set/expression.test | 12 - .../Tests/Fixtures/tags/spaceless/simple.test | 12 - .../Tests/Fixtures/tags/special_chars.test | 8 - .../Twig/Tests/Fixtures/tags/trim_block.test | 74 -- .../Twig/Tests/Fixtures/tags/use/aliases.test | 12 - .../Twig/Tests/Fixtures/tags/use/basic.test | 12 - .../Twig/Tests/Fixtures/tags/use/deep.test | 22 - .../Tests/Fixtures/tags/use/deep_empty.test | 10 - .../Tests/Fixtures/tags/use/inheritance.test | 25 - .../Tests/Fixtures/tags/use/inheritance2.test | 24 - .../Tests/Fixtures/tags/use/multiple.test | 21 - .../Fixtures/tags/use/multiple_aliases.test | 23 - .../Tests/Fixtures/tags/use/parent_block.test | 24 - .../Fixtures/tags/use/parent_block2.test | 24 - .../Fixtures/tags/use/parent_block3.test | 38 - .../Tests/Fixtures/tags/verbatim/basic.test | 10 - .../tags/verbatim/mixed_usage_with_raw.test | 10 - .../tags/verbatim/whitespace_control.test | 56 -- .../test/Twig/Tests/Fixtures/tests/array.test | 24 - .../Twig/Tests/Fixtures/tests/constant.test | 14 - .../Twig/Tests/Fixtures/tests/defined.test | 129 --- .../test/Twig/Tests/Fixtures/tests/empty.test | 45 - .../test/Twig/Tests/Fixtures/tests/even.test | 14 - .../test/Twig/Tests/Fixtures/tests/in.test | 128 --- .../Tests/Fixtures/tests/in_with_objects.test | 19 - .../Twig/Tests/Fixtures/tests/iterable.test | 19 - .../Tests/Fixtures/tests/null_coalesce.test | 30 - .../test/Twig/Tests/Fixtures/tests/odd.test | 10 - .../twig/test/Twig/Tests/IntegrationTest.php | 229 ----- .../Tests/LegacyFixtures/test.legacy.test | 8 - .../test/Twig/Tests/LegacyIntegrationTest.php | 54 -- .../twig/twig/test/Twig/Tests/LexerTest.php | 300 ------ .../twig/test/Twig/Tests/Loader/ArrayTest.php | 97 -- .../twig/test/Twig/Tests/Loader/ChainTest.php | 79 -- .../test/Twig/Tests/Loader/FilesystemTest.php | 175 ---- .../array_inheritance_empty_parent.html.twig | 3 - ...y_inheritance_nonexistent_parent.html.twig | 3 - .../array_inheritance_null_parent.html.twig | 3 - .../array_inheritance_valid_parent.html.twig | 3 - .../Fixtures/inheritance/parent.html.twig | 1 - .../inheritance/spare_parent.html.twig | 1 - .../Tests/Loader/Fixtures/named/index.html | 1 - .../Loader/Fixtures/named_bis/index.html | 1 - .../Loader/Fixtures/named_final/index.html | 1 - .../Fixtures/named_quater/named_absolute.html | 1 - .../Loader/Fixtures/named_ter/index.html | 1 - .../Tests/Loader/Fixtures/normal/index.html | 1 - .../Loader/Fixtures/normal_bis/index.html | 1 - .../Loader/Fixtures/normal_final/index.html | 1 - .../Loader/Fixtures/normal_ter/index.html | 1 - .../Fixtures/themes/theme1/blocks.html.twig | 3 - .../Fixtures/themes/theme2/blocks.html.twig | 3 - .../test/Twig/Tests/NativeExtensionTest.php | 33 - .../test/Twig/Tests/Node/AutoEscapeTest.php | 32 - .../Twig/Tests/Node/BlockReferenceTest.php | 31 - .../twig/test/Twig/Tests/Node/BlockTest.php | 39 - .../twig/twig/test/Twig/Tests/Node/DoTest.php | 32 - .../Twig/Tests/Node/Expression/ArrayTest.php | 37 - .../Tests/Node/Expression/AssignNameTest.php | 29 - .../Tests/Node/Expression/Binary/AddTest.php | 34 - .../Tests/Node/Expression/Binary/AndTest.php | 34 - .../Node/Expression/Binary/ConcatTest.php | 34 - .../Tests/Node/Expression/Binary/DivTest.php | 34 - .../Node/Expression/Binary/FloorDivTest.php | 34 - .../Tests/Node/Expression/Binary/ModTest.php | 34 - .../Tests/Node/Expression/Binary/MulTest.php | 34 - .../Tests/Node/Expression/Binary/OrTest.php | 34 - .../Tests/Node/Expression/Binary/SubTest.php | 34 - .../Twig/Tests/Node/Expression/CallTest.php | 116 --- .../Tests/Node/Expression/ConditionalTest.php | 38 - .../Tests/Node/Expression/ConstantTest.php | 30 - .../Twig/Tests/Node/Expression/FilterTest.php | 154 --- .../Tests/Node/Expression/FunctionTest.php | 110 --- .../Tests/Node/Expression/GetAttrTest.php | 50 - .../Twig/Tests/Node/Expression/NameTest.php | 35 - .../Node/Expression/PHP53/FilterInclude.php | 6 - .../Node/Expression/PHP53/FunctionInclude.php | 6 - .../Node/Expression/PHP53/TestInclude.php | 6 - .../Twig/Tests/Node/Expression/ParentTest.php | 28 - .../Twig/Tests/Node/Expression/TestTest.php | 82 -- .../Tests/Node/Expression/Unary/NegTest.php | 32 - .../Tests/Node/Expression/Unary/NotTest.php | 31 - .../Tests/Node/Expression/Unary/PosTest.php | 31 - .../twig/test/Twig/Tests/Node/ForTest.php | 191 ---- .../twig/twig/test/Twig/Tests/Node/IfTest.php | 88 -- .../twig/test/Twig/Tests/Node/ImportTest.php | 40 - .../twig/test/Twig/Tests/Node/IncludeTest.php | 83 -- .../twig/test/Twig/Tests/Node/MacroTest.php | 70 -- .../twig/test/Twig/Tests/Node/ModuleTest.php | 183 ---- .../twig/test/Twig/Tests/Node/PrintTest.php | 29 - .../twig/test/Twig/Tests/Node/SandboxTest.php | 44 - .../Twig/Tests/Node/SandboxedPrintTest.php | 33 - .../twig/test/Twig/Tests/Node/SetTest.php | 69 -- .../test/Twig/Tests/Node/SpacelessTest.php | 37 - .../twig/test/Twig/Tests/Node/TextTest.php | 28 - .../Twig/Tests/NodeVisitor/OptimizerTest.php | 124 --- .../twig/twig/test/Twig/Tests/ParserTest.php | 196 ---- .../Tests/Profiler/Dumper/AbstractTest.php | 101 -- .../Tests/Profiler/Dumper/BlackfireTest.php | 32 - .../Twig/Tests/Profiler/Dumper/HtmlTest.php | 30 - .../Twig/Tests/Profiler/Dumper/TextTest.php | 30 - .../test/Twig/Tests/Profiler/ProfileTest.php | 100 -- .../twig/test/Twig/Tests/TemplateTest.php | 693 ------------- .../twig/test/Twig/Tests/TokenStreamTest.php | 70 -- .../twig/test/Twig/Tests/escapingTest.php | 320 ------ .../twig/vendor/twig/twig/test/bootstrap.php | 13 - 430 files changed, 19389 deletions(-) delete mode 100644 plugins/twig/vendor/twig/twig/doc/advanced.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/advanced_legacy.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/api.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/coding_standards.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/deprecated.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/abs.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/batch.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/capitalize.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/convert_encoding.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/date.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/date_modify.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/default.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/escape.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/first.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/format.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/index.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/join.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/json_encode.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/keys.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/last.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/length.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/lower.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/merge.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/nl2br.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/number_format.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/raw.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/replace.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/reverse.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/round.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/slice.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/sort.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/split.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/striptags.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/title.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/trim.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/upper.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/filters/url_encode.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/attribute.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/block.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/constant.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/cycle.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/date.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/dump.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/include.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/index.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/max.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/min.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/parent.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/random.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/range.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/source.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/functions/template_from_string.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/index.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/installation.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/internals.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/intro.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/recipes.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/autoescape.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/block.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/do.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/embed.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/extends.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/filter.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/flush.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/for.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/from.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/if.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/import.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/include.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/index.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/macro.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/sandbox.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/set.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/spaceless.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/use.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tags/verbatim.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/templates.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tests/constant.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tests/defined.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tests/divisibleby.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tests/empty.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tests/even.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tests/index.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tests/iterable.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tests/null.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tests/odd.rst delete mode 100644 plugins/twig/vendor/twig/twig/doc/tests/sameas.rst delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/CompilerTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/ErrorTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/filename.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/LexerTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/DoTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/ParserTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/TemplateTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/Twig/Tests/escapingTest.php delete mode 100644 plugins/twig/vendor/twig/twig/test/bootstrap.php diff --git a/plugins/twig/vendor/twig/twig/doc/advanced.rst b/plugins/twig/vendor/twig/twig/doc/advanced.rst deleted file mode 100644 index 5b436ff2..00000000 --- a/plugins/twig/vendor/twig/twig/doc/advanced.rst +++ /dev/null @@ -1,872 +0,0 @@ -Extending Twig -============== - -.. caution:: - - This section describes how to extend Twig as of **Twig 1.12**. If you are - using an older version, read the :doc:`legacy` chapter - instead. - -Twig can be extended in many ways; you can add extra tags, filters, tests, -operators, global variables, and functions. You can even extend the parser -itself with node visitors. - -.. note:: - - The first section of this chapter describes how to extend Twig easily. If - you want to reuse your changes in different projects or if you want to - share them with others, you should then create an extension as described - in the following section. - -.. caution:: - - When extending Twig without creating an extension, Twig won't be able to - recompile your templates when the PHP code is updated. To see your changes - in real-time, either disable template caching or package your code into an - extension (see the next section of this chapter). - -Before extending Twig, you must understand the differences between all the -different possible extension points and when to use them. - -First, remember that Twig has two main language constructs: - -* ``{{ }}``: used to print the result of an expression evaluation; - -* ``{% %}``: used to execute statements. - -To understand why Twig exposes so many extension points, let's see how to -implement a *Lorem ipsum* generator (it needs to know the number of words to -generate). - -You can use a ``lipsum`` *tag*: - -.. code-block:: jinja - - {% lipsum 40 %} - -That works, but using a tag for ``lipsum`` is not a good idea for at least -three main reasons: - -* ``lipsum`` is not a language construct; -* The tag outputs something; -* The tag is not flexible as you cannot use it in an expression: - - .. code-block:: jinja - - {{ 'some text' ~ {% lipsum 40 %} ~ 'some more text' }} - -In fact, you rarely need to create tags; and that's good news because tags are -the most complex extension point of Twig. - -Now, let's use a ``lipsum`` *filter*: - -.. code-block:: jinja - - {{ 40|lipsum }} - -Again, it works, but it looks weird. A filter transforms the passed value to -something else but here we use the value to indicate the number of words to -generate (so, ``40`` is an argument of the filter, not the value we want to -transform). - -Next, let's use a ``lipsum`` *function*: - -.. code-block:: jinja - - {{ lipsum(40) }} - -Here we go. For this specific example, the creation of a function is the -extension point to use. And you can use it anywhere an expression is accepted: - -.. code-block:: jinja - - {{ 'some text' ~ lipsum(40) ~ 'some more text' }} - - {% set lipsum = lipsum(40) %} - -Last but not the least, you can also use a *global* object with a method able -to generate lorem ipsum text: - -.. code-block:: jinja - - {{ text.lipsum(40) }} - -As a rule of thumb, use functions for frequently used features and global -objects for everything else. - -Keep in mind the following when you want to extend Twig: - -========== ========================== ========== ========================= -What? Implementation difficulty? How often? When? -========== ========================== ========== ========================= -*macro* trivial frequent Content generation -*global* trivial frequent Helper object -*function* trivial frequent Content generation -*filter* trivial frequent Value transformation -*tag* complex rare DSL language construct -*test* trivial rare Boolean decision -*operator* trivial rare Values transformation -========== ========================== ========== ========================= - -Globals -------- - -A global variable is like any other template variable, except that it's -available in all templates and macros:: - - $twig = new Twig_Environment($loader); - $twig->addGlobal('text', new Text()); - -You can then use the ``text`` variable anywhere in a template: - -.. code-block:: jinja - - {{ text.lipsum(40) }} - -Filters -------- - -Creating a filter is as simple as associating a name with a PHP callable:: - - // an anonymous function - $filter = new Twig_SimpleFilter('rot13', function ($string) { - return str_rot13($string); - }); - - // or a simple PHP function - $filter = new Twig_SimpleFilter('rot13', 'str_rot13'); - - // or a class method - $filter = new Twig_SimpleFilter('rot13', array('SomeClass', 'rot13Filter')); - -The first argument passed to the ``Twig_SimpleFilter`` constructor is the name -of the filter you will use in templates and the second one is the PHP callable -to associate with it. - -Then, add the filter to your Twig environment:: - - $twig = new Twig_Environment($loader); - $twig->addFilter($filter); - -And here is how to use it in a template: - -.. code-block:: jinja - - {{ 'Twig'|rot13 }} - - {# will output Gjvt #} - -When called by Twig, the PHP callable receives the left side of the filter -(before the pipe ``|``) as the first argument and the extra arguments passed -to the filter (within parentheses ``()``) as extra arguments. - -For instance, the following code: - -.. code-block:: jinja - - {{ 'TWIG'|lower }} - {{ now|date('d/m/Y') }} - -is compiled to something like the following:: - - - - -The ``Twig_SimpleFilter`` class takes an array of options as its last -argument:: - - $filter = new Twig_SimpleFilter('rot13', 'str_rot13', $options); - -Environment-aware Filters -~~~~~~~~~~~~~~~~~~~~~~~~~ - -If you want to access the current environment instance in your filter, set the -``needs_environment`` option to ``true``; Twig will pass the current -environment as the first argument to the filter call:: - - $filter = new Twig_SimpleFilter('rot13', function (Twig_Environment $env, $string) { - // get the current charset for instance - $charset = $env->getCharset(); - - return str_rot13($string); - }, array('needs_environment' => true)); - -Context-aware Filters -~~~~~~~~~~~~~~~~~~~~~ - -If you want to access the current context in your filter, set the -``needs_context`` option to ``true``; Twig will pass the current context as -the first argument to the filter call (or the second one if -``needs_environment`` is also set to ``true``):: - - $filter = new Twig_SimpleFilter('rot13', function ($context, $string) { - // ... - }, array('needs_context' => true)); - - $filter = new Twig_SimpleFilter('rot13', function (Twig_Environment $env, $context, $string) { - // ... - }, array('needs_context' => true, 'needs_environment' => true)); - -Automatic Escaping -~~~~~~~~~~~~~~~~~~ - -If automatic escaping is enabled, the output of the filter may be escaped -before printing. If your filter acts as an escaper (or explicitly outputs HTML -or JavaScript code), you will want the raw output to be printed. In such a -case, set the ``is_safe`` option:: - - $filter = new Twig_SimpleFilter('nl2br', 'nl2br', array('is_safe' => array('html'))); - -Some filters may need to work on input that is already escaped or safe, for -example when adding (safe) HTML tags to originally unsafe output. In such a -case, set the ``pre_escape`` option to escape the input data before it is run -through your filter:: - - $filter = new Twig_SimpleFilter('somefilter', 'somefilter', array('pre_escape' => 'html', 'is_safe' => array('html'))); - -Variadic Filters -~~~~~~~~~~~~~~~~ - -.. versionadded:: 1.19 - Support for variadic filters was added in Twig 1.19. - -When a filter should accept an arbitrary number of arguments, set the -``is_variadic`` option to ``true``; Twig will pass the extra arguments as the -last argument to the filter call as an array:: - - $filter = new Twig_SimpleFilter('thumbnail', function ($file, array $options = array()) { - // ... - }, array('is_variadic' => true)); - -Be warned that named arguments passed to a variadic filter cannot be checked -for validity as they will automatically end up in the option array. - -Dynamic Filters -~~~~~~~~~~~~~~~ - -A filter name containing the special ``*`` character is a dynamic filter as -the ``*`` can be any string:: - - $filter = new Twig_SimpleFilter('*_path', function ($name, $arguments) { - // ... - }); - -The following filters will be matched by the above defined dynamic filter: - -* ``product_path`` -* ``category_path`` - -A dynamic filter can define more than one dynamic parts:: - - $filter = new Twig_SimpleFilter('*_path_*', function ($name, $suffix, $arguments) { - // ... - }); - -The filter will receive all dynamic part values before the normal filter -arguments, but after the environment and the context. For instance, a call to -``'foo'|a_path_b()`` will result in the following arguments to be passed to -the filter: ``('a', 'b', 'foo')``. - -Deprecated Filters -~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 1.21 - Support for deprecated filters was added in Twig 1.21. - -You can mark a filter as being deprecated by setting the ``deprecated`` option -to ``true``. You can also give an alternative filter that replaces the -deprecated one when that makes sense:: - - $filter = new Twig_SimpleFilter('obsolete', function () { - // ... - }, array('deprecated' => true, 'alternative' => 'new_one')); - -When a filter is deprecated, Twig emits a deprecation notice when compiling a -template using it. See :ref:`deprecation-notices` for more information. - -Functions ---------- - -Functions are defined in the exact same way as filters, but you need to create -an instance of ``Twig_SimpleFunction``:: - - $twig = new Twig_Environment($loader); - $function = new Twig_SimpleFunction('function_name', function () { - // ... - }); - $twig->addFunction($function); - -Functions support the same features as filters, except for the ``pre_escape`` -and ``preserves_safety`` options. - -Tests ------ - -Tests are defined in the exact same way as filters and functions, but you need -to create an instance of ``Twig_SimpleTest``:: - - $twig = new Twig_Environment($loader); - $test = new Twig_SimpleTest('test_name', function () { - // ... - }); - $twig->addTest($test); - -Tests allow you to create custom application specific logic for evaluating -boolean conditions. As a simple example, let's create a Twig test that checks if -objects are 'red':: - - $twig = new Twig_Environment($loader); - $test = new Twig_SimpleTest('red', function ($value) { - if (isset($value->color) && $value->color == 'red') { - return true; - } - if (isset($value->paint) && $value->paint == 'red') { - return true; - } - return false; - }); - $twig->addTest($test); - -Test functions should always return true/false. - -When creating tests you can use the ``node_class`` option to provide custom test -compilation. This is useful if your test can be compiled into PHP primitives. -This is used by many of the tests built into Twig:: - - $twig = new Twig_Environment($loader); - $test = new Twig_SimpleTest( - 'odd', - null, - array('node_class' => 'Twig_Node_Expression_Test_Odd')); - $twig->addTest($test); - - class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test - { - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' % 2 == 1') - ->raw(')') - ; - } - } - -The above example shows how you can create tests that use a node class. The -node class has access to one sub-node called 'node'. This sub-node contains the -value that is being tested. When the ``odd`` filter is used in code such as: - -.. code-block:: jinja - - {% if my_value is odd %} - -The ``node`` sub-node will contain an expression of ``my_value``. Node-based -tests also have access to the ``arguments`` node. This node will contain the -various other arguments that have been provided to your test. - -If you want to pass a variable number of positional or named arguments to the -test, set the ``is_variadic`` option to ``true``. Tests also support dynamic -name feature as filters and functions. - -Tags ----- - -One of the most exciting features of a template engine like Twig is the -possibility to define new language constructs. This is also the most complex -feature as you need to understand how Twig's internals work. - -Let's create a simple ``set`` tag that allows the definition of simple -variables from within a template. The tag can be used like follows: - -.. code-block:: jinja - - {% set name = "value" %} - - {{ name }} - - {# should output value #} - -.. note:: - - The ``set`` tag is part of the Core extension and as such is always - available. The built-in version is slightly more powerful and supports - multiple assignments by default (cf. the template designers chapter for - more information). - -Three steps are needed to define a new tag: - -* Defining a Token Parser class (responsible for parsing the template code); - -* Defining a Node class (responsible for converting the parsed code to PHP); - -* Registering the tag. - -Registering a new tag -~~~~~~~~~~~~~~~~~~~~~ - -Adding a tag is as simple as calling the ``addTokenParser`` method on the -``Twig_Environment`` instance:: - - $twig = new Twig_Environment($loader); - $twig->addTokenParser(new Project_Set_TokenParser()); - -Defining a Token Parser -~~~~~~~~~~~~~~~~~~~~~~~ - -Now, let's see the actual code of this class:: - - class Project_Set_TokenParser extends Twig_TokenParser - { - public function parse(Twig_Token $token) - { - $parser = $this->parser; - $stream = $parser->getStream(); - - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - $stream->expect(Twig_Token::OPERATOR_TYPE, '='); - $value = $parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Project_Set_Node($name, $value, $token->getLine(), $this->getTag()); - } - - public function getTag() - { - return 'set'; - } - } - -The ``getTag()`` method must return the tag we want to parse, here ``set``. - -The ``parse()`` method is invoked whenever the parser encounters a ``set`` -tag. It should return a ``Twig_Node`` instance that represents the node (the -``Project_Set_Node`` calls creating is explained in the next section). - -The parsing process is simplified thanks to a bunch of methods you can call -from the token stream (``$this->parser->getStream()``): - -* ``getCurrent()``: Gets the current token in the stream. - -* ``next()``: Moves to the next token in the stream, *but returns the old one*. - -* ``test($type)``, ``test($value)`` or ``test($type, $value)``: Determines whether - the current token is of a particular type or value (or both). The value may be an - array of several possible values. - -* ``expect($type[, $value[, $message]])``: If the current token isn't of the given - type/value a syntax error is thrown. Otherwise, if the type and value are correct, - the token is returned and the stream moves to the next token. - -* ``look()``: Looks a the next token without consuming it. - -Parsing expressions is done by calling the ``parseExpression()`` like we did for -the ``set`` tag. - -.. tip:: - - Reading the existing ``TokenParser`` classes is the best way to learn all - the nitty-gritty details of the parsing process. - -Defining a Node -~~~~~~~~~~~~~~~ - -The ``Project_Set_Node`` class itself is rather simple:: - - class Project_Set_Node extends Twig_Node - { - public function __construct($name, Twig_Node_Expression $value, $line, $tag = null) - { - parent::__construct(array('value' => $value), array('name' => $name), $line, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('$context[\''.$this->getAttribute('name').'\'] = ') - ->subcompile($this->getNode('value')) - ->raw(";\n") - ; - } - } - -The compiler implements a fluid interface and provides methods that helps the -developer generate beautiful and readable PHP code: - -* ``subcompile()``: Compiles a node. - -* ``raw()``: Writes the given string as is. - -* ``write()``: Writes the given string by adding indentation at the beginning - of each line. - -* ``string()``: Writes a quoted string. - -* ``repr()``: Writes a PHP representation of a given value (see - ``Twig_Node_For`` for a usage example). - -* ``addDebugInfo()``: Adds the line of the original template file related to - the current node as a comment. - -* ``indent()``: Indents the generated code (see ``Twig_Node_Block`` for a - usage example). - -* ``outdent()``: Outdents the generated code (see ``Twig_Node_Block`` for a - usage example). - -.. _creating_extensions: - -Creating an Extension ---------------------- - -The main motivation for writing an extension is to move often used code into a -reusable class like adding support for internationalization. An extension can -define tags, filters, tests, operators, global variables, functions, and node -visitors. - -Creating an extension also makes for a better separation of code that is -executed at compilation time and code needed at runtime. As such, it makes -your code faster. - -Most of the time, it is useful to create a single extension for your project, -to host all the specific tags and filters you want to add to Twig. - -.. tip:: - - When packaging your code into an extension, Twig is smart enough to - recompile your templates whenever you make a change to it (when - ``auto_reload`` is enabled). - -.. note:: - - Before writing your own extensions, have a look at the Twig official - extension repository: http://github.com/twigphp/Twig-extensions. - -An extension is a class that implements the following interface:: - - interface Twig_ExtensionInterface - { - /** - * Initializes the runtime environment. - * - * This is where you can load some file that contains filter functions for instance. - * - * @param Twig_Environment $environment The current Twig_Environment instance - * - * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead - */ - function initRuntime(Twig_Environment $environment); - - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - function getTokenParsers(); - - /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances - */ - function getNodeVisitors(); - - /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters - */ - function getFilters(); - - /** - * Returns a list of tests to add to the existing list. - * - * @return array An array of tests - */ - function getTests(); - - /** - * Returns a list of functions to add to the existing list. - * - * @return array An array of functions - */ - function getFunctions(); - - /** - * Returns a list of operators to add to the existing list. - * - * @return array An array of operators - */ - function getOperators(); - - /** - * Returns a list of global variables to add to the existing list. - * - * @return array An array of global variables - * - * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_GlobalsInterface instead - */ - function getGlobals(); - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - function getName(); - } - -To keep your extension class clean and lean, it can inherit from the built-in -``Twig_Extension`` class instead of implementing the whole interface. That -way, you just need to implement the ``getName()`` method as the -``Twig_Extension`` provides empty implementations for all other methods. - -The ``getName()`` method must return a unique identifier for your extension. - -Now, with this information in mind, let's create the most basic extension -possible:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getName() - { - return 'project'; - } - } - -.. note:: - - Of course, this extension does nothing for now. We will customize it in - the next sections. - -Twig does not care where you save your extension on the filesystem, as all -extensions must be registered explicitly to be available in your templates. - -You can register an extension by using the ``addExtension()`` method on your -main ``Environment`` object:: - - $twig = new Twig_Environment($loader); - $twig->addExtension(new Project_Twig_Extension()); - -.. tip:: - - The bundled extensions are great examples of how extensions work. - -Globals -~~~~~~~ - -Global variables can be registered in an extension via the ``getGlobals()`` -method:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getGlobals() - { - return array( - 'text' => new Text(), - ); - } - - // ... - } - -Functions -~~~~~~~~~ - -Functions can be registered in an extension via the ``getFunctions()`` -method:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getFunctions() - { - return array( - new Twig_SimpleFunction('lipsum', 'generate_lipsum'), - ); - } - - // ... - } - -Filters -~~~~~~~ - -To add a filter to an extension, you need to override the ``getFilters()`` -method. This method must return an array of filters to add to the Twig -environment:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getFilters() - { - return array( - new Twig_SimpleFilter('rot13', 'str_rot13'), - ); - } - - // ... - } - -Tags -~~~~ - -Adding a tag in an extension can be done by overriding the -``getTokenParsers()`` method. This method must return an array of tags to add -to the Twig environment:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getTokenParsers() - { - return array(new Project_Set_TokenParser()); - } - - // ... - } - -In the above code, we have added a single new tag, defined by the -``Project_Set_TokenParser`` class. The ``Project_Set_TokenParser`` class is -responsible for parsing the tag and compiling it to PHP. - -Operators -~~~~~~~~~ - -The ``getOperators()`` methods lets you add new operators. Here is how to add -``!``, ``||``, and ``&&`` operators:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getOperators() - { - return array( - array( - '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), - ), - array( - '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - ), - ); - } - - // ... - } - -Tests -~~~~~ - -The ``getTests()`` method lets you add new test functions:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getTests() - { - return array( - new Twig_SimpleTest('even', 'twig_test_even'), - ); - } - - // ... - } - -Overloading ------------ - -To overload an already defined filter, test, operator, global variable, or -function, re-define it in an extension and register it **as late as -possible** (order matters):: - - class MyCoreExtension extends Twig_Extension - { - public function getFilters() - { - return array( - new Twig_SimpleFilter('date', array($this, 'dateFilter')), - ); - } - - public function dateFilter($timestamp, $format = 'F j, Y H:i') - { - // do something different from the built-in date filter - } - - public function getName() - { - return 'project'; - } - } - - $twig = new Twig_Environment($loader); - $twig->addExtension(new MyCoreExtension()); - -Here, we have overloaded the built-in ``date`` filter with a custom one. - -If you do the same on the Twig_Environment itself, beware that it takes -precedence over any other registered extensions:: - - $twig = new Twig_Environment($loader); - $twig->addFilter(new Twig_SimpleFilter('date', function ($timestamp, $format = 'F j, Y H:i') { - // do something different from the built-in date filter - })); - // the date filter will come from the above registration, not - // from the registered extension below - $twig->addExtension(new MyCoreExtension()); - -.. caution:: - - Note that overloading the built-in Twig elements is not recommended as it - might be confusing. - -Testing an Extension --------------------- - -Functional Tests -~~~~~~~~~~~~~~~~ - -You can create functional tests for extensions simply by creating the -following file structure in your test directory:: - - Fixtures/ - filters/ - foo.test - bar.test - functions/ - foo.test - bar.test - tags/ - foo.test - bar.test - IntegrationTest.php - -The ``IntegrationTest.php`` file should look like this:: - - class Project_Tests_IntegrationTest extends Twig_Test_IntegrationTestCase - { - public function getExtensions() - { - return array( - new Project_Twig_Extension1(), - new Project_Twig_Extension2(), - ); - } - - public function getFixturesDir() - { - return dirname(__FILE__).'/Fixtures/'; - } - } - -Fixtures examples can be found within the Twig repository -`tests/Twig/Fixtures`_ directory. - -Node Tests -~~~~~~~~~~ - -Testing the node visitors can be complex, so extend your test cases from -``Twig_Test_NodeTestCase``. Examples can be found in the Twig repository -`tests/Twig/Node`_ directory. - -.. _`rot13`: http://www.php.net/manual/en/function.str-rot13.php -.. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Fixtures -.. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Node diff --git a/plugins/twig/vendor/twig/twig/doc/advanced_legacy.rst b/plugins/twig/vendor/twig/twig/doc/advanced_legacy.rst deleted file mode 100644 index 2ef6bfde..00000000 --- a/plugins/twig/vendor/twig/twig/doc/advanced_legacy.rst +++ /dev/null @@ -1,887 +0,0 @@ -Extending Twig -============== - -.. caution:: - - This section describes how to extends Twig for versions **older than - 1.12**. If you are using a newer version, read the :doc:`newer` - chapter instead. - -Twig can be extended in many ways; you can add extra tags, filters, tests, -operators, global variables, and functions. You can even extend the parser -itself with node visitors. - -.. note:: - - The first section of this chapter describes how to extend Twig easily. If - you want to reuse your changes in different projects or if you want to - share them with others, you should then create an extension as described - in the following section. - -.. caution:: - - When extending Twig by calling methods on the Twig environment instance, - Twig won't be able to recompile your templates when the PHP code is - updated. To see your changes in real-time, either disable template caching - or package your code into an extension (see the next section of this - chapter). - -Before extending Twig, you must understand the differences between all the -different possible extension points and when to use them. - -First, remember that Twig has two main language constructs: - -* ``{{ }}``: used to print the result of an expression evaluation; - -* ``{% %}``: used to execute statements. - -To understand why Twig exposes so many extension points, let's see how to -implement a *Lorem ipsum* generator (it needs to know the number of words to -generate). - -You can use a ``lipsum`` *tag*: - -.. code-block:: jinja - - {% lipsum 40 %} - -That works, but using a tag for ``lipsum`` is not a good idea for at least -three main reasons: - -* ``lipsum`` is not a language construct; -* The tag outputs something; -* The tag is not flexible as you cannot use it in an expression: - - .. code-block:: jinja - - {{ 'some text' ~ {% lipsum 40 %} ~ 'some more text' }} - -In fact, you rarely need to create tags; and that's good news because tags are -the most complex extension point of Twig. - -Now, let's use a ``lipsum`` *filter*: - -.. code-block:: jinja - - {{ 40|lipsum }} - -Again, it works, but it looks weird. A filter transforms the passed value to -something else but here we use the value to indicate the number of words to -generate (so, ``40`` is an argument of the filter, not the value we want to -transform). - -Next, let's use a ``lipsum`` *function*: - -.. code-block:: jinja - - {{ lipsum(40) }} - -Here we go. For this specific example, the creation of a function is the -extension point to use. And you can use it anywhere an expression is accepted: - -.. code-block:: jinja - - {{ 'some text' ~ ipsum(40) ~ 'some more text' }} - - {% set ipsum = ipsum(40) %} - -Last but not the least, you can also use a *global* object with a method able -to generate lorem ipsum text: - -.. code-block:: jinja - - {{ text.lipsum(40) }} - -As a rule of thumb, use functions for frequently used features and global -objects for everything else. - -Keep in mind the following when you want to extend Twig: - -========== ========================== ========== ========================= -What? Implementation difficulty? How often? When? -========== ========================== ========== ========================= -*macro* trivial frequent Content generation -*global* trivial frequent Helper object -*function* trivial frequent Content generation -*filter* trivial frequent Value transformation -*tag* complex rare DSL language construct -*test* trivial rare Boolean decision -*operator* trivial rare Values transformation -========== ========================== ========== ========================= - -Globals -------- - -A global variable is like any other template variable, except that it's -available in all templates and macros:: - - $twig = new Twig_Environment($loader); - $twig->addGlobal('text', new Text()); - -You can then use the ``text`` variable anywhere in a template: - -.. code-block:: jinja - - {{ text.lipsum(40) }} - -Filters -------- - -A filter is a regular PHP function or an object method that takes the left -side of the filter (before the pipe ``|``) as first argument and the extra -arguments passed to the filter (within parentheses ``()``) as extra arguments. - -Defining a filter is as easy as associating the filter name with a PHP -callable. For instance, let's say you have the following code in a template: - -.. code-block:: jinja - - {{ 'TWIG'|lower }} - -When compiling this template to PHP, Twig looks for the PHP callable -associated with the ``lower`` filter. The ``lower`` filter is a built-in Twig -filter, and it is simply mapped to the PHP ``strtolower()`` function. After -compilation, the generated PHP code is roughly equivalent to: - -.. code-block:: html+php - - - -As you can see, the ``'TWIG'`` string is passed as a first argument to the PHP -function. - -A filter can also take extra arguments like in the following example: - -.. code-block:: jinja - - {{ now|date('d/m/Y') }} - -In this case, the extra arguments are passed to the function after the main -argument, and the compiled code is equivalent to: - -.. code-block:: html+php - - - -Let's see how to create a new filter. - -In this section, we will create a ``rot13`` filter, which should return the -`rot13`_ transformation of a string. Here is an example of its usage and the -expected output: - -.. code-block:: jinja - - {{ "Twig"|rot13 }} - - {# should displays Gjvt #} - -Adding a filter is as simple as calling the ``addFilter()`` method on the -``Twig_Environment`` instance:: - - $twig = new Twig_Environment($loader); - $twig->addFilter('rot13', new Twig_Filter_Function('str_rot13')); - -The second argument of ``addFilter()`` is an instance of ``Twig_Filter``. -Here, we use ``Twig_Filter_Function`` as the filter is a PHP function. The -first argument passed to the ``Twig_Filter_Function`` constructor is the name -of the PHP function to call, here ``str_rot13``, a native PHP function. - -Let's say I now want to be able to add a prefix before the converted string: - -.. code-block:: jinja - - {{ "Twig"|rot13('prefix_') }} - - {# should displays prefix_Gjvt #} - -As the PHP ``str_rot13()`` function does not support this requirement, let's -create a new PHP function:: - - function project_compute_rot13($string, $prefix = '') - { - return $prefix.str_rot13($string); - } - -As you can see, the ``prefix`` argument of the filter is passed as an extra -argument to the ``project_compute_rot13()`` function. - -Adding this filter is as easy as before:: - - $twig->addFilter('rot13', new Twig_Filter_Function('project_compute_rot13')); - -For better encapsulation, a filter can also be defined as a static method of a -class. The ``Twig_Filter_Function`` class can also be used to register such -static methods as filters:: - - $twig->addFilter('rot13', new Twig_Filter_Function('SomeClass::rot13Filter')); - -.. tip:: - - In an extension, you can also define a filter as a static method of the - extension class. - -Environment aware Filters -~~~~~~~~~~~~~~~~~~~~~~~~~ - -The ``Twig_Filter`` classes take options as their last argument. For instance, -if you want access to the current environment instance in your filter, set the -``needs_environment`` option to ``true``:: - - $filter = new Twig_Filter_Function('str_rot13', array('needs_environment' => true)); - -Twig will then pass the current environment as the first argument to the -filter call:: - - function twig_compute_rot13(Twig_Environment $env, $string) - { - // get the current charset for instance - $charset = $env->getCharset(); - - return str_rot13($string); - } - -Automatic Escaping -~~~~~~~~~~~~~~~~~~ - -If automatic escaping is enabled, the output of the filter may be escaped -before printing. If your filter acts as an escaper (or explicitly outputs HTML -or JavaScript code), you will want the raw output to be printed. In such a -case, set the ``is_safe`` option:: - - $filter = new Twig_Filter_Function('nl2br', array('is_safe' => array('html'))); - -Some filters may need to work on input that is already escaped or safe, for -example when adding (safe) HTML tags to originally unsafe output. In such a -case, set the ``pre_escape`` option to escape the input data before it is run -through your filter:: - - $filter = new Twig_Filter_Function('somefilter', array('pre_escape' => 'html', 'is_safe' => array('html'))); - -Dynamic Filters -~~~~~~~~~~~~~~~ - -.. versionadded:: 1.5 - Dynamic filters support was added in Twig 1.5. - -A filter name containing the special ``*`` character is a dynamic filter as -the ``*`` can be any string:: - - $twig->addFilter('*_path_*', new Twig_Filter_Function('twig_path')); - - function twig_path($name, $arguments) - { - // ... - } - -The following filters will be matched by the above defined dynamic filter: - -* ``product_path`` -* ``category_path`` - -A dynamic filter can define more than one dynamic parts:: - - $twig->addFilter('*_path_*', new Twig_Filter_Function('twig_path')); - - function twig_path($name, $suffix, $arguments) - { - // ... - } - -The filter will receive all dynamic part values before the normal filters -arguments. For instance, a call to ``'foo'|a_path_b()`` will result in the -following PHP call: ``twig_path('a', 'b', 'foo')``. - -Functions ---------- - -A function is a regular PHP function or an object method that can be called from -templates. - -.. code-block:: jinja - - {{ constant("DATE_W3C") }} - -When compiling this template to PHP, Twig looks for the PHP callable -associated with the ``constant`` function. The ``constant`` function is a built-in Twig -function, and it is simply mapped to the PHP ``constant()`` function. After -compilation, the generated PHP code is roughly equivalent to: - -.. code-block:: html+php - - - -Adding a function is similar to adding a filter. This can be done by calling the -``addFunction()`` method on the ``Twig_Environment`` instance:: - - $twig = new Twig_Environment($loader); - $twig->addFunction('functionName', new Twig_Function_Function('someFunction')); - -You can also expose extension methods as functions in your templates:: - - // $this is an object that implements Twig_ExtensionInterface. - $twig = new Twig_Environment($loader); - $twig->addFunction('otherFunction', new Twig_Function_Method($this, 'someMethod')); - -Functions also support ``needs_environment`` and ``is_safe`` parameters. - -Dynamic Functions -~~~~~~~~~~~~~~~~~ - -.. versionadded:: 1.5 - Dynamic functions support was added in Twig 1.5. - -A function name containing the special ``*`` character is a dynamic function -as the ``*`` can be any string:: - - $twig->addFunction('*_path', new Twig_Function_Function('twig_path')); - - function twig_path($name, $arguments) - { - // ... - } - -The following functions will be matched by the above defined dynamic function: - -* ``product_path`` -* ``category_path`` - -A dynamic function can define more than one dynamic parts:: - - $twig->addFilter('*_path_*', new Twig_Filter_Function('twig_path')); - - function twig_path($name, $suffix, $arguments) - { - // ... - } - -The function will receive all dynamic part values before the normal functions -arguments. For instance, a call to ``a_path_b('foo')`` will result in the -following PHP call: ``twig_path('a', 'b', 'foo')``. - -Tags ----- - -One of the most exciting feature of a template engine like Twig is the -possibility to define new language constructs. This is also the most complex -feature as you need to understand how Twig's internals work. - -Let's create a simple ``set`` tag that allows the definition of simple -variables from within a template. The tag can be used like follows: - -.. code-block:: jinja - - {% set name = "value" %} - - {{ name }} - - {# should output value #} - -.. note:: - - The ``set`` tag is part of the Core extension and as such is always - available. The built-in version is slightly more powerful and supports - multiple assignments by default (cf. the template designers chapter for - more information). - -Three steps are needed to define a new tag: - -* Defining a Token Parser class (responsible for parsing the template code); - -* Defining a Node class (responsible for converting the parsed code to PHP); - -* Registering the tag. - -Registering a new tag -~~~~~~~~~~~~~~~~~~~~~ - -Adding a tag is as simple as calling the ``addTokenParser`` method on the -``Twig_Environment`` instance:: - - $twig = new Twig_Environment($loader); - $twig->addTokenParser(new Project_Set_TokenParser()); - -Defining a Token Parser -~~~~~~~~~~~~~~~~~~~~~~~ - -Now, let's see the actual code of this class:: - - class Project_Set_TokenParser extends Twig_TokenParser - { - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $name = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(); - $this->parser->getStream()->expect(Twig_Token::OPERATOR_TYPE, '='); - $value = $this->parser->getExpressionParser()->parseExpression(); - - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return new Project_Set_Node($name, $value, $lineno, $this->getTag()); - } - - public function getTag() - { - return 'set'; - } - } - -The ``getTag()`` method must return the tag we want to parse, here ``set``. - -The ``parse()`` method is invoked whenever the parser encounters a ``set`` -tag. It should return a ``Twig_Node`` instance that represents the node (the -``Project_Set_Node`` calls creating is explained in the next section). - -The parsing process is simplified thanks to a bunch of methods you can call -from the token stream (``$this->parser->getStream()``): - -* ``getCurrent()``: Gets the current token in the stream. - -* ``next()``: Moves to the next token in the stream, *but returns the old one*. - -* ``test($type)``, ``test($value)`` or ``test($type, $value)``: Determines whether - the current token is of a particular type or value (or both). The value may be an - array of several possible values. - -* ``expect($type[, $value[, $message]])``: If the current token isn't of the given - type/value a syntax error is thrown. Otherwise, if the type and value are correct, - the token is returned and the stream moves to the next token. - -* ``look()``: Looks a the next token without consuming it. - -Parsing expressions is done by calling the ``parseExpression()`` like we did for -the ``set`` tag. - -.. tip:: - - Reading the existing ``TokenParser`` classes is the best way to learn all - the nitty-gritty details of the parsing process. - -Defining a Node -~~~~~~~~~~~~~~~ - -The ``Project_Set_Node`` class itself is rather simple:: - - class Project_Set_Node extends Twig_Node - { - public function __construct($name, Twig_Node_Expression $value, $lineno, $tag = null) - { - parent::__construct(array('value' => $value), array('name' => $name), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('$context[\''.$this->getAttribute('name').'\'] = ') - ->subcompile($this->getNode('value')) - ->raw(";\n") - ; - } - } - -The compiler implements a fluid interface and provides methods that helps the -developer generate beautiful and readable PHP code: - -* ``subcompile()``: Compiles a node. - -* ``raw()``: Writes the given string as is. - -* ``write()``: Writes the given string by adding indentation at the beginning - of each line. - -* ``string()``: Writes a quoted string. - -* ``repr()``: Writes a PHP representation of a given value (see - ``Twig_Node_For`` for a usage example). - -* ``addDebugInfo()``: Adds the line of the original template file related to - the current node as a comment. - -* ``indent()``: Indents the generated code (see ``Twig_Node_Block`` for a - usage example). - -* ``outdent()``: Outdents the generated code (see ``Twig_Node_Block`` for a - usage example). - -.. _creating_extensions: - -Creating an Extension ---------------------- - -The main motivation for writing an extension is to move often used code into a -reusable class like adding support for internationalization. An extension can -define tags, filters, tests, operators, global variables, functions, and node -visitors. - -Creating an extension also makes for a better separation of code that is -executed at compilation time and code needed at runtime. As such, it makes -your code faster. - -Most of the time, it is useful to create a single extension for your project, -to host all the specific tags and filters you want to add to Twig. - -.. tip:: - - When packaging your code into an extension, Twig is smart enough to - recompile your templates whenever you make a change to it (when the - ``auto_reload`` is enabled). - -.. note:: - - Before writing your own extensions, have a look at the Twig official - extension repository: http://github.com/twigphp/Twig-extensions. - -An extension is a class that implements the following interface:: - - interface Twig_ExtensionInterface - { - /** - * Initializes the runtime environment. - * - * This is where you can load some file that contains filter functions for instance. - * - * @param Twig_Environment $environment The current Twig_Environment instance - */ - function initRuntime(Twig_Environment $environment); - - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - function getTokenParsers(); - - /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances - */ - function getNodeVisitors(); - - /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters - */ - function getFilters(); - - /** - * Returns a list of tests to add to the existing list. - * - * @return array An array of tests - */ - function getTests(); - - /** - * Returns a list of functions to add to the existing list. - * - * @return array An array of functions - */ - function getFunctions(); - - /** - * Returns a list of operators to add to the existing list. - * - * @return array An array of operators - */ - function getOperators(); - - /** - * Returns a list of global variables to add to the existing list. - * - * @return array An array of global variables - */ - function getGlobals(); - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - function getName(); - } - -To keep your extension class clean and lean, it can inherit from the built-in -``Twig_Extension`` class instead of implementing the whole interface. That -way, you just need to implement the ``getName()`` method as the -``Twig_Extension`` provides empty implementations for all other methods. - -The ``getName()`` method must return a unique identifier for your extension. - -Now, with this information in mind, let's create the most basic extension -possible:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getName() - { - return 'project'; - } - } - -.. note:: - - Of course, this extension does nothing for now. We will customize it in - the next sections. - -Twig does not care where you save your extension on the filesystem, as all -extensions must be registered explicitly to be available in your templates. - -You can register an extension by using the ``addExtension()`` method on your -main ``Environment`` object:: - - $twig = new Twig_Environment($loader); - $twig->addExtension(new Project_Twig_Extension()); - -Of course, you need to first load the extension file by either using -``require_once()`` or by using an autoloader (see `spl_autoload_register()`_). - -.. tip:: - - The bundled extensions are great examples of how extensions work. - -Globals -~~~~~~~ - -Global variables can be registered in an extension via the ``getGlobals()`` -method:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getGlobals() - { - return array( - 'text' => new Text(), - ); - } - - // ... - } - -Functions -~~~~~~~~~ - -Functions can be registered in an extension via the ``getFunctions()`` -method:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getFunctions() - { - return array( - 'lipsum' => new Twig_Function_Function('generate_lipsum'), - ); - } - - // ... - } - -Filters -~~~~~~~ - -To add a filter to an extension, you need to override the ``getFilters()`` -method. This method must return an array of filters to add to the Twig -environment:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getFilters() - { - return array( - 'rot13' => new Twig_Filter_Function('str_rot13'), - ); - } - - // ... - } - -As you can see in the above code, the ``getFilters()`` method returns an array -where keys are the name of the filters (``rot13``) and the values the -definition of the filter (``new Twig_Filter_Function('str_rot13')``). - -As seen in the previous chapter, you can also define filters as static methods -on the extension class:: - -$twig->addFilter('rot13', new Twig_Filter_Function('Project_Twig_Extension::rot13Filter')); - -You can also use ``Twig_Filter_Method`` instead of ``Twig_Filter_Function`` -when defining a filter to use a method:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getFilters() - { - return array( - 'rot13' => new Twig_Filter_Method($this, 'rot13Filter'), - ); - } - - public function rot13Filter($string) - { - return str_rot13($string); - } - - // ... - } - -The first argument of the ``Twig_Filter_Method`` constructor is always -``$this``, the current extension object. The second one is the name of the -method to call. - -Using methods for filters is a great way to package your filter without -polluting the global namespace. This also gives the developer more flexibility -at the cost of a small overhead. - -Overriding default Filters -.......................... - -If some default core filters do not suit your needs, you can easily override -them by creating your own extension. Just use the same names as the one you -want to override:: - - class MyCoreExtension extends Twig_Extension - { - public function getFilters() - { - return array( - 'date' => new Twig_Filter_Method($this, 'dateFilter'), - // ... - ); - } - - public function dateFilter($timestamp, $format = 'F j, Y H:i') - { - return '...'.twig_date_format_filter($timestamp, $format); - } - - public function getName() - { - return 'project'; - } - } - -Here, we override the ``date`` filter with a custom one. Using this extension -is as simple as registering the ``MyCoreExtension`` extension by calling the -``addExtension()`` method on the environment instance:: - - $twig = new Twig_Environment($loader); - $twig->addExtension(new MyCoreExtension()); - -Tags -~~~~ - -Adding a tag in an extension can be done by overriding the -``getTokenParsers()`` method. This method must return an array of tags to add -to the Twig environment:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getTokenParsers() - { - return array(new Project_Set_TokenParser()); - } - - // ... - } - -In the above code, we have added a single new tag, defined by the -``Project_Set_TokenParser`` class. The ``Project_Set_TokenParser`` class is -responsible for parsing the tag and compiling it to PHP. - -Operators -~~~~~~~~~ - -The ``getOperators()`` methods allows to add new operators. Here is how to add -``!``, ``||``, and ``&&`` operators:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getOperators() - { - return array( - array( - '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), - ), - array( - '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - ), - ); - } - - // ... - } - -Tests -~~~~~ - -The ``getTests()`` methods allows to add new test functions:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getTests() - { - return array( - 'even' => new Twig_Test_Function('twig_test_even'), - ); - } - - // ... - } - -Testing an Extension --------------------- - -.. versionadded:: 1.10 - Support for functional tests was added in Twig 1.10. - -Functional Tests -~~~~~~~~~~~~~~~~ - -You can create functional tests for extensions simply by creating the -following file structure in your test directory:: - - Fixtures/ - filters/ - foo.test - bar.test - functions/ - foo.test - bar.test - tags/ - foo.test - bar.test - IntegrationTest.php - -The ``IntegrationTest.php`` file should look like this:: - - class Project_Tests_IntegrationTest extends Twig_Test_IntegrationTestCase - { - public function getExtensions() - { - return array( - new Project_Twig_Extension1(), - new Project_Twig_Extension2(), - ); - } - - public function getFixturesDir() - { - return dirname(__FILE__).'/Fixtures/'; - } - } - -Fixtures examples can be found within the Twig repository -`tests/Twig/Fixtures`_ directory. - -Node Tests -~~~~~~~~~~ - -Testing the node visitors can be complex, so extend your test cases from -``Twig_Test_NodeTestCase``. Examples can be found in the Twig repository -`tests/Twig/Node`_ directory. - -.. _`spl_autoload_register()`: http://www.php.net/spl_autoload_register -.. _`rot13`: http://www.php.net/manual/en/function.str-rot13.php -.. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Fixtures -.. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Node diff --git a/plugins/twig/vendor/twig/twig/doc/api.rst b/plugins/twig/vendor/twig/twig/doc/api.rst deleted file mode 100644 index f367db07..00000000 --- a/plugins/twig/vendor/twig/twig/doc/api.rst +++ /dev/null @@ -1,552 +0,0 @@ -Twig for Developers -=================== - -This chapter describes the API to Twig and not the template language. It will -be most useful as reference to those implementing the template interface to -the application and not those who are creating Twig templates. - -Basics ------- - -Twig uses a central object called the **environment** (of class -``Twig_Environment``). Instances of this class are used to store the -configuration and extensions, and are used to load templates from the file -system or other locations. - -Most applications will create one ``Twig_Environment`` object on application -initialization and use that to load templates. In some cases it's however -useful to have multiple environments side by side, if different configurations -are in use. - -The simplest way to configure Twig to load templates for your application -looks roughly like this:: - - require_once '/path/to/lib/Twig/Autoloader.php'; - Twig_Autoloader::register(); - - $loader = new Twig_Loader_Filesystem('/path/to/templates'); - $twig = new Twig_Environment($loader, array( - 'cache' => '/path/to/compilation_cache', - )); - -This will create a template environment with the default settings and a loader -that looks up the templates in the ``/path/to/templates/`` folder. Different -loaders are available and you can also write your own if you want to load -templates from a database or other resources. - -.. note:: - - Notice that the second argument of the environment is an array of options. - The ``cache`` option is a compilation cache directory, where Twig caches - the compiled templates to avoid the parsing phase for sub-sequent - requests. It is very different from the cache you might want to add for - the evaluated templates. For such a need, you can use any available PHP - cache library. - -To load a template from this environment you just have to call the -``loadTemplate()`` method which then returns a ``Twig_Template`` instance:: - - $template = $twig->loadTemplate('index.html'); - -To render the template with some variables, call the ``render()`` method:: - - echo $template->render(array('the' => 'variables', 'go' => 'here')); - -.. note:: - - The ``display()`` method is a shortcut to output the template directly. - -You can also load and render the template in one fell swoop:: - - echo $twig->render('index.html', array('the' => 'variables', 'go' => 'here')); - -.. _environment_options: - -Environment Options -------------------- - -When creating a new ``Twig_Environment`` instance, you can pass an array of -options as the constructor second argument:: - - $twig = new Twig_Environment($loader, array('debug' => true)); - -The following options are available: - -* ``debug`` *boolean* - - When set to ``true``, the generated templates have a - ``__toString()`` method that you can use to display the generated nodes - (default to ``false``). - -* ``charset`` *string (default to ``utf-8``)* - - The charset used by the templates. - -* ``base_template_class`` *string (default to ``Twig_Template``)* - - The base template class to use for generated - templates. - -* ``cache`` *string|false* - - An absolute path where to store the compiled templates, or - ``false`` to disable caching (which is the default). - -* ``auto_reload`` *boolean* - - When developing with Twig, it's useful to recompile the - template whenever the source code changes. If you don't provide a value for - the ``auto_reload`` option, it will be determined automatically based on the - ``debug`` value. - -* ``strict_variables`` *boolean* - - If set to ``false``, Twig will silently ignore invalid - variables (variables and or attributes/methods that do not exist) and - replace them with a ``null`` value. When set to ``true``, Twig throws an - exception instead (default to ``false``). - -* ``autoescape`` *string|boolean* - - If set to ``true``, HTML auto-escaping will be enabled by - default for all templates (default to ``true``). - - As of Twig 1.8, you can set the escaping strategy to use (``html``, ``js``, - ``false`` to disable). - - As of Twig 1.9, you can set the escaping strategy to use (``css``, ``url``, - ``html_attr``, or a PHP callback that takes the template "filename" and must - return the escaping strategy to use -- the callback cannot be a function name - to avoid collision with built-in escaping strategies). - - As of Twig 1.17, the ``filename`` escaping strategy determines the escaping - strategy to use for a template based on the template filename extension (this - strategy does not incur any overhead at runtime as auto-escaping is done at - compilation time.) - -* ``optimizations`` *integer* - - A flag that indicates which optimizations to apply - (default to ``-1`` -- all optimizations are enabled; set it to ``0`` to - disable). - -Loaders -------- - -Loaders are responsible for loading templates from a resource such as the file -system. - -Compilation Cache -~~~~~~~~~~~~~~~~~ - -All template loaders can cache the compiled templates on the filesystem for -future reuse. It speeds up Twig a lot as templates are only compiled once; and -the performance boost is even larger if you use a PHP accelerator such as APC. -See the ``cache`` and ``auto_reload`` options of ``Twig_Environment`` above -for more information. - -Built-in Loaders -~~~~~~~~~~~~~~~~ - -Here is a list of the built-in loaders Twig provides: - -``Twig_Loader_Filesystem`` -.......................... - -.. versionadded:: 1.10 - The ``prependPath()`` and support for namespaces were added in Twig 1.10. - -``Twig_Loader_Filesystem`` loads templates from the file system. This loader -can find templates in folders on the file system and is the preferred way to -load them:: - - $loader = new Twig_Loader_Filesystem($templateDir); - -It can also look for templates in an array of directories:: - - $loader = new Twig_Loader_Filesystem(array($templateDir1, $templateDir2)); - -With such a configuration, Twig will first look for templates in -``$templateDir1`` and if they do not exist, it will fallback to look for them -in the ``$templateDir2``. - -You can add or prepend paths via the ``addPath()`` and ``prependPath()`` -methods:: - - $loader->addPath($templateDir3); - $loader->prependPath($templateDir4); - -The filesystem loader also supports namespaced templates. This allows to group -your templates under different namespaces which have their own template paths. - -When using the ``setPaths()``, ``addPath()``, and ``prependPath()`` methods, -specify the namespace as the second argument (when not specified, these -methods act on the "main" namespace):: - - $loader->addPath($templateDir, 'admin'); - -Namespaced templates can be accessed via the special -``@namespace_name/template_path`` notation:: - - $twig->render('@admin/index.html', array()); - -``Twig_Loader_Array`` -..................... - -``Twig_Loader_Array`` loads a template from a PHP array. It's passed an array -of strings bound to template names:: - - $loader = new Twig_Loader_Array(array( - 'index.html' => 'Hello {{ name }}!', - )); - $twig = new Twig_Environment($loader); - - echo $twig->render('index.html', array('name' => 'Fabien')); - -This loader is very useful for unit testing. It can also be used for small -projects where storing all templates in a single PHP file might make sense. - -.. tip:: - - When using the ``Array`` or ``String`` loaders with a cache mechanism, you - should know that a new cache key is generated each time a template content - "changes" (the cache key being the source code of the template). If you - don't want to see your cache grows out of control, you need to take care - of clearing the old cache file by yourself. - -``Twig_Loader_Chain`` -..................... - -``Twig_Loader_Chain`` delegates the loading of templates to other loaders:: - - $loader1 = new Twig_Loader_Array(array( - 'base.html' => '{% block content %}{% endblock %}', - )); - $loader2 = new Twig_Loader_Array(array( - 'index.html' => '{% extends "base.html" %}{% block content %}Hello {{ name }}{% endblock %}', - 'base.html' => 'Will never be loaded', - )); - - $loader = new Twig_Loader_Chain(array($loader1, $loader2)); - - $twig = new Twig_Environment($loader); - -When looking for a template, Twig will try each loader in turn and it will -return as soon as the template is found. When rendering the ``index.html`` -template from the above example, Twig will load it with ``$loader2`` but the -``base.html`` template will be loaded from ``$loader1``. - -``Twig_Loader_Chain`` accepts any loader that implements -``Twig_LoaderInterface``. - -.. note:: - - You can also add loaders via the ``addLoader()`` method. - -Create your own Loader -~~~~~~~~~~~~~~~~~~~~~~ - -All loaders implement the ``Twig_LoaderInterface``:: - - interface Twig_LoaderInterface - { - /** - * Gets the source code of a template, given its name. - * - * @param string $name string The name of the template to load - * - * @return string The template source code - */ - function getSource($name); - - /** - * Gets the cache key to use for the cache for a given template name. - * - * @param string $name string The name of the template to load - * - * @return string The cache key - */ - function getCacheKey($name); - - /** - * Returns true if the template is still fresh. - * - * @param string $name The template name - * @param timestamp $time The last modification time of the cached template - */ - function isFresh($name, $time); - } - -The ``isFresh()`` method must return ``true`` if the current cached template -is still fresh, given the last modification time, or ``false`` otherwise. - -.. tip:: - - As of Twig 1.11.0, you can also implement ``Twig_ExistsLoaderInterface`` - to make your loader faster when used with the chain loader. - -Using Extensions ----------------- - -Twig extensions are packages that add new features to Twig. Using an -extension is as simple as using the ``addExtension()`` method:: - - $twig->addExtension(new Twig_Extension_Sandbox()); - -Twig comes bundled with the following extensions: - -* *Twig_Extension_Core*: Defines all the core features of Twig. - -* *Twig_Extension_Escaper*: Adds automatic output-escaping and the possibility - to escape/unescape blocks of code. - -* *Twig_Extension_Sandbox*: Adds a sandbox mode to the default Twig - environment, making it safe to evaluate untrusted code. - -* *Twig_Extension_Profiler*: Enabled the built-in Twig profiler (as of Twig - 1.18). - -* *Twig_Extension_Optimizer*: Optimizes the node tree before compilation. - -The core, escaper, and optimizer extensions do not need to be added to the -Twig environment, as they are registered by default. - -Built-in Extensions -------------------- - -This section describes the features added by the built-in extensions. - -.. tip:: - - Read the chapter about extending Twig to learn how to create your own - extensions. - -Core Extension -~~~~~~~~~~~~~~ - -The ``core`` extension defines all the core features of Twig: - -* :doc:`Tags `; -* :doc:`Filters `; -* :doc:`Functions `; -* :doc:`Tests `. - -Escaper Extension -~~~~~~~~~~~~~~~~~ - -The ``escaper`` extension adds automatic output escaping to Twig. It defines a -tag, ``autoescape``, and a filter, ``raw``. - -When creating the escaper extension, you can switch on or off the global -output escaping strategy:: - - $escaper = new Twig_Extension_Escaper('html'); - $twig->addExtension($escaper); - -If set to ``html``, all variables in templates are escaped (using the ``html`` -escaping strategy), except those using the ``raw`` filter: - -.. code-block:: jinja - - {{ article.to_html|raw }} - -You can also change the escaping mode locally by using the ``autoescape`` tag -(see the :doc:`autoescape` doc for the syntax used before -Twig 1.8): - -.. code-block:: jinja - - {% autoescape 'html' %} - {{ var }} - {{ var|raw }} {# var won't be escaped #} - {{ var|escape }} {# var won't be double-escaped #} - {% endautoescape %} - -.. warning:: - - The ``autoescape`` tag has no effect on included files. - -The escaping rules are implemented as follows: - -* Literals (integers, booleans, arrays, ...) used in the template directly as - variables or filter arguments are never automatically escaped: - - .. code-block:: jinja - - {{ "Twig
    " }} {# won't be escaped #} - - {% set text = "Twig
    " %} - {{ text }} {# will be escaped #} - -* Expressions which the result is always a literal or a variable marked safe - are never automatically escaped: - - .. code-block:: jinja - - {{ foo ? "Twig
    " : "
    Twig" }} {# won't be escaped #} - - {% set text = "Twig
    " %} - {{ foo ? text : "
    Twig" }} {# will be escaped #} - - {% set text = "Twig
    " %} - {{ foo ? text|raw : "
    Twig" }} {# won't be escaped #} - - {% set text = "Twig
    " %} - {{ foo ? text|escape : "
    Twig" }} {# the result of the expression won't be escaped #} - -* Escaping is applied before printing, after any other filter is applied: - - .. code-block:: jinja - - {{ var|upper }} {# is equivalent to {{ var|upper|escape }} #} - -* The `raw` filter should only be used at the end of the filter chain: - - .. code-block:: jinja - - {{ var|raw|upper }} {# will be escaped #} - - {{ var|upper|raw }} {# won't be escaped #} - -* Automatic escaping is not applied if the last filter in the chain is marked - safe for the current context (e.g. ``html`` or ``js``). ``escape`` and - ``escape('html')`` are marked safe for HTML, ``escape('js')`` is marked - safe for JavaScript, ``raw`` is marked safe for everything. - - .. code-block:: jinja - - {% autoescape 'js' %} - {{ var|escape('html') }} {# will be escaped for HTML and JavaScript #} - {{ var }} {# will be escaped for JavaScript #} - {{ var|escape('js') }} {# won't be double-escaped #} - {% endautoescape %} - -.. note:: - - Note that autoescaping has some limitations as escaping is applied on - expressions after evaluation. For instance, when working with - concatenation, ``{{ foo|raw ~ bar }}`` won't give the expected result as - escaping is applied on the result of the concatenation, not on the - individual variables (so, the ``raw`` filter won't have any effect here). - -Sandbox Extension -~~~~~~~~~~~~~~~~~ - -The ``sandbox`` extension can be used to evaluate untrusted code. Access to -unsafe attributes and methods is prohibited. The sandbox security is managed -by a policy instance. By default, Twig comes with one policy class: -``Twig_Sandbox_SecurityPolicy``. This class allows you to white-list some -tags, filters, properties, and methods:: - - $tags = array('if'); - $filters = array('upper'); - $methods = array( - 'Article' => array('getTitle', 'getBody'), - ); - $properties = array( - 'Article' => array('title', 'body'), - ); - $functions = array('range'); - $policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions); - -With the previous configuration, the security policy will only allow usage of -the ``if`` tag, and the ``upper`` filter. Moreover, the templates will only be -able to call the ``getTitle()`` and ``getBody()`` methods on ``Article`` -objects, and the ``title`` and ``body`` public properties. Everything else -won't be allowed and will generate a ``Twig_Sandbox_SecurityError`` exception. - -The policy object is the first argument of the sandbox constructor:: - - $sandbox = new Twig_Extension_Sandbox($policy); - $twig->addExtension($sandbox); - -By default, the sandbox mode is disabled and should be enabled when including -untrusted template code by using the ``sandbox`` tag: - -.. code-block:: jinja - - {% sandbox %} - {% include 'user.html' %} - {% endsandbox %} - -You can sandbox all templates by passing ``true`` as the second argument of -the extension constructor:: - - $sandbox = new Twig_Extension_Sandbox($policy, true); - -Profiler Extension -~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 1.18 - The Profile extension was added in Twig 1.18. - -The ``profiler`` extension enables a profiler for Twig templates; it should -only be used on your development machines as it adds some overhead:: - - $profile = new Twig_Profiler_Profile(); - $twig->addExtension(new Twig_Extension_Profiler($profile)); - - $dumper = new Twig_Profiler_Dumper_Text(); - echo $dumper->dump($profile); - -A profile contains information about time and memory consumption for template, -block, and macro executions. - -You can also dump the data in a `Blackfire.io `_ -compatible format:: - - $dumper = new Twig_Profiler_Dumper_Blackfire(); - file_put_contents('/path/to/profile.prof', $dumper->dump($profile)); - -Upload the profile to visualize it (create a `free account -`_ first): - -.. code-block:: sh - - blackfire --slot=7 upload /path/to/profile.prof - -Optimizer Extension -~~~~~~~~~~~~~~~~~~~ - -The ``optimizer`` extension optimizes the node tree before compilation:: - - $twig->addExtension(new Twig_Extension_Optimizer()); - -By default, all optimizations are turned on. You can select the ones you want -to enable by passing them to the constructor:: - - $optimizer = new Twig_Extension_Optimizer(Twig_NodeVisitor_Optimizer::OPTIMIZE_FOR); - - $twig->addExtension($optimizer); - -Twig supports the following optimizations: - -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_ALL``, enables all optimizations - (this is the default value). -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_NONE``, disables all optimizations. - This reduces the compilation time, but it can increase the execution time - and the consumed memory. -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_FOR``, optimizes the ``for`` tag by - removing the ``loop`` variable creation whenever possible. -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_RAW_FILTER``, removes the ``raw`` - filter whenever possible. -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_VAR_ACCESS``, simplifies the creation - and access of variables in the compiled templates whenever possible. - -Exceptions ----------- - -Twig can throw exceptions: - -* ``Twig_Error``: The base exception for all errors. - -* ``Twig_Error_Syntax``: Thrown to tell the user that there is a problem with - the template syntax. - -* ``Twig_Error_Runtime``: Thrown when an error occurs at runtime (when a filter - does not exist for instance). - -* ``Twig_Error_Loader``: Thrown when an error occurs during template loading. - -* ``Twig_Sandbox_SecurityError``: Thrown when an unallowed tag, filter, or - method is called in a sandboxed template. diff --git a/plugins/twig/vendor/twig/twig/doc/coding_standards.rst b/plugins/twig/vendor/twig/twig/doc/coding_standards.rst deleted file mode 100644 index f435df49..00000000 --- a/plugins/twig/vendor/twig/twig/doc/coding_standards.rst +++ /dev/null @@ -1,101 +0,0 @@ -Coding Standards -================ - -When writing Twig templates, we recommend you to follow these official coding -standards: - -* Put one (and only one) space after the start of a delimiter (``{{``, ``{%``, - and ``{#``) and before the end of a delimiter (``}}``, ``%}``, and ``#}``): - - .. code-block:: jinja - - {{ foo }} - {# comment #} - {% if foo %}{% endif %} - - When using the whitespace control character, do not put any spaces between - it and the delimiter: - - .. code-block:: jinja - - {{- foo -}} - {#- comment -#} - {%- if foo -%}{%- endif -%} - -* Put one (and only one) space before and after the following operators: - comparison operators (``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``), math - operators (``+``, ``-``, ``/``, ``*``, ``%``, ``//``, ``**``), logic - operators (``not``, ``and``, ``or``), ``~``, ``is``, ``in``, and the ternary - operator (``?:``): - - .. code-block:: jinja - - {{ 1 + 2 }} - {{ foo ~ bar }} - {{ true ? true : false }} - -* Put one (and only one) space after the ``:`` sign in hashes and ``,`` in - arrays and hashes: - - .. code-block:: jinja - - {{ [1, 2, 3] }} - {{ {'foo': 'bar'} }} - -* Do not put any spaces after an opening parenthesis and before a closing - parenthesis in expressions: - - .. code-block:: jinja - - {{ 1 + (2 * 3) }} - -* Do not put any spaces before and after string delimiters: - - .. code-block:: jinja - - {{ 'foo' }} - {{ "foo" }} - -* Do not put any spaces before and after the following operators: ``|``, - ``.``, ``..``, ``[]``: - - .. code-block:: jinja - - {{ foo|upper|lower }} - {{ user.name }} - {{ user[name] }} - {% for i in 1..12 %}{% endfor %} - -* Do not put any spaces before and after the parenthesis used for filter and - function calls: - - .. code-block:: jinja - - {{ foo|default('foo') }} - {{ range(1..10) }} - -* Do not put any spaces before and after the opening and the closing of arrays - and hashes: - - .. code-block:: jinja - - {{ [1, 2, 3] }} - {{ {'foo': 'bar'} }} - -* Use lower cased and underscored variable names: - - .. code-block:: jinja - - {% set foo = 'foo' %} - {% set foo_bar = 'foo' %} - -* Indent your code inside tags (use the same indentation as the one used for - the target language of the rendered template): - - .. code-block:: jinja - - {% block foo %} - {% if true %} - true - {% endif %} - {% endblock %} diff --git a/plugins/twig/vendor/twig/twig/doc/deprecated.rst b/plugins/twig/vendor/twig/twig/doc/deprecated.rst deleted file mode 100644 index d31f1dd3..00000000 --- a/plugins/twig/vendor/twig/twig/doc/deprecated.rst +++ /dev/null @@ -1,162 +0,0 @@ -Deprecated Features -=================== - -This document lists all deprecated features in Twig. Deprecated features are -kept for backward compatibility and removed in the next major release (a -feature that was deprecated in Twig 1.x is removed in Twig 2.0). - -Deprecation Notices -------------------- - -As of Twig 1.21, Twig generates deprecation notices when a template uses -deprecated features. See :ref:`deprecation-notices` for more information. - -Token Parsers -------------- - -* As of Twig 1.x, the token parser broker sub-system is deprecated. The - following class and interface will be removed in 2.0: - - * ``Twig_TokenParserBrokerInterface`` - * ``Twig_TokenParserBroker`` - -Extensions ----------- - -* As of Twig 1.x, the ability to remove an extension is deprecated and the - ``Twig_Environment::removeExtension()`` method will be removed in 2.0. - -* As of Twig 1.23, the ``Twig_ExtensionInterface::initRuntime()`` method is - deprecated. You have two options to avoid the deprecation notice: if you - implement this method to store the environment for your custom filters, - functions, or tests, use the ``needs_environment`` option instead; if you - have more complex needs, explicitly implement - ``Twig_Extension_InitRuntimeInterface`` (not recommended). - -* As of Twig 1.23, the ``Twig_ExtensionInterface::getGlobals()`` method is - deprecated. Implement ``Twig_Extension_GlobalsInterface`` to avoid - deprecation notices. - -PEAR ----- - -PEAR support has been discontinued in Twig 1.15.1, and no PEAR packages are -provided anymore. Use Composer instead. - -Filters -------- - -* As of Twig 1.x, use ``Twig_SimpleFilter`` to add a filter. The following - classes and interfaces will be removed in 2.0: - - * ``Twig_FilterInterface`` - * ``Twig_FilterCallableInterface`` - * ``Twig_Filter`` - * ``Twig_Filter_Function`` - * ``Twig_Filter_Method`` - * ``Twig_Filter_Node`` - -* As of Twig 2.x, the ``Twig_SimpleFilter`` class is deprecated and will be - removed in Twig 3.x (use ``Twig_Filter`` instead). In Twig 2.x, - ``Twig_SimpleFilter`` is just an alias for ``Twig_Filter``. - -Functions ---------- - -* As of Twig 1.x, use ``Twig_SimpleFunction`` to add a function. The following - classes and interfaces will be removed in 2.0: - - * ``Twig_FunctionInterface`` - * ``Twig_FunctionCallableInterface`` - * ``Twig_Function`` - * ``Twig_Function_Function`` - * ``Twig_Function_Method`` - * ``Twig_Function_Node`` - -* As of Twig 2.x, the ``Twig_SimpleFunction`` class is deprecated and will be - removed in Twig 3.x (use ``Twig_Function`` instead). In Twig 2.x, - ``Twig_SimpleFunction`` is just an alias for ``Twig_Function``. - -Tests ------ - -* As of Twig 1.x, use ``Twig_SimpleTest`` to add a test. The following classes - and interfaces will be removed in 2.0: - - * ``Twig_TestInterface`` - * ``Twig_TestCallableInterface`` - * ``Twig_Test`` - * ``Twig_Test_Function`` - * ``Twig_Test_Method`` - * ``Twig_Test_Node`` - -* As of Twig 2.x, the ``Twig_SimpleTest`` class is deprecated and will be - removed in Twig 3.x (use ``Twig_Test`` instead). In Twig 2.x, - ``Twig_SimpleTest`` is just an alias for ``Twig_Test``. - -* The ``sameas`` and ``divisibleby`` tests are deprecated in favor of ``same - as`` and ``divisible by`` respectively. - -Tags ----- - -* As of Twig 1.x, the ``raw`` tag is deprecated. You should use ``verbatim`` - instead. - -Nodes ------ - -* As of Twig 1.x, ``Node::toXml()`` is deprecated and will be removed in Twig - 2.0. - -Interfaces ----------- - -* As of Twig 2.x, the following interfaces are deprecated and empty (they will - be removed in Twig 3.0): - -* ``Twig_CompilerInterface`` (use ``Twig_Compiler`` instead) -* ``Twig_LexerInterface`` (use ``Twig_Lexer`` instead) -* ``Twig_NodeInterface`` (use ``Twig_Node`` instead) -* ``Twig_ParserInterface`` (use ``Twig_Parser`` instead) -* ``Twig_ExistsLoaderInterface`` (merged with ``Twig_LoaderInterface``) -* ``Twig_TemplateInterface`` (use ``Twig_Template`` instead, and use - those constants Twig_Template::ANY_CALL, Twig_Template::ARRAY_CALL, - Twig_Template::METHOD_CALL) - -Loaders -------- - -* As of Twig 1.x, ``Twig_Loader_String`` is deprecated and will be removed in - 2.0. You can render a string via ``Twig_Environment::createTemplate()``. - -Node Visitors -------------- - -* Because of the removal of ``Twig_NodeInterface`` in 2.0, you need to extend - ``Twig_BaseNodeVisitor`` instead of implementing ``Twig_NodeVisitorInterface`` - directly to make your node visitors compatible with both Twig 1.x and 2.x. - -Globals -------- - -* As of Twig 2.x, the ability to register a global variable after the runtime - or the extensions have been initialized is not possible anymore (but - changing the value of an already registered global is possible). - -* As of Twig 1.x, using the ``_self`` global variable to get access to the - current ``Twig_Template`` instance is deprecated; most usages only need the - current template name, which will continue to work in Twig 2.0. In Twig 2.0, - ``_self`` returns the current template name instead of the current - ``Twig_Template`` instance. - -Miscellaneous -------------- - -* As of Twig 1.x, ``Twig_Environment::clearTemplateCache()``, ``Twig_Environment::writeCacheFile()``, - ``Twig_Environment::clearCacheFiles()``, ``Twig_Environment::getCacheFilename()``, and - ``Twig_Environment::getTemplateClassPrefix()`` are deprecated and will be removed in 2.0. - -* As of Twig 1.x, ``Twig_Template::getEnvironment()`` and - ``Twig_TemplateInterface::getEnvironment()`` are deprecated and will be - removed in 2.0. diff --git a/plugins/twig/vendor/twig/twig/doc/filters/abs.rst b/plugins/twig/vendor/twig/twig/doc/filters/abs.rst deleted file mode 100644 index 22fa59d0..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/abs.rst +++ /dev/null @@ -1,18 +0,0 @@ -``abs`` -======= - -The ``abs`` filter returns the absolute value. - -.. code-block:: jinja - - {# number = -5 #} - - {{ number|abs }} - - {# outputs 5 #} - -.. note:: - - Internally, Twig uses the PHP `abs`_ function. - -.. _`abs`: http://php.net/abs diff --git a/plugins/twig/vendor/twig/twig/doc/filters/batch.rst b/plugins/twig/vendor/twig/twig/doc/filters/batch.rst deleted file mode 100644 index f8b6fa9d..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/batch.rst +++ /dev/null @@ -1,51 +0,0 @@ -``batch`` -========= - -.. versionadded:: 1.12.3 - The ``batch`` filter was added in Twig 1.12.3. - -The ``batch`` filter "batches" items by returning a list of lists with the -given number of items. A second parameter can be provided and used to fill in -missing items: - -.. code-block:: jinja - - {% set items = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] %} - - - {% for row in items|batch(3, 'No item') %} - - {% for column in row %} - - {% endfor %} - - {% endfor %} -
    {{ column }}
    - -The above example will be rendered as: - -.. code-block:: jinja - - - - - - - - - - - - - - - - - -
    abc
    def
    gNo itemNo item
    - -Arguments ---------- - -* ``size``: The size of the batch; fractional numbers will be rounded up -* ``fill``: Used to fill in missing items diff --git a/plugins/twig/vendor/twig/twig/doc/filters/capitalize.rst b/plugins/twig/vendor/twig/twig/doc/filters/capitalize.rst deleted file mode 100644 index 10546a1f..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/capitalize.rst +++ /dev/null @@ -1,11 +0,0 @@ -``capitalize`` -============== - -The ``capitalize`` filter capitalizes a value. The first character will be -uppercase, all others lowercase: - -.. code-block:: jinja - - {{ 'my first car'|capitalize }} - - {# outputs 'My first car' #} diff --git a/plugins/twig/vendor/twig/twig/doc/filters/convert_encoding.rst b/plugins/twig/vendor/twig/twig/doc/filters/convert_encoding.rst deleted file mode 100644 index f4ebe580..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/convert_encoding.rst +++ /dev/null @@ -1,28 +0,0 @@ -``convert_encoding`` -==================== - -.. versionadded:: 1.4 - The ``convert_encoding`` filter was added in Twig 1.4. - -The ``convert_encoding`` filter converts a string from one encoding to -another. The first argument is the expected output charset and the second one -is the input charset: - -.. code-block:: jinja - - {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }} - -.. note:: - - This filter relies on the `iconv`_ or `mbstring`_ extension, so one of - them must be installed. In case both are installed, `mbstring`_ is used by - default (Twig before 1.8.1 uses `iconv`_ by default). - -Arguments ---------- - -* ``to``: The output charset -* ``from``: The input charset - -.. _`iconv`: http://php.net/iconv -.. _`mbstring`: http://php.net/mbstring diff --git a/plugins/twig/vendor/twig/twig/doc/filters/date.rst b/plugins/twig/vendor/twig/twig/doc/filters/date.rst deleted file mode 100644 index c86d42ba..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/date.rst +++ /dev/null @@ -1,94 +0,0 @@ -``date`` -======== - -.. versionadded:: 1.1 - The timezone support has been added in Twig 1.1. - -.. versionadded:: 1.5 - The default date format support has been added in Twig 1.5. - -.. versionadded:: 1.6.1 - The default timezone support has been added in Twig 1.6.1. - -.. versionadded:: 1.11.0 - The introduction of the false value for the timezone was introduced in Twig 1.11.0 - -The ``date`` filter formats a date to a given format: - -.. code-block:: jinja - - {{ post.published_at|date("m/d/Y") }} - -The format specifier is the same as supported by `date`_, -except when the filtered data is of type `DateInterval`_, when the format must conform to -`DateInterval::format`_ instead. - -The ``date`` filter accepts strings (it must be in a format supported by the -`strtotime`_ function), `DateTime`_ instances, or `DateInterval`_ instances. For -instance, to display the current date, filter the word "now": - -.. code-block:: jinja - - {{ "now"|date("m/d/Y") }} - -To escape words and characters in the date format use ``\\`` in front of each -character: - -.. code-block:: jinja - - {{ post.published_at|date("F jS \\a\\t g:ia") }} - -If the value passed to the ``date`` filter is ``null``, it will return the -current date by default. If an empty string is desired instead of the current -date, use a ternary operator: - -.. code-block:: jinja - - {{ post.published_at is empty ? "" : post.published_at|date("m/d/Y") }} - -If no format is provided, Twig will use the default one: ``F j, Y H:i``. This -default can be easily changed by calling the ``setDateFormat()`` method on the -``core`` extension instance. The first argument is the default format for -dates and the second one is the default format for date intervals: - -.. code-block:: php - - $twig = new Twig_Environment($loader); - $twig->getExtension('core')->setDateFormat('d/m/Y', '%d days'); - -Timezone --------- - -By default, the date is displayed by applying the default timezone (the one -specified in php.ini or declared in Twig -- see below), but you can override -it by explicitly specifying a timezone: - -.. code-block:: jinja - - {{ post.published_at|date("m/d/Y", "Europe/Paris") }} - -If the date is already a DateTime object, and if you want to keep its current -timezone, pass ``false`` as the timezone value: - -.. code-block:: jinja - - {{ post.published_at|date("m/d/Y", false) }} - -The default timezone can also be set globally by calling ``setTimezone()``: - -.. code-block:: php - - $twig = new Twig_Environment($loader); - $twig->getExtension('core')->setTimezone('Europe/Paris'); - -Arguments ---------- - -* ``format``: The date format -* ``timezone``: The date timezone - -.. _`strtotime`: http://www.php.net/strtotime -.. _`DateTime`: http://www.php.net/DateTime -.. _`DateInterval`: http://www.php.net/DateInterval -.. _`date`: http://www.php.net/date -.. _`DateInterval::format`: http://www.php.net/DateInterval.format diff --git a/plugins/twig/vendor/twig/twig/doc/filters/date_modify.rst b/plugins/twig/vendor/twig/twig/doc/filters/date_modify.rst deleted file mode 100644 index add40b56..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/date_modify.rst +++ /dev/null @@ -1,23 +0,0 @@ -``date_modify`` -=============== - -.. versionadded:: 1.9.0 - The date_modify filter has been added in Twig 1.9.0. - -The ``date_modify`` filter modifies a date with a given modifier string: - -.. code-block:: jinja - - {{ post.published_at|date_modify("+1 day")|date("m/d/Y") }} - -The ``date_modify`` filter accepts strings (it must be in a format supported -by the `strtotime`_ function) or `DateTime`_ instances. You can easily combine -it with the :doc:`date` filter for formatting. - -Arguments ---------- - -* ``modifier``: The modifier - -.. _`strtotime`: http://www.php.net/strtotime -.. _`DateTime`: http://www.php.net/DateTime diff --git a/plugins/twig/vendor/twig/twig/doc/filters/default.rst b/plugins/twig/vendor/twig/twig/doc/filters/default.rst deleted file mode 100644 index 641ac6e7..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/default.rst +++ /dev/null @@ -1,33 +0,0 @@ -``default`` -=========== - -The ``default`` filter returns the passed default value if the value is -undefined or empty, otherwise the value of the variable: - -.. code-block:: jinja - - {{ var|default('var is not defined') }} - - {{ var.foo|default('foo item on var is not defined') }} - - {{ var['foo']|default('foo item on var is not defined') }} - - {{ ''|default('passed var is empty') }} - -When using the ``default`` filter on an expression that uses variables in some -method calls, be sure to use the ``default`` filter whenever a variable can be -undefined: - -.. code-block:: jinja - - {{ var.method(foo|default('foo'))|default('foo') }} - -.. note:: - - Read the documentation for the :doc:`defined<../tests/defined>` and - :doc:`empty<../tests/empty>` tests to learn more about their semantics. - -Arguments ---------- - -* ``default``: The default value diff --git a/plugins/twig/vendor/twig/twig/doc/filters/escape.rst b/plugins/twig/vendor/twig/twig/doc/filters/escape.rst deleted file mode 100644 index fc9771ac..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/escape.rst +++ /dev/null @@ -1,116 +0,0 @@ -``escape`` -========== - -.. versionadded:: 1.9.0 - The ``css``, ``url``, and ``html_attr`` strategies were added in Twig - 1.9.0. - -.. versionadded:: 1.14.0 - The ability to define custom escapers was added in Twig 1.14.0. - -The ``escape`` filter escapes a string for safe insertion into the final -output. It supports different escaping strategies depending on the template -context. - -By default, it uses the HTML escaping strategy: - -.. code-block:: jinja - - {{ user.username|escape }} - -For convenience, the ``e`` filter is defined as an alias: - -.. code-block:: jinja - - {{ user.username|e }} - -The ``escape`` filter can also be used in other contexts than HTML thanks to -an optional argument which defines the escaping strategy to use: - -.. code-block:: jinja - - {{ user.username|e }} - {# is equivalent to #} - {{ user.username|e('html') }} - -And here is how to escape variables included in JavaScript code: - -.. code-block:: jinja - - {{ user.username|escape('js') }} - {{ user.username|e('js') }} - -The ``escape`` filter supports the following escaping strategies: - -* ``html``: escapes a string for the **HTML body** context. - -* ``js``: escapes a string for the **JavaScript context**. - -* ``css``: escapes a string for the **CSS context**. CSS escaping can be - applied to any string being inserted into CSS and escapes everything except - alphanumerics. - -* ``url``: escapes a string for the **URI or parameter contexts**. This should - not be used to escape an entire URI; only a subcomponent being inserted. - -* ``html_attr``: escapes a string for the **HTML attribute** context. - -.. note:: - - Internally, ``escape`` uses the PHP native `htmlspecialchars`_ function - for the HTML escaping strategy. - -.. caution:: - - When using automatic escaping, Twig tries to not double-escape a variable - when the automatic escaping strategy is the same as the one applied by the - escape filter; but that does not work when using a variable as the - escaping strategy: - - .. code-block:: jinja - - {% set strategy = 'html' %} - - {% autoescape 'html' %} - {{ var|escape('html') }} {# won't be double-escaped #} - {{ var|escape(strategy) }} {# will be double-escaped #} - {% endautoescape %} - - When using a variable as the escaping strategy, you should disable - automatic escaping: - - .. code-block:: jinja - - {% set strategy = 'html' %} - - {% autoescape 'html' %} - {{ var|escape(strategy)|raw }} {# won't be double-escaped #} - {% endautoescape %} - -Custom Escapers ---------------- - -You can define custom escapers by calling the ``setEscaper()`` method on the -``core`` extension instance. The first argument is the escaper name (to be -used in the ``escape`` call) and the second one must be a valid PHP callable: - -.. code-block:: php - - $twig = new Twig_Environment($loader); - $twig->getExtension('core')->setEscaper('csv', 'csv_escaper')); - -When called by Twig, the callable receives the Twig environment instance, the -string to escape, and the charset. - -.. note:: - - Built-in escapers cannot be overridden mainly they should be considered as - the final implementation and also for better performance. - -Arguments ---------- - -* ``strategy``: The escaping strategy -* ``charset``: The string charset - -.. _`htmlspecialchars`: http://php.net/htmlspecialchars diff --git a/plugins/twig/vendor/twig/twig/doc/filters/first.rst b/plugins/twig/vendor/twig/twig/doc/filters/first.rst deleted file mode 100644 index 674c1f9e..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/first.rst +++ /dev/null @@ -1,25 +0,0 @@ -``first`` -========= - -.. versionadded:: 1.12.2 - The ``first`` filter was added in Twig 1.12.2. - -The ``first`` filter returns the first "element" of a sequence, a mapping, or -a string: - -.. code-block:: jinja - - {{ [1, 2, 3, 4]|first }} - {# outputs 1 #} - - {{ { a: 1, b: 2, c: 3, d: 4 }|first }} - {# outputs 1 #} - - {{ '1234'|first }} - {# outputs 1 #} - -.. note:: - - It also works with objects implementing the `Traversable`_ interface. - -.. _`Traversable`: http://php.net/manual/en/class.traversable.php diff --git a/plugins/twig/vendor/twig/twig/doc/filters/format.rst b/plugins/twig/vendor/twig/twig/doc/filters/format.rst deleted file mode 100644 index f8effd9a..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/format.rst +++ /dev/null @@ -1,16 +0,0 @@ -``format`` -========== - -The ``format`` filter formats a given string by replacing the placeholders -(placeholders follows the `sprintf`_ notation): - -.. code-block:: jinja - - {{ "I like %s and %s."|format(foo, "bar") }} - - {# outputs I like foo and bar - if the foo parameter equals to the foo string. #} - -.. _`sprintf`: http://www.php.net/sprintf - -.. seealso:: :doc:`replace` diff --git a/plugins/twig/vendor/twig/twig/doc/filters/index.rst b/plugins/twig/vendor/twig/twig/doc/filters/index.rst deleted file mode 100644 index 8daa9611..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/index.rst +++ /dev/null @@ -1,37 +0,0 @@ -Filters -======= - -.. toctree:: - :maxdepth: 1 - - abs - batch - capitalize - convert_encoding - date - date_modify - default - escape - first - format - join - json_encode - keys - last - length - lower - merge - nl2br - number_format - raw - replace - reverse - round - slice - sort - split - striptags - title - trim - upper - url_encode diff --git a/plugins/twig/vendor/twig/twig/doc/filters/join.rst b/plugins/twig/vendor/twig/twig/doc/filters/join.rst deleted file mode 100644 index 2fab9452..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/join.rst +++ /dev/null @@ -1,23 +0,0 @@ -``join`` -======== - -The ``join`` filter returns a string which is the concatenation of the items -of a sequence: - -.. code-block:: jinja - - {{ [1, 2, 3]|join }} - {# returns 123 #} - -The separator between elements is an empty string per default, but you can -define it with the optional first parameter: - -.. code-block:: jinja - - {{ [1, 2, 3]|join('|') }} - {# outputs 1|2|3 #} - -Arguments ---------- - -* ``glue``: The separator diff --git a/plugins/twig/vendor/twig/twig/doc/filters/json_encode.rst b/plugins/twig/vendor/twig/twig/doc/filters/json_encode.rst deleted file mode 100644 index a39bb476..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/json_encode.rst +++ /dev/null @@ -1,21 +0,0 @@ -``json_encode`` -=============== - -The ``json_encode`` filter returns the JSON representation of a value: - -.. code-block:: jinja - - {{ data|json_encode() }} - -.. note:: - - Internally, Twig uses the PHP `json_encode`_ function. - -Arguments ---------- - -* ``options``: A bitmask of `json_encode options`_ (``{{ - data|json_encode(constant('JSON_PRETTY_PRINT')) }}``) - -.. _`json_encode`: http://php.net/json_encode -.. _`json_encode options`: http://www.php.net/manual/en/json.constants.php diff --git a/plugins/twig/vendor/twig/twig/doc/filters/keys.rst b/plugins/twig/vendor/twig/twig/doc/filters/keys.rst deleted file mode 100644 index e4f090c6..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/keys.rst +++ /dev/null @@ -1,11 +0,0 @@ -``keys`` -======== - -The ``keys`` filter returns the keys of an array. It is useful when you want to -iterate over the keys of an array: - -.. code-block:: jinja - - {% for key in array|keys %} - ... - {% endfor %} diff --git a/plugins/twig/vendor/twig/twig/doc/filters/last.rst b/plugins/twig/vendor/twig/twig/doc/filters/last.rst deleted file mode 100644 index 345b6573..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/last.rst +++ /dev/null @@ -1,25 +0,0 @@ -``last`` -======== - -.. versionadded:: 1.12.2 - The ``last`` filter was added in Twig 1.12.2. - -The ``last`` filter returns the last "element" of a sequence, a mapping, or -a string: - -.. code-block:: jinja - - {{ [1, 2, 3, 4]|last }} - {# outputs 4 #} - - {{ { a: 1, b: 2, c: 3, d: 4 }|last }} - {# outputs 4 #} - - {{ '1234'|last }} - {# outputs 4 #} - -.. note:: - - It also works with objects implementing the `Traversable`_ interface. - -.. _`Traversable`: http://php.net/manual/en/class.traversable.php diff --git a/plugins/twig/vendor/twig/twig/doc/filters/length.rst b/plugins/twig/vendor/twig/twig/doc/filters/length.rst deleted file mode 100644 index 1f783b3d..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/length.rst +++ /dev/null @@ -1,11 +0,0 @@ -``length`` -========== - -The ``length`` filter returns the number of items of a sequence or mapping, or -the length of a string: - -.. code-block:: jinja - - {% if users|length > 10 %} - ... - {% endif %} diff --git a/plugins/twig/vendor/twig/twig/doc/filters/lower.rst b/plugins/twig/vendor/twig/twig/doc/filters/lower.rst deleted file mode 100644 index ef9faa90..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/lower.rst +++ /dev/null @@ -1,10 +0,0 @@ -``lower`` -========= - -The ``lower`` filter converts a value to lowercase: - -.. code-block:: jinja - - {{ 'WELCOME'|lower }} - - {# outputs 'welcome' #} diff --git a/plugins/twig/vendor/twig/twig/doc/filters/merge.rst b/plugins/twig/vendor/twig/twig/doc/filters/merge.rst deleted file mode 100644 index 88780dd6..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/merge.rst +++ /dev/null @@ -1,48 +0,0 @@ -``merge`` -========= - -The ``merge`` filter merges an array with another array: - -.. code-block:: jinja - - {% set values = [1, 2] %} - - {% set values = values|merge(['apple', 'orange']) %} - - {# values now contains [1, 2, 'apple', 'orange'] #} - -New values are added at the end of the existing ones. - -The ``merge`` filter also works on hashes: - -.. code-block:: jinja - - {% set items = { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'unknown' } %} - - {% set items = items|merge({ 'peugeot': 'car', 'renault': 'car' }) %} - - {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car', 'renault': 'car' } #} - -For hashes, the merging process occurs on the keys: if the key does not -already exist, it is added but if the key already exists, its value is -overridden. - -.. tip:: - - If you want to ensure that some values are defined in an array (by given - default values), reverse the two elements in the call: - - .. code-block:: jinja - - {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} - - {% set items = { 'apple': 'unknown' }|merge(items) %} - - {# items now contains { 'apple': 'fruit', 'orange': 'fruit' } #} - -.. note:: - - Internally, Twig uses the PHP `array_merge`_ function. It supports - Traversable objects by transforming those to arrays. - -.. _`array_merge`: http://php.net/array_merge diff --git a/plugins/twig/vendor/twig/twig/doc/filters/nl2br.rst b/plugins/twig/vendor/twig/twig/doc/filters/nl2br.rst deleted file mode 100644 index 5c923e14..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/nl2br.rst +++ /dev/null @@ -1,22 +0,0 @@ -``nl2br`` -========= - -.. versionadded:: 1.5 - The ``nl2br`` filter was added in Twig 1.5. - -The ``nl2br`` filter inserts HTML line breaks before all newlines in a string: - -.. code-block:: jinja - - {{ "I like Twig.\nYou will like it too."|nl2br }} - {# outputs - - I like Twig.
    - You will like it too. - - #} - -.. note:: - - The ``nl2br`` filter pre-escapes the input before applying the - transformation. diff --git a/plugins/twig/vendor/twig/twig/doc/filters/number_format.rst b/plugins/twig/vendor/twig/twig/doc/filters/number_format.rst deleted file mode 100644 index 3114e845..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/number_format.rst +++ /dev/null @@ -1,45 +0,0 @@ -``number_format`` -================= - -.. versionadded:: 1.5 - The ``number_format`` filter was added in Twig 1.5 - -The ``number_format`` filter formats numbers. It is a wrapper around PHP's -`number_format`_ function: - -.. code-block:: jinja - - {{ 200.35|number_format }} - -You can control the number of decimal places, decimal point, and thousands -separator using the additional arguments: - -.. code-block:: jinja - - {{ 9800.333|number_format(2, '.', ',') }} - -If no formatting options are provided then Twig will use the default formatting -options of: - -* 0 decimal places. -* ``.`` as the decimal point. -* ``,`` as the thousands separator. - -These defaults can be easily changed through the core extension: - -.. code-block:: php - - $twig = new Twig_Environment($loader); - $twig->getExtension('core')->setNumberFormat(3, '.', ','); - -The defaults set for ``number_format`` can be over-ridden upon each call using the -additional parameters. - -Arguments ---------- - -* ``decimal``: The number of decimal points to display -* ``decimal_point``: The character(s) to use for the decimal point -* ``thousand_sep``: The character(s) to use for the thousands separator - -.. _`number_format`: http://php.net/number_format diff --git a/plugins/twig/vendor/twig/twig/doc/filters/raw.rst b/plugins/twig/vendor/twig/twig/doc/filters/raw.rst deleted file mode 100644 index e5e5b12e..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/raw.rst +++ /dev/null @@ -1,36 +0,0 @@ -``raw`` -======= - -The ``raw`` filter marks the value as being "safe", which means that in an -environment with automatic escaping enabled this variable will not be escaped -if ``raw`` is the last filter applied to it: - -.. code-block:: jinja - - {% autoescape %} - {{ var|raw }} {# var won't be escaped #} - {% endautoescape %} - -.. note:: - - Be careful when using the ``raw`` filter inside expressions: - - .. code-block:: jinja - - {% autoescape %} - {% set hello = 'Hello' %} - {% set hola = 'Hola' %} - - {{ false ? 'Hola' : hello|raw }} - does not render the same as - {{ false ? hola : hello|raw }} - but renders the same as - {{ (false ? hola : hello)|raw }} - {% endautoescape %} - - The first ternary statement is not escaped: ``hello`` is marked as being - safe and Twig does not escape static values (see - :doc:`escape<../tags/autoescape>`). In the second ternary statement, even - if ``hello`` is marked as safe, ``hola`` remains unsafe and so is the whole - expression. The third ternary statement is marked as safe and the result is - not escaped. diff --git a/plugins/twig/vendor/twig/twig/doc/filters/replace.rst b/plugins/twig/vendor/twig/twig/doc/filters/replace.rst deleted file mode 100644 index 1227957b..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/replace.rst +++ /dev/null @@ -1,19 +0,0 @@ -``replace`` -=========== - -The ``replace`` filter formats a given string by replacing the placeholders -(placeholders are free-form): - -.. code-block:: jinja - - {{ "I like %this% and %that%."|replace({'%this%': foo, '%that%': "bar"}) }} - - {# outputs I like foo and bar - if the foo parameter equals to the foo string. #} - -Arguments ---------- - -* ``replace_pairs``: The placeholder values - -.. seealso:: :doc:`format` diff --git a/plugins/twig/vendor/twig/twig/doc/filters/reverse.rst b/plugins/twig/vendor/twig/twig/doc/filters/reverse.rst deleted file mode 100644 index 76fd2c1a..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/reverse.rst +++ /dev/null @@ -1,47 +0,0 @@ -``reverse`` -=========== - -.. versionadded:: 1.6 - Support for strings has been added in Twig 1.6. - -The ``reverse`` filter reverses a sequence, a mapping, or a string: - -.. code-block:: jinja - - {% for user in users|reverse %} - ... - {% endfor %} - - {{ '1234'|reverse }} - - {# outputs 4321 #} - -.. tip:: - - For sequences and mappings, numeric keys are not preserved. To reverse - them as well, pass ``true`` as an argument to the ``reverse`` filter: - - .. code-block:: jinja - - {% for key, value in {1: "a", 2: "b", 3: "c"}|reverse %} - {{ key }}: {{ value }} - {%- endfor %} - - {# output: 0: c 1: b 2: a #} - - {% for key, value in {1: "a", 2: "b", 3: "c"}|reverse(true) %} - {{ key }}: {{ value }} - {%- endfor %} - - {# output: 3: c 2: b 1: a #} - -.. note:: - - It also works with objects implementing the `Traversable`_ interface. - -Arguments ---------- - -* ``preserve_keys``: Preserve keys when reversing a mapping or a sequence. - -.. _`Traversable`: http://php.net/Traversable diff --git a/plugins/twig/vendor/twig/twig/doc/filters/round.rst b/plugins/twig/vendor/twig/twig/doc/filters/round.rst deleted file mode 100644 index 2521cf16..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/round.rst +++ /dev/null @@ -1,37 +0,0 @@ -``round`` -========= - -.. versionadded:: 1.15.0 - The ``round`` filter was added in Twig 1.15.0. - -The ``round`` filter rounds a number to a given precision: - -.. code-block:: jinja - - {{ 42.55|round }} - {# outputs 43 #} - - {{ 42.55|round(1, 'floor') }} - {# outputs 42.5 #} - -The ``round`` filter takes two optional arguments; the first one specifies the -precision (default is ``0``) and the second the rounding method (default is -``common``): - -* ``common`` rounds either up or down (rounds the value up to precision decimal - places away from zero, when it is half way there -- making 1.5 into 2 and - -1.5 into -2); - -* ``ceil`` always rounds up; - -* ``floor`` always rounds down. - -.. note:: - - The ``//`` operator is equivalent to ``|round(0, 'floor')``. - -Arguments ---------- - -* ``precision``: The rounding precision -* ``method``: The rounding method diff --git a/plugins/twig/vendor/twig/twig/doc/filters/slice.rst b/plugins/twig/vendor/twig/twig/doc/filters/slice.rst deleted file mode 100644 index 70bf139e..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/slice.rst +++ /dev/null @@ -1,71 +0,0 @@ -``slice`` -=========== - -.. versionadded:: 1.6 - The ``slice`` filter was added in Twig 1.6. - -The ``slice`` filter extracts a slice of a sequence, a mapping, or a string: - -.. code-block:: jinja - - {% for i in [1, 2, 3, 4, 5]|slice(1, 2) %} - {# will iterate over 2 and 3 #} - {% endfor %} - - {{ '12345'|slice(1, 2) }} - - {# outputs 23 #} - -You can use any valid expression for both the start and the length: - -.. code-block:: jinja - - {% for i in [1, 2, 3, 4, 5]|slice(start, length) %} - {# ... #} - {% endfor %} - -As syntactic sugar, you can also use the ``[]`` notation: - -.. code-block:: jinja - - {% for i in [1, 2, 3, 4, 5][start:length] %} - {# ... #} - {% endfor %} - - {{ '12345'[1:2] }} {# will display "23" #} - - {# you can omit the first argument -- which is the same as 0 #} - {{ '12345'[:2] }} {# will display "12" #} - - {# you can omit the last argument -- which will select everything till the end #} - {{ '12345'[2:] }} {# will display "345" #} - -The ``slice`` filter works as the `array_slice`_ PHP function for arrays and -`mb_substr`_ for strings with a fallback to `substr`_. - -If the start is non-negative, the sequence will start at that start in the -variable. If start is negative, the sequence will start that far from the end -of the variable. - -If length is given and is positive, then the sequence will have up to that -many elements in it. If the variable is shorter than the length, then only the -available variable elements will be present. If length is given and is -negative then the sequence will stop that many elements from the end of the -variable. If it is omitted, then the sequence will have everything from offset -up until the end of the variable. - -.. note:: - - It also works with objects implementing the `Traversable`_ interface. - -Arguments ---------- - -* ``start``: The start of the slice -* ``length``: The size of the slice -* ``preserve_keys``: Whether to preserve key or not (when the input is an array) - -.. _`Traversable`: http://php.net/manual/en/class.traversable.php -.. _`array_slice`: http://php.net/array_slice -.. _`mb_substr` : http://php.net/mb-substr -.. _`substr`: http://php.net/substr diff --git a/plugins/twig/vendor/twig/twig/doc/filters/sort.rst b/plugins/twig/vendor/twig/twig/doc/filters/sort.rst deleted file mode 100644 index 350207f8..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/sort.rst +++ /dev/null @@ -1,18 +0,0 @@ -``sort`` -======== - -The ``sort`` filter sorts an array: - -.. code-block:: jinja - - {% for user in users|sort %} - ... - {% endfor %} - -.. note:: - - Internally, Twig uses the PHP `asort`_ function to maintain index - association. It supports Traversable objects by transforming - those to arrays. - -.. _`asort`: http://php.net/asort diff --git a/plugins/twig/vendor/twig/twig/doc/filters/split.rst b/plugins/twig/vendor/twig/twig/doc/filters/split.rst deleted file mode 100644 index bbc6d798..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/split.rst +++ /dev/null @@ -1,53 +0,0 @@ -``split`` -========= - -.. versionadded:: 1.10.3 - The ``split`` filter was added in Twig 1.10.3. - -The ``split`` filter splits a string by the given delimiter and returns a list -of strings: - -.. code-block:: jinja - - {% set foo = "one,two,three"|split(',') %} - {# foo contains ['one', 'two', 'three'] #} - -You can also pass a ``limit`` argument: - - * If ``limit`` is positive, the returned array will contain a maximum of - limit elements with the last element containing the rest of string; - - * If ``limit`` is negative, all components except the last -limit are - returned; - - * If ``limit`` is zero, then this is treated as 1. - -.. code-block:: jinja - - {% set foo = "one,two,three,four,five"|split(',', 3) %} - {# foo contains ['one', 'two', 'three,four,five'] #} - -If the ``delimiter`` is an empty string, then value will be split by equal -chunks. Length is set by the ``limit`` argument (one character by default). - -.. code-block:: jinja - - {% set foo = "123"|split('') %} - {# foo contains ['1', '2', '3'] #} - - {% set bar = "aabbcc"|split('', 2) %} - {# bar contains ['aa', 'bb', 'cc'] #} - -.. note:: - - Internally, Twig uses the PHP `explode`_ or `str_split`_ (if delimiter is - empty) functions for string splitting. - -Arguments ---------- - -* ``delimiter``: The delimiter -* ``limit``: The limit argument - -.. _`explode`: http://php.net/explode -.. _`str_split`: http://php.net/str_split diff --git a/plugins/twig/vendor/twig/twig/doc/filters/striptags.rst b/plugins/twig/vendor/twig/twig/doc/filters/striptags.rst deleted file mode 100644 index 72c6f252..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/striptags.rst +++ /dev/null @@ -1,15 +0,0 @@ -``striptags`` -============= - -The ``striptags`` filter strips SGML/XML tags and replace adjacent whitespace -by one space: - -.. code-block:: jinja - - {{ some_html|striptags }} - -.. note:: - - Internally, Twig uses the PHP `strip_tags`_ function. - -.. _`strip_tags`: http://php.net/strip_tags diff --git a/plugins/twig/vendor/twig/twig/doc/filters/title.rst b/plugins/twig/vendor/twig/twig/doc/filters/title.rst deleted file mode 100644 index c5a318e8..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/title.rst +++ /dev/null @@ -1,11 +0,0 @@ -``title`` -========= - -The ``title`` filter returns a titlecased version of the value. Words will -start with uppercase letters, all remaining characters are lowercase: - -.. code-block:: jinja - - {{ 'my first car'|title }} - - {# outputs 'My First Car' #} diff --git a/plugins/twig/vendor/twig/twig/doc/filters/trim.rst b/plugins/twig/vendor/twig/twig/doc/filters/trim.rst deleted file mode 100644 index 4ddb2083..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/trim.rst +++ /dev/null @@ -1,29 +0,0 @@ -``trim`` -======== - -.. versionadded:: 1.6.2 - The ``trim`` filter was added in Twig 1.6.2. - -The ``trim`` filter strips whitespace (or other characters) from the beginning -and end of a string: - -.. code-block:: jinja - - {{ ' I like Twig. '|trim }} - - {# outputs 'I like Twig.' #} - - {{ ' I like Twig.'|trim('.') }} - - {# outputs ' I like Twig' #} - -.. note:: - - Internally, Twig uses the PHP `trim`_ function. - -Arguments ---------- - -* ``character_mask``: The characters to strip - -.. _`trim`: http://php.net/trim diff --git a/plugins/twig/vendor/twig/twig/doc/filters/upper.rst b/plugins/twig/vendor/twig/twig/doc/filters/upper.rst deleted file mode 100644 index 561cebe3..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/upper.rst +++ /dev/null @@ -1,10 +0,0 @@ -``upper`` -========= - -The ``upper`` filter converts a value to uppercase: - -.. code-block:: jinja - - {{ 'welcome'|upper }} - - {# outputs 'WELCOME' #} diff --git a/plugins/twig/vendor/twig/twig/doc/filters/url_encode.rst b/plugins/twig/vendor/twig/twig/doc/filters/url_encode.rst deleted file mode 100644 index 5944e59c..00000000 --- a/plugins/twig/vendor/twig/twig/doc/filters/url_encode.rst +++ /dev/null @@ -1,34 +0,0 @@ -``url_encode`` -============== - -.. versionadded:: 1.12.3 - Support for encoding an array as query string was added in Twig 1.12.3. - -.. versionadded:: 1.16.0 - The ``raw`` argument was removed in Twig 1.16.0. Twig now always encodes - according to RFC 3986. - -The ``url_encode`` filter percent encodes a given string as URL segment -or an array as query string: - -.. code-block:: jinja - - {{ "path-seg*ment"|url_encode }} - {# outputs "path-seg%2Ament" #} - - {{ "string with spaces"|url_encode }} - {# outputs "string%20with%20spaces" #} - - {{ {'param': 'value', 'foo': 'bar'}|url_encode }} - {# outputs "param=value&foo=bar" #} - -.. note:: - - Internally, Twig uses the PHP `urlencode`_ (or `rawurlencode`_ if you pass - ``true`` as the first parameter) or the `http_build_query`_ function. Note - that as of Twig 1.16.0, ``urlencode`` **always** uses ``rawurlencode`` (the - ``raw`` argument was removed.) - -.. _`urlencode`: http://php.net/urlencode -.. _`rawurlencode`: http://php.net/rawurlencode -.. _`http_build_query`: http://php.net/http_build_query diff --git a/plugins/twig/vendor/twig/twig/doc/functions/attribute.rst b/plugins/twig/vendor/twig/twig/doc/functions/attribute.rst deleted file mode 100644 index ceba96b0..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/attribute.rst +++ /dev/null @@ -1,26 +0,0 @@ -``attribute`` -============= - -.. versionadded:: 1.2 - The ``attribute`` function was added in Twig 1.2. - -The ``attribute`` function can be used to access a "dynamic" attribute of a -variable: - -.. code-block:: jinja - - {{ attribute(object, method) }} - {{ attribute(object, method, arguments) }} - {{ attribute(array, item) }} - -In addition, the ``defined`` test can check for the existence of a dynamic -attribute: - -.. code-block:: jinja - - {{ attribute(object, method) is defined ? 'Method exists' : 'Method does not exist' }} - -.. note:: - - The resolution algorithm is the same as the one used for the ``.`` - notation, except that the item can be any valid expression. diff --git a/plugins/twig/vendor/twig/twig/doc/functions/block.rst b/plugins/twig/vendor/twig/twig/doc/functions/block.rst deleted file mode 100644 index fd571efb..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/block.rst +++ /dev/null @@ -1,15 +0,0 @@ -``block`` -========= - -When a template uses inheritance and if you want to print a block multiple -times, use the ``block`` function: - -.. code-block:: jinja - - {% block title %}{% endblock %} - -

    {{ block('title') }}

    - - {% block body %}{% endblock %} - -.. seealso:: :doc:`extends<../tags/extends>`, :doc:`parent<../functions/parent>` diff --git a/plugins/twig/vendor/twig/twig/doc/functions/constant.rst b/plugins/twig/vendor/twig/twig/doc/functions/constant.rst deleted file mode 100644 index bea0e9fc..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/constant.rst +++ /dev/null @@ -1,18 +0,0 @@ -``constant`` -============ - -.. versionadded: 1.12.1 - constant now accepts object instances as the second argument. - -``constant`` returns the constant value for a given string: - -.. code-block:: jinja - - {{ some_date|date(constant('DATE_W3C')) }} - {{ constant('Namespace\\Classname::CONSTANT_NAME') }} - -As of 1.12.1 you can read constants from object instances as well: - -.. code-block:: jinja - - {{ constant('RSS', date) }} diff --git a/plugins/twig/vendor/twig/twig/doc/functions/cycle.rst b/plugins/twig/vendor/twig/twig/doc/functions/cycle.rst deleted file mode 100644 index e3434932..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/cycle.rst +++ /dev/null @@ -1,28 +0,0 @@ -``cycle`` -========= - -The ``cycle`` function cycles on an array of values: - -.. code-block:: jinja - - {% set start_year = date() | date('Y') %} - {% set end_year = start_year + 5 %} - - {% for year in start_year..end_year %} - {{ cycle(['odd', 'even'], loop.index0) }} - {% endfor %} - -The array can contain any number of values: - -.. code-block:: jinja - - {% set fruits = ['apple', 'orange', 'citrus'] %} - - {% for i in 0..10 %} - {{ cycle(fruits, i) }} - {% endfor %} - -Arguments ---------- - -* ``position``: The cycle position diff --git a/plugins/twig/vendor/twig/twig/doc/functions/date.rst b/plugins/twig/vendor/twig/twig/doc/functions/date.rst deleted file mode 100644 index 714e08c4..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/date.rst +++ /dev/null @@ -1,52 +0,0 @@ -``date`` -======== - -.. versionadded:: 1.6 - The date function has been added in Twig 1.6. - -.. versionadded:: 1.6.1 - The default timezone support has been added in Twig 1.6.1. - -Converts an argument to a date to allow date comparison: - -.. code-block:: jinja - - {% if date(user.created_at) < date('-2days') %} - {# do something #} - {% endif %} - -The argument must be in one of PHP’s supported `date and time formats`_. - -You can pass a timezone as the second argument: - -.. code-block:: jinja - - {% if date(user.created_at) < date('-2days', 'Europe/Paris') %} - {# do something #} - {% endif %} - -If no argument is passed, the function returns the current date: - -.. code-block:: jinja - - {% if date(user.created_at) < date() %} - {# always! #} - {% endif %} - -.. note:: - - You can set the default timezone globally by calling ``setTimezone()`` on - the ``core`` extension instance: - - .. code-block:: php - - $twig = new Twig_Environment($loader); - $twig->getExtension('core')->setTimezone('Europe/Paris'); - -Arguments ---------- - -* ``date``: The date -* ``timezone``: The timezone - -.. _`date and time formats`: http://php.net/manual/en/datetime.formats.php diff --git a/plugins/twig/vendor/twig/twig/doc/functions/dump.rst b/plugins/twig/vendor/twig/twig/doc/functions/dump.rst deleted file mode 100644 index a231f089..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/dump.rst +++ /dev/null @@ -1,69 +0,0 @@ -``dump`` -======== - -.. versionadded:: 1.5 - The ``dump`` function was added in Twig 1.5. - -The ``dump`` function dumps information about a template variable. This is -mostly useful to debug a template that does not behave as expected by -introspecting its variables: - -.. code-block:: jinja - - {{ dump(user) }} - -.. note:: - - The ``dump`` function is not available by default. You must add the - ``Twig_Extension_Debug`` extension explicitly when creating your Twig - environment:: - - $twig = new Twig_Environment($loader, array( - 'debug' => true, - // ... - )); - $twig->addExtension(new Twig_Extension_Debug()); - - Even when enabled, the ``dump`` function won't display anything if the - ``debug`` option on the environment is not enabled (to avoid leaking debug - information on a production server). - -In an HTML context, wrap the output with a ``pre`` tag to make it easier to -read: - -.. code-block:: jinja - -
    -        {{ dump(user) }}
    -    
    - -.. tip:: - - Using a ``pre`` tag is not needed when `XDebug`_ is enabled and - ``html_errors`` is ``on``; as a bonus, the output is also nicer with - XDebug enabled. - -You can debug several variables by passing them as additional arguments: - -.. code-block:: jinja - - {{ dump(user, categories) }} - -If you don't pass any value, all variables from the current context are -dumped: - -.. code-block:: jinja - - {{ dump() }} - -.. note:: - - Internally, Twig uses the PHP `var_dump`_ function. - -Arguments ---------- - -* ``context``: The context to dump - -.. _`XDebug`: http://xdebug.org/docs/display -.. _`var_dump`: http://php.net/var_dump diff --git a/plugins/twig/vendor/twig/twig/doc/functions/include.rst b/plugins/twig/vendor/twig/twig/doc/functions/include.rst deleted file mode 100644 index 33bd56d1..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/include.rst +++ /dev/null @@ -1,80 +0,0 @@ -``include`` -=========== - -.. versionadded:: 1.12 - The ``include`` function was added in Twig 1.12. - -The ``include`` function returns the rendered content of a template: - -.. code-block:: jinja - - {{ include('template.html') }} - {{ include(some_var) }} - -Included templates have access to the variables of the active context. - -If you are using the filesystem loader, the templates are looked for in the -paths defined by it. - -The context is passed by default to the template but you can also pass -additional variables: - -.. code-block:: jinja - - {# template.html will have access to the variables from the current context and the additional ones provided #} - {{ include('template.html', {foo: 'bar'}) }} - -You can disable access to the context by setting ``with_context`` to -``false``: - -.. code-block:: jinja - - {# only the foo variable will be accessible #} - {{ include('template.html', {foo: 'bar'}, with_context = false) }} - -.. code-block:: jinja - - {# no variables will be accessible #} - {{ include('template.html', with_context = false) }} - -And if the expression evaluates to a ``Twig_Template`` object, Twig will use it -directly:: - - // {{ include(template) }} - - $template = $twig->loadTemplate('some_template.twig'); - - $twig->loadTemplate('template.twig')->display(array('template' => $template)); - -When you set the ``ignore_missing`` flag, Twig will return an empty string if -the template does not exist: - -.. code-block:: jinja - - {{ include('sidebar.html', ignore_missing = true) }} - -You can also provide a list of templates that are checked for existence before -inclusion. The first template that exists will be rendered: - -.. code-block:: jinja - - {{ include(['page_detailed.html', 'page.html']) }} - -If ``ignore_missing`` is set, it will fall back to rendering nothing if none -of the templates exist, otherwise it will throw an exception. - -When including a template created by an end user, you should consider -sandboxing it: - -.. code-block:: jinja - - {{ include('page.html', sandboxed = true) }} - -Arguments ---------- - -* ``template``: The template to render -* ``variables``: The variables to pass to the template -* ``with_context``: Whether to pass the current context variables or not -* ``ignore_missing``: Whether to ignore missing templates or not -* ``sandboxed``: Whether to sandbox the template or not diff --git a/plugins/twig/vendor/twig/twig/doc/functions/index.rst b/plugins/twig/vendor/twig/twig/doc/functions/index.rst deleted file mode 100644 index 07214a76..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/index.rst +++ /dev/null @@ -1,20 +0,0 @@ -Functions -========= - -.. toctree:: - :maxdepth: 1 - - attribute - block - constant - cycle - date - dump - include - max - min - parent - random - range - source - template_from_string diff --git a/plugins/twig/vendor/twig/twig/doc/functions/max.rst b/plugins/twig/vendor/twig/twig/doc/functions/max.rst deleted file mode 100644 index 6f3cfc53..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/max.rst +++ /dev/null @@ -1,20 +0,0 @@ -``max`` -======= - -.. versionadded:: 1.15 - The ``max`` function was added in Twig 1.15. - -``max`` returns the biggest value of a sequence or a set of values: - -.. code-block:: jinja - - {{ max(1, 3, 2) }} - {{ max([1, 3, 2]) }} - -When called with a mapping, max ignores keys and only compares values: - -.. code-block:: jinja - - {{ max({2: "e", 1: "a", 3: "b", 5: "d", 4: "c"}) }} - {# returns "e" #} - diff --git a/plugins/twig/vendor/twig/twig/doc/functions/min.rst b/plugins/twig/vendor/twig/twig/doc/functions/min.rst deleted file mode 100644 index 7b6a65e1..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/min.rst +++ /dev/null @@ -1,20 +0,0 @@ -``min`` -======= - -.. versionadded:: 1.15 - The ``min`` function was added in Twig 1.15. - -``min`` returns the lowest value of a sequence or a set of values: - -.. code-block:: jinja - - {{ min(1, 3, 2) }} - {{ min([1, 3, 2]) }} - -When called with a mapping, min ignores keys and only compares values: - -.. code-block:: jinja - - {{ min({2: "e", 3: "a", 1: "b", 5: "d", 4: "c"}) }} - {# returns "a" #} - diff --git a/plugins/twig/vendor/twig/twig/doc/functions/parent.rst b/plugins/twig/vendor/twig/twig/doc/functions/parent.rst deleted file mode 100644 index f5bd2001..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/parent.rst +++ /dev/null @@ -1,20 +0,0 @@ -``parent`` -========== - -When a template uses inheritance, it's possible to render the contents of the -parent block when overriding a block by using the ``parent`` function: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% block sidebar %} -

    Table Of Contents

    - ... - {{ parent() }} - {% endblock %} - -The ``parent()`` call will return the content of the ``sidebar`` block as -defined in the ``base.html`` template. - -.. seealso:: :doc:`extends<../tags/extends>`, :doc:`block<../functions/block>`, :doc:`block<../tags/block>` diff --git a/plugins/twig/vendor/twig/twig/doc/functions/random.rst b/plugins/twig/vendor/twig/twig/doc/functions/random.rst deleted file mode 100644 index 168e74f8..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/random.rst +++ /dev/null @@ -1,29 +0,0 @@ -``random`` -========== - -.. versionadded:: 1.5 - The ``random`` function was added in Twig 1.5. - -.. versionadded:: 1.6 - String and integer handling was added in Twig 1.6. - -The ``random`` function returns a random value depending on the supplied -parameter type: - -* a random item from a sequence; -* a random character from a string; -* a random integer between 0 and the integer parameter (inclusive). - -.. code-block:: jinja - - {{ random(['apple', 'orange', 'citrus']) }} {# example output: orange #} - {{ random('ABC') }} {# example output: C #} - {{ random() }} {# example output: 15386094 (works as the native PHP mt_rand function) #} - {{ random(5) }} {# example output: 3 #} - -Arguments ---------- - -* ``values``: The values - -.. _`mt_rand`: http://php.net/mt_rand diff --git a/plugins/twig/vendor/twig/twig/doc/functions/range.rst b/plugins/twig/vendor/twig/twig/doc/functions/range.rst deleted file mode 100644 index b7cd0111..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/range.rst +++ /dev/null @@ -1,45 +0,0 @@ -``range`` -========= - -Returns a list containing an arithmetic progression of integers: - -.. code-block:: jinja - - {% for i in range(0, 3) %} - {{ i }}, - {% endfor %} - - {# outputs 0, 1, 2, 3, #} - -When step is given (as the third parameter), it specifies the increment (or -decrement): - -.. code-block:: jinja - - {% for i in range(0, 6, 2) %} - {{ i }}, - {% endfor %} - - {# outputs 0, 2, 4, 6, #} - -The Twig built-in ``..`` operator is just syntactic sugar for the ``range`` -function (with a step of 1): - -.. code-block:: jinja - - {% for i in 0..3 %} - {{ i }}, - {% endfor %} - -.. tip:: - - The ``range`` function works as the native PHP `range`_ function. - -Arguments ---------- - -* ``low``: The first value of the sequence. -* ``high``: The highest possible value of the sequence. -* ``step``: The increment between elements of the sequence. - -.. _`range`: http://php.net/range diff --git a/plugins/twig/vendor/twig/twig/doc/functions/source.rst b/plugins/twig/vendor/twig/twig/doc/functions/source.rst deleted file mode 100644 index 3c921b1c..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/source.rst +++ /dev/null @@ -1,32 +0,0 @@ -``source`` -========== - -.. versionadded:: 1.15 - The ``source`` function was added in Twig 1.15. - -.. versionadded:: 1.18.3 - The ``ignore_missing`` flag was added in Twig 1.18.3. - -The ``source`` function returns the content of a template without rendering it: - -.. code-block:: jinja - - {{ source('template.html') }} - {{ source(some_var) }} - -When you set the ``ignore_missing`` flag, Twig will return an empty string if -the template does not exist: - -.. code-block:: jinja - - {{ source('template.html', ignore_missing = true) }} - -The function uses the same template loaders as the ones used to include -templates. So, if you are using the filesystem loader, the templates are looked -for in the paths defined by it. - -Arguments ---------- - -* ``name``: The name of the template to read -* ``ignore_missing``: Whether to ignore missing templates or not diff --git a/plugins/twig/vendor/twig/twig/doc/functions/template_from_string.rst b/plugins/twig/vendor/twig/twig/doc/functions/template_from_string.rst deleted file mode 100644 index ce6a60dc..00000000 --- a/plugins/twig/vendor/twig/twig/doc/functions/template_from_string.rst +++ /dev/null @@ -1,32 +0,0 @@ -``template_from_string`` -======================== - -.. versionadded:: 1.11 - The ``template_from_string`` function was added in Twig 1.11. - -The ``template_from_string`` function loads a template from a string: - -.. code-block:: jinja - - {{ include(template_from_string("Hello {{ name }}")) }} - {{ include(template_from_string(page.template)) }} - -.. note:: - - The ``template_from_string`` function is not available by default. You - must add the ``Twig_Extension_StringLoader`` extension explicitly when - creating your Twig environment:: - - $twig = new Twig_Environment(...); - $twig->addExtension(new Twig_Extension_StringLoader()); - -.. note:: - - Even if you will probably always use the ``template_from_string`` function - with the ``include`` function, you can use it with any tag or function that - takes a template as an argument (like the ``embed`` or ``extends`` tags). - -Arguments ---------- - -* ``template``: The template diff --git a/plugins/twig/vendor/twig/twig/doc/index.rst b/plugins/twig/vendor/twig/twig/doc/index.rst deleted file mode 100644 index 358bd738..00000000 --- a/plugins/twig/vendor/twig/twig/doc/index.rst +++ /dev/null @@ -1,19 +0,0 @@ -Twig -==== - -.. toctree:: - :maxdepth: 2 - - intro - installation - templates - api - advanced - internals - deprecated - recipes - coding_standards - tags/index - filters/index - functions/index - tests/index diff --git a/plugins/twig/vendor/twig/twig/doc/installation.rst b/plugins/twig/vendor/twig/twig/doc/installation.rst deleted file mode 100644 index afdcf165..00000000 --- a/plugins/twig/vendor/twig/twig/doc/installation.rst +++ /dev/null @@ -1,116 +0,0 @@ -Installation -============ - -You have multiple ways to install Twig. - -Installing the Twig PHP package -------------------------------- - -Installing via Composer (recommended) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Install `Composer`_ and run the following command to get the latest version: - -.. code-block:: bash - - composer require twig/twig:~1.0 - -Installing from the tarball release -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -1. Download the most recent tarball from the `download page`_ -2. Verify the integrity of the tarball http://fabien.potencier.org/article/73/signing-project-releases -3. Unpack the tarball -4. Move the files somewhere in your project - -Installing the development version -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. code-block:: bash - - git clone git://github.com/twigphp/Twig.git - -Installing the PEAR package -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. note:: - - Using PEAR for installing Twig is deprecated and Twig 1.15.1 was the last - version published on the PEAR channel; use Composer instead. - -.. code-block:: bash - - pear channel-discover pear.twig-project.org - pear install twig/Twig - -Installing the C extension --------------------------- - -.. versionadded:: 1.4 - The C extension was added in Twig 1.4. - -.. note:: - - The C extension is **optional** but it brings some nice performance - improvements. Note that the extension is not a replacement for the PHP - code; it only implements a small part of the PHP code to improve the - performance at runtime; you must still install the regular PHP code. - -Twig comes with a C extension that enhances the performance of the Twig -runtime engine; install it like any other PHP extensions: - -.. code-block:: bash - - cd ext/twig - phpize - ./configure - make - make install - -.. note:: - - You can also install the C extension via PEAR (note that this method is - deprecated and newer versions of Twig are not available on the PEAR - channel): - - .. code-block:: bash - - pear channel-discover pear.twig-project.org - pear install twig/CTwig - -For Windows: - -1. Setup the build environment following the `PHP documentation`_ -2. Put Twig's C extension source code into ``C:\php-sdk\phpdev\vcXX\x86\php-source-directory\ext\twig`` -3. Use the ``configure --disable-all --enable-cli --enable-twig=shared`` command instead of step 14 -4. ``nmake`` -5. Copy the ``C:\php-sdk\phpdev\vcXX\x86\php-source-directory\Release_TS\php_twig.dll`` file to your PHP setup. - -.. tip:: - - For Windows ZendServer, ZTS is not enabled as mentioned in `Zend Server - FAQ`_. - - You have to use ``configure --disable-all --disable-zts --enable-cli - --enable-twig=shared`` to be able to build the twig C extension for - ZendServer. - - The built DLL will be available in - ``C:\\php-sdk\\phpdev\\vcXX\\x86\\php-source-directory\\Release`` - -Finally, enable the extension in your ``php.ini`` configuration file: - -.. code-block:: ini - - extension=twig.so #For Unix systems - extension=php_twig.dll #For Windows systems - -And from now on, Twig will automatically compile your templates to take -advantage of the C extension. Note that this extension does not replace the -PHP code but only provides an optimized version of the -``Twig_Template::getAttribute()`` method. - -.. _`download page`: https://github.com/twigphp/Twig/tags -.. _`Composer`: https://getcomposer.org/download/ -.. _`PHP documentation`: https://wiki.php.net/internals/windows/stepbystepbuild -.. _`Zend Server FAQ`: http://www.zend.com/en/products/server/faq#faqD6 diff --git a/plugins/twig/vendor/twig/twig/doc/internals.rst b/plugins/twig/vendor/twig/twig/doc/internals.rst deleted file mode 100644 index ef1174dd..00000000 --- a/plugins/twig/vendor/twig/twig/doc/internals.rst +++ /dev/null @@ -1,138 +0,0 @@ -Twig Internals -============== - -Twig is very extensible and you can easily hack it. Keep in mind that you -should probably try to create an extension before hacking the core, as most -features and enhancements can be handled with extensions. This chapter is also -useful for people who want to understand how Twig works under the hood. - -How does Twig work? -------------------- - -The rendering of a Twig template can be summarized into four key steps: - -* **Load** the template: If the template is already compiled, load it and go - to the *evaluation* step, otherwise: - - * First, the **lexer** tokenizes the template source code into small pieces - for easier processing; - * Then, the **parser** converts the token stream into a meaningful tree - of nodes (the Abstract Syntax Tree); - * Eventually, the *compiler* transforms the AST into PHP code. - -* **Evaluate** the template: It basically means calling the ``display()`` - method of the compiled template and passing it the context. - -The Lexer ---------- - -The lexer tokenizes a template source code into a token stream (each token is -an instance of ``Twig_Token``, and the stream is an instance of -``Twig_TokenStream``). The default lexer recognizes 13 different token types: - -* ``Twig_Token::BLOCK_START_TYPE``, ``Twig_Token::BLOCK_END_TYPE``: Delimiters for blocks (``{% %}``) -* ``Twig_Token::VAR_START_TYPE``, ``Twig_Token::VAR_END_TYPE``: Delimiters for variables (``{{ }}``) -* ``Twig_Token::TEXT_TYPE``: A text outside an expression; -* ``Twig_Token::NAME_TYPE``: A name in an expression; -* ``Twig_Token::NUMBER_TYPE``: A number in an expression; -* ``Twig_Token::STRING_TYPE``: A string in an expression; -* ``Twig_Token::OPERATOR_TYPE``: An operator; -* ``Twig_Token::PUNCTUATION_TYPE``: A punctuation sign; -* ``Twig_Token::INTERPOLATION_START_TYPE``, ``Twig_Token::INTERPOLATION_END_TYPE`` (as of Twig 1.5): Delimiters for string interpolation; -* ``Twig_Token::EOF_TYPE``: Ends of template. - -You can manually convert a source code into a token stream by calling the -``tokenize()`` method of an environment:: - - $stream = $twig->tokenize($source, $identifier); - -As the stream has a ``__toString()`` method, you can have a textual -representation of it by echoing the object:: - - echo $stream."\n"; - -Here is the output for the ``Hello {{ name }}`` template: - -.. code-block:: text - - TEXT_TYPE(Hello ) - VAR_START_TYPE() - NAME_TYPE(name) - VAR_END_TYPE() - EOF_TYPE() - -.. note:: - - The default lexer (``Twig_Lexer``) can be changed by calling - the ``setLexer()`` method:: - - $twig->setLexer($lexer); - -The Parser ----------- - -The parser converts the token stream into an AST (Abstract Syntax Tree), or a -node tree (an instance of ``Twig_Node_Module``). The core extension defines -the basic nodes like: ``for``, ``if``, ... and the expression nodes. - -You can manually convert a token stream into a node tree by calling the -``parse()`` method of an environment:: - - $nodes = $twig->parse($stream); - -Echoing the node object gives you a nice representation of the tree:: - - echo $nodes."\n"; - -Here is the output for the ``Hello {{ name }}`` template: - -.. code-block:: text - - Twig_Node_Module( - Twig_Node_Text(Hello ) - Twig_Node_Print( - Twig_Node_Expression_Name(name) - ) - ) - -.. note:: - - The default parser (``Twig_TokenParser``) can be changed by calling the - ``setParser()`` method:: - - $twig->setParser($parser); - -The Compiler ------------- - -The last step is done by the compiler. It takes a node tree as an input and -generates PHP code usable for runtime execution of the template. - -You can manually compile a node tree to PHP code with the ``compile()`` method -of an environment:: - - $php = $twig->compile($nodes); - -The generated template for a ``Hello {{ name }}`` template reads as follows -(the actual output can differ depending on the version of Twig you are -using):: - - /* Hello {{ name }} */ - class __TwigTemplate_1121b6f109fe93ebe8c6e22e3712bceb extends Twig_Template - { - protected function doDisplay(array $context, array $blocks = array()) - { - // line 1 - echo "Hello "; - echo twig_escape_filter($this->env, isset($context["name"]) ? $context["name"] : null), "html", null, true); - } - - // some more code - } - -.. note:: - - The default compiler (``Twig_Compiler``) can be changed by calling the - ``setCompiler()`` method:: - - $twig->setCompiler($compiler); diff --git a/plugins/twig/vendor/twig/twig/doc/intro.rst b/plugins/twig/vendor/twig/twig/doc/intro.rst deleted file mode 100644 index 9b38c97d..00000000 --- a/plugins/twig/vendor/twig/twig/doc/intro.rst +++ /dev/null @@ -1,85 +0,0 @@ -Introduction -============ - -This is the documentation for Twig, the flexible, fast, and secure template -engine for PHP. - -If you have any exposure to other text-based template languages, such as -Smarty, Django, or Jinja, you should feel right at home with Twig. It's both -designer and developer friendly by sticking to PHP's principles and adding -functionality useful for templating environments. - -The key-features are... - -* *Fast*: Twig compiles templates down to plain optimized PHP code. The - overhead compared to regular PHP code was reduced to the very minimum. - -* *Secure*: Twig has a sandbox mode to evaluate untrusted template code. This - allows Twig to be used as a template language for applications where users - may modify the template design. - -* *Flexible*: Twig is powered by a flexible lexer and parser. This allows the - developer to define its own custom tags and filters, and create its own DSL. - -Twig is used by many Open-Source projects like Symfony, Drupal8, eZPublish, -phpBB, Piwik, OroCRM, and many frameworks have support for it as well like -Slim, Yii, Laravel, Codeigniter, and Kohana, just to name a few. - -Prerequisites -------------- - -Twig needs at least **PHP 5.2.7** to run. - -Installation ------------- - -The recommended way to install Twig is via Composer: - -.. code-block:: bash - - composer require "twig/twig:~1.0" - -.. note:: - - To learn more about the other installation methods, read the - :doc:`installation` chapter; it also explains how to install - the Twig C extension. - -Basic API Usage ---------------- - -This section gives you a brief introduction to the PHP API for Twig. - -.. code-block:: php - - require_once '/path/to/vendor/autoload.php'; - - $loader = new Twig_Loader_Array(array( - 'index' => 'Hello {{ name }}!', - )); - $twig = new Twig_Environment($loader); - - echo $twig->render('index', array('name' => 'Fabien')); - -Twig uses a loader (``Twig_Loader_Array``) to locate templates, and an -environment (``Twig_Environment``) to store the configuration. - -The ``render()`` method loads the template passed as a first argument and -renders it with the variables passed as a second argument. - -As templates are generally stored on the filesystem, Twig also comes with a -filesystem loader:: - - $loader = new Twig_Loader_Filesystem('/path/to/templates'); - $twig = new Twig_Environment($loader, array( - 'cache' => '/path/to/compilation_cache', - )); - - echo $twig->render('index.html', array('name' => 'Fabien')); - -.. tip:: - - If you are not using Composer, use the Twig built-in autoloader:: - - require_once '/path/to/lib/Twig/Autoloader.php'; - Twig_Autoloader::register(); diff --git a/plugins/twig/vendor/twig/twig/doc/recipes.rst b/plugins/twig/vendor/twig/twig/doc/recipes.rst deleted file mode 100644 index 6ad53276..00000000 --- a/plugins/twig/vendor/twig/twig/doc/recipes.rst +++ /dev/null @@ -1,518 +0,0 @@ -Recipes -======= - -.. _deprecation-notices: - -Displaying Deprecation Notices ------------------------------- - -.. versionadded:: 1.21 - This works as of Twig 1.21. - -Deprecated features generate deprecation notices (via a call to the -``trigger_error()`` PHP function). By default, they are silenced and never -displayed nor logged. - -To easily remove all deprecated feature usages from your templates, write and -run a script along the lines of the following:: - - require_once __DIR__.'/vendor/autoload.php'; - - $twig = create_your_twig_env(); - - $deprecations = new Twig_Util_DeprecationCollector($twig); - - print_r($deprecations->collectDir(__DIR__.'/templates')); - -The ``collectDir()`` method compiles all templates found in a directory, -catches deprecation notices, and return them. - -.. tip:: - - If your templates are not stored on the filesystem, use the ``collect()`` - method instead which takes an ``Iterator``; the iterator must return - template names as keys and template contents as values (as done by - ``Twig_Util_TemplateDirIterator``). - -However, this code won't find all deprecations (like using deprecated some Twig -classes). To catch all notices, register a custom error handler like the one -below:: - - $deprecations = array(); - set_error_handler(function ($type, $msg) use (&$deprecations) { - if (E_USER_DEPRECATED === $type) { - $deprecations[] = $msg; - } - }); - - // run your application - - print_r($deprecations); - -Note that most deprecation notices are triggered during **compilation**, so -they won't be generated when templates are already cached. - -.. tip:: - - If you want to manage the deprecation notices from your PHPUnit tests, have - a look at the `symfony/phpunit-bridge - `_ package, which eases the - process a lot. - -Making a Layout conditional ---------------------------- - -Working with Ajax means that the same content is sometimes displayed as is, -and sometimes decorated with a layout. As Twig layout template names can be -any valid expression, you can pass a variable that evaluates to ``true`` when -the request is made via Ajax and choose the layout accordingly: - -.. code-block:: jinja - - {% extends request.ajax ? "base_ajax.html" : "base.html" %} - - {% block content %} - This is the content to be displayed. - {% endblock %} - -Making an Include dynamic -------------------------- - -When including a template, its name does not need to be a string. For -instance, the name can depend on the value of a variable: - -.. code-block:: jinja - - {% include var ~ '_foo.html' %} - -If ``var`` evaluates to ``index``, the ``index_foo.html`` template will be -rendered. - -As a matter of fact, the template name can be any valid expression, such as -the following: - -.. code-block:: jinja - - {% include var|default('index') ~ '_foo.html' %} - -Overriding a Template that also extends itself ----------------------------------------------- - -A template can be customized in two different ways: - -* *Inheritance*: A template *extends* a parent template and overrides some - blocks; - -* *Replacement*: If you use the filesystem loader, Twig loads the first - template it finds in a list of configured directories; a template found in a - directory *replaces* another one from a directory further in the list. - -But how do you combine both: *replace* a template that also extends itself -(aka a template in a directory further in the list)? - -Let's say that your templates are loaded from both ``.../templates/mysite`` -and ``.../templates/default`` in this order. The ``page.twig`` template, -stored in ``.../templates/default`` reads as follows: - -.. code-block:: jinja - - {# page.twig #} - {% extends "layout.twig" %} - - {% block content %} - {% endblock %} - -You can replace this template by putting a file with the same name in -``.../templates/mysite``. And if you want to extend the original template, you -might be tempted to write the following: - -.. code-block:: jinja - - {# page.twig in .../templates/mysite #} - {% extends "page.twig" %} {# from .../templates/default #} - -Of course, this will not work as Twig will always load the template from -``.../templates/mysite``. - -It turns out it is possible to get this to work, by adding a directory right -at the end of your template directories, which is the parent of all of the -other directories: ``.../templates`` in our case. This has the effect of -making every template file within our system uniquely addressable. Most of the -time you will use the "normal" paths, but in the special case of wanting to -extend a template with an overriding version of itself we can reference its -parent's full, unambiguous template path in the extends tag: - -.. code-block:: jinja - - {# page.twig in .../templates/mysite #} - {% extends "default/page.twig" %} {# from .../templates #} - -.. note:: - - This recipe was inspired by the following Django wiki page: - http://code.djangoproject.com/wiki/ExtendingTemplates - -Customizing the Syntax ----------------------- - -Twig allows some syntax customization for the block delimiters. It's not -recommended to use this feature as templates will be tied with your custom -syntax. But for specific projects, it can make sense to change the defaults. - -To change the block delimiters, you need to create your own lexer object:: - - $twig = new Twig_Environment(); - - $lexer = new Twig_Lexer($twig, array( - 'tag_comment' => array('{#', '#}'), - 'tag_block' => array('{%', '%}'), - 'tag_variable' => array('{{', '}}'), - 'interpolation' => array('#{', '}'), - )); - $twig->setLexer($lexer); - -Here are some configuration example that simulates some other template engines -syntax:: - - // Ruby erb syntax - $lexer = new Twig_Lexer($twig, array( - 'tag_comment' => array('<%#', '%>'), - 'tag_block' => array('<%', '%>'), - 'tag_variable' => array('<%=', '%>'), - )); - - // SGML Comment Syntax - $lexer = new Twig_Lexer($twig, array( - 'tag_comment' => array(''), - 'tag_block' => array(''), - 'tag_variable' => array('${', '}'), - )); - - // Smarty like - $lexer = new Twig_Lexer($twig, array( - 'tag_comment' => array('{*', '*}'), - 'tag_block' => array('{', '}'), - 'tag_variable' => array('{$', '}'), - )); - -Using dynamic Object Properties -------------------------------- - -When Twig encounters a variable like ``article.title``, it tries to find a -``title`` public property in the ``article`` object. - -It also works if the property does not exist but is rather defined dynamically -thanks to the magic ``__get()`` method; you just need to also implement the -``__isset()`` magic method like shown in the following snippet of code:: - - class Article - { - public function __get($name) - { - if ('title' == $name) { - return 'The title'; - } - - // throw some kind of error - } - - public function __isset($name) - { - if ('title' == $name) { - return true; - } - - return false; - } - } - -Accessing the parent Context in Nested Loops --------------------------------------------- - -Sometimes, when using nested loops, you need to access the parent context. The -parent context is always accessible via the ``loop.parent`` variable. For -instance, if you have the following template data:: - - $data = array( - 'topics' => array( - 'topic1' => array('Message 1 of topic 1', 'Message 2 of topic 1'), - 'topic2' => array('Message 1 of topic 2', 'Message 2 of topic 2'), - ), - ); - -And the following template to display all messages in all topics: - -.. code-block:: jinja - - {% for topic, messages in topics %} - * {{ loop.index }}: {{ topic }} - {% for message in messages %} - - {{ loop.parent.loop.index }}.{{ loop.index }}: {{ message }} - {% endfor %} - {% endfor %} - -The output will be similar to: - -.. code-block:: text - - * 1: topic1 - - 1.1: The message 1 of topic 1 - - 1.2: The message 2 of topic 1 - * 2: topic2 - - 2.1: The message 1 of topic 2 - - 2.2: The message 2 of topic 2 - -In the inner loop, the ``loop.parent`` variable is used to access the outer -context. So, the index of the current ``topic`` defined in the outer for loop -is accessible via the ``loop.parent.loop.index`` variable. - -Defining undefined Functions and Filters on the Fly ---------------------------------------------------- - -When a function (or a filter) is not defined, Twig defaults to throw a -``Twig_Error_Syntax`` exception. However, it can also call a `callback`_ (any -valid PHP callable) which should return a function (or a filter). - -For filters, register callbacks with ``registerUndefinedFilterCallback()``. -For functions, use ``registerUndefinedFunctionCallback()``:: - - // auto-register all native PHP functions as Twig functions - // don't try this at home as it's not secure at all! - $twig->registerUndefinedFunctionCallback(function ($name) { - if (function_exists($name)) { - return new Twig_Function_Function($name); - } - - return false; - }); - -If the callable is not able to return a valid function (or filter), it must -return ``false``. - -If you register more than one callback, Twig will call them in turn until one -does not return ``false``. - -.. tip:: - - As the resolution of functions and filters is done during compilation, - there is no overhead when registering these callbacks. - -Validating the Template Syntax ------------------------------- - -When template code is provided by a third-party (through a web interface for -instance), it might be interesting to validate the template syntax before -saving it. If the template code is stored in a `$template` variable, here is -how you can do it:: - - try { - $twig->parse($twig->tokenize($template)); - - // the $template is valid - } catch (Twig_Error_Syntax $e) { - // $template contains one or more syntax errors - } - -If you iterate over a set of files, you can pass the filename to the -``tokenize()`` method to get the filename in the exception message:: - - foreach ($files as $file) { - try { - $twig->parse($twig->tokenize($template, $file)); - - // the $template is valid - } catch (Twig_Error_Syntax $e) { - // $template contains one or more syntax errors - } - } - -.. note:: - - This method won't catch any sandbox policy violations because the policy - is enforced during template rendering (as Twig needs the context for some - checks like allowed methods on objects). - -Refreshing modified Templates when OPcache or APC is enabled ------------------------------------------------------------- - -When using OPcache with ``opcache.validate_timestamps`` set to ``0`` or APC -with ``apc.stat`` set to ``0`` and Twig cache enabled, clearing the template -cache won't update the cache. - -To get around this, force Twig to invalidate the bytecode cache:: - - $twig = new Twig_Environment($loader, array( - 'cache' => new Twig_Cache_Filesystem('/some/cache/path', Twig_Cache_Filesystem::FORCE_BYTECODE_INVALIDATION), - // ... - )); - -.. note:: - - Before Twig 1.22, you should extend ``Twig_Environment`` instead:: - - class OpCacheAwareTwigEnvironment extends Twig_Environment - { - protected function writeCacheFile($file, $content) - { - parent::writeCacheFile($file, $content); - - // Compile cached file into bytecode cache - if (function_exists('opcache_invalidate')) { - opcache_invalidate($file, true); - } elseif (function_exists('apc_compile_file')) { - apc_compile_file($file); - } - } - } - -Reusing a stateful Node Visitor -------------------------------- - -When attaching a visitor to a ``Twig_Environment`` instance, Twig uses it to -visit *all* templates it compiles. If you need to keep some state information -around, you probably want to reset it when visiting a new template. - -This can be easily achieved with the following code:: - - protected $someTemplateState = array(); - - public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - // reset the state as we are entering a new template - $this->someTemplateState = array(); - } - - // ... - - return $node; - } - -Using a Database to store Templates ------------------------------------ - -If you are developing a CMS, templates are usually stored in a database. This -recipe gives you a simple PDO template loader you can use as a starting point -for your own. - -First, let's create a temporary in-memory SQLite3 database to work with:: - - $dbh = new PDO('sqlite::memory:'); - $dbh->exec('CREATE TABLE templates (name STRING, source STRING, last_modified INTEGER)'); - $base = '{% block content %}{% endblock %}'; - $index = ' - {% extends "base.twig" %} - {% block content %}Hello {{ name }}{% endblock %} - '; - $now = time(); - $dbh->exec("INSERT INTO templates (name, source, last_modified) VALUES ('base.twig', '$base', $now)"); - $dbh->exec("INSERT INTO templates (name, source, last_modified) VALUES ('index.twig', '$index', $now)"); - -We have created a simple ``templates`` table that hosts two templates: -``base.twig`` and ``index.twig``. - -Now, let's define a loader able to use this database:: - - class DatabaseTwigLoader implements Twig_LoaderInterface, Twig_ExistsLoaderInterface - { - protected $dbh; - - public function __construct(PDO $dbh) - { - $this->dbh = $dbh; - } - - public function getSource($name) - { - if (false === $source = $this->getValue('source', $name)) { - throw new Twig_Error_Loader(sprintf('Template "%s" does not exist.', $name)); - } - - return $source; - } - - // Twig_ExistsLoaderInterface as of Twig 1.11 - public function exists($name) - { - return $name === $this->getValue('name', $name); - } - - public function getCacheKey($name) - { - return $name; - } - - public function isFresh($name, $time) - { - if (false === $lastModified = $this->getValue('last_modified', $name)) { - return false; - } - - return $lastModified <= $time; - } - - protected function getValue($column, $name) - { - $sth = $this->dbh->prepare('SELECT '.$column.' FROM templates WHERE name = :name'); - $sth->execute(array(':name' => (string) $name)); - - return $sth->fetchColumn(); - } - } - -Finally, here is an example on how you can use it:: - - $loader = new DatabaseTwigLoader($dbh); - $twig = new Twig_Environment($loader); - - echo $twig->render('index.twig', array('name' => 'Fabien')); - -Using different Template Sources --------------------------------- - -This recipe is the continuation of the previous one. Even if you store the -contributed templates in a database, you might want to keep the original/base -templates on the filesystem. When templates can be loaded from different -sources, you need to use the ``Twig_Loader_Chain`` loader. - -As you can see in the previous recipe, we reference the template in the exact -same way as we would have done it with a regular filesystem loader. This is -the key to be able to mix and match templates coming from the database, the -filesystem, or any other loader for that matter: the template name should be a -logical name, and not the path from the filesystem:: - - $loader1 = new DatabaseTwigLoader($dbh); - $loader2 = new Twig_Loader_Array(array( - 'base.twig' => '{% block content %}{% endblock %}', - )); - $loader = new Twig_Loader_Chain(array($loader1, $loader2)); - - $twig = new Twig_Environment($loader); - - echo $twig->render('index.twig', array('name' => 'Fabien')); - -Now that the ``base.twig`` templates is defined in an array loader, you can -remove it from the database, and everything else will still work as before. - -Loading a Template from a String --------------------------------- - -From a template, you can easily load a template stored in a string via the -``template_from_string`` function (available as of Twig 1.11 via the -``Twig_Extension_StringLoader`` extension):: - -.. code-block:: jinja - - {{ include(template_from_string("Hello {{ name }}")) }} - -From PHP, it's also possible to load a template stored in a string via -``Twig_Environment::createTemplate()`` (available as of Twig 1.18):: - - $template = $twig->createTemplate('hello {{ name }}'); - echo $template->render(array('name' => 'Fabien')); - -.. note:: - - Never use the ``Twig_Loader_String`` loader, which has severe limitations. - -.. _callback: http://www.php.net/manual/en/function.is-callable.php diff --git a/plugins/twig/vendor/twig/twig/doc/tags/autoescape.rst b/plugins/twig/vendor/twig/twig/doc/tags/autoescape.rst deleted file mode 100644 index 4208d1a3..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/autoescape.rst +++ /dev/null @@ -1,83 +0,0 @@ -``autoescape`` -============== - -Whether automatic escaping is enabled or not, you can mark a section of a -template to be escaped or not by using the ``autoescape`` tag: - -.. code-block:: jinja - - {# The following syntax works as of Twig 1.8 -- see the note below for previous versions #} - - {% autoescape %} - Everything will be automatically escaped in this block - using the HTML strategy - {% endautoescape %} - - {% autoescape 'html' %} - Everything will be automatically escaped in this block - using the HTML strategy - {% endautoescape %} - - {% autoescape 'js' %} - Everything will be automatically escaped in this block - using the js escaping strategy - {% endautoescape %} - - {% autoescape false %} - Everything will be outputted as is in this block - {% endautoescape %} - -.. note:: - - Before Twig 1.8, the syntax was different: - - .. code-block:: jinja - - {% autoescape true %} - Everything will be automatically escaped in this block - using the HTML strategy - {% endautoescape %} - - {% autoescape false %} - Everything will be outputted as is in this block - {% endautoescape %} - - {% autoescape true js %} - Everything will be automatically escaped in this block - using the js escaping strategy - {% endautoescape %} - -When automatic escaping is enabled everything is escaped by default except for -values explicitly marked as safe. Those can be marked in the template by using -the :doc:`raw<../filters/raw>` filter: - -.. code-block:: jinja - - {% autoescape %} - {{ safe_value|raw }} - {% endautoescape %} - -Functions returning template data (like :doc:`macros` and -:doc:`parent<../functions/parent>`) always return safe markup. - -.. note:: - - Twig is smart enough to not escape an already escaped value by the - :doc:`escape<../filters/escape>` filter. - -.. note:: - - Twig does not escape static expressions: - - .. code-block:: jinja - - {% set hello = "Hello" %} - {{ hello }} - {{ "world" }} - - Will be rendered "Hello **world**". - -.. note:: - - The chapter :doc:`Twig for Developers<../api>` gives more information - about when and how automatic escaping is applied. diff --git a/plugins/twig/vendor/twig/twig/doc/tags/block.rst b/plugins/twig/vendor/twig/twig/doc/tags/block.rst deleted file mode 100644 index e3804823..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/block.rst +++ /dev/null @@ -1,11 +0,0 @@ -``block`` -========= - -Blocks are used for inheritance and act as placeholders and replacements at -the same time. They are documented in detail in the documentation for the -:doc:`extends<../tags/extends>` tag. - -Block names should consist of alphanumeric characters, and underscores. Dashes -are not permitted. - -.. seealso:: :doc:`block<../functions/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>`, :doc:`extends<../tags/extends>` diff --git a/plugins/twig/vendor/twig/twig/doc/tags/do.rst b/plugins/twig/vendor/twig/twig/doc/tags/do.rst deleted file mode 100644 index 1c344e30..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/do.rst +++ /dev/null @@ -1,12 +0,0 @@ -``do`` -====== - -.. versionadded:: 1.5 - The ``do`` tag was added in Twig 1.5. - -The ``do`` tag works exactly like the regular variable expression (``{{ ... -}}``) just that it doesn't print anything: - -.. code-block:: jinja - - {% do 1 + 2 %} diff --git a/plugins/twig/vendor/twig/twig/doc/tags/embed.rst b/plugins/twig/vendor/twig/twig/doc/tags/embed.rst deleted file mode 100644 index 5a6a0299..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/embed.rst +++ /dev/null @@ -1,178 +0,0 @@ -``embed`` -========= - -.. versionadded:: 1.8 - The ``embed`` tag was added in Twig 1.8. - -The ``embed`` tag combines the behaviour of :doc:`include` and -:doc:`extends`. -It allows you to include another template's contents, just like ``include`` -does. But it also allows you to override any block defined inside the -included template, like when extending a template. - -Think of an embedded template as a "micro layout skeleton". - -.. code-block:: jinja - - {% embed "teasers_skeleton.twig" %} - {# These blocks are defined in "teasers_skeleton.twig" #} - {# and we override them right here: #} - {% block left_teaser %} - Some content for the left teaser box - {% endblock %} - {% block right_teaser %} - Some content for the right teaser box - {% endblock %} - {% endembed %} - -The ``embed`` tag takes the idea of template inheritance to the level of -content fragments. While template inheritance allows for "document skeletons", -which are filled with life by child templates, the ``embed`` tag allows you to -create "skeletons" for smaller units of content and re-use and fill them -anywhere you like. - -Since the use case may not be obvious, let's look at a simplified example. -Imagine a base template shared by multiple HTML pages, defining a single block -named "content": - -.. code-block:: text - - ┌─── page layout ─────────────────────┐ - │ │ - │ ┌── block "content" ──┐ │ - │ │ │ │ - │ │ │ │ - │ │ (child template to │ │ - │ │ put content here) │ │ - │ │ │ │ - │ │ │ │ - │ └─────────────────────┘ │ - │ │ - └─────────────────────────────────────┘ - -Some pages ("foo" and "bar") share the same content structure - -two vertically stacked boxes: - -.. code-block:: text - - ┌─── page layout ─────────────────────┐ - │ │ - │ ┌── block "content" ──┐ │ - │ │ ┌─ block "top" ───┐ │ │ - │ │ │ │ │ │ - │ │ └─────────────────┘ │ │ - │ │ ┌─ block "bottom" ┐ │ │ - │ │ │ │ │ │ - │ │ └─────────────────┘ │ │ - │ └─────────────────────┘ │ - │ │ - └─────────────────────────────────────┘ - -While other pages ("boom" and "baz") share a different content structure - -two boxes side by side: - -.. code-block:: text - - ┌─── page layout ─────────────────────┐ - │ │ - │ ┌── block "content" ──┐ │ - │ │ │ │ - │ │ ┌ block ┐ ┌ block ┐ │ │ - │ │ │"left" │ │"right"│ │ │ - │ │ │ │ │ │ │ │ - │ │ │ │ │ │ │ │ - │ │ └───────┘ └───────┘ │ │ - │ └─────────────────────┘ │ - │ │ - └─────────────────────────────────────┘ - -Without the ``embed`` tag, you have two ways to design your templates: - - * Create two "intermediate" base templates that extend the master layout - template: one with vertically stacked boxes to be used by the "foo" and - "bar" pages and another one with side-by-side boxes for the "boom" and - "baz" pages. - - * Embed the markup for the top/bottom and left/right boxes into each page - template directly. - -These two solutions do not scale well because they each have a major drawback: - - * The first solution may indeed work for this simplified example. But imagine - we add a sidebar, which may again contain different, recurring structures - of content. Now we would need to create intermediate base templates for - all occurring combinations of content structure and sidebar structure... - and so on. - - * The second solution involves duplication of common code with all its negative - consequences: any change involves finding and editing all affected copies - of the structure, correctness has to be verified for each copy, copies may - go out of sync by careless modifications etc. - -In such a situation, the ``embed`` tag comes in handy. The common layout -code can live in a single base template, and the two different content structures, -let's call them "micro layouts" go into separate templates which are embedded -as necessary: - -Page template ``foo.twig``: - -.. code-block:: jinja - - {% extends "layout_skeleton.twig" %} - - {% block content %} - {% embed "vertical_boxes_skeleton.twig" %} - {% block top %} - Some content for the top box - {% endblock %} - - {% block bottom %} - Some content for the bottom box - {% endblock %} - {% endembed %} - {% endblock %} - -And here is the code for ``vertical_boxes_skeleton.twig``: - -.. code-block:: html+jinja - -
    - {% block top %} - Top box default content - {% endblock %} -
    - -
    - {% block bottom %} - Bottom box default content - {% endblock %} -
    - -The goal of the ``vertical_boxes_skeleton.twig`` template being to factor -out the HTML markup for the boxes. - -The ``embed`` tag takes the exact same arguments as the ``include`` tag: - -.. code-block:: jinja - - {% embed "base" with {'foo': 'bar'} %} - ... - {% endembed %} - - {% embed "base" with {'foo': 'bar'} only %} - ... - {% endembed %} - - {% embed "base" ignore missing %} - ... - {% endembed %} - -.. warning:: - - As embedded templates do not have "names", auto-escaping strategies based - on the template "filename" won't work as expected if you change the - context (for instance, if you embed a CSS/JavaScript template into an HTML - one). In that case, explicitly set the default auto-escaping strategy with - the ``autoescape`` tag. - -.. seealso:: :doc:`include<../tags/include>` diff --git a/plugins/twig/vendor/twig/twig/doc/tags/extends.rst b/plugins/twig/vendor/twig/twig/doc/tags/extends.rst deleted file mode 100644 index 1ad2b12b..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/extends.rst +++ /dev/null @@ -1,268 +0,0 @@ -``extends`` -=========== - -The ``extends`` tag can be used to extend a template from another one. - -.. note:: - - Like PHP, Twig does not support multiple inheritance. So you can only have - one extends tag called per rendering. However, Twig supports horizontal - :doc:`reuse`. - -Let's define a base template, ``base.html``, which defines a simple HTML -skeleton document: - -.. code-block:: html+jinja - - - - - {% block head %} - - {% block title %}{% endblock %} - My Webpage - {% endblock %} - - -
    {% block content %}{% endblock %}
    - - - - -In this example, the :doc:`block` tags define four blocks that child -templates can fill in. - -All the ``block`` tag does is to tell the template engine that a child -template may override those portions of the template. - -Child Template --------------- - -A child template might look like this: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% block title %}Index{% endblock %} - {% block head %} - {{ parent() }} - - {% endblock %} - {% block content %} -

    Index

    -

    - Welcome on my awesome homepage. -

    - {% endblock %} - -The ``extends`` tag is the key here. It tells the template engine that this -template "extends" another template. When the template system evaluates this -template, first it locates the parent. The extends tag should be the first tag -in the template. - -Note that since the child template doesn't define the ``footer`` block, the -value from the parent template is used instead. - -You can't define multiple ``block`` tags with the same name in the same -template. This limitation exists because a block tag works in "both" -directions. That is, a block tag doesn't just provide a hole to fill - it also -defines the content that fills the hole in the *parent*. If there were two -similarly-named ``block`` tags in a template, that template's parent wouldn't -know which one of the blocks' content to use. - -If you want to print a block multiple times you can however use the -``block`` function: - -.. code-block:: jinja - - {% block title %}{% endblock %} -

    {{ block('title') }}

    - {% block body %}{% endblock %} - -Parent Blocks -------------- - -It's possible to render the contents of the parent block by using the -:doc:`parent<../functions/parent>` function. This gives back the results of -the parent block: - -.. code-block:: jinja - - {% block sidebar %} -

    Table Of Contents

    - ... - {{ parent() }} - {% endblock %} - -Named Block End-Tags --------------------- - -Twig allows you to put the name of the block after the end tag for better -readability: - -.. code-block:: jinja - - {% block sidebar %} - {% block inner_sidebar %} - ... - {% endblock inner_sidebar %} - {% endblock sidebar %} - -Of course, the name after the ``endblock`` word must match the block name. - -Block Nesting and Scope ------------------------ - -Blocks can be nested for more complex layouts. Per default, blocks have access -to variables from outer scopes: - -.. code-block:: jinja - - {% for item in seq %} -
  • {% block loop_item %}{{ item }}{% endblock %}
  • - {% endfor %} - -Block Shortcuts ---------------- - -For blocks with few content, it's possible to use a shortcut syntax. The -following constructs do the same: - -.. code-block:: jinja - - {% block title %} - {{ page_title|title }} - {% endblock %} - -.. code-block:: jinja - - {% block title page_title|title %} - -Dynamic Inheritance -------------------- - -Twig supports dynamic inheritance by using a variable as the base template: - -.. code-block:: jinja - - {% extends some_var %} - -If the variable evaluates to a ``Twig_Template`` object, Twig will use it as -the parent template:: - - // {% extends layout %} - - $layout = $twig->loadTemplate('some_layout_template.twig'); - - $twig->display('template.twig', array('layout' => $layout)); - -.. versionadded:: 1.2 - The possibility to pass an array of templates has been added in Twig 1.2. - -You can also provide a list of templates that are checked for existence. The -first template that exists will be used as a parent: - -.. code-block:: jinja - - {% extends ['layout.html', 'base_layout.html'] %} - -Conditional Inheritance ------------------------ - -As the template name for the parent can be any valid Twig expression, it's -possible to make the inheritance mechanism conditional: - -.. code-block:: jinja - - {% extends standalone ? "minimum.html" : "base.html" %} - -In this example, the template will extend the "minimum.html" layout template -if the ``standalone`` variable evaluates to ``true``, and "base.html" -otherwise. - -How do blocks work? -------------------- - -A block provides a way to change how a certain part of a template is rendered -but it does not interfere in any way with the logic around it. - -Let's take the following example to illustrate how a block works and more -importantly, how it does not work: - -.. code-block:: jinja - - {# base.twig #} - - {% for post in posts %} - {% block post %} -

    {{ post.title }}

    -

    {{ post.body }}

    - {% endblock %} - {% endfor %} - -If you render this template, the result would be exactly the same with or -without the ``block`` tag. The ``block`` inside the ``for`` loop is just a way -to make it overridable by a child template: - -.. code-block:: jinja - - {# child.twig #} - - {% extends "base.twig" %} - - {% block post %} -
    -
    {{ post.title }}
    -
    {{ post.text }}
    -
    - {% endblock %} - -Now, when rendering the child template, the loop is going to use the block -defined in the child template instead of the one defined in the base one; the -executed template is then equivalent to the following one: - -.. code-block:: jinja - - {% for post in posts %} -
    -
    {{ post.title }}
    -
    {{ post.text }}
    -
    - {% endfor %} - -Let's take another example: a block included within an ``if`` statement: - -.. code-block:: jinja - - {% if posts is empty %} - {% block head %} - {{ parent() }} - - - {% endblock head %} - {% endif %} - -Contrary to what you might think, this template does not define a block -conditionally; it just makes overridable by a child template the output of -what will be rendered when the condition is ``true``. - -If you want the output to be displayed conditionally, use the following -instead: - -.. code-block:: jinja - - {% block head %} - {{ parent() }} - - {% if posts is empty %} - - {% endif %} - {% endblock head %} - -.. seealso:: :doc:`block<../functions/block>`, :doc:`block<../tags/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>` diff --git a/plugins/twig/vendor/twig/twig/doc/tags/filter.rst b/plugins/twig/vendor/twig/twig/doc/tags/filter.rst deleted file mode 100644 index 82ca5c62..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/filter.rst +++ /dev/null @@ -1,21 +0,0 @@ -``filter`` -========== - -Filter sections allow you to apply regular Twig filters on a block of template -data. Just wrap the code in the special ``filter`` section: - -.. code-block:: jinja - - {% filter upper %} - This text becomes uppercase - {% endfilter %} - -You can also chain filters: - -.. code-block:: jinja - - {% filter lower|escape %} - SOME TEXT - {% endfilter %} - - {# outputs "<strong>some text</strong>" #} diff --git a/plugins/twig/vendor/twig/twig/doc/tags/flush.rst b/plugins/twig/vendor/twig/twig/doc/tags/flush.rst deleted file mode 100644 index 55ef593a..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/flush.rst +++ /dev/null @@ -1,17 +0,0 @@ -``flush`` -========= - -.. versionadded:: 1.5 - The flush tag was added in Twig 1.5. - -The ``flush`` tag tells Twig to flush the output buffer: - -.. code-block:: jinja - - {% flush %} - -.. note:: - - Internally, Twig uses the PHP `flush`_ function. - -.. _`flush`: http://php.net/flush diff --git a/plugins/twig/vendor/twig/twig/doc/tags/for.rst b/plugins/twig/vendor/twig/twig/doc/tags/for.rst deleted file mode 100644 index 0673b551..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/for.rst +++ /dev/null @@ -1,172 +0,0 @@ -``for`` -======= - -Loop over each item in a sequence. For example, to display a list of users -provided in a variable called ``users``: - -.. code-block:: jinja - -

    Members

    -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - -.. note:: - - A sequence can be either an array or an object implementing the - ``Traversable`` interface. - -If you do need to iterate over a sequence of numbers, you can use the ``..`` -operator: - -.. code-block:: jinja - - {% for i in 0..10 %} - * {{ i }} - {% endfor %} - -The above snippet of code would print all numbers from 0 to 10. - -It can be also useful with letters: - -.. code-block:: jinja - - {% for letter in 'a'..'z' %} - * {{ letter }} - {% endfor %} - -The ``..`` operator can take any expression at both sides: - -.. code-block:: jinja - - {% for letter in 'a'|upper..'z'|upper %} - * {{ letter }} - {% endfor %} - -.. tip: - - If you need a step different from 1, you can use the ``range`` function - instead. - -The `loop` variable -------------------- - -Inside of a ``for`` loop block you can access some special variables: - -===================== ============================================================= -Variable Description -===================== ============================================================= -``loop.index`` The current iteration of the loop. (1 indexed) -``loop.index0`` The current iteration of the loop. (0 indexed) -``loop.revindex`` The number of iterations from the end of the loop (1 indexed) -``loop.revindex0`` The number of iterations from the end of the loop (0 indexed) -``loop.first`` True if first iteration -``loop.last`` True if last iteration -``loop.length`` The number of items in the sequence -``loop.parent`` The parent context -===================== ============================================================= - -.. code-block:: jinja - - {% for user in users %} - {{ loop.index }} - {{ user.username }} - {% endfor %} - -.. note:: - - The ``loop.length``, ``loop.revindex``, ``loop.revindex0``, and - ``loop.last`` variables are only available for PHP arrays, or objects that - implement the ``Countable`` interface. They are also not available when - looping with a condition. - -.. versionadded:: 1.2 - The ``if`` modifier support has been added in Twig 1.2. - -Adding a condition ------------------- - -Unlike in PHP, it's not possible to ``break`` or ``continue`` in a loop. You -can however filter the sequence during iteration which allows you to skip -items. The following example skips all the users which are not active: - -.. code-block:: jinja - -
      - {% for user in users if user.active %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - -The advantage is that the special loop variable will count correctly thus not -counting the users not iterated over. Keep in mind that properties like -``loop.last`` will not be defined when using loop conditions. - -.. note:: - - Using the ``loop`` variable within the condition is not recommended as it - will probably not be doing what you expect it to. For instance, adding a - condition like ``loop.index > 4`` won't work as the index is only - incremented when the condition is true (so the condition will never - match). - -The `else` Clause ------------------ - -If no iteration took place because the sequence was empty, you can render a -replacement block by using ``else``: - -.. code-block:: jinja - -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% else %} -
    • no user found
    • - {% endfor %} -
    - -Iterating over Keys -------------------- - -By default, a loop iterates over the values of the sequence. You can iterate -on keys by using the ``keys`` filter: - -.. code-block:: jinja - -

    Members

    -
      - {% for key in users|keys %} -
    • {{ key }}
    • - {% endfor %} -
    - -Iterating over Keys and Values ------------------------------- - -You can also access both keys and values: - -.. code-block:: jinja - -

    Members

    -
      - {% for key, user in users %} -
    • {{ key }}: {{ user.username|e }}
    • - {% endfor %} -
    - -Iterating over a Subset ------------------------ - -You might want to iterate over a subset of values. This can be achieved using -the :doc:`slice <../filters/slice>` filter: - -.. code-block:: jinja - -

    Top Ten Members

    -
      - {% for user in users|slice(0, 10) %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    diff --git a/plugins/twig/vendor/twig/twig/doc/tags/from.rst b/plugins/twig/vendor/twig/twig/doc/tags/from.rst deleted file mode 100644 index 39334fdd..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/from.rst +++ /dev/null @@ -1,8 +0,0 @@ -``from`` -======== - -The ``from`` tag imports :doc:`macro<../tags/macro>` names into the current -namespace. The tag is documented in detail in the documentation for the -:doc:`import<../tags/import>` tag. - -.. seealso:: :doc:`macro<../tags/macro>`, :doc:`import<../tags/import>` diff --git a/plugins/twig/vendor/twig/twig/doc/tags/if.rst b/plugins/twig/vendor/twig/twig/doc/tags/if.rst deleted file mode 100644 index 12edf980..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/if.rst +++ /dev/null @@ -1,76 +0,0 @@ -``if`` -====== - -The ``if`` statement in Twig is comparable with the if statements of PHP. - -In the simplest form you can use it to test if an expression evaluates to -``true``: - -.. code-block:: jinja - - {% if online == false %} -

    Our website is in maintenance mode. Please, come back later.

    - {% endif %} - -You can also test if an array is not empty: - -.. code-block:: jinja - - {% if users %} -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - {% endif %} - -.. note:: - - If you want to test if the variable is defined, use ``if users is - defined`` instead. - -You can also use ``not`` to check for values that evaluate to ``false``: - -.. code-block:: jinja - - {% if not user.subscribed %} -

    You are not subscribed to our mailing list.

    - {% endif %} - -For multiple conditions, ``and`` and ``or`` can be used: - -.. code-block:: jinja - - {% if temperature > 18 and temperature < 27 %} -

    It's a nice day for a walk in the park.

    - {% endif %} - -For multiple branches ``elseif`` and ``else`` can be used like in PHP. You can -use more complex ``expressions`` there too: - -.. code-block:: jinja - - {% if kenny.sick %} - Kenny is sick. - {% elseif kenny.dead %} - You killed Kenny! You bastard!!! - {% else %} - Kenny looks okay --- so far - {% endif %} - -.. note:: - - The rules to determine if an expression is ``true`` or ``false`` are the - same as in PHP; here are the edge cases rules: - - ====================== ==================== - Value Boolean evaluation - ====================== ==================== - empty string false - numeric zero false - whitespace-only string true - empty array false - null false - non-empty array true - object true - ====================== ==================== diff --git a/plugins/twig/vendor/twig/twig/doc/tags/import.rst b/plugins/twig/vendor/twig/twig/doc/tags/import.rst deleted file mode 100644 index 21a1e198..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/import.rst +++ /dev/null @@ -1,57 +0,0 @@ -``import`` -========== - -Twig supports putting often used code into :doc:`macros<../tags/macro>`. These -macros can go into different templates and get imported from there. - -There are two ways to import templates. You can import the complete template -into a variable or request specific macros from it. - -Imagine we have a helper module that renders forms (called ``forms.html``): - -.. code-block:: jinja - - {% macro input(name, value, type, size) %} - - {% endmacro %} - - {% macro textarea(name, value, rows, cols) %} - - {% endmacro %} - -The easiest and most flexible is importing the whole module into a variable. -That way you can access the attributes: - -.. code-block:: jinja - - {% import 'forms.html' as forms %} - -
    -
    Username
    -
    {{ forms.input('username') }}
    -
    Password
    -
    {{ forms.input('password', null, 'password') }}
    -
    -

    {{ forms.textarea('comment') }}

    - -Alternatively you can import names from the template into the current -namespace: - -.. code-block:: jinja - - {% from 'forms.html' import input as input_field, textarea %} - -
    -
    Username
    -
    {{ input_field('username') }}
    -
    Password
    -
    {{ input_field('password', '', 'password') }}
    -
    -

    {{ textarea('comment') }}

    - -.. tip:: - - To import macros from the current file, use the special ``_self`` variable - for the source. - -.. seealso:: :doc:`macro<../tags/macro>`, :doc:`from<../tags/from>` diff --git a/plugins/twig/vendor/twig/twig/doc/tags/include.rst b/plugins/twig/vendor/twig/twig/doc/tags/include.rst deleted file mode 100644 index da18dc65..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/include.rst +++ /dev/null @@ -1,86 +0,0 @@ -``include`` -=========== - -The ``include`` statement includes a template and returns the rendered content -of that file into the current namespace: - -.. code-block:: jinja - - {% include 'header.html' %} - Body - {% include 'footer.html' %} - -Included templates have access to the variables of the active context. - -If you are using the filesystem loader, the templates are looked for in the -paths defined by it. - -You can add additional variables by passing them after the ``with`` keyword: - -.. code-block:: jinja - - {# template.html will have access to the variables from the current context and the additional ones provided #} - {% include 'template.html' with {'foo': 'bar'} %} - - {% set vars = {'foo': 'bar'} %} - {% include 'template.html' with vars %} - -You can disable access to the context by appending the ``only`` keyword: - -.. code-block:: jinja - - {# only the foo variable will be accessible #} - {% include 'template.html' with {'foo': 'bar'} only %} - -.. code-block:: jinja - - {# no variables will be accessible #} - {% include 'template.html' only %} - -.. tip:: - - When including a template created by an end user, you should consider - sandboxing it. More information in the :doc:`Twig for Developers<../api>` - chapter and in the :doc:`sandbox<../tags/sandbox>` tag documentation. - -The template name can be any valid Twig expression: - -.. code-block:: jinja - - {% include some_var %} - {% include ajax ? 'ajax.html' : 'not_ajax.html' %} - -And if the expression evaluates to a ``Twig_Template`` object, Twig will use it -directly:: - - // {% include template %} - - $template = $twig->loadTemplate('some_template.twig'); - - $twig->loadTemplate('template.twig')->display(array('template' => $template)); - -.. versionadded:: 1.2 - The ``ignore missing`` feature has been added in Twig 1.2. - -You can mark an include with ``ignore missing`` in which case Twig will ignore -the statement if the template to be included does not exist. It has to be -placed just after the template name. Here some valid examples: - -.. code-block:: jinja - - {% include 'sidebar.html' ignore missing %} - {% include 'sidebar.html' ignore missing with {'foo': 'bar'} %} - {% include 'sidebar.html' ignore missing only %} - -.. versionadded:: 1.2 - The possibility to pass an array of templates has been added in Twig 1.2. - -You can also provide a list of templates that are checked for existence before -inclusion. The first template that exists will be included: - -.. code-block:: jinja - - {% include ['page_detailed.html', 'page.html'] %} - -If ``ignore missing`` is given, it will fall back to rendering nothing if none -of the templates exist, otherwise it will throw an exception. diff --git a/plugins/twig/vendor/twig/twig/doc/tags/index.rst b/plugins/twig/vendor/twig/twig/doc/tags/index.rst deleted file mode 100644 index e6a632b7..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/index.rst +++ /dev/null @@ -1,24 +0,0 @@ -Tags -==== - -.. toctree:: - :maxdepth: 1 - - autoescape - block - do - embed - extends - filter - flush - for - from - if - import - include - macro - sandbox - set - spaceless - use - verbatim diff --git a/plugins/twig/vendor/twig/twig/doc/tags/macro.rst b/plugins/twig/vendor/twig/twig/doc/tags/macro.rst deleted file mode 100644 index 60a1567d..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/macro.rst +++ /dev/null @@ -1,86 +0,0 @@ -``macro`` -========= - -Macros are comparable with functions in regular programming languages. They -are useful to put often used HTML idioms into reusable elements to not repeat -yourself. - -Here is a small example of a macro that renders a form element: - -.. code-block:: jinja - - {% macro input(name, value, type, size) %} - - {% endmacro %} - -Macros differs from native PHP functions in a few ways: - -* Default argument values are defined by using the ``default`` filter in the - macro body; - -* Arguments of a macro are always optional. - -* If extra positional arguments are passed to a macro, they end up in the - special ``varargs`` variable as a list of values. - -But as with PHP functions, macros don't have access to the current template -variables. - -.. tip:: - - You can pass the whole context as an argument by using the special - ``_context`` variable. - -Macros can be defined in any template, and need to be "imported" before being -used (see the documentation for the :doc:`import<../tags/import>` tag for more -information): - -.. code-block:: jinja - - {% import "forms.html" as forms %} - -The above ``import`` call imports the "forms.html" file (which can contain only -macros, or a template and some macros), and import the functions as items of -the ``forms`` variable. - -The macro can then be called at will: - -.. code-block:: jinja - -

    {{ forms.input('username') }}

    -

    {{ forms.input('password', null, 'password') }}

    - -If macros are defined and used in the same template, you can use the -special ``_self`` variable to import them: - -.. code-block:: jinja - - {% import _self as forms %} - -

    {{ forms.input('username') }}

    - -.. warning:: - - When you define a macro in the template where you are going to use it, you - might be tempted to call the macro directly via ``_self.input()`` instead - of importing it; even if seems to work, this is just a side-effect of the - current implementation and it won't work anymore in Twig 2.x. - -When you want to use a macro in another macro from the same file, you need to -import it locally: - -.. code-block:: jinja - - {% macro input(name, value, type, size) %} - - {% endmacro %} - - {% macro wrapped_input(name, value, type, size) %} - {% import _self as forms %} - -
    - {{ forms.input(name, value, type, size) }} -
    - {% endmacro %} - -.. seealso:: :doc:`from<../tags/from>`, :doc:`import<../tags/import>` diff --git a/plugins/twig/vendor/twig/twig/doc/tags/sandbox.rst b/plugins/twig/vendor/twig/twig/doc/tags/sandbox.rst deleted file mode 100644 index e186726c..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/sandbox.rst +++ /dev/null @@ -1,30 +0,0 @@ -``sandbox`` -=========== - -The ``sandbox`` tag can be used to enable the sandboxing mode for an included -template, when sandboxing is not enabled globally for the Twig environment: - -.. code-block:: jinja - - {% sandbox %} - {% include 'user.html' %} - {% endsandbox %} - -.. warning:: - - The ``sandbox`` tag is only available when the sandbox extension is - enabled (see the :doc:`Twig for Developers<../api>` chapter). - -.. note:: - - The ``sandbox`` tag can only be used to sandbox an include tag and it - cannot be used to sandbox a section of a template. The following example - won't work: - - .. code-block:: jinja - - {% sandbox %} - {% for i in 1..2 %} - {{ i }} - {% endfor %} - {% endsandbox %} diff --git a/plugins/twig/vendor/twig/twig/doc/tags/set.rst b/plugins/twig/vendor/twig/twig/doc/tags/set.rst deleted file mode 100644 index 3eba239a..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/set.rst +++ /dev/null @@ -1,78 +0,0 @@ -``set`` -======= - -Inside code blocks you can also assign values to variables. Assignments use -the ``set`` tag and can have multiple targets. - -Here is how you can assign the ``bar`` value to the ``foo`` variable: - -.. code-block:: jinja - - {% set foo = 'bar' %} - -After the ``set`` call, the ``foo`` variable is available in the template like -any other ones: - -.. code-block:: jinja - - {# displays bar #} - {{ foo }} - -The assigned value can be any valid :ref:`Twig expressions -`: - -.. code-block:: jinja - - {% set foo = [1, 2] %} - {% set foo = {'foo': 'bar'} %} - {% set foo = 'foo' ~ 'bar' %} - -Several variables can be assigned in one block: - -.. code-block:: jinja - - {% set foo, bar = 'foo', 'bar' %} - - {# is equivalent to #} - - {% set foo = 'foo' %} - {% set bar = 'bar' %} - -The ``set`` tag can also be used to 'capture' chunks of text: - -.. code-block:: jinja - - {% set foo %} - - {% endset %} - -.. caution:: - - If you enable automatic output escaping, Twig will only consider the - content to be safe when capturing chunks of text. - -.. note:: - - Note that loops are scoped in Twig; therefore a variable declared inside a - ``for`` loop is not accessible outside the loop itself: - - .. code-block:: jinja - - {% for item in list %} - {% set foo = item %} - {% endfor %} - - {# foo is NOT available #} - - If you want to access the variable, just declare it before the loop: - - .. code-block:: jinja - - {% set foo = "" %} - {% for item in list %} - {% set foo = item %} - {% endfor %} - - {# foo is available #} diff --git a/plugins/twig/vendor/twig/twig/doc/tags/spaceless.rst b/plugins/twig/vendor/twig/twig/doc/tags/spaceless.rst deleted file mode 100644 index b39cb27e..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/spaceless.rst +++ /dev/null @@ -1,37 +0,0 @@ -``spaceless`` -============= - -Use the ``spaceless`` tag to remove whitespace *between HTML tags*, not -whitespace within HTML tags or whitespace in plain text: - -.. code-block:: jinja - - {% spaceless %} -
    - foo -
    - {% endspaceless %} - - {# output will be
    foo
    #} - -This tag is not meant to "optimize" the size of the generated HTML content but -merely to avoid extra whitespace between HTML tags to avoid browser rendering -quirks under some circumstances. - -.. tip:: - - If you want to optimize the size of the generated HTML content, gzip - compress the output instead. - -.. tip:: - - If you want to create a tag that actually removes all extra whitespace in - an HTML string, be warned that this is not as easy as it seems to be - (think of ``textarea`` or ``pre`` tags for instance). Using a third-party - library like Tidy is probably a better idea. - -.. tip:: - - For more information on whitespace control, read the - :ref:`dedicated section ` of the documentation and learn how - you can also use the whitespace control modifier on your tags. diff --git a/plugins/twig/vendor/twig/twig/doc/tags/use.rst b/plugins/twig/vendor/twig/twig/doc/tags/use.rst deleted file mode 100644 index 071b1975..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/use.rst +++ /dev/null @@ -1,124 +0,0 @@ -``use`` -======= - -.. versionadded:: 1.1 - Horizontal reuse was added in Twig 1.1. - -.. note:: - - Horizontal reuse is an advanced Twig feature that is hardly ever needed in - regular templates. It is mainly used by projects that need to make - template blocks reusable without using inheritance. - -Template inheritance is one of the most powerful Twig's feature but it is -limited to single inheritance; a template can only extend one other template. -This limitation makes template inheritance simple to understand and easy to -debug: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -Horizontal reuse is a way to achieve the same goal as multiple inheritance, -but without the associated complexity: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% use "blocks.html" %} - - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -The ``use`` statement tells Twig to import the blocks defined in -``blocks.html`` into the current template (it's like macros, but for blocks): - -.. code-block:: jinja - - {# blocks.html #} - - {% block sidebar %}{% endblock %} - -In this example, the ``use`` statement imports the ``sidebar`` block into the -main template. The code is mostly equivalent to the following one (the -imported blocks are not outputted automatically): - -.. code-block:: jinja - - {% extends "base.html" %} - - {% block sidebar %}{% endblock %} - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -.. note:: - - The ``use`` tag only imports a template if it does not extend another - template, if it does not define macros, and if the body is empty. But it - can *use* other templates. - -.. note:: - - Because ``use`` statements are resolved independently of the context - passed to the template, the template reference cannot be an expression. - -The main template can also override any imported block. If the template -already defines the ``sidebar`` block, then the one defined in ``blocks.html`` -is ignored. To avoid name conflicts, you can rename imported blocks: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% use "blocks.html" with sidebar as base_sidebar, title as base_title %} - - {% block sidebar %}{% endblock %} - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -.. versionadded:: 1.3 - The ``parent()`` support was added in Twig 1.3. - -The ``parent()`` function automatically determines the correct inheritance -tree, so it can be used when overriding a block defined in an imported -template: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% use "blocks.html" %} - - {% block sidebar %} - {{ parent() }} - {% endblock %} - - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -In this example, ``parent()`` will correctly call the ``sidebar`` block from -the ``blocks.html`` template. - -.. tip:: - - In Twig 1.2, renaming allows you to simulate inheritance by calling the - "parent" block: - - .. code-block:: jinja - - {% extends "base.html" %} - - {% use "blocks.html" with sidebar as parent_sidebar %} - - {% block sidebar %} - {{ block('parent_sidebar') }} - {% endblock %} - -.. note:: - - You can use as many ``use`` statements as you want in any given template. - If two imported templates define the same block, the latest one wins. diff --git a/plugins/twig/vendor/twig/twig/doc/tags/verbatim.rst b/plugins/twig/vendor/twig/twig/doc/tags/verbatim.rst deleted file mode 100644 index fe61ca1b..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tags/verbatim.rst +++ /dev/null @@ -1,24 +0,0 @@ -``verbatim`` -============ - -.. versionadded:: 1.12 - The ``verbatim`` tag was added in Twig 1.12 (it was named ``raw`` before). - -The ``verbatim`` tag marks sections as being raw text that should not be -parsed. For example to put Twig syntax as example into a template you can use -this snippet: - -.. code-block:: jinja - - {% verbatim %} -
      - {% for item in seq %} -
    • {{ item }}
    • - {% endfor %} -
    - {% endverbatim %} - -.. note:: - - The ``verbatim`` tag works in the exact same way as the old ``raw`` tag, - but was renamed to avoid confusion with the ``raw`` filter. \ No newline at end of file diff --git a/plugins/twig/vendor/twig/twig/doc/templates.rst b/plugins/twig/vendor/twig/twig/doc/templates.rst deleted file mode 100644 index 36a0a7fa..00000000 --- a/plugins/twig/vendor/twig/twig/doc/templates.rst +++ /dev/null @@ -1,907 +0,0 @@ -Twig for Template Designers -=========================== - -This document describes the syntax and semantics of the template engine and -will be most useful as reference to those creating Twig templates. - -Synopsis --------- - -A template is simply a text file. It can generate any text-based format (HTML, -XML, CSV, LaTeX, etc.). It doesn't have a specific extension, ``.html`` or -``.xml`` are just fine. - -A template contains **variables** or **expressions**, which get replaced with -values when the template is evaluated, and **tags**, which control the logic -of the template. - -Below is a minimal template that illustrates a few basics. We will cover further -details later on: - -.. code-block:: html+jinja - - - - - My Webpage - - - - -

    My Webpage

    - {{ a_variable }} - - - -There are two kinds of delimiters: ``{% ... %}`` and ``{{ ... }}``. The first -one is used to execute statements such as for-loops, the latter prints the -result of an expression to the template. - -IDEs Integration ----------------- - -Many IDEs support syntax highlighting and auto-completion for Twig: - -* *Textmate* via the `Twig bundle`_ -* *Vim* via the `Jinja syntax plugin`_ or the `vim-twig plugin`_ -* *Netbeans* via the `Twig syntax plugin`_ (until 7.1, native as of 7.2) -* *PhpStorm* (native as of 2.1) -* *Eclipse* via the `Twig plugin`_ -* *Sublime Text* via the `Twig bundle`_ -* *GtkSourceView* via the `Twig language definition`_ (used by gedit and other projects) -* *Coda* and *SubEthaEdit* via the `Twig syntax mode`_ -* *Coda 2* via the `other Twig syntax mode`_ -* *Komodo* and *Komodo Edit* via the Twig highlight/syntax check mode -* *Notepad++* via the `Notepad++ Twig Highlighter`_ -* *Emacs* via `web-mode.el`_ -* *Atom* via the `PHP-twig for atom`_ - -Also, `TwigFiddle`_ is an online service that allows you to execute Twig templates -from a browser; it supports all versions of Twig. - -Variables ---------- - -The application passes variables to the templates for manipulation in the -template. Variables may have attributes or elements you can access, -too. The visual representation of a variable depends heavily on the application providing -it. - -You can use a dot (``.``) to access attributes of a variable (methods or -properties of a PHP object, or items of a PHP array), or the so-called -"subscript" syntax (``[]``): - -.. code-block:: jinja - - {{ foo.bar }} - {{ foo['bar'] }} - -When the attribute contains special characters (like ``-`` that would be -interpreted as the minus operator), use the ``attribute`` function instead to -access the variable attribute: - -.. code-block:: jinja - - {# equivalent to the non-working foo.data-foo #} - {{ attribute(foo, 'data-foo') }} - -.. note:: - - It's important to know that the curly braces are *not* part of the - variable but the print statement. When accessing variables inside tags, - don't put the braces around them. - -If a variable or attribute does not exist, you will receive a ``null`` value -when the ``strict_variables`` option is set to ``false``; alternatively, if ``strict_variables`` -is set, Twig will throw an error (see :ref:`environment options`). - -.. sidebar:: Implementation - - For convenience's sake ``foo.bar`` does the following things on the PHP - layer: - - * check if ``foo`` is an array and ``bar`` a valid element; - * if not, and if ``foo`` is an object, check that ``bar`` is a valid property; - * if not, and if ``foo`` is an object, check that ``bar`` is a valid method - (even if ``bar`` is the constructor - use ``__construct()`` instead); - * if not, and if ``foo`` is an object, check that ``getBar`` is a valid method; - * if not, and if ``foo`` is an object, check that ``isBar`` is a valid method; - * if not, return a ``null`` value. - - ``foo['bar']`` on the other hand only works with PHP arrays: - - * check if ``foo`` is an array and ``bar`` a valid element; - * if not, return a ``null`` value. - -.. note:: - - If you want to access a dynamic attribute of a variable, use the - :doc:`attribute` function instead. - -Global Variables -~~~~~~~~~~~~~~~~ - -The following variables are always available in templates: - -* ``_self``: references the current template; -* ``_context``: references the current context; -* ``_charset``: references the current charset. - -Setting Variables -~~~~~~~~~~~~~~~~~ - -You can assign values to variables inside code blocks. Assignments use the -:doc:`set` tag: - -.. code-block:: jinja - - {% set foo = 'foo' %} - {% set foo = [1, 2] %} - {% set foo = {'foo': 'bar'} %} - -Filters -------- - -Variables can be modified by **filters**. Filters are separated from the -variable by a pipe symbol (``|``) and may have optional arguments in -parentheses. Multiple filters can be chained. The output of one filter is -applied to the next. - -The following example removes all HTML tags from the ``name`` and title-cases -it: - -.. code-block:: jinja - - {{ name|striptags|title }} - -Filters that accept arguments have parentheses around the arguments. This -example will join a list by commas: - -.. code-block:: jinja - - {{ list|join(', ') }} - -To apply a filter on a section of code, wrap it in the -:doc:`filter` tag: - -.. code-block:: jinja - - {% filter upper %} - This text becomes uppercase - {% endfilter %} - -Go to the :doc:`filters` page to learn more about built-in -filters. - -Functions ---------- - -Functions can be called to generate content. Functions are called by their -name followed by parentheses (``()``) and may have arguments. - -For instance, the ``range`` function returns a list containing an arithmetic -progression of integers: - -.. code-block:: jinja - - {% for i in range(0, 3) %} - {{ i }}, - {% endfor %} - -Go to the :doc:`functions` page to learn more about the -built-in functions. - -Named Arguments ---------------- - -.. versionadded:: 1.12 - Support for named arguments was added in Twig 1.12. - -.. code-block:: jinja - - {% for i in range(low=1, high=10, step=2) %} - {{ i }}, - {% endfor %} - -Using named arguments makes your templates more explicit about the meaning of -the values you pass as arguments: - -.. code-block:: jinja - - {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }} - - {# versus #} - - {{ data|convert_encoding(from='iso-2022-jp', to='UTF-8') }} - -Named arguments also allow you to skip some arguments for which you don't want -to change the default value: - -.. code-block:: jinja - - {# the first argument is the date format, which defaults to the global date format if null is passed #} - {{ "now"|date(null, "Europe/Paris") }} - - {# or skip the format value by using a named argument for the time zone #} - {{ "now"|date(timezone="Europe/Paris") }} - -You can also use both positional and named arguments in one call, in which -case positional arguments must always come before named arguments: - -.. code-block:: jinja - - {{ "now"|date('d/m/Y H:i', timezone="Europe/Paris") }} - -.. tip:: - - Each function and filter documentation page has a section where the names - of all arguments are listed when supported. - -Control Structure ------------------ - -A control structure refers to all those things that control the flow of a -program - conditionals (i.e. ``if``/``elseif``/``else``), ``for``-loops, as -well as things like blocks. Control structures appear inside ``{% ... %}`` -blocks. - -For example, to display a list of users provided in a variable called -``users``, use the :doc:`for` tag: - -.. code-block:: jinja - -

    Members

    -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - -The :doc:`if` tag can be used to test an expression: - -.. code-block:: jinja - - {% if users|length > 0 %} -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - {% endif %} - -Go to the :doc:`tags` page to learn more about the built-in tags. - -Comments --------- - -To comment-out part of a line in a template, use the comment syntax ``{# ... -#}``. This is useful for debugging or to add information for other template -designers or yourself: - -.. code-block:: jinja - - {# note: disabled template because we no longer use this - {% for user in users %} - ... - {% endfor %} - #} - -Including other Templates -------------------------- - -The :doc:`include` tag is useful to include a template and -return the rendered content of that template into the current one: - -.. code-block:: jinja - - {% include 'sidebar.html' %} - -Per default included templates are passed the current context. - -The context that is passed to the included template includes variables defined -in the template: - -.. code-block:: jinja - - {% for box in boxes %} - {% include "render_box.html" %} - {% endfor %} - -The included template ``render_box.html`` is able to access ``box``. - -The filename of the template depends on the template loader. For instance, the -``Twig_Loader_Filesystem`` allows you to access other templates by giving the -filename. You can access templates in subdirectories with a slash: - -.. code-block:: jinja - - {% include "sections/articles/sidebar.html" %} - -This behavior depends on the application embedding Twig. - -Template Inheritance --------------------- - -The most powerful part of Twig is template inheritance. Template inheritance -allows you to build a base "skeleton" template that contains all the common -elements of your site and defines **blocks** that child templates can -override. - -Sounds complicated but it is very basic. It's easier to understand it by -starting with an example. - -Let's define a base template, ``base.html``, which defines a simple HTML -skeleton document that you might use for a simple two-column page: - -.. code-block:: html+jinja - - - - - {% block head %} - - {% block title %}{% endblock %} - My Webpage - {% endblock %} - - -
    {% block content %}{% endblock %}
    - - - - -In this example, the :doc:`block` tags define four blocks that -child templates can fill in. All the ``block`` tag does is to tell the -template engine that a child template may override those portions of the -template. - -A child template might look like this: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% block title %}Index{% endblock %} - {% block head %} - {{ parent() }} - - {% endblock %} - {% block content %} -

    Index

    -

    - Welcome to my awesome homepage. -

    - {% endblock %} - -The :doc:`extends` tag is the key here. It tells the template -engine that this template "extends" another template. When the template system -evaluates this template, first it locates the parent. The extends tag should -be the first tag in the template. - -Note that since the child template doesn't define the ``footer`` block, the -value from the parent template is used instead. - -It's possible to render the contents of the parent block by using the -:doc:`parent` function. This gives back the results of the -parent block: - -.. code-block:: jinja - - {% block sidebar %} -

    Table Of Contents

    - ... - {{ parent() }} - {% endblock %} - -.. tip:: - - The documentation page for the :doc:`extends` tag describes - more advanced features like block nesting, scope, dynamic inheritance, and - conditional inheritance. - -.. note:: - - Twig also supports multiple inheritance with the so called horizontal reuse - with the help of the :doc:`use` tag. This is an advanced feature - hardly ever needed in regular templates. - -HTML Escaping -------------- - -When generating HTML from templates, there's always a risk that a variable -will include characters that affect the resulting HTML. There are two -approaches: manually escaping each variable or automatically escaping -everything by default. - -Twig supports both, automatic escaping is enabled by default. - -.. note:: - - Automatic escaping is only supported if the *escaper* extension has been - enabled (which is the default). - -Working with Manual Escaping -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If manual escaping is enabled, it is **your** responsibility to escape -variables if needed. What to escape? Any variable you don't trust. - -Escaping works by piping the variable through the -:doc:`escape` or ``e`` filter: - -.. code-block:: jinja - - {{ user.username|e }} - -By default, the ``escape`` filter uses the ``html`` strategy, but depending on -the escaping context, you might want to explicitly use any other available -strategies: - -.. code-block:: jinja - - {{ user.username|e('js') }} - {{ user.username|e('css') }} - {{ user.username|e('url') }} - {{ user.username|e('html_attr') }} - -Working with Automatic Escaping -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Whether automatic escaping is enabled or not, you can mark a section of a -template to be escaped or not by using the :doc:`autoescape` -tag: - -.. code-block:: jinja - - {% autoescape %} - Everything will be automatically escaped in this block (using the HTML strategy) - {% endautoescape %} - -By default, auto-escaping uses the ``html`` escaping strategy. If you output -variables in other contexts, you need to explicitly escape them with the -appropriate escaping strategy: - -.. code-block:: jinja - - {% autoescape 'js' %} - Everything will be automatically escaped in this block (using the JS strategy) - {% endautoescape %} - -Escaping --------- - -It is sometimes desirable or even necessary to have Twig ignore parts it would -otherwise handle as variables or blocks. For example if the default syntax is -used and you want to use ``{{`` as raw string in the template and not start a -variable you have to use a trick. - -The easiest way is to output the variable delimiter (``{{``) by using a variable -expression: - -.. code-block:: jinja - - {{ '{{' }} - -For bigger sections it makes sense to mark a block -:doc:`verbatim`. - -Macros ------- - -.. versionadded:: 1.12 - Support for default argument values was added in Twig 1.12. - -Macros are comparable with functions in regular programming languages. They -are useful to reuse often used HTML fragments to not repeat yourself. - -A macro is defined via the :doc:`macro` tag. Here is a small example -(subsequently called ``forms.html``) of a macro that renders a form element: - -.. code-block:: jinja - - {% macro input(name, value, type, size) %} - - {% endmacro %} - -Macros can be defined in any template, and need to be "imported" via the -:doc:`import` tag before being used: - -.. code-block:: jinja - - {% import "forms.html" as forms %} - -

    {{ forms.input('username') }}

    - -Alternatively, you can import individual macro names from a template into the -current namespace via the :doc:`from` tag and optionally alias them: - -.. code-block:: jinja - - {% from 'forms.html' import input as input_field %} - -
    -
    Username
    -
    {{ input_field('username') }}
    -
    Password
    -
    {{ input_field('password', '', 'password') }}
    -
    - -A default value can also be defined for macro arguments when not provided in a -macro call: - -.. code-block:: jinja - - {% macro input(name, value = "", type = "text", size = 20) %} - - {% endmacro %} - -If extra positional arguments are passed to a macro call, they end up in the -special ``varargs`` variable as a list of values. - -.. _twig-expressions: - -Expressions ------------ - -Twig allows expressions everywhere. These work very similar to regular PHP and -even if you're not working with PHP you should feel comfortable with it. - -.. note:: - - The operator precedence is as follows, with the lowest-precedence - operators listed first: ``b-and``, ``b-xor``, ``b-or``, ``or``, ``and``, - ``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``, ``in``, ``matches``, - ``starts with``, ``ends with``, ``..``, ``+``, ``-``, ``~``, ``*``, ``/``, - ``//``, ``%``, ``is``, ``**``, ``|``, ``[]``, and ``.``: - - .. code-block:: jinja - - {% set greeting = 'Hello ' %} - {% set name = 'Fabien' %} - - {{ greeting ~ name|lower }} {# Hello fabien #} - - {# use parenthesis to change precedence #} - {{ (greeting ~ name)|lower }} {# hello fabien #} - -Literals -~~~~~~~~ - -.. versionadded:: 1.5 - Support for hash keys as names and expressions was added in Twig 1.5. - -The simplest form of expressions are literals. Literals are representations -for PHP types such as strings, numbers, and arrays. The following literals -exist: - -* ``"Hello World"``: Everything between two double or single quotes is a - string. They are useful whenever you need a string in the template (for - example as arguments to function calls, filters or just to extend or include - a template). A string can contain a delimiter if it is preceded by a - backslash (``\``) -- like in ``'It\'s good'``. - -* ``42`` / ``42.23``: Integers and floating point numbers are created by just - writing the number down. If a dot is present the number is a float, - otherwise an integer. - -* ``["foo", "bar"]``: Arrays are defined by a sequence of expressions - separated by a comma (``,``) and wrapped with squared brackets (``[]``). - -* ``{"foo": "bar"}``: Hashes are defined by a list of keys and values - separated by a comma (``,``) and wrapped with curly braces (``{}``): - - .. code-block:: jinja - - {# keys as string #} - { 'foo': 'foo', 'bar': 'bar' } - - {# keys as names (equivalent to the previous hash) -- as of Twig 1.5 #} - { foo: 'foo', bar: 'bar' } - - {# keys as integer #} - { 2: 'foo', 4: 'bar' } - - {# keys as expressions (the expression must be enclosed into parentheses) -- as of Twig 1.5 #} - { (1 + 1): 'foo', (a ~ 'b'): 'bar' } - -* ``true`` / ``false``: ``true`` represents the true value, ``false`` - represents the false value. - -* ``null``: ``null`` represents no specific value. This is the value returned - when a variable does not exist. ``none`` is an alias for ``null``. - -Arrays and hashes can be nested: - -.. code-block:: jinja - - {% set foo = [1, {"foo": "bar"}] %} - -.. tip:: - - Using double-quoted or single-quoted strings has no impact on performance - but string interpolation is only supported in double-quoted strings. - -Math -~~~~ - -Twig allows you to calculate with values. This is rarely useful in templates -but exists for completeness' sake. The following operators are supported: - -* ``+``: Adds two objects together (the operands are casted to numbers). ``{{ - 1 + 1 }}`` is ``2``. - -* ``-``: Subtracts the second number from the first one. ``{{ 3 - 2 }}`` is - ``1``. - -* ``/``: Divides two numbers. The returned value will be a floating point - number. ``{{ 1 / 2 }}`` is ``{{ 0.5 }}``. - -* ``%``: Calculates the remainder of an integer division. ``{{ 11 % 7 }}`` is - ``4``. - -* ``//``: Divides two numbers and returns the floored integer result. ``{{ 20 - // 7 }}`` is ``2``, ``{{ -20 // 7 }}`` is ``-3`` (this is just syntactic - sugar for the :doc:`round` filter). - -* ``*``: Multiplies the left operand with the right one. ``{{ 2 * 2 }}`` would - return ``4``. - -* ``**``: Raises the left operand to the power of the right operand. ``{{ 2 ** - 3 }}`` would return ``8``. - -Logic -~~~~~ - -You can combine multiple expressions with the following operators: - -* ``and``: Returns true if the left and the right operands are both true. - -* ``or``: Returns true if the left or the right operand is true. - -* ``not``: Negates a statement. - -* ``(expr)``: Groups an expression. - -.. note:: - - Twig also support bitwise operators (``b-and``, ``b-xor``, and ``b-or``). - -.. note:: - - Operators are case sensitive. - -Comparisons -~~~~~~~~~~~ - -The following comparison operators are supported in any expression: ``==``, -``!=``, ``<``, ``>``, ``>=``, and ``<=``. - -You can also check if a string ``starts with`` or ``ends with`` another -string: - -.. code-block:: jinja - - {% if 'Fabien' starts with 'F' %} - {% endif %} - - {% if 'Fabien' ends with 'n' %} - {% endif %} - -.. note:: - - For complex string comparisons, the ``matches`` operator allows you to use - `regular expressions`_: - - .. code-block:: jinja - - {% if phone matches '/^[\\d\\.]+$/' %} - {% endif %} - -Containment Operator -~~~~~~~~~~~~~~~~~~~~ - -The ``in`` operator performs containment test. - -It returns ``true`` if the left operand is contained in the right: - -.. code-block:: jinja - - {# returns true #} - - {{ 1 in [1, 2, 3] }} - - {{ 'cd' in 'abcde' }} - -.. tip:: - - You can use this filter to perform a containment test on strings, arrays, - or objects implementing the ``Traversable`` interface. - -To perform a negative test, use the ``not in`` operator: - -.. code-block:: jinja - - {% if 1 not in [1, 2, 3] %} - - {# is equivalent to #} - {% if not (1 in [1, 2, 3]) %} - -Test Operator -~~~~~~~~~~~~~ - -The ``is`` operator performs tests. Tests can be used to test a variable against -a common expression. The right operand is name of the test: - -.. code-block:: jinja - - {# find out if a variable is odd #} - - {{ name is odd }} - -Tests can accept arguments too: - -.. code-block:: jinja - - {% if post.status is constant('Post::PUBLISHED') %} - -Tests can be negated by using the ``is not`` operator: - -.. code-block:: jinja - - {% if post.status is not constant('Post::PUBLISHED') %} - - {# is equivalent to #} - {% if not (post.status is constant('Post::PUBLISHED')) %} - -Go to the :doc:`tests` page to learn more about the built-in -tests. - -Other Operators -~~~~~~~~~~~~~~~ - -.. versionadded:: 1.12.0 - Support for the extended ternary operator was added in Twig 1.12.0. - -The following operators don't fit into any of the other categories: - -* ``|``: Applies a filter. - -* ``..``: Creates a sequence based on the operand before and after the operator - (this is just syntactic sugar for the :doc:`range` function): - - .. code-block:: jinja - - {{ 1..5 }} - - {# equivalent to #} - {{ range(1, 5) }} - - Note that you must use parentheses when combining it with the filter operator - due to the :ref:`operator precedence rules `: - - .. code-block:: jinja - - (1..5)|join(', ') - -* ``~``: Converts all operands into strings and concatenates them. ``{{ "Hello - " ~ name ~ "!" }}`` would return (assuming ``name`` is ``'John'``) ``Hello - John!``. - -* ``.``, ``[]``: Gets an attribute of an object. - -* ``?:``: The ternary operator: - - .. code-block:: jinja - - {{ foo ? 'yes' : 'no' }} - - {# as of Twig 1.12.0 #} - {{ foo ?: 'no' }} is the same as {{ foo ? foo : 'no' }} - {{ foo ? 'yes' }} is the same as {{ foo ? 'yes' : '' }} - -* ``??``: The null-coalescing operator: - - .. code-block:: jinja - - {# returns the value of foo if it is defined and not null, 'no' otherwise #} - {{ foo ?? 'no' }} - -String Interpolation -~~~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 1.5 - String interpolation was added in Twig 1.5. - -String interpolation (`#{expression}`) allows any valid expression to appear -within a *double-quoted string*. The result of evaluating that expression is -inserted into the string: - -.. code-block:: jinja - - {{ "foo #{bar} baz" }} - {{ "foo #{1 + 2} baz" }} - -.. _templates-whitespace-control: - -Whitespace Control ------------------- - -.. versionadded:: 1.1 - Tag level whitespace control was added in Twig 1.1. - -The first newline after a template tag is removed automatically (like in PHP.) -Whitespace is not further modified by the template engine, so each whitespace -(spaces, tabs, newlines etc.) is returned unchanged. - -Use the ``spaceless`` tag to remove whitespace *between HTML tags*: - -.. code-block:: jinja - - {% spaceless %} -
    - foo bar -
    - {% endspaceless %} - - {# output will be
    foo bar
    #} - -In addition to the spaceless tag you can also control whitespace on a per tag -level. By using the whitespace control modifier on your tags, you can trim -leading and or trailing whitespace: - -.. code-block:: jinja - - {% set value = 'no spaces' %} - {#- No leading/trailing whitespace -#} - {%- if true -%} - {{- value -}} - {%- endif -%} - - {# output 'no spaces' #} - -The above sample shows the default whitespace control modifier, and how you can -use it to remove whitespace around tags. Trimming space will consume all whitespace -for that side of the tag. It is possible to use whitespace trimming on one side -of a tag: - -.. code-block:: jinja - - {% set value = 'no spaces' %} -
  • {{- value }}
  • - - {# outputs '
  • no spaces
  • ' #} - -Extensions ----------- - -Twig can be easily extended. - -If you are looking for new tags, filters, or functions, have a look at the Twig official -`extension repository`_. - -If you want to create your own, read the :ref:`Creating an -Extension` chapter. - -.. _`Twig bundle`: https://github.com/Anomareh/PHP-Twig.tmbundle -.. _`Jinja syntax plugin`: http://jinja.pocoo.org/docs/integration/#vim -.. _`vim-twig plugin`: https://github.com/evidens/vim-twig -.. _`Twig syntax plugin`: http://plugins.netbeans.org/plugin/37069/php-twig -.. _`Twig plugin`: https://github.com/pulse00/Twig-Eclipse-Plugin -.. _`Twig language definition`: https://github.com/gabrielcorpse/gedit-twig-template-language -.. _`extension repository`: http://github.com/twigphp/Twig-extensions -.. _`Twig syntax mode`: https://github.com/bobthecow/Twig-HTML.mode -.. _`other Twig syntax mode`: https://github.com/muxx/Twig-HTML.mode -.. _`Notepad++ Twig Highlighter`: https://github.com/Banane9/notepadplusplus-twig -.. _`web-mode.el`: http://web-mode.org/ -.. _`regular expressions`: http://php.net/manual/en/pcre.pattern.php -.. _`PHP-twig for atom`: https://github.com/reesef/php-twig -.. _`TwigFiddle`: http://twigfiddle.com/ diff --git a/plugins/twig/vendor/twig/twig/doc/tests/constant.rst b/plugins/twig/vendor/twig/twig/doc/tests/constant.rst deleted file mode 100644 index 8d0724a8..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tests/constant.rst +++ /dev/null @@ -1,22 +0,0 @@ -``constant`` -============ - -.. versionadded: 1.13.1 - constant now accepts object instances as the second argument. - -``constant`` checks if a variable has the exact same value as a constant. You -can use either global constants or class constants: - -.. code-block:: jinja - - {% if post.status is constant('Post::PUBLISHED') %} - the status attribute is exactly the same as Post::PUBLISHED - {% endif %} - -You can test constants from object instances as well: - -.. code-block:: jinja - - {% if post.status is constant('PUBLISHED', post) %} - the status attribute is exactly the same as Post::PUBLISHED - {% endif %} diff --git a/plugins/twig/vendor/twig/twig/doc/tests/defined.rst b/plugins/twig/vendor/twig/twig/doc/tests/defined.rst deleted file mode 100644 index 702ce725..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tests/defined.rst +++ /dev/null @@ -1,30 +0,0 @@ -``defined`` -=========== - -``defined`` checks if a variable is defined in the current context. This is very -useful if you use the ``strict_variables`` option: - -.. code-block:: jinja - - {# defined works with variable names #} - {% if foo is defined %} - ... - {% endif %} - - {# and attributes on variables names #} - {% if foo.bar is defined %} - ... - {% endif %} - - {% if foo['bar'] is defined %} - ... - {% endif %} - -When using the ``defined`` test on an expression that uses variables in some -method calls, be sure that they are all defined first: - -.. code-block:: jinja - - {% if var is defined and foo.method(var) is defined %} - ... - {% endif %} diff --git a/plugins/twig/vendor/twig/twig/doc/tests/divisibleby.rst b/plugins/twig/vendor/twig/twig/doc/tests/divisibleby.rst deleted file mode 100644 index 6c693b2b..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tests/divisibleby.rst +++ /dev/null @@ -1,14 +0,0 @@ -``divisible by`` -================ - -.. versionadded:: 1.14.2 - The ``divisible by`` test was added in Twig 1.14.2 as an alias for - ``divisibleby``. - -``divisible by`` checks if a variable is divisible by a number: - -.. code-block:: jinja - - {% if loop.index is divisible by(3) %} - ... - {% endif %} diff --git a/plugins/twig/vendor/twig/twig/doc/tests/empty.rst b/plugins/twig/vendor/twig/twig/doc/tests/empty.rst deleted file mode 100644 index e5b55999..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tests/empty.rst +++ /dev/null @@ -1,11 +0,0 @@ -``empty`` -========= - -``empty`` checks if a variable is empty: - -.. code-block:: jinja - - {# evaluates to true if the foo variable is null, false, an empty array, or the empty string #} - {% if foo is empty %} - ... - {% endif %} diff --git a/plugins/twig/vendor/twig/twig/doc/tests/even.rst b/plugins/twig/vendor/twig/twig/doc/tests/even.rst deleted file mode 100644 index 6ab5cc39..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tests/even.rst +++ /dev/null @@ -1,10 +0,0 @@ -``even`` -======== - -``even`` returns ``true`` if the given number is even: - -.. code-block:: jinja - - {{ var is even }} - -.. seealso:: :doc:`odd<../tests/odd>` diff --git a/plugins/twig/vendor/twig/twig/doc/tests/index.rst b/plugins/twig/vendor/twig/twig/doc/tests/index.rst deleted file mode 100644 index c63208ee..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tests/index.rst +++ /dev/null @@ -1,15 +0,0 @@ -Tests -===== - -.. toctree:: - :maxdepth: 1 - - constant - defined - divisibleby - empty - even - iterable - null - odd - sameas diff --git a/plugins/twig/vendor/twig/twig/doc/tests/iterable.rst b/plugins/twig/vendor/twig/twig/doc/tests/iterable.rst deleted file mode 100644 index 89a172f7..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tests/iterable.rst +++ /dev/null @@ -1,19 +0,0 @@ -``iterable`` -============ - -.. versionadded:: 1.7 - The iterable test was added in Twig 1.7. - -``iterable`` checks if a variable is an array or a traversable object: - -.. code-block:: jinja - - {# evaluates to true if the foo variable is iterable #} - {% if users is iterable %} - {% for user in users %} - Hello {{ user }}! - {% endfor %} - {% else %} - {# users is probably a string #} - Hello {{ users }}! - {% endif %} diff --git a/plugins/twig/vendor/twig/twig/doc/tests/null.rst b/plugins/twig/vendor/twig/twig/doc/tests/null.rst deleted file mode 100644 index 44eec62e..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tests/null.rst +++ /dev/null @@ -1,12 +0,0 @@ -``null`` -======== - -``null`` returns ``true`` if the variable is ``null``: - -.. code-block:: jinja - - {{ var is null }} - -.. note:: - - ``none`` is an alias for ``null``. diff --git a/plugins/twig/vendor/twig/twig/doc/tests/odd.rst b/plugins/twig/vendor/twig/twig/doc/tests/odd.rst deleted file mode 100644 index 9eece777..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tests/odd.rst +++ /dev/null @@ -1,10 +0,0 @@ -``odd`` -======= - -``odd`` returns ``true`` if the given number is odd: - -.. code-block:: jinja - - {{ var is odd }} - -.. seealso:: :doc:`even<../tests/even>` diff --git a/plugins/twig/vendor/twig/twig/doc/tests/sameas.rst b/plugins/twig/vendor/twig/twig/doc/tests/sameas.rst deleted file mode 100644 index 16f904d5..00000000 --- a/plugins/twig/vendor/twig/twig/doc/tests/sameas.rst +++ /dev/null @@ -1,14 +0,0 @@ -``same as`` -=========== - -.. versionadded:: 1.14.2 - The ``same as`` test was added in Twig 1.14.2 as an alias for ``sameas``. - -``same as`` checks if a variable is the same as another variable. -This is the equivalent to ``===`` in PHP: - -.. code-block:: jinja - - {% if foo.attribute is same as(false) %} - the foo attribute really is the 'false' PHP value - {% endif %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php deleted file mode 100644 index 52107c0c..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php +++ /dev/null @@ -1,24 +0,0 @@ -assertFalse(class_exists('FooBarFoo'), '->autoload() does not try to load classes that does not begin with Twig'); - - $autoloader = new Twig_Autoloader(); - $this->assertNull($autoloader->autoload('Foo'), '->autoload() returns false if it is not able to load a class'); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php deleted file mode 100644 index 93a92d93..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php +++ /dev/null @@ -1,193 +0,0 @@ -classname = '__Twig_Tests_Cache_FilesystemTest_Template_'.$nonce; - $this->directory = sys_get_temp_dir().'/twig-test'; - $this->cache = new Twig_Cache_Filesystem($this->directory); - } - - protected function tearDown() - { - if (file_exists($this->directory)) { - Twig_Tests_FilesystemHelper::removeDir($this->directory); - } - } - - public function testLoad() - { - $key = $this->directory.'/cache/cachefile.php'; - - $dir = dirname($key); - @mkdir($dir, 0777, true); - $this->assertTrue(is_dir($dir)); - $this->assertFalse(class_exists($this->classname, false)); - - $content = $this->generateSource(); - file_put_contents($key, $content); - - $this->cache->load($key); - - $this->assertTrue(class_exists($this->classname, false)); - } - - public function testLoadMissing() - { - $key = $this->directory.'/cache/cachefile.php'; - - $this->assertFalse(class_exists($this->classname, false)); - - $this->cache->load($key); - - $this->assertFalse(class_exists($this->classname, false)); - } - - public function testWrite() - { - $key = $this->directory.'/cache/cachefile.php'; - $content = $this->generateSource(); - - $this->assertFalse(file_exists($key)); - $this->assertFalse(file_exists($this->directory)); - - $this->cache->write($key, $content); - - $this->assertTrue(file_exists($this->directory)); - $this->assertTrue(file_exists($key)); - $this->assertSame(file_get_contents($key), $content); - } - - /** - * @expectedException RuntimeException - * @expectedExceptionMessage Unable to create the cache directory - */ - public function testWriteFailMkdir() - { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - $this->markTestSkipped('Read-only directories not possible on Windows.'); - } - - $key = $this->directory.'/cache/cachefile.php'; - $content = $this->generateSource(); - - $this->assertFalse(file_exists($key)); - - // Create read-only root directory. - @mkdir($this->directory, 0555, true); - $this->assertTrue(is_dir($this->directory)); - - $this->cache->write($key, $content); - } - - /** - * @expectedException RuntimeException - * @expectedExceptionMessage Unable to write in the cache directory - */ - public function testWriteFailDirWritable() - { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - $this->markTestSkipped('Read-only directories not possible on Windows.'); - } - - $key = $this->directory.'/cache/cachefile.php'; - $content = $this->generateSource(); - - $this->assertFalse(file_exists($key)); - - // Create root directory. - @mkdir($this->directory, 0777, true); - // Create read-only subdirectory. - @mkdir($this->directory.'/cache' , 0555); - $this->assertTrue(is_dir($this->directory.'/cache')); - - $this->cache->write($key, $content); - } - - /** - * @expectedException RuntimeException - * @expectedExceptionMessage Failed to write cache file - */ - public function testWriteFailWriteFile() - { - $key = $this->directory.'/cache/cachefile.php'; - $content = $this->generateSource(); - - $this->assertFalse(file_exists($key)); - - // Create a directory in the place of the cache file. - @mkdir($key, 0777, true); - $this->assertTrue(is_dir($key)); - - $this->cache->write($key, $content); - } - - public function testGetTimestamp() - { - $key = $this->directory.'/cache/cachefile.php'; - - $dir = dirname($key); - @mkdir($dir, 0777, true); - $this->assertTrue(is_dir($dir)); - - // Create the file with a specific modification time. - touch($key, 1234567890); - - $this->assertSame(1234567890, $this->cache->getTimestamp($key)); - } - - public function testGetTimestampMissingFile() - { - $key = $this->directory.'/cache/cachefile.php'; - $this->assertSame(0, $this->cache->getTimestamp($key)); - } - - /** - * Test file cache is tolerant towards trailing (back)slashes on the configured cache directory. - * - * @dataProvider provideDirectories - */ - public function testGenerateKey($expected, $input) - { - $cache = new Twig_Cache_Filesystem($input); - $this->assertRegExp($expected, $cache->generateKey('_test_', get_class($this))); - } - - public function provideDirectories() - { - $pattern = '#a/b/[a-zA-Z0-9]+/[a-zA-Z0-9]+.php$#'; - - return array( - array($pattern, 'a/b'), - array($pattern, 'a/b/'), - array($pattern, 'a/b\\'), - array($pattern, 'a/b\\/'), - array($pattern, 'a/b\\//'), - array('#/'.substr($pattern, 1), '/a/b'), - ); - } - - private function generateSource() - { - return strtr(' $this->classname, - )); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/CompilerTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/CompilerTest.php deleted file mode 100644 index bc25f117..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/CompilerTest.php +++ /dev/null @@ -1,33 +0,0 @@ -getMock('Twig_LoaderInterface'))); - - $locale = setlocale(LC_NUMERIC, 0); - if (false === $locale) { - $this->markTestSkipped('Your platform does not support locales.'); - } - - $required_locales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'); - if (false === setlocale(LC_NUMERIC, $required_locales)) { - $this->markTestSkipped('Could not set any of required locales: '.implode(', ', $required_locales)); - } - - $this->assertEquals('1.2', $compiler->repr(1.2)->getSource()); - $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0))); - - setlocale(LC_NUMERIC, $locale); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php deleted file mode 100644 index 35f65bdd..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php +++ /dev/null @@ -1,529 +0,0 @@ -render('test'); - } - - public function testAutoescapeOption() - { - $loader = new Twig_Loader_Array(array( - 'html' => '{{ foo }} {{ foo }}', - 'js' => '{{ bar }} {{ bar }}', - )); - - $twig = new Twig_Environment($loader, array( - 'debug' => true, - 'cache' => false, - 'autoescape' => array($this, 'escapingStrategyCallback'), - )); - - $this->assertEquals('foo<br/ > foo<br/ >', $twig->render('html', array('foo' => 'foo
    '))); - $this->assertEquals('foo\x3Cbr\x2F\x20\x3E foo\x3Cbr\x2F\x20\x3E', $twig->render('js', array('bar' => 'foo
    '))); - } - - public function escapingStrategyCallback($filename) - { - return $filename; - } - - public function testGlobals() - { - // globals can be added after calling getGlobals - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->addGlobal('foo', 'bar'); - $globals = $twig->getGlobals(); - $this->assertEquals('bar', $globals['foo']); - - // globals can be modified after a template has been loaded - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->loadTemplate('index'); - $twig->addGlobal('foo', 'bar'); - $globals = $twig->getGlobals(); - $this->assertEquals('bar', $globals['foo']); - - // globals can be modified after extensions init - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->getFunctions(); - $twig->addGlobal('foo', 'bar'); - $globals = $twig->getGlobals(); - $this->assertEquals('bar', $globals['foo']); - - // globals can be modified after extensions and a template has been loaded - $twig = new Twig_Environment($loader = new Twig_Loader_Array(array('index' => '{{foo}}'))); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->getFunctions(); - $twig->loadTemplate('index'); - $twig->addGlobal('foo', 'bar'); - $globals = $twig->getGlobals(); - $this->assertEquals('bar', $globals['foo']); - - $twig = new Twig_Environment($loader); - $twig->getGlobals(); - $twig->addGlobal('foo', 'bar'); - $template = $twig->loadTemplate('index'); - $this->assertEquals('bar', $template->render(array())); - - /* to be uncomment in Twig 2.0 - // globals cannot be added after a template has been loaded - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->loadTemplate('index'); - try { - $twig->addGlobal('bar', 'bar'); - $this->fail(); - } catch (LogicException $e) { - $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); - } - - // globals cannot be added after extensions init - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->getFunctions(); - try { - $twig->addGlobal('bar', 'bar'); - $this->fail(); - } catch (LogicException $e) { - $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); - } - - // globals cannot be added after extensions and a template has been loaded - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->getFunctions(); - $twig->loadTemplate('index'); - try { - $twig->addGlobal('bar', 'bar'); - $this->fail(); - } catch (LogicException $e) { - $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); - } - - // test adding globals after a template has been loaded without call to getGlobals - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->loadTemplate('index'); - try { - $twig->addGlobal('bar', 'bar'); - $this->fail(); - } catch (LogicException $e) { - $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); - } - */ - } - - public function testCompileSourceInlinesSource() - { - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - - $source = "\r\nbar\n"; - $expected = "/* */\n/* bar*/\n/* */\n"; - $compiled = $twig->compileSource($source, 'index'); - - $this->assertContains($expected, $compiled); - $this->assertNotContains('/**', $compiled); - } - - public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate() - { - $cache = new Twig_Cache_Filesystem($dir = sys_get_temp_dir().'/twig'); - $options = array('cache' => $cache, 'auto_reload' => false, 'debug' => false); - - // force compilation - $twig = new Twig_Environment($loader = new Twig_Loader_Array(array('index' => '{{ foo }}')), $options); - - $key = $cache->generateKey('index', $twig->getTemplateClass('index')); - $cache->write($key, $twig->compileSource('{{ foo }}', 'index')); - - // check that extensions won't be initialized when rendering a template that is already in the cache - $twig = $this - ->getMockBuilder('Twig_Environment') - ->setConstructorArgs(array($loader, $options)) - ->setMethods(array('initExtensions')) - ->getMock() - ; - - $twig->expects($this->never())->method('initExtensions'); - - // render template - $output = $twig->render('index', array('foo' => 'bar')); - $this->assertEquals('bar', $output); - - Twig_Tests_FilesystemHelper::removeDir($dir); - } - - public function testAutoReloadCacheMiss() - { - $templateName = __FUNCTION__; - $templateContent = __FUNCTION__; - - $cache = $this->getMock('Twig_CacheInterface'); - $loader = $this->getMockLoader($templateName, $templateContent); - $twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false)); - - // Cache miss: getTimestamp returns 0 and as a result the load() is - // skipped. - $cache->expects($this->once()) - ->method('generateKey') - ->will($this->returnValue('key')); - $cache->expects($this->once()) - ->method('getTimestamp') - ->will($this->returnValue(0)); - $loader->expects($this->never()) - ->method('isFresh'); - $cache->expects($this->never()) - ->method('load'); - - $twig->loadTemplate($templateName); - } - - public function testAutoReloadCacheHit() - { - $templateName = __FUNCTION__; - $templateContent = __FUNCTION__; - - $cache = $this->getMock('Twig_CacheInterface'); - $loader = $this->getMockLoader($templateName, $templateContent); - $twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false)); - - $now = time(); - - // Cache hit: getTimestamp returns something > extension timestamps and - // the loader returns true for isFresh(). - $cache->expects($this->once()) - ->method('generateKey') - ->will($this->returnValue('key')); - $cache->expects($this->once()) - ->method('getTimestamp') - ->will($this->returnValue($now)); - $loader->expects($this->once()) - ->method('isFresh') - ->will($this->returnValue(true)); - $cache->expects($this->once()) - ->method('load'); - - $twig->loadTemplate($templateName); - } - - public function testAutoReloadOutdatedCacheHit() - { - $templateName = __FUNCTION__; - $templateContent = __FUNCTION__; - - $cache = $this->getMock('Twig_CacheInterface'); - $loader = $this->getMockLoader($templateName, $templateContent); - $twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false)); - - $now = time(); - - $cache->expects($this->once()) - ->method('generateKey') - ->will($this->returnValue('key')); - $cache->expects($this->once()) - ->method('getTimestamp') - ->will($this->returnValue($now)); - $loader->expects($this->once()) - ->method('isFresh') - ->will($this->returnValue(false)); - $cache->expects($this->never()) - ->method('load'); - - $twig->loadTemplate($templateName); - } - - public function testAddExtension() - { - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension()); - - $this->assertArrayHasKey('test', $twig->getTags()); - $this->assertArrayHasKey('foo_filter', $twig->getFilters()); - $this->assertArrayHasKey('foo_function', $twig->getFunctions()); - $this->assertArrayHasKey('foo_test', $twig->getTests()); - $this->assertArrayHasKey('foo_unary', $twig->getUnaryOperators()); - $this->assertArrayHasKey('foo_binary', $twig->getBinaryOperators()); - $this->assertArrayHasKey('foo_global', $twig->getGlobals()); - $visitors = $twig->getNodeVisitors(); - $this->assertEquals('Twig_Tests_EnvironmentTest_NodeVisitor', get_class($visitors[2])); - } - - /** - * @requires PHP 5.3 - */ - public function testAddExtensionWithDeprecatedGetGlobals() - { - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithGlobals()); - - $this->deprecations = array(); - set_error_handler(array($this, 'handleError')); - - $this->assertArrayHasKey('foo_global', $twig->getGlobals()); - - $this->assertCount(1, $this->deprecations); - $this->assertContains('Defining the getGlobals() method in the "environment_test" extension ', $this->deprecations[0]); - - restore_error_handler(); - } - - /** - * @group legacy - */ - public function testRemoveExtension() - { - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension()); - $twig->removeExtension('environment_test'); - - $this->assertFalse(array_key_exists('test', $twig->getTags())); - $this->assertFalse(array_key_exists('foo_filter', $twig->getFilters())); - $this->assertFalse(array_key_exists('foo_function', $twig->getFunctions())); - $this->assertFalse(array_key_exists('foo_test', $twig->getTests())); - $this->assertFalse(array_key_exists('foo_unary', $twig->getUnaryOperators())); - $this->assertFalse(array_key_exists('foo_binary', $twig->getBinaryOperators())); - $this->assertFalse(array_key_exists('foo_global', $twig->getGlobals())); - $this->assertCount(2, $twig->getNodeVisitors()); - } - - public function testAddMockExtension() - { - $extension = $this->getMock('Twig_ExtensionInterface'); - $extension->expects($this->once()) - ->method('getName') - ->will($this->returnValue('mock')); - - $loader = new Twig_Loader_Array(array('page' => 'hey')); - - $twig = new Twig_Environment($loader); - $twig->addExtension($extension); - - $this->assertInstanceOf('Twig_ExtensionInterface', $twig->getExtension('mock')); - $this->assertTrue($twig->isTemplateFresh('page', time())); - } - - public function testInitRuntimeWithAnExtensionUsingInitRuntimeNoDeprecation() - { - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime()); - - $twig->initRuntime(); - } - - /** - * @requires PHP 5.3 - */ - public function testInitRuntimeWithAnExtensionUsingInitRuntimeDeprecation() - { - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime()); - - $this->deprecations = array(); - set_error_handler(array($this, 'handleError')); - - $twig->initRuntime(); - - $this->assertCount(1, $this->deprecations); - $this->assertContains('Defining the initRuntime() method in the "with_deprecation" extension is deprecated since version 1.23.', $this->deprecations[0]); - - restore_error_handler(); - } - - public function handleError($type, $msg) - { - if (E_USER_DEPRECATED === $type) { - $this->deprecations[] = $msg; - } - } - - /** - * @requires PHP 5.3 - */ - public function testOverrideExtension() - { - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime()); - - $this->deprecations = array(); - set_error_handler(array($this, 'handleError')); - - $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension()); - $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension()); - - $this->assertCount(1, $this->deprecations); - $this->assertContains('The possibility to register the same extension twice', $this->deprecations[0]); - - restore_error_handler(); - } - - protected function getMockLoader($templateName, $templateContent) - { - $loader = $this->getMock('Twig_LoaderInterface'); - $loader->expects($this->any()) - ->method('getSource') - ->with($templateName) - ->will($this->returnValue($templateContent)); - $loader->expects($this->any()) - ->method('getCacheKey') - ->with($templateName) - ->will($this->returnValue($templateName)); - - return $loader; - } -} - -class Twig_Tests_EnvironmentTest_Extension_WithGlobals extends Twig_Extension -{ - public function getGlobals() - { - return array( - 'foo_global' => 'foo_global', - ); - } - - public function getName() - { - return 'environment_test'; - } -} - -class Twig_Tests_EnvironmentTest_Extension extends Twig_Extension implements Twig_Extension_GlobalsInterface -{ - public function getTokenParsers() - { - return array( - new Twig_Tests_EnvironmentTest_TokenParser(), - ); - } - - public function getNodeVisitors() - { - return array( - new Twig_Tests_EnvironmentTest_NodeVisitor(), - ); - } - - public function getFilters() - { - return array( - new Twig_SimpleFilter('foo_filter', 'foo_filter'), - ); - } - - public function getTests() - { - return array( - new Twig_SimpleTest('foo_test', 'foo_test'), - ); - } - - public function getFunctions() - { - return array( - new Twig_SimpleFunction('foo_function', 'foo_function'), - ); - } - - public function getOperators() - { - return array( - array('foo_unary' => array()), - array('foo_binary' => array()), - ); - } - - public function getGlobals() - { - return array( - 'foo_global' => 'foo_global', - ); - } - - public function getName() - { - return 'environment_test'; - } -} - -class Twig_Tests_EnvironmentTest_TokenParser extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - } - - public function getTag() - { - return 'test'; - } -} - -class Twig_Tests_EnvironmentTest_NodeVisitor implements Twig_NodeVisitorInterface -{ - public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) - { - return $node; - } - - public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) - { - return $node; - } - - public function getPriority() - { - return 0; - } -} - -class Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime extends Twig_Extension -{ - public function initRuntime(Twig_Environment $env) - { - } - - public function getName() - { - return 'with_deprecation'; - } -} - -class Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime extends Twig_Extension implements Twig_Extension_InitRuntimeInterface -{ - public function initRuntime(Twig_Environment $env) - { - } - - public function getName() - { - return 'without_deprecation'; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/ErrorTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/ErrorTest.php deleted file mode 100644 index d58c40b8..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/ErrorTest.php +++ /dev/null @@ -1,144 +0,0 @@ -setTemplateFile(new SplFileInfo(__FILE__)); - - $this->assertContains('test'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Tests'.DIRECTORY_SEPARATOR.'ErrorTest.php', $error->getMessage()); - } - - public function testErrorWithArrayFilename() - { - $error = new Twig_Error('foo'); - $error->setTemplateFile(array('foo' => 'bar')); - - $this->assertEquals('foo in {"foo":"bar"}', $error->getMessage()); - } - - public function testTwigExceptionAddsFileAndLineWhenMissingWithInheritanceOnDisk() - { - $loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors'); - $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); - - $template = $twig->loadTemplate('index.html'); - try { - $template->render(array()); - - $this->fail(); - } catch (Twig_Error_Runtime $e) { - $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()); - } - - try { - $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); - - $this->fail(); - } catch (Twig_Error_Runtime $e) { - $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index.html" at line 3.', $e->getMessage()); - $this->assertEquals(3, $e->getTemplateLine()); - $this->assertEquals('index.html', $e->getTemplateFile()); - } - } - - /** - * @dataProvider getErroredTemplates - */ - public function testTwigExceptionAddsFileAndLine($templates, $name, $line) - { - $loader = new Twig_Loader_Array($templates); - $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); - - $template = $twig->loadTemplate('index'); - - try { - $template->render(array()); - - $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($line, $e->getTemplateLine()); - $this->assertEquals($name, $e->getTemplateFile()); - } - - try { - $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); - - $this->fail(); - } catch (Twig_Error_Runtime $e) { - $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()); - $this->assertEquals($line, $e->getTemplateLine()); - $this->assertEquals($name, $e->getTemplateFile()); - } - } - - public function getErroredTemplates() - { - return array( - // error occurs in a template - array( - array( - 'index' => "\n\n{{ foo.bar }}\n\n\n{{ 'foo' }}", - ), - 'index', 3, - ), - - // error occurs in an included template - array( - array( - 'index' => "{% include 'partial' %}", - 'partial' => '{{ foo.bar }}', - ), - 'partial', 1, - ), - - // error occurs in a parent block when called via parent() - array( - array( - 'index' => "{% extends 'base' %} - {% block content %} - {{ parent() }} - {% endblock %}", - 'base' => '{% block content %}{{ foo.bar }}{% endblock %}', - ), - 'base', 1, - ), - - // error occurs in a block from the child - array( - array( - 'index' => "{% extends 'base' %} - {% block content %} - {{ foo.bar }} - {% endblock %} - {% block foo %} - {{ foo.bar }} - {% endblock %}", - 'base' => '{% block content %}{% endblock %}', - ), - 'index', 3, - ), - ); - } -} - -class Twig_Tests_ErrorTest_Foo -{ - public function bar() - { - throw new Exception('Runtime error...'); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php deleted file mode 100644 index 33bf48be..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php +++ /dev/null @@ -1,368 +0,0 @@ -getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize($template, 'index')); - } - - public function getFailingTestsForAssignment() - { - return array( - array('{% set false = "foo" %}'), - array('{% set true = "foo" %}'), - array('{% set none = "foo" %}'), - array('{% set 3 = "foo" %}'), - array('{% set 1 + 2 = "foo" %}'), - array('{% set "bar" = "foo" %}'), - array('{% set %}{% endset %}'), - ); - } - - /** - * @dataProvider getTestsForArray - */ - public function testArrayExpression($template, $expected) - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $stream = $env->tokenize($template, 'index'); - $parser = new Twig_Parser($env); - - $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); - } - - /** - * @expectedException Twig_Error_Syntax - * @dataProvider getFailingTestsForArray - */ - public function testArraySyntaxError($template) - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize($template, 'index')); - } - - public function getFailingTestsForArray() - { - return array( - array('{{ [1, "a": "b"] }}'), - array('{{ {"a": "b", 2} }}'), - ); - } - - public function getTestsForArray() - { - return array( - // simple array - array('{{ [1, 2] }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant(0, 1), - new Twig_Node_Expression_Constant(1, 1), - - new Twig_Node_Expression_Constant(1, 1), - new Twig_Node_Expression_Constant(2, 1), - ), 1), - ), - - // array with trailing , - array('{{ [1, 2, ] }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant(0, 1), - new Twig_Node_Expression_Constant(1, 1), - - new Twig_Node_Expression_Constant(1, 1), - new Twig_Node_Expression_Constant(2, 1), - ), 1), - ), - - // simple hash - array('{{ {"a": "b", "b": "c"} }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant('a', 1), - new Twig_Node_Expression_Constant('b', 1), - - new Twig_Node_Expression_Constant('b', 1), - new Twig_Node_Expression_Constant('c', 1), - ), 1), - ), - - // hash with trailing , - array('{{ {"a": "b", "b": "c", } }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant('a', 1), - new Twig_Node_Expression_Constant('b', 1), - - new Twig_Node_Expression_Constant('b', 1), - new Twig_Node_Expression_Constant('c', 1), - ), 1), - ), - - // hash in an array - array('{{ [1, {"a": "b", "b": "c"}] }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant(0, 1), - new Twig_Node_Expression_Constant(1, 1), - - new Twig_Node_Expression_Constant(1, 1), - new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant('a', 1), - new Twig_Node_Expression_Constant('b', 1), - - new Twig_Node_Expression_Constant('b', 1), - new Twig_Node_Expression_Constant('c', 1), - ), 1), - ), 1), - ), - - // array in a hash - array('{{ {"a": [1, 2], "b": "c"} }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant('a', 1), - new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant(0, 1), - new Twig_Node_Expression_Constant(1, 1), - - new Twig_Node_Expression_Constant(1, 1), - new Twig_Node_Expression_Constant(2, 1), - ), 1), - new Twig_Node_Expression_Constant('b', 1), - new Twig_Node_Expression_Constant('c', 1), - ), 1), - ), - ); - } - - /** - * @expectedException Twig_Error_Syntax - */ - public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings() - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); - $stream = $env->tokenize('{{ "a" "b" }}', 'index'); - $parser = new Twig_Parser($env); - - $parser->parse($stream); - } - - /** - * @dataProvider getTestsForString - */ - public function testStringExpression($template, $expected) - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); - $stream = $env->tokenize($template, 'index'); - $parser = new Twig_Parser($env); - - $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); - } - - public function getTestsForString() - { - return array( - array( - '{{ "foo" }}', new Twig_Node_Expression_Constant('foo', 1), - ), - array( - '{{ "foo #{bar}" }}', new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Constant('foo ', 1), - new Twig_Node_Expression_Name('bar', 1), - 1 - ), - ), - array( - '{{ "foo #{bar} baz" }}', new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Constant('foo ', 1), - new Twig_Node_Expression_Name('bar', 1), - 1 - ), - new Twig_Node_Expression_Constant(' baz', 1), - 1 - ), - ), - - array( - '{{ "foo #{"foo #{bar} baz"} baz" }}', new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Constant('foo ', 1), - new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Constant('foo ', 1), - new Twig_Node_Expression_Name('bar', 1), - 1 - ), - new Twig_Node_Expression_Constant(' baz', 1), - 1 - ), - 1 - ), - new Twig_Node_Expression_Constant(' baz', 1), - 1 - ), - ), - ); - } - - /** - * @expectedException Twig_Error_Syntax - */ - public function testAttributeCallDoesNotSupportNamedArguments() - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize('{{ foo.bar(name="Foo") }}', 'index')); - } - - /** - * @expectedException Twig_Error_Syntax - */ - public function testMacroCallDoesNotSupportNamedArguments() - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize('{% from _self import foo %}{% macro foo() %}{% endmacro %}{{ foo(name="Foo") }}', 'index')); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage An argument must be a name. Unexpected token "string" of value "a" ("name" expected) in "index" at line 1. - */ - public function testMacroDefinitionDoesNotSupportNonNameVariableName() - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize('{% macro foo("a") %}{% endmacro %}', 'index')); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage A default value for an argument must be a constant (a boolean, a string, a number, or an array) in "index" at line 1 - * @dataProvider getMacroDefinitionDoesNotSupportNonConstantDefaultValues - */ - public function testMacroDefinitionDoesNotSupportNonConstantDefaultValues($template) - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize($template, 'index')); - } - - public function getMacroDefinitionDoesNotSupportNonConstantDefaultValues() - { - return array( - array('{% macro foo(name = "a #{foo} a") %}{% endmacro %}'), - array('{% macro foo(name = [["b", "a #{foo} a"]]) %}{% endmacro %}'), - ); - } - - /** - * @dataProvider getMacroDefinitionSupportsConstantDefaultValues - */ - public function testMacroDefinitionSupportsConstantDefaultValues($template) - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize($template, 'index')); - } - - public function getMacroDefinitionSupportsConstantDefaultValues() - { - return array( - array('{% macro foo(name = "aa") %}{% endmacro %}'), - array('{% macro foo(name = 12) %}{% endmacro %}'), - array('{% macro foo(name = true) %}{% endmacro %}'), - array('{% macro foo(name = ["a"]) %}{% endmacro %}'), - array('{% macro foo(name = [["a"]]) %}{% endmacro %}'), - array('{% macro foo(name = {a: "a"}) %}{% endmacro %}'), - array('{% macro foo(name = {a: {b: "a"}}) %}{% endmacro %}'), - ); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "cycl" function. Did you mean "cycle" in "index" at line 1? - */ - public function testUnknownFunction() - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize('{{ cycl() }}', 'index')); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "foobar" function in "index" at line 1. - */ - public function testUnknownFunctionWithoutSuggestions() - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize('{{ foobar() }}', 'index')); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "lowe" filter. Did you mean "lower" in "index" at line 1? - */ - public function testUnknownFilter() - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize('{{ 1|lowe }}', 'index')); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "foobar" filter in "index" at line 1. - */ - public function testUnknownFilterWithoutSuggestions() - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize('{{ 1|foobar }}', 'index')); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "nul" test. Did you mean "null" in "index" at line 1 - */ - public function testUnknownTest() - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize('{{ 1 is nul }}', 'index')); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "foobar" test in "index" at line 1. - */ - public function testUnknownTestWithoutSuggestions() - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize('{{ 1 is foobar }}', 'index')); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php deleted file mode 100644 index cd49e2f5..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php +++ /dev/null @@ -1,158 +0,0 @@ -getMock('Twig_LoaderInterface')); - - for ($i = 0; $i < 100; ++$i) { - $this->assertTrue(in_array(twig_random($env, $value), $expectedInArray, true)); // assertContains() would not consider the type - } - } - - public function getRandomFunctionTestData() - { - return array( - array(// array - array('apple', 'orange', 'citrus'), - array('apple', 'orange', 'citrus'), - ), - array(// Traversable - new ArrayObject(array('apple', 'orange', 'citrus')), - array('apple', 'orange', 'citrus'), - ), - array(// unicode string - 'Ä€é', - array('Ä', '€', 'é'), - ), - array(// numeric but string - '123', - array('1', '2', '3'), - ), - array(// integer - 5, - range(0, 5, 1), - ), - array(// float - 5.9, - range(0, 5, 1), - ), - array(// negative - -2, - array(0, -1, -2), - ), - ); - } - - public function testRandomFunctionWithoutParameter() - { - $max = mt_getrandmax(); - - for ($i = 0; $i < 100; ++$i) { - $val = twig_random(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $this->assertTrue(is_int($val) && $val >= 0 && $val <= $max); - } - } - - public function testRandomFunctionReturnsAsIs() - { - $this->assertSame('', twig_random(new Twig_Environment($this->getMock('Twig_LoaderInterface')), '')); - $this->assertSame('', twig_random(new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('charset' => null)), '')); - - $instance = new stdClass(); - $this->assertSame($instance, twig_random(new Twig_Environment($this->getMock('Twig_LoaderInterface')), $instance)); - } - - /** - * @expectedException Twig_Error_Runtime - */ - public function testRandomFunctionOfEmptyArrayThrowsException() - { - twig_random(new Twig_Environment($this->getMock('Twig_LoaderInterface')), array()); - } - - public function testRandomFunctionOnNonUTF8String() - { - if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) { - $this->markTestSkipped('needs iconv or mbstring'); - } - - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->setCharset('ISO-8859-1'); - - $text = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8'); - for ($i = 0; $i < 30; ++$i) { - $rand = twig_random($twig, $text); - $this->assertTrue(in_array(twig_convert_encoding($rand, 'UTF-8', 'ISO-8859-1'), array('Ä', 'é'), true)); - } - } - - public function testReverseFilterOnNonUTF8String() - { - if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) { - $this->markTestSkipped('needs iconv or mbstring'); - } - - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->setCharset('ISO-8859-1'); - - $input = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8'); - $output = twig_convert_encoding(twig_reverse_filter($twig, $input), 'UTF-8', 'ISO-8859-1'); - - $this->assertEquals($output, 'éÄ'); - } - - public function testCustomEscaper() - { - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->getExtension('core')->setEscaper('foo', 'foo_escaper_for_test'); - - $this->assertEquals('fooUTF-8', twig_escape_filter($twig, 'foo', 'foo')); - $this->assertEquals('UTF-8', twig_escape_filter($twig, null, 'foo')); - $this->assertEquals('42UTF-8', twig_escape_filter($twig, 42, 'foo')); - } - - /** - * @expectedException Twig_Error_Runtime - */ - public function testUnknownCustomEscaper() - { - twig_escape_filter(new Twig_Environment($this->getMock('Twig_LoaderInterface')), 'foo', 'bar'); - } - - public function testTwigFirst() - { - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $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->getMock('Twig_LoaderInterface')); - $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) -{ - return $string.$charset; -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php deleted file mode 100644 index bfaa62b0..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php +++ /dev/null @@ -1,220 +0,0 @@ - 'Fabien', - 'obj' => new FooObject(), - 'arr' => array('obj' => new FooObject()), - ); - - self::$templates = array( - '1_basic1' => '{{ obj.foo }}', - '1_basic2' => '{{ name|upper }}', - '1_basic3' => '{% if name %}foo{% endif %}', - '1_basic4' => '{{ obj.bar }}', - '1_basic5' => '{{ obj }}', - '1_basic6' => '{{ arr.obj }}', - '1_basic7' => '{{ cycle(["foo","bar"], 1) }}', - '1_basic8' => '{{ obj.getfoobar }}{{ obj.getFooBar }}', - '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\" %}\n{% block content %}\n{{ \"a\"|json_encode }}\n{% endblock %}", - ); - } - - /** - * @expectedException Twig_Sandbox_SecurityError - * @expectedExceptionMessage Filter "json_encode" is not allowed in "1_child" at line 3. - */ - public function testSandboxWithInheritance() - { - $twig = $this->getEnvironment(true, array(), self::$templates, array('block')); - $twig->loadTemplate('1_child')->render(array()); - } - - public function testSandboxGloballySet() - { - $twig = $this->getEnvironment(false, array(), self::$templates); - $this->assertEquals('FOO', $twig->loadTemplate('1_basic')->render(self::$params), 'Sandbox does nothing if it is disabled globally'); - - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic1')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed method is called'); - } catch (Twig_Sandbox_SecurityError $e) { - } - - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic2')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed filter is called'); - } catch (Twig_Sandbox_SecurityError $e) { - } - - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic3')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed tag is used in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - } - - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic4')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed property is called in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - } - - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic5')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - } - - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic6')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - } - - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic7')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed function is called in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - } - - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => 'foo')); - FooObject::reset(); - $this->assertEquals('foo', $twig->loadTemplate('1_basic1')->render(self::$params), 'Sandbox allow some methods'); - $this->assertEquals(1, FooObject::$called['foo'], 'Sandbox only calls method once'); - - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => '__toString')); - FooObject::reset(); - $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'); - - $twig = $this->getEnvironment(true, array(), self::$templates, array('if')); - $this->assertEquals('foo', $twig->loadTemplate('1_basic3')->render(self::$params), 'Sandbox allow some tags'); - - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array('FooObject' => 'bar')); - $this->assertEquals('bar', $twig->loadTemplate('1_basic4')->render(self::$params), 'Sandbox allow some properties'); - - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array(), array('cycle')); - $this->assertEquals('bar', $twig->loadTemplate('1_basic7')->render(self::$params), 'Sandbox allow some functions'); - - foreach (array('getfoobar', 'getFoobar', 'getFooBar') as $name) { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => $name)); - FooObject::reset(); - $this->assertEquals('foobarfoobar', $twig->loadTemplate('1_basic8')->render(self::$params), 'Sandbox allow methods in a case-insensitive way'); - $this->assertEquals(2, FooObject::$called['getFooBar'], 'Sandbox only calls method once'); - - $this->assertEquals('foobarfoobar', $twig->loadTemplate('1_basic9')->render(self::$params), 'Sandbox allow methods via shortcut names (ie. without get/set)'); - } - } - - public function testSandboxLocallySetForAnInclude() - { - self::$templates = array( - '2_basic' => '{{ obj.foo }}{% include "2_included" %}{{ obj.foo }}', - '2_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', - ); - - $twig = $this->getEnvironment(false, array(), self::$templates); - $this->assertEquals('fooFOOfoo', $twig->loadTemplate('2_basic')->render(self::$params), 'Sandbox does nothing if disabled globally and sandboxed not used for the include'); - - self::$templates = array( - '3_basic' => '{{ obj.foo }}{% sandbox %}{% include "3_included" %}{% endsandbox %}{{ obj.foo }}', - '3_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', - ); - - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('3_basic')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception when the included file is sandboxed'); - } catch (Twig_Sandbox_SecurityError $e) { - } - } - - public function testMacrosInASandbox() - { - $twig = $this->getEnvironment(true, array('autoescape' => 'html'), array('index' => <<{{ text }}

    {% endmacro %} - -{{- macros.test('username') }} -EOF - ), array('macro', 'import'), array('escape')); - - $this->assertEquals('

    username

    ', $twig->loadTemplate('index')->render(array())); - } - - protected function getEnvironment($sandboxed, $options, $templates, $tags = array(), $filters = array(), $methods = array(), $properties = array(), $functions = array()) - { - $loader = new Twig_Loader_Array($templates); - $twig = new Twig_Environment($loader, array_merge(array('debug' => true, 'cache' => false, 'autoescape' => false), $options)); - $policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions); - $twig->addExtension(new Twig_Extension_Sandbox($policy, $sandboxed)); - - return $twig; - } -} - -class FooObject -{ - public static $called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0); - - public $bar = 'bar'; - - public static function reset() - { - self::$called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0); - } - - public function __toString() - { - ++self::$called['__toString']; - - return 'foo'; - } - - public function foo() - { - ++self::$called['foo']; - - return 'foo'; - } - - public function getFooBar() - { - ++self::$called['getFooBar']; - - return 'foobar'; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php deleted file mode 100644 index d9c02c07..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php +++ /dev/null @@ -1,63 +0,0 @@ -tmpDir = sys_get_temp_dir().'/TwigTests'; - if (!file_exists($this->tmpDir)) { - @mkdir($this->tmpDir, 0777, true); - } - - if (!is_writable($this->tmpDir)) { - $this->markTestSkipped(sprintf('Unable to run the tests as "%s" is not writable.', $this->tmpDir)); - } - - $this->env = new Twig_Environment(new Twig_Loader_Array(array('index' => 'index', 'index2' => 'index2')), array('cache' => $this->tmpDir)); - } - - protected function tearDown() - { - Twig_Tests_FilesystemHelper::removeDir($this->tmpDir); - } - - /** - * @group legacy - */ - public function testWritingCacheFiles() - { - $name = 'index'; - $this->env->loadTemplate($name); - $cacheFileName = $this->env->getCacheFilename($name); - - $this->assertTrue(file_exists($cacheFileName), 'Cache file does not exist.'); - } - - /** - * @group legacy - */ - public function testClearingCacheFiles() - { - $name = 'index2'; - $this->env->loadTemplate($name); - $cacheFileName = $this->env->getCacheFilename($name); - - $this->assertTrue(file_exists($cacheFileName), 'Cache file does not exist.'); - $this->env->clearCacheFiles(); - $this->assertFalse(file_exists($cacheFileName), 'Cache file was not cleared.'); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php deleted file mode 100644 index b310a5be..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php +++ /dev/null @@ -1,51 +0,0 @@ -assertSame($strategy, Twig_FileExtensionEscapingStrategy::guess($filename)); - } - - public function getGuessData() - { - return array( - // default - array('html', 'foo.html'), - array('html', 'foo.html.twig'), - array('html', 'foo'), - array('html', 'foo.bar.twig'), - array('html', 'foo.txt/foo'), - array('html', 'foo.txt/foo.js/'), - - // css - array('css', 'foo.css'), - array('css', 'foo.css.twig'), - array('css', 'foo.twig.css'), - array('css', 'foo.js.css'), - array('css', 'foo.js.css.twig'), - - // js - array('js', 'foo.js'), - array('js', 'foo.js.twig'), - array('js', 'foo.txt/foo.js'), - array('js', 'foo.txt.twig/foo.js'), - - // txt - array(false, 'foo.txt'), - array(false, 'foo.txt.twig'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php deleted file mode 100644 index 0e315e8f..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php +++ /dev/null @@ -1,30 +0,0 @@ - $fileInfo) { - if ($iterator->isDot()) { - continue; - } - - if ($fileInfo->isDir()) { - rmdir($filename); - } else { - unlink($filename); - } - } - rmdir($dir); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/filename.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/filename.test deleted file mode 100644 index b091ad34..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/filename.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"filename" autoescape strategy ---TEMPLATE-- -{{ br -}} -{{ include('index.html.twig') -}} -{{ include('index.txt.twig') -}} ---TEMPLATE(index.html.twig)-- -{{ br -}} ---TEMPLATE(index.txt.twig)-- -{{ br -}} ---DATA-- -return array('br' => '
    ') ---CONFIG-- -return array('autoescape' => 'filename') ---EXPECT-- -<br /> -<br /> -
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html deleted file mode 100644 index cb0dbe44..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html +++ /dev/null @@ -1 +0,0 @@ -{% block content %}{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html deleted file mode 100644 index df57c822..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% block content %} - {{ foo.bar }} -{% endblock %} -{% block foo %} - {{ foo.bar }} -{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test deleted file mode 100644 index ce49165d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Exception for multiline array with undefined variable ---TEMPLATE-- -{% set foo = { - foo: 'foo', - bar: 'bar', - - - foobar: foobar, - - - - foo2: foo2, -} %} ---DATA-- -return array('foobar' => 'foobar') ---EXCEPTION-- -Twig_Error_Runtime: Variable "foo2" does not exist in "index.twig" at line 11 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test deleted file mode 100644 index e3c040f9..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Exception for multiline array with undefined variable ---TEMPLATE-- -{% set foo = { - foo: 'foo', - bar: 'bar', - - - foobar: foobar, - - - - foo2: foo2, -} %} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Runtime: Variable "foobar" does not exist in "index.twig" at line 7 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test deleted file mode 100644 index d799a390..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Exception for multile function with undefined variable ---TEMPLATE-- -{{ include('foo', - with_context=with_context -) }} ---TEMPLATE(foo)-- -Foo ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Runtime: Variable "with_context" does not exist in "index.twig" at line 3 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test deleted file mode 100644 index 64761fcf..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test +++ /dev/null @@ -1,9 +0,0 @@ ---TEST-- -Exception for multiline function with unknown argument ---TEMPLATE-- -{{ include('foo', - with_context=True, - invalid=False -) }} ---EXCEPTION-- -Twig_Error_Syntax: Unknown argument "invalid" for function "include(template, variables, with_context, ignore_missing, sandboxed)" in "index.twig" at line 4. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test deleted file mode 100644 index 096a5dbf..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Exception for multiline tag with undefined variable ---TEMPLATE-- -{% include 'foo' - with vars -%} ---TEMPLATE(foo)-- -Foo ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Runtime: Variable "vars" does not exist in "index.twig" at line 3 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test deleted file mode 100644 index 9ca418b2..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Exception for syntax error in reused template ---TEMPLATE-- -{% use 'foo.twig' %} ---TEMPLATE(foo.twig)-- -{% block bar %} - {% do node.data = 5 %} -{% endblock %} ---EXCEPTION-- -Twig_Error_Syntax: Unexpected token "operator" of value "=" ("end of statement block" expected) in "foo.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test deleted file mode 100644 index 2c35ad56..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Exception for an unclosed tag ---TEMPLATE-- -{% block foo %} - {% if foo %} - - - - - {% for i in fo %} - - - - {% endfor %} - - - -{% endblock %} ---EXCEPTION-- -Twig_Error_Syntax: Unexpected "endblock" tag (expecting closing tag for the "if" tag defined near line 4) in "index.twig" at line 16. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test deleted file mode 100644 index c8e7a097..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Exception for an undefined parent ---TEMPLATE-- -{% extends 'foo.html' %} - -{% set foo = "foo" %} ---EXCEPTION-- -Twig_Error_Loader: Template "foo.html" is not defined in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test deleted file mode 100644 index 1992510b..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Exception for an undefined template in a child template ---TEMPLATE-- -{% extends 'base.twig' %} - -{% block sidebar %} - {{ include('include.twig') }} -{% endblock %} ---TEMPLATE(base.twig)-- -{% block sidebar %} -{% endblock %} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Loader: Template "include.twig" is not defined in "index.twig" at line 5. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test deleted file mode 100644 index 6679fbe1..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test +++ /dev/null @@ -1,9 +0,0 @@ ---TEST-- -Exception for an undefined trait ---TEMPLATE-- -{% use 'foo' with foobar as bar %} ---TEMPLATE(foo)-- -{% block bar %} -{% endblock %} ---EXCEPTION-- -Twig_Error_Runtime: Block "foobar" is not defined in trait "foo" in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test deleted file mode 100644 index c69b1192..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -Twig supports array notation ---TEMPLATE-- -{# empty array #} -{{ []|join(',') }} - -{{ [1, 2]|join(',') }} -{{ ['foo', "bar"]|join(',') }} -{{ {0: 1, 'foo': 'bar'}|join(',') }} -{{ {0: 1, 'foo': 'bar'}|keys|join(',') }} - -{{ {0: 1, foo: 'bar'}|join(',') }} -{{ {0: 1, foo: 'bar'}|keys|join(',') }} - -{# nested arrays #} -{% set a = [1, 2, [1, 2], {'foo': {'foo': 'bar'}}] %} -{{ a[2]|join(',') }} -{{ a[3]["foo"]|join(',') }} - -{# works even if [] is used inside the array #} -{{ [foo[bar]]|join(',') }} - -{# elements can be any expression #} -{{ ['foo'|upper, bar|upper, bar == foo]|join(',') }} - -{# arrays can have a trailing , like in PHP #} -{{ - [ - 1, - 2, - ]|join(',') -}} - -{# keys can be any expression #} -{% set a = 1 %} -{% set b = "foo" %} -{% set ary = { (a): 'a', (b): 'b', 'c': 'c', (a ~ b): 'd' } %} -{{ ary|keys|join(',') }} -{{ ary|join(',') }} ---DATA-- -return array('bar' => 'bar', 'foo' => array('bar' => 'bar')) ---EXPECT-- -1,2 -foo,bar -1,bar -0,foo - -1,bar -0,foo - -1,2 -bar - -bar - -FOO,BAR, - -1,2 - -1,foo,c,1foo -a,b,c,d diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test deleted file mode 100644 index f3df328f..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Twig supports method calls ---TEMPLATE-- -{{ items.foo }} -{{ items['foo'] }} -{{ items[foo] }} -{{ items[items[foo]] }} ---DATA-- -return array('foo' => 'bar', 'items' => array('foo' => 'bar', 'bar' => 'foo')) ---EXPECT-- -bar -bar -foo -bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test deleted file mode 100644 index f5e68456..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Twig supports binary operations (+, -, *, /, ~, %, and, or) ---TEMPLATE-- -{{ 1 + 1 }} -{{ 2 - 1 }} -{{ 2 * 2 }} -{{ 2 / 2 }} -{{ 3 % 2 }} -{{ 1 and 1 }} -{{ 1 and 0 }} -{{ 0 and 1 }} -{{ 0 and 0 }} -{{ 1 or 1 }} -{{ 1 or 0 }} -{{ 0 or 1 }} -{{ 0 or 0 }} -{{ 0 or 1 and 0 }} -{{ 1 or 0 and 1 }} -{{ "foo" ~ "bar" }} -{{ foo ~ "bar" }} -{{ "foo" ~ bar }} -{{ foo ~ bar }} -{{ 20 // 7 }} ---DATA-- -return array('foo' => 'bar', 'bar' => 'foo') ---EXPECT-- -2 -1 -4 -1 -1 -1 - - - -1 -1 -1 - - -1 -foobar -barbar -foofoo -barfoo -2 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test deleted file mode 100644 index 74fe6cab..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Twig supports bitwise operations ---TEMPLATE-- -{{ 1 b-and 5 }} -{{ 1 b-or 5 }} -{{ 1 b-xor 5 }} -{{ (1 and 0 b-or 0) is same as(1 and (0 b-or 0)) ? 'ok' : 'ko' }} ---DATA-- -return array() ---EXPECT-- -1 -5 -4 -ok diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test deleted file mode 100644 index 726b8507..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Twig supports comparison operators (==, !=, <, >, >=, <=) ---TEMPLATE-- -{{ 1 > 2 }}/{{ 1 > 1 }}/{{ 1 >= 2 }}/{{ 1 >= 1 }} -{{ 1 < 2 }}/{{ 1 < 1 }}/{{ 1 <= 2 }}/{{ 1 <= 1 }} -{{ 1 == 1 }}/{{ 1 == 2 }} -{{ 1 != 1 }}/{{ 1 != 2 }} ---DATA-- -return array() ---EXPECT-- -///1 -1//1/1 -1/ -/1 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test deleted file mode 100644 index 238dd279..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Twig supports the "divisible by" operator ---TEMPLATE-- -{{ 8 is divisible by(2) ? 'OK' }} -{{ 8 is not divisible by(3) ? 'OK' }} -{{ 8 is divisible by (2) ? 'OK' }} -{{ 8 is not - divisible - by - (3) ? 'OK' }} ---DATA-- -return array() ---EXPECT-- -OK -OK -OK -OK diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test deleted file mode 100644 index 9cd0676c..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Twig supports the .. operator ---TEMPLATE-- -{% for i in 0..10 %}{{ i }} {% endfor %} - -{% for letter in 'a'..'z' %}{{ letter }} {% endfor %} - -{% for letter in 'a'|upper..'z'|upper %}{{ letter }} {% endfor %} - -{% for i in foo[0]..foo[1] %}{{ i }} {% endfor %} - -{% for i in 0 + 1 .. 10 - 1 %}{{ i }} {% endfor %} ---DATA-- -return array('foo' => array(1, 10)) ---EXPECT-- -0 1 2 3 4 5 6 7 8 9 10 -a b c d e f g h i j k l m n o p q r s t u v w x y z -A B C D E F G H I J K L M N O P Q R S T U V W X Y Z -1 2 3 4 5 6 7 8 9 10 -1 2 3 4 5 6 7 8 9 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test deleted file mode 100644 index 9ad5e5e8..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -Twig supports the "ends with" operator ---TEMPLATE-- -{{ '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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test deleted file mode 100644 index 79f8e0b0..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Twig supports grouping of expressions ---TEMPLATE-- -{{ (2 + 2) / 2 }} ---DATA-- -return array() ---EXPECT-- -2 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test deleted file mode 100644 index 7ae3bae9..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Twig supports literals ---TEMPLATE-- -1 {{ true }} -2 {{ TRUE }} -3 {{ false }} -4 {{ FALSE }} -5 {{ none }} -6 {{ NONE }} -7 {{ null }} -8 {{ NULL }} ---DATA-- -return array() ---EXPECT-- -1 1 -2 1 -3 -4 -5 -6 -7 -8 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test deleted file mode 100644 index 159db96f..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Twig supports __call() for attributes ---TEMPLATE-- -{{ foo.foo }} -{{ foo.bar }} ---DATA-- -class TestClassForMagicCallAttributes -{ - public function getBar() - { - return 'bar_from_getbar'; - } - - public function __call($method, $arguments) - { - if ('foo' === $method) - { - return 'foo_from_call'; - } - - return false; - } -} -return array('foo' => new TestClassForMagicCallAttributes()) ---EXPECT-- -foo_from_call -bar_from_getbar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test deleted file mode 100644 index b6c77165..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Twig supports the "matches" operator ---TEMPLATE-- -{{ 'foo' matches '/o/' ? 'OK' : 'KO' }} -{{ 'foo' matches '/^fo/' ? 'OK' : 'KO' }} -{{ 'foo' matches '/O/i' ? 'OK' : 'KO' }} ---DATA-- -return array() ---EXPECT-- -OK -OK -OK diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test deleted file mode 100644 index 5f801e63..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Twig supports method calls ---TEMPLATE-- -{{ items.foo.foo }} -{{ items.foo.getFoo() }} -{{ items.foo.bar }} -{{ items.foo['bar'] }} -{{ items.foo.bar('a', 43) }} -{{ items.foo.bar(foo) }} -{{ items.foo.self.foo() }} -{{ items.foo.is }} -{{ items.foo.in }} -{{ items.foo.not }} ---DATA-- -return array('foo' => 'bar', 'items' => array('foo' => new TwigTestFoo(), 'bar' => 'foo')) ---CONFIG-- -return array('strict_variables' => false) ---EXPECT-- -foo -foo -bar - -bar_a-43 -bar_bar -foo -is -in -not diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test deleted file mode 100644 index 1853b1b0..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Twig manages negative numbers correctly ---TEMPLATE-- -{{ -1 }} -{{ - 1 }} -{{ 5 - 1 }} -{{ 5-1 }} -{{ 5 + -1 }} -{{ 5 + - 1 }} ---DATA-- -return array() ---EXPECT-- --1 --1 -4 -4 -4 -4 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test deleted file mode 100644 index fe29d08b..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -Twig allows to use named operators as variable names ---TEMPLATE-- -{% for match in matches %} - {{- match }} -{% endfor %} -{{ in }} -{{ is }} ---DATA-- -return array('matches' => array(1, 2, 3), 'in' => 'in', 'is' => 'is') ---EXPECT-- -1 -2 -3 -in -is diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test deleted file mode 100644 index 542c3504..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Twig parses postfix expressions ---TEMPLATE-- -{% import _self as macros %} - -{% macro foo() %}foo{% endmacro %} - -{{ 'a' }} -{{ 'a'|upper }} -{{ ('a')|upper }} -{{ -1|upper }} -{{ macros.foo() }} -{{ (macros).foo() }} ---DATA-- -return array(); ---EXPECT-- -a -A -A --1 -foo -foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test deleted file mode 100644 index 601201de..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Twig supports the "same as" operator ---TEMPLATE-- -{{ 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' }} -{{ 1 is not - same - as - (true) ? 'OK' }} ---DATA-- -return array() ---EXPECT-- -OK -OK -OK -OK -OK -OK diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test deleted file mode 100644 index 75d331e9..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Twig supports the "starts with" operator ---TEMPLATE-- -{{ 'foo' starts with 'f' ? 'OK' : 'KO' }} -{{ not ('foo' starts with 'oo') ? 'OK' : 'KO' }} -{{ not ('foo' starts with 'foowaytoolong') ? 'OK' : 'KO' }} -{{ '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-- -OK -OK -OK -OK -OK -OK -KO -KO -KO -KO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test deleted file mode 100644 index a9116613..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Twig supports string interpolation ---TEMPLATE-- -{{ "foo #{"foo #{bar} baz"} baz" }} -{{ "foo #{bar}#{bar} baz" }} ---DATA-- -return array('bar' => 'BAR'); ---EXPECT-- -foo foo BAR baz baz -foo BARBAR baz diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test deleted file mode 100644 index 0e6fa96e..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Twig supports the ternary operator ---TEMPLATE-- -{{ 1 ? 'YES' : 'NO' }} -{{ 0 ? 'YES' : 'NO' }} -{{ 0 ? 'YES' : (1 ? 'YES1' : 'NO1') }} -{{ 0 ? 'YES' : (0 ? 'YES1' : 'NO1') }} -{{ 1 == 1 ? 'foo
    ':'' }} -{{ foo ~ (bar ? ('-' ~ bar) : '') }} ---DATA-- -return array('foo' => 'foo', 'bar' => 'bar') ---EXPECT-- -YES -NO -YES1 -NO1 -foo
    -foo-bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test deleted file mode 100644 index fdc660fc..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Twig supports the ternary operator ---TEMPLATE-- -{{ 1 ? 'YES' }} -{{ 0 ? 'YES' }} ---DATA-- -return array() ---EXPECT-- -YES - diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test deleted file mode 100644 index 9057e837..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Twig supports the ternary operator ---TEMPLATE-- -{{ 'YES' ?: 'NO' }} -{{ 0 ?: 'NO' }} ---DATA-- -return array() ---EXPECT-- -YES -NO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test deleted file mode 100644 index 0eaabb44..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Twig does not allow to use two-word named operators as variable names ---TEMPLATE-- -{{ starts with }} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Syntax: Unexpected token "operator" of value "starts with" in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test deleted file mode 100644 index b79219a2..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Twig supports unary operators (not, -, +) ---TEMPLATE-- -{{ not 1 }}/{{ not 0 }} -{{ +1 + 1 }}/{{ -1 - 1 }} -{{ not (false or true) }} ---DATA-- -return array() ---EXPECT-- -/1 -2/-2 - diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test deleted file mode 100644 index ad84a9c2..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Twig manages negative numbers as default parameters ---TEMPLATE-- -{% import _self as macros %} -{{ macros.negative_number1() }} -{{ macros.negative_number2() }} -{{ macros.negative_number3() }} -{{ macros.positive_number1() }} -{{ macros.positive_number2() }} -{% macro negative_number1(nb=-1) %}{{ nb }}{% endmacro %} -{% macro negative_number2(nb = --1) %}{{ nb }}{% endmacro %} -{% macro negative_number3(nb = - 1) %}{{ nb }}{% endmacro %} -{% macro positive_number1(nb = +1) %}{{ nb }}{% endmacro %} -{% macro positive_number2(nb = ++1) %}{{ nb }}{% endmacro %} ---DATA-- -return array() ---EXPECT-- --1 -1 --1 -1 -1 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test deleted file mode 100644 index cc6eef8d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Twig unary operators precedence ---TEMPLATE-- -{{ -1 - 1 }} -{{ -1 - -1 }} -{{ -1 * -1 }} -{{ 4 / -1 * 5 }} ---DATA-- -return array() ---EXPECT-- --2 -0 -1 --20 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test deleted file mode 100644 index 27e93fd6..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -"abs" filter ---TEMPLATE-- -{{ (-5.5)|abs }} -{{ (-5)|abs }} -{{ (-0)|abs }} -{{ 0|abs }} -{{ 5|abs }} -{{ 5.5|abs }} -{{ number1|abs }} -{{ number2|abs }} -{{ number3|abs }} -{{ number4|abs }} -{{ number5|abs }} -{{ number6|abs }} ---DATA-- -return array('number1' => -5.5, 'number2' => -5, 'number3' => -0, 'number4' => 0, 'number5' => 5, 'number6' => 5.5) ---EXPECT-- -5.5 -5 -0 -0 -5 -5.5 -5.5 -5 -0 -0 -5 -5.5 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test deleted file mode 100644 index cb6de7f9..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -"batch" filter ---TEMPLATE-- -{% for row in items|batch(3) %} -
    - {% for column in row %} -
    {{ column }}
    - {% endfor %} -
    -{% endfor %} ---DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) ---EXPECT-- -
    -
    a
    -
    b
    -
    c
    -
    -
    -
    d
    -
    e
    -
    f
    -
    -
    -
    g
    -
    h
    -
    i
    -
    -
    -
    j
    -
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test deleted file mode 100644 index e2ec4beb..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test +++ /dev/null @@ -1,29 +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-- -
    -
    a
    -
    b
    -
    c
    -
    d
    -
    -
    -
    e
    -
    f
    -
    g
    -
    h
    -
    -
    -
    i
    -
    j
    -
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test deleted file mode 100644 index af996f24..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -"batch" filter ---TEMPLATE-- - -{% for row in items|batch(3, '') %} - - {% for column in row %} - - {% endfor %} - -{% endfor %} -
    {{ column }}
    ---DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) ---EXPECT-- - - - - - - - - - - - - - - - - - - - - - -
    abc
    def
    ghi
    j
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test deleted file mode 100644 index 72483f4b..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -"batch" filter ---TEMPLATE-- -{% for row in items|batch(3, 'fill') %} -
    - {% for column in row %} -
    {{ column }}
    - {% endfor %} -
    -{% endfor %} ---DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l')) ---EXPECT-- -
    -
    a
    -
    b
    -
    c
    -
    -
    -
    d
    -
    e
    -
    f
    -
    -
    -
    g
    -
    h
    -
    i
    -
    -
    -
    j
    -
    k
    -
    l
    -
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test deleted file mode 100644 index 746295f1..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -"batch" filter ---TEMPLATE-- - -{% for row in items|batch(3, 'fill') %} - - {% for column in row %} - - {% endfor %} - -{% endfor %} -
    {{ column }}
    ---DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) ---EXPECT-- - - - - - - - - - - - - - - - - - - - - - -
    abc
    def
    ghi
    jfillfill
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test deleted file mode 100644 index 6015380e..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"batch" filter preserves array keys ---TEMPLATE-- -{{ {'foo': 'bar', 'key': 'value'}|batch(4)|first|keys|join(',') }} -{{ {'foo': 'bar', 'key': 'value'}|batch(4, 'fill')|first|keys|join(',') }} ---DATA-- -return array() ---EXPECT-- -foo,key -foo,key,0,1 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test deleted file mode 100644 index b9c058d6..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"batch" filter with zero elements ---TEMPLATE-- -{{ []|batch(3)|length }} -{{ []|batch(3, 'fill')|length }} ---DATA-- -return array() ---EXPECT-- -0 -0 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test deleted file mode 100644 index 380b04bb..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"convert_encoding" filter ---CONDITION-- -function_exists('iconv') || function_exists('mb_convert_encoding') ---TEMPLATE-- -{{ "愛していますか?"|convert_encoding('ISO-2022-JP', 'UTF-8')|convert_encoding('UTF-8', 'ISO-2022-JP') }} ---DATA-- -return array() ---EXPECT-- -愛していますか? diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test deleted file mode 100644 index d17e5e2f..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test +++ /dev/null @@ -1,90 +0,0 @@ ---TEST-- -"date" filter ---TEMPLATE-- -{{ date1|date }} -{{ date1|date('d/m/Y') }} -{{ date1|date('d/m/Y H:i:s', 'Asia/Hong_Kong') }} -{{ date1|date('d/m/Y H:i:s P', 'Asia/Hong_Kong') }} -{{ date1|date('d/m/Y H:i:s P', 'America/Chicago') }} -{{ date1|date('e') }} -{{ date1|date('d/m/Y H:i:s') }} - -{{ date2|date }} -{{ date2|date('d/m/Y') }} -{{ date2|date('d/m/Y H:i:s', 'Asia/Hong_Kong') }} -{{ date2|date('d/m/Y H:i:s', timezone1) }} -{{ date2|date('d/m/Y H:i:s') }} - -{{ date3|date }} -{{ date3|date('d/m/Y') }} - -{{ date4|date }} -{{ date4|date('d/m/Y') }} - -{{ date5|date }} -{{ date5|date('d/m/Y') }} - -{{ date6|date('d/m/Y H:i:s P', 'Europe/Paris') }} -{{ date6|date('d/m/Y H:i:s P', 'Asia/Hong_Kong') }} -{{ date6|date('d/m/Y H:i:s P', false) }} -{{ date6|date('e', 'Europe/Paris') }} -{{ 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( - 'date1' => mktime(13, 45, 0, 10, 4, 2010), - 'date2' => new DateTime('2010-10-04 13:45'), - 'date3' => '2010-10-04 13:45', - '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+04:00', - 'timezone1' => new DateTimeZone('America/New_York'), -) ---EXPECT-- -October 4, 2010 13:45 -04/10/2010 -04/10/2010 19:45:00 -04/10/2010 19:45:00 +08:00 -04/10/2010 06:45:00 -05:00 -Europe/Paris -04/10/2010 13:45:00 - -October 4, 2010 13:45 -04/10/2010 -04/10/2010 19:45:00 -04/10/2010 07:45:00 -04/10/2010 13:45:00 - -October 4, 2010 13:45 -04/10/2010 - -October 4, 2010 15:45 -04/10/2010 - -January 2, 1964 04:04 -02/01/1964 - -04/10/2010 19:45:00 +02:00 -05/10/2010 01:45:00 +08:00 -04/10/2010 13:45:00 -04:00 -Europe/Paris -America/New_York - -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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test deleted file mode 100644 index 11a1ef4b..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"date" filter ---TEMPLATE-- -{{ date1|date }} -{{ date1|date('d/m/Y') }} ---DATA-- -date_default_timezone_set('UTC'); -$twig->getExtension('core')->setDateFormat('Y-m-d', '%d days %h hours'); -return array( - 'date1' => mktime(13, 45, 0, 10, 4, 2010), -) ---EXPECT-- -2010-10-04 -04/10/2010 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test deleted file mode 100644 index e6d3707d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"date" filter (interval support as of PHP 5.3) ---CONDITION-- -version_compare(phpversion(), '5.3.0', '>=') ---TEMPLATE-- -{{ date2|date }} -{{ date2|date('%d days') }} ---DATA-- -date_default_timezone_set('UTC'); -$twig->getExtension('core')->setDateFormat('Y-m-d', '%d days %h hours'); -return array( - 'date2' => new DateInterval('P2D'), -) ---EXPECT-- -2 days 0 hours -2 days diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test deleted file mode 100644 index 4e183256..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -"date" filter ---CONDITION-- -version_compare(phpversion(), '5.5.0', '>=') ---TEMPLATE-- -{{ date1|date }} -{{ date1|date('d/m/Y') }} -{{ 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') }} -{{ date2|date('d/m/Y H:i:s P', false) }} -{{ date2|date('e', 'Europe/Paris') }} -{{ date2|date('e', false) }} ---DATA-- -date_default_timezone_set('Europe/Paris'); -return array( - 'date1' => new DateTimeImmutable('2010-10-04 13:45'), - 'date2' => new DateTimeImmutable('2010-10-04 13:45', new DateTimeZone('America/New_York')), - 'timezone1' => new DateTimeZone('America/New_York'), -) ---EXPECT-- -October 4, 2010 13:45 -04/10/2010 -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 -04/10/2010 13:45:00 -04:00 -Europe/Paris -America/New_York diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test deleted file mode 100644 index 0c8c6f1a..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -"date" filter (interval support as of PHP 5.3) ---CONDITION-- -version_compare(phpversion(), '5.3.0', '>=') ---TEMPLATE-- -{{ date1|date }} -{{ date1|date('%d days %h hours') }} -{{ date1|date('%d days %h hours', timezone1) }} ---DATA-- -date_default_timezone_set('UTC'); -return array( - 'date1' => new DateInterval('P2D'), - // This should have no effect on DateInterval formatting - 'timezone1' => new DateTimeZone('America/New_York'), -) ---EXPECT-- -2 days -2 days 0 hours -2 days 0 hours diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test deleted file mode 100644 index 53d3a69c..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"date_modify" filter ---TEMPLATE-- -{{ date1|date_modify('-1day')|date('Y-m-d H:i:s') }} -{{ date2|date_modify('-1day')|date('Y-m-d H:i:s') }} ---DATA-- -date_default_timezone_set('UTC'); -return array( - 'date1' => '2010-10-04 13:45', - 'date2' => new DateTime('2010-10-04 13:45'), -) ---EXPECT-- -2010-10-03 13:45:00 -2010-10-03 13:45:00 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test deleted file mode 100644 index 4ecde8a1..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -"date" filter ---TEMPLATE-- -{{ date|date(format='d/m/Y H:i:s P', timezone='America/Chicago') }} -{{ date|date(timezone='America/Chicago', format='d/m/Y H:i:s P') }} -{{ date|date('d/m/Y H:i:s P', timezone='America/Chicago') }} ---DATA-- -date_default_timezone_set('UTC'); -return array('date' => mktime(13, 45, 0, 10, 4, 2010)) ---EXPECT-- -04/10/2010 08:45:00 -05:00 -04/10/2010 08:45:00 -05:00 -04/10/2010 08:45:00 -05:00 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test deleted file mode 100644 index b8d1d66f..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test +++ /dev/null @@ -1,150 +0,0 @@ ---TEST-- -"default" filter ---TEMPLATE-- -Variable: -{{ 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 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 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 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 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', - 'zeroVar' => 0, - 'emptyVar' => '', - 'nullVar' => null, - 'nested' => array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'emptyVar' => '', - 'nullVar' => null, - 'definedArray' => array(0), - ), - 'object' => new TwigTestFoo(), -) ---CONFIG-- -return array('strict_variables' => false) ---EXPECT-- -Variable: -ok -ok -ok -ok -ok -Array access: -ok -ok -ok -ok -ok -ok -ok -ok -Plain values: -ok -ok -ok -ok -Precedence: -ok -ok -Object methods: -ok -ok -ok -ok -ok -ok -Deep nested: -ok -ok -ok -ok -ok -ok ---DATA-- -return array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'emptyVar' => '', - 'nullVar' => null, - 'nested' => array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'emptyVar' => '', - 'nullVar' => null, - 'definedArray' => array(0), - ), - 'object' => new TwigTestFoo(), -) ---CONFIG-- -return array('strict_variables' => true) ---EXPECT-- -Variable: -ok -ok -ok -ok -ok -Array access: -ok -ok -ok -ok -ok -ok -ok -ok -Plain values: -ok -ok -ok -ok -Precedence: -ok -ok -Object methods: -ok -ok -ok -ok -ok -ok -Deep nested: -ok -ok -ok -ok -ok -ok diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test deleted file mode 100644 index 93c5913f..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -dynamic filter ---TEMPLATE-- -{{ 'bar'|foo_path }} -{{ 'bar'|a_foo_b_bar }} ---DATA-- -return array() ---EXPECT-- -foo/bar -a/b/bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test deleted file mode 100644 index a606c106..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"escape" filter ---TEMPLATE-- -{{ "foo
    "|e }} ---DATA-- -return array() ---EXPECT-- -foo <br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test deleted file mode 100644 index 009a2453..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"escape" filter does not escape with the html strategy when using the html_attr strategy ---TEMPLATE-- -{{ '
    '|escape('html_attr') }} ---DATA-- -return array() ---EXPECT-- -<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test deleted file mode 100644 index bba26a0d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"escape" filter ---TEMPLATE-- -{{ "愛していますか?
    "|e }} ---DATA-- -return array() ---EXPECT-- -愛していますか? <br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test deleted file mode 100644 index aa54645c..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"first" filter ---TEMPLATE-- -{{ [1, 2, 3, 4]|first }} -{{ {a: 1, b: 2, c: 3, d: 4}|first }} -{{ '1234'|first }} -{{ arr|first }} -{{ 'Ä€é'|first }} -{{ ''|first }} ---DATA-- -return array('arr' => new ArrayObject(array(1, 2, 3, 4))) ---EXPECT-- -1 -1 -1 -1 -Ä diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test deleted file mode 100644 index 85a9b717..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"escape" filter ---TEMPLATE-- -{% set foo %} - foo
    -{% endset %} - -{{ foo|e('html') -}} -{{ foo|e('js') }} -{% autoescape true %} - {{ foo }} -{% endautoescape %} ---DATA-- -return array() ---EXPECT-- - foo<br /> -\x20\x20\x20\x20foo\x3Cbr\x20\x2F\x3E\x0A - foo
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test deleted file mode 100644 index 97221ff8..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"format" filter ---TEMPLATE-- -{{ string|format(foo, 3) }} ---DATA-- -return array('string' => '%s/%d', 'foo' => 'bar') ---EXPECT-- -bar/3 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test deleted file mode 100644 index b342c174..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"join" filter ---TEMPLATE-- -{{ ["foo", "bar"]|join(', ') }} -{{ foo|join(', ') }} -{{ bar|join(', ') }} ---DATA-- -return array('foo' => new TwigTestFoo(), 'bar' => new ArrayObject(array(3, 4))) ---EXPECT-- -foo, bar -1, 2 -3, 4 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test deleted file mode 100644 index 1738d40c..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"json_encode" filter ---TEMPLATE-- -{{ "foo"|json_encode|raw }} -{{ foo|json_encode|raw }} -{{ [foo, "foo"]|json_encode|raw }} ---DATA-- -return array('foo' => new Twig_Markup('foo', 'UTF-8')) ---EXPECT-- -"foo" -"foo" -["foo","foo"] diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test deleted file mode 100644 index 1b8031ee..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"last" filter ---TEMPLATE-- -{{ [1, 2, 3, 4]|last }} -{{ {a: 1, b: 2, c: 3, d: 4}|last }} -{{ '1234'|last }} -{{ arr|last }} -{{ 'Ä€é'|last }} -{{ ''|last }} ---DATA-- -return array('arr' => new ArrayObject(array(1, 2, 3, 4))) ---EXPECT-- -4 -4 -4 -4 -é diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test deleted file mode 100644 index 3347474d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"length" filter ---TEMPLATE-- -{{ array|length }} -{{ string|length }} -{{ number|length }} -{{ markup|length }} ---DATA-- -return array('array' => array(1, 4), 'string' => 'foo', 'number' => 1000, 'markup' => new Twig_Markup('foo', 'UTF-8')) ---EXPECT-- -2 -3 -4 -3 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test deleted file mode 100644 index 5d5e2436..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"length" filter ---CONDITION-- -function_exists('mb_get_info') ---TEMPLATE-- -{{ string|length }} -{{ markup|length }} ---DATA-- -return array('string' => 'été', 'markup' => new Twig_Markup('foo', 'UTF-8')) ---EXPECT-- -3 -3 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test deleted file mode 100644 index 81371a41..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"merge" filter ---TEMPLATE-- -{{ items|merge({'bar': 'foo'})|join }} -{{ items|merge({'bar': 'foo'})|keys|join }} -{{ {'bar': 'foo'}|merge(items)|join }} -{{ {'bar': 'foo'}|merge(items)|keys|join }} -{{ numerics|merge([4, 5, 6])|join }} -{{ traversable.a|merge(traversable.b)|join }} ---DATA-- -return array('items' => array('foo' => 'bar'), 'numerics' => array(1, 2, 3), 'traversable' => array('a' => new ArrayObject(array(0 => 1, 1 => 2, 2 => 3)), 'b' => new ArrayObject(array('a' => 'b')))) ---EXPECT-- -barfoo -foobar -foobar -barfoo -123456 -123b diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test deleted file mode 100644 index 6545a9bb..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"nl2br" filter ---TEMPLATE-- -{{ "I like Twig.\nYou will like it too.\n\nEverybody like it!"|nl2br }} -{{ text|nl2br }} ---DATA-- -return array('text' => "If you have some HTML\nit will be escaped.") ---EXPECT-- -I like Twig.
    -You will like it too.
    -
    -Everybody like it! -If you have some <strong>HTML</strong>
    -it will be escaped. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test deleted file mode 100644 index 639a8659..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"number_format" filter ---TEMPLATE-- -{{ 20|number_format }} -{{ 20.25|number_format }} -{{ 20.25|number_format(2) }} -{{ 20.25|number_format(2, ',') }} -{{ 1020.25|number_format(2, ',') }} -{{ 1020.25|number_format(2, ',', '.') }} ---DATA-- -return array(); ---EXPECT-- -20 -20 -20.25 -20,25 -1,020,25 -1.020,25 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test deleted file mode 100644 index c6903cc7..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -"number_format" filter with defaults. ---TEMPLATE-- -{{ 20|number_format }} -{{ 20.25|number_format }} -{{ 20.25|number_format(1) }} -{{ 20.25|number_format(2, ',') }} -{{ 1020.25|number_format }} -{{ 1020.25|number_format(2, ',') }} -{{ 1020.25|number_format(2, ',', '.') }} ---DATA-- -$twig->getExtension('core')->setNumberFormat(2, '!', '='); -return array(); ---EXPECT-- -20!00 -20!25 -20!3 -20,25 -1=020!25 -1=020,25 -1.020,25 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test deleted file mode 100644 index 06be7e27..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"replace" filter ---TEMPLATE-- -{{ "I liké %this% and %that%."|replace({'%this%': "foo", '%that%': "bar"}) }} -{{ 'I like single replace operation only %that%'|replace({'%that%' : '%that%1'}) }} -{{ 'I like %this% and %that%.'|replace(traversable) }} ---DATA-- -return array('traversable' => new ArrayObject(array('%this%' => 'foo', '%that%' => 'bar'))) ---EXPECT-- -I liké foo and bar. -I like single replace operation only %that%1 -I like foo and bar. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test deleted file mode 100644 index 2143a869..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Exception for invalid argument type in replace call ---TEMPLATE-- -{{ 'test %foo%'|replace(stdClass) }} ---DATA-- -return array('stdClass' => new stdClass()) ---EXCEPTION-- -Twig_Error_Runtime: The "replace" filter expects an array or "Traversable" as replace values, got "stdClass" in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test deleted file mode 100644 index 7948ac45..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"reverse" filter ---TEMPLATE-- -{{ [1, 2, 3, 4]|reverse|join('') }} -{{ '1234évènement'|reverse }} -{{ arr|reverse|join('') }} -{{ {'a': 'c', 'b': 'a'}|reverse()|join(',') }} -{{ {'a': 'c', 'b': 'a'}|reverse(preserveKeys=true)|join(glue=',') }} -{{ {'a': 'c', 'b': 'a'}|reverse(preserve_keys=true)|join(glue=',') }} ---DATA-- -return array('arr' => new ArrayObject(array(1, 2, 3, 4))) ---EXPECT-- -4321 -tnemenèvé4321 -4321 -a,c -a,c -a,c diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test deleted file mode 100644 index 57806b61..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"round" filter ---TEMPLATE-- -{{ 2.7|round }} -{{ 2.1|round }} -{{ 2.1234|round(3, 'floor') }} -{{ 2.1|round(0, 'ceil') }} - -{{ 21.3|round(-1)}} -{{ 21.3|round(-1, 'ceil')}} -{{ 21.3|round(-1, 'floor')}} ---DATA-- -return array() ---EXPECT-- -3 -2 -2.123 -3 - -20 -30 -20 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test deleted file mode 100644 index b49b89fe..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -"slice" filter ---TEMPLATE-- -{{ [1, 2, 3, 4][1:2]|join('') }} -{{ {a: 1, b: 2, c: 3, d: 4}[1:2]|join('') }} -{{ [1, 2, 3, 4][start:length]|join('') }} -{{ [1, 2, 3, 4]|slice(1, 2)|join('') }} -{{ [1, 2, 3, 4]|slice(1, 2)|keys|join('') }} -{{ [1, 2, 3, 4]|slice(1, 2, true)|keys|join('') }} -{{ {a: 1, b: 2, c: 3, d: 4}|slice(1, 2)|join('') }} -{{ {a: 1, b: 2, c: 3, d: 4}|slice(1, 2)|keys|join('') }} -{{ '1234'|slice(1, 2) }} -{{ '1234'[1:2] }} -{{ arr|slice(1, 2)|join('') }} -{{ arr[1:2]|join('') }} -{{ arr[4:1]|join('') }} -{{ arr[3:2]|join('') }} - -{{ [1, 2, 3, 4]|slice(1)|join('') }} -{{ [1, 2, 3, 4][1:]|join('') }} -{{ '1234'|slice(1) }} -{{ '1234'[1:] }} -{{ '1234'[:1] }} - -{{ arr|slice(3)|join('') }} -{{ arr[2:]|join('') }} -{{ xml|slice(1)|join('')}} ---DATA-- -return array('start' => 1, 'length' => 2, 'arr' => new ArrayObject(array(1, 2, 3, 4)), 'xml' => new SimpleXMLElement('12')) ---EXPECT-- -23 -23 -23 -23 -01 -12 -23 -bc -23 -23 -23 -23 - -4 - -234 -234 -234 -234 -1 - -4 -34 -2 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test deleted file mode 100644 index c67c18ea..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"sort" filter ---TEMPLATE-- -{{ array1|sort|join }} -{{ array2|sort|join }} -{{ traversable|sort|join }} ---DATA-- -return array('array1' => array(4, 1), 'array2' => array('foo', 'bar'), 'traversable' => new ArrayObject(array(0 => 3, 1 => 2, 2 => 1))) ---EXPECT-- -14 -barfoo -123 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test deleted file mode 100644 index dbaf7dc9..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"§" custom filter ---TEMPLATE-- -{{ 'foo'|§ }} ---DATA-- -return array() ---EXPECT-- -§foo§ diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test deleted file mode 100644 index a093ed79..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -"split" filter ---TEMPLATE-- -{{ "one,two,three,four,five"|split(',')|join('-') }} -{{ foo|split(',')|join('-') }} -{{ foo|split(',', 3)|join('-') }} -{{ baz|split('')|join('-') }} -{{ baz|split('', 1)|join('-') }} -{{ baz|split('', 2)|join('-') }} -{{ foo|split(',', -2)|join('-') }} ---DATA-- -return array('foo' => "one,two,three,four,five", 'baz' => '12345',) ---EXPECT-- -one-two-three-four-five -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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test deleted file mode 100644 index 305e162f..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test +++ /dev/null @@ -1,24 +0,0 @@ ---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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test deleted file mode 100644 index 31920625..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"trim" filter ---TEMPLATE-- -{{ " I like Twig. "|trim }} -{{ text|trim }} -{{ " foo/"|trim("/") }} ---DATA-- -return array('text' => " If you have some HTML it will be escaped. ") ---EXPECT-- -I like Twig. -If you have some <strong>HTML</strong> it will be escaped. - foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test deleted file mode 100644 index 8726159d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test +++ /dev/null @@ -1,16 +0,0 @@ ---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%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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test deleted file mode 100644 index 11800e9c..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test +++ /dev/null @@ -1,16 +0,0 @@ ---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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test deleted file mode 100644 index 71b2038a..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"attribute" function ---TEMPLATE-- -{{ 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', 'arguments' => array('a', 'b')) ---EXPECT-- -foo -bar -bar_a-b -bar_a-b -ok -ko diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test deleted file mode 100644 index 8e54059a..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"block" function ---TEMPLATE-- -{% extends 'base.twig' %} -{% block bar %}BAR{% endblock %} ---TEMPLATE(base.twig)-- -{% block foo %}{{ block('bar') }}{% endblock %} -{% block bar %}BAR_BASE{% endblock %} ---DATA-- -return array() ---EXPECT-- -BARBAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test deleted file mode 100644 index 63128791..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"constant" function ---TEMPLATE-- -{{ constant('DATE_W3C') == expect ? 'true' : 'false' }} -{{ constant('ARRAY_AS_PROPS', object) }} ---DATA-- -return array('expect' => DATE_W3C, 'object' => new ArrayObject(array('hi'))); ---EXPECT-- -true -2 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test deleted file mode 100644 index 522a63b8..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"cycle" function ---TEMPLATE-- -{% for i in 0..6 %} -{{ cycle(array1, i) }}-{{ cycle(array2, i) }} -{% endfor %} ---DATA-- -return array('array1' => array('odd', 'even'), 'array2' => array('apple', 'orange', 'citrus')) ---EXPECT-- -odd-apple -even-orange -odd-citrus -even-apple -odd-orange -even-citrus -odd-apple diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test deleted file mode 100644 index 8be9c0c4..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -"date" function ---TEMPLATE-- -{{ date() == date('now') ? 'OK' : 'KO' }} -{{ date(date1) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} -{{ date(date2) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} -{{ date(date3) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} -{{ date(date4) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} -{{ date(date5) == date('1964-01-02 03:04') ? 'OK' : 'KO' }} ---DATA-- -date_default_timezone_set('UTC'); -return array( - 'date1' => mktime(13, 45, 0, 10, 4, 2010), - 'date2' => new DateTime('2010-10-04 13:45'), - 'date3' => '2010-10-04 13:45', - '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(), -) ---EXPECT-- -OK -OK -OK -OK -OK -OK diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test deleted file mode 100644 index b9dd9e38..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"date" function ---TEMPLATE-- -{{ date(date, "America/New_York")|date('d/m/Y H:i:s P', false) }} -{{ date(timezone="America/New_York", date=date)|date('d/m/Y H:i:s P', false) }} ---DATA-- -date_default_timezone_set('UTC'); -return array('date' => mktime(13, 45, 0, 10, 4, 2010)) ---EXPECT-- -04/10/2010 09:45:00 -04:00 -04/10/2010 09:45:00 -04:00 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test deleted file mode 100644 index f4072375..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"dump" function ---CONDITION-- -!extension_loaded('xdebug') ---TEMPLATE-- -{{ dump('foo') }} -{{ dump('foo', 'bar') }} ---DATA-- -return array('foo' => 'foo', 'bar' => 'bar') ---CONFIG-- -return array('debug' => true, 'autoescape' => false); ---EXPECT-- -string(3) "foo" - -string(3) "foo" -string(3) "bar" diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test deleted file mode 100644 index 889b7a92..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -"dump" function, xdebug is not loaded or xdebug <2.2-dev is loaded ---CONDITION-- -!extension_loaded('xdebug') || (($r = new ReflectionExtension('xdebug')) && version_compare($r->getVersion(), '2.2-dev', '<')) ---TEMPLATE-- -{{ dump() }} ---DATA-- -return array('foo' => 'foo', 'bar' => 'bar') ---CONFIG-- -return array('debug' => true, 'autoescape' => false); ---EXPECT-- -array(3) { - ["foo"]=> - string(3) "foo" - ["bar"]=> - string(3) "bar" - ["global"]=> - string(6) "global" -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test deleted file mode 100644 index 913fbc99..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -dynamic function ---TEMPLATE-- -{{ foo_path('bar') }} -{{ a_foo_b_bar('bar') }} ---DATA-- -return array() ---EXPECT-- -foo/bar -a/b/bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test deleted file mode 100644 index b7653b4e..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -"include" function ---TEMPLATE-- -{% set tmp = include("foo.twig") %} - -FOO{{ tmp }}BAR ---TEMPLATE(foo.twig)-- -FOOBAR ---DATA-- -return array() ---EXPECT-- -FOO -FOOBARBAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test deleted file mode 100644 index 56f8f3b5..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"include" function is safe for auto-escaping ---TEMPLATE-- -{{ include("foo.twig") }} ---TEMPLATE(foo.twig)-- -

    Test

    ---DATA-- -return array() ---EXPECT-- -

    Test

    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test deleted file mode 100644 index a434182a..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"include" function ---TEMPLATE-- -FOO -{{ include("foo.twig") }} - -BAR ---TEMPLATE(foo.twig)-- -FOOBAR ---DATA-- -return array() ---EXPECT-- -FOO - -FOOBAR - -BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test deleted file mode 100644 index aba30ce3..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"include" function allows expressions for the template to include ---TEMPLATE-- -FOO -{{ include(foo) }} - -BAR ---TEMPLATE(foo.twig)-- -FOOBAR ---DATA-- -return array('foo' => 'foo.twig') ---EXPECT-- -FOO - -FOOBAR - -BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test deleted file mode 100644 index 43a2ccc2..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"include" function ---TEMPLATE-- -{{ include(["foo.twig", "bar.twig"], ignore_missing = true) }} -{{ include("foo.twig", ignore_missing = true) }} -{{ include("foo.twig", ignore_missing = true, variables = {}) }} -{{ include("foo.twig", ignore_missing = true, variables = {}, with_context = true) }} ---DATA-- -return array() ---EXPECT-- diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test deleted file mode 100644 index 4d2f6cf1..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"include" function ---TEMPLATE-- -{{ include("foo.twig") }} ---DATA-- -return array(); ---EXCEPTION-- -Twig_Error_Loader: Template "foo.twig" is not defined in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test deleted file mode 100644 index 78fddc7a..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" function ---TEMPLATE-- -{% extends "base.twig" %} - -{% block content %} - {{ parent() }} -{% endblock %} ---TEMPLATE(base.twig)-- -{% block content %} - {{ include("foo.twig") }} -{% endblock %} ---DATA-- -return array(); ---EXCEPTION-- -Twig_Error_Loader: Template "foo.twig" is not defined in "base.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test deleted file mode 100644 index 7b9ccaca..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -"include" tag sandboxed ---TEMPLATE-- -{{ include("foo.twig", sandboxed = true) }} ---TEMPLATE(foo.twig)-- - - -{{ foo|e }} -{{ foo|e }} ---DATA-- -return array() ---EXCEPTION-- -Twig_Sandbox_SecurityNotAllowedFilterError: Filter "e" is not allowed in "foo.twig" at line 4. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test deleted file mode 100644 index 8ffc4922..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" tag sandboxed ---TEMPLATE-- -{{ include("foo.twig", sandboxed = true) }} -{{ include("bar.twig") }} ---TEMPLATE(foo.twig)-- -foo ---TEMPLATE(bar.twig)-- -{{ foo|e }} ---DATA-- -return array('foo' => 'bar
    ') ---EXPECT-- -foo - - -bar<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test deleted file mode 100644 index 8bf6e102..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -"include" tag sandboxed ---TEMPLATE-- -{{ include("unknown.twig", sandboxed = true, ignore_missing = true) }} -{{ include("bar.twig") }} ---TEMPLATE(bar.twig)-- -{{ foo|e }} ---DATA-- -return array('foo' => 'bar
    ') ---EXPECT-- - - -bar<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test deleted file mode 100644 index 18d405a0..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"include" function accepts Twig_Template instance ---TEMPLATE-- -{{ include(foo) }} FOO ---TEMPLATE(foo.twig)-- -BAR ---DATA-- -return array('foo' => $twig->loadTemplate('foo.twig')) ---EXPECT-- -BAR FOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test deleted file mode 100644 index 1a810068..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"include" function ---TEMPLATE-- -{{ include(["foo.twig", "bar.twig"]) }} -{{- include(["bar.twig", "foo.twig"]) }} ---TEMPLATE(foo.twig)-- -foo ---DATA-- -return array() ---EXPECT-- -foo -foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test deleted file mode 100644 index 35611fbb..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" function accept variables and with_context ---TEMPLATE-- -{{ include("foo.twig") }} -{{- include("foo.twig", with_context = false) }} -{{- include("foo.twig", {'foo1': 'bar'}) }} -{{- include("foo.twig", {'foo1': 'bar'}, with_context = false) }} ---TEMPLATE(foo.twig)-- -{% for k, v in _context %}{{ k }},{% endfor %} ---DATA-- -return array('foo' => 'bar') ---EXPECT-- -foo,global,_parent, -global,_parent, -foo,global,foo1,_parent, -foo1,global,_parent, diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test deleted file mode 100644 index b2ace940..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"include" function accept variables ---TEMPLATE-- -{{ include("foo.twig", {'foo': 'bar'}) }} -{{- include("foo.twig", vars) }} ---TEMPLATE(foo.twig)-- -{{ foo }} ---DATA-- -return array('vars' => array('foo' => 'bar')) ---EXPECT-- -bar -bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test deleted file mode 100644 index e6c94af6..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"max" function ---TEMPLATE-- -{{ max([2, 1, 3, 5, 4]) }} -{{ max(2, 1, 3, 5, 4) }} -{{ max({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} ---DATA-- -return array() ---EXPECT-- -5 -5 -two diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test deleted file mode 100644 index 660471c0..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"min" function ---TEMPLATE-- -{{ min(2, 1, 3, 5, 4) }} -{{ min([2, 1, 3, 5, 4]) }} -{{ min({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} ---DATA-- -return array() ---EXPECT-- -1 -1 -five diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test deleted file mode 100644 index e0377c8d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"range" function ---TEMPLATE-- -{{ range(low=0+1, high=10+0, step=2)|join(',') }} ---DATA-- -return array() ---EXPECT-- -1,3,5,7,9 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test deleted file mode 100644 index f39712da..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test +++ /dev/null @@ -1,21 +0,0 @@ ---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 %}
      {{ block('children') }}
    {% 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. "1"
    2. "2"
      1. "3.1"
        1. "3.2.1"
        2. "3.2.2"
      2. "3.4"
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test deleted file mode 100644 index 0e094c3b..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"source" function ---TEMPLATE-- -FOO -{{ source("foo.twig") }} - -BAR ---TEMPLATE(foo.twig)-- -{{ foo }}
    ---DATA-- -return array() ---EXPECT-- -FOO - -{{ foo }}
    - -BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test deleted file mode 100644 index 30c3df51..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"§" custom function ---TEMPLATE-- -{{ §('foo') }} ---DATA-- -return array() ---EXPECT-- -§foo§ diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test deleted file mode 100644 index 3d3b9587..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -"template_from_string" function ---TEMPLATE-- -{% include template_from_string(template) %} - -{% include template_from_string("Hello {{ name }}") %} -{% include template_from_string('{% extends "parent.twig" %}{% block content %}Hello {{ name }}{% endblock %}') %} ---TEMPLATE(parent.twig)-- -{% block content %}{% endblock %} ---DATA-- -return array('name' => 'Fabien', 'template' => "Hello {{ name }}") ---EXPECT-- -Hello Fabien -Hello Fabien -Hello Fabien diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test deleted file mode 100644 index 4ccff7b6..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -macro ---TEMPLATE-- -{% from _self import test %} - -{% macro test(a, b = 'bar') -%} -{{ a }}{{ b }} -{%- endmacro %} - -{{ test('foo') }} -{{ test('bar', 'foo') }} ---DATA-- -return array(); ---EXPECT-- -foobar -barfoo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test deleted file mode 100644 index cd254281..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -macro ---TEMPLATE-- -{% import _self as macros %} - -{% macro foo(data) %} - {{ data }} -{% endmacro %} - -{% macro bar() %} -
    -{% endmacro %} - -{{ macros.foo(macros.bar()) }} ---DATA-- -return array(); ---EXPECT-- -
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test deleted file mode 100644 index cbfb921b..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -macro ---TEMPLATE-- -{% from _self import test %} - -{% macro test(this) -%} - {{ this }} -{%- endmacro %} - -{{ test(this) }} ---DATA-- -return array('this' => 'foo'); ---EXPECT-- -foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test deleted file mode 100644 index 6a366cdf..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -macro ---TEMPLATE-- -{% import _self as test %} -{% from _self import test %} - -{% macro test(a, b) -%} - {{ a|default('a') }}
    - {{- b|default('b') }}
    -{%- endmacro %} - -{{ test.test() }} -{{ test() }} -{{ test.test(1, "c") }} -{{ test(1, "c") }} ---DATA-- -return array(); ---EXPECT-- -a
    b
    -a
    b
    -1
    c
    -1
    c
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test deleted file mode 100644 index 412c90fa..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -macro with arbitrary arguments ---TEMPLATE-- -{% from _self import test1, test2 %} - -{% macro test1(var) %} - {{- var }}: {{ varargs|join(", ") }} -{% endmacro %} - -{% macro test2() %} - {{- varargs|join(", ") }} -{% endmacro %} - -{{ test1("foo", "bar", "foobar") }} -{{ test2("foo", "bar", "foobar") }} ---DATA-- -return array(); ---EXPECT-- -foo: bar, foobar - -foo, bar, foobar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test deleted file mode 100644 index 9cfbbd20..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -macro with varargs argument ---TEMPLATE-- -{% macro test(varargs) %} -{% 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. - diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test deleted file mode 100644 index 685626f2..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -macro with a filter ---TEMPLATE-- -{% import _self as test %} - -{% macro test() %} - {% filter escape %}foo
    {% endfilter %} -{% endmacro %} - -{{ test.test() }} ---DATA-- -return array(); ---EXPECT-- -foo<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test deleted file mode 100644 index df485783..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test +++ /dev/null @@ -1,15 +0,0 @@ ---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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test deleted file mode 100644 index 65f6cd2b..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Twig outputs 0 nodes correctly ---TEMPLATE-- -{{ foo }}0{{ foo }} ---DATA-- -return array('foo' => 'foo') ---EXPECT-- -foo0foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test deleted file mode 100644 index ff7c8bb7..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -error in twig extension ---TEMPLATE-- -{{ object.region is not null ? object.regionChoices[object.region] }} ---DATA-- -class House -{ - const REGION_S = 1; - const REGION_P = 2; - - public static $regionChoices = array(self::REGION_S => 'house.region.s', self::REGION_P => 'house.region.p'); - - public function getRegionChoices() - { - return self::$regionChoices; - } -} - -$object = new House(); -$object->region = 1; -return array('object' => $object) ---EXPECT-- -house.region.s diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test deleted file mode 100644 index 269a3057..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test +++ /dev/null @@ -1,10 +0,0 @@ ---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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test deleted file mode 100644 index 60c3c51d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Twig is able to deal with SimpleXMLElement instances as variables ---CONDITION-- -version_compare(phpversion(), '5.3.0', '>=') ---TEMPLATE-- -Hello '{{ images.image.0.group }}'! -{{ images.image.0.group.attributes.myattr }} -{{ images.children().image.count() }} -{% for image in images %} - - {{ image.group }} -{% endfor %} ---DATA-- -return array('images' => new SimpleXMLElement('foobar')) ---EXPECT-- -Hello 'foo'! -example -2 - - foo - - bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test deleted file mode 100644 index e18e1107..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Twig does not confuse strings with integers in getAttribute() ---TEMPLATE-- -{{ hash['2e2'] }} ---DATA-- -return array('hash' => array('2e2' => 'works')) ---EXPECT-- -works diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test deleted file mode 100644 index 2f6a3e1a..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -"autoescape" tag applies escaping on its children ---TEMPLATE-- -{% autoescape %} -{{ var }}
    -{% endautoescape %} -{% autoescape 'html' %} -{{ var }}
    -{% endautoescape %} -{% autoescape false %} -{{ var }}
    -{% endautoescape %} -{% autoescape true %} -{{ var }}
    -{% endautoescape %} -{% autoescape false %} -{{ var }}
    -{% endautoescape %} ---DATA-- -return array('var' => '
    ') ---EXPECT-- -<br />
    -<br />
    -

    -<br />
    -

    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test deleted file mode 100644 index 05ab83ce..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"autoescape" tag applies escaping on embedded blocks ---TEMPLATE-- -{% autoescape 'html' %} - {% block foo %} - {{ var }} - {% endblock %} -{% endautoescape %} ---DATA-- -return array('var' => '
    ') ---EXPECT-- -<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test deleted file mode 100644 index 9c097246..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"autoescape" tag does not double-escape ---TEMPLATE-- -{% autoescape 'html' %} -{{ var|escape }} -{% endautoescape %} ---DATA-- -return array('var' => '
    ') ---EXPECT-- -<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test deleted file mode 100644 index ce7ea789..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test +++ /dev/null @@ -1,83 +0,0 @@ ---TEST-- -"autoescape" tag applies escaping after calling functions ---TEMPLATE-- - -autoescape false -{% autoescape false %} - -safe_br -{{ safe_br() }} - -unsafe_br -{{ unsafe_br() }} - -{% endautoescape %} - -autoescape 'html' -{% autoescape 'html' %} - -safe_br -{{ safe_br() }} - -unsafe_br -{{ unsafe_br() }} - -unsafe_br()|raw -{{ (unsafe_br())|raw }} - -safe_br()|escape -{{ (safe_br())|escape }} - -safe_br()|raw -{{ (safe_br())|raw }} - -unsafe_br()|escape -{{ (unsafe_br())|escape }} - -{% endautoescape %} - -autoescape js -{% autoescape 'js' %} - -safe_br -{{ safe_br() }} - -{% endautoescape %} ---DATA-- -return array() ---EXPECT-- - -autoescape false - -safe_br -
    - -unsafe_br -
    - - -autoescape 'html' - -safe_br -
    - -unsafe_br -<br /> - -unsafe_br()|raw -
    - -safe_br()|escape -<br /> - -safe_br()|raw -
    - -unsafe_br()|escape -<br /> - - -autoescape js - -safe_br -\x3Cbr\x20\x2F\x3E diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test deleted file mode 100644 index e389d4dd..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -"autoescape" tag does not apply escaping on literals ---TEMPLATE-- -{% autoescape 'html' %} - -1. Simple literal -{{ "
    " }} - -2. Conditional expression with only literals -{{ true ? "
    " : "
    " }} - -3. Conditional expression with a variable -{{ true ? "
    " : someVar }} - -4. Nested conditionals with only literals -{{ true ? (true ? "
    " : "
    ") : "\n" }} - -5. Nested conditionals with a variable -{{ true ? (true ? "
    " : someVar) : "\n" }} - -6. Nested conditionals with a variable marked safe -{{ true ? (true ? "
    " : someVar|raw) : "\n" }} - -{% endautoescape %} ---DATA-- -return array() ---EXPECT-- - -1. Simple literal -
    - -2. Conditional expression with only literals -
    - -3. Conditional expression with a variable -<br /> - -4. Nested conditionals with only literals -
    - -5. Nested conditionals with a variable -<br /> - -6. Nested conditionals with a variable marked safe -
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test deleted file mode 100644 index 798e6fea..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -"autoescape" tags can be nested at will ---TEMPLATE-- -{{ var }} -{% autoescape 'html' %} - {{ var }} - {% autoescape false %} - {{ var }} - {% autoescape 'html' %} - {{ var }} - {% endautoescape %} - {{ var }} - {% endautoescape %} - {{ var }} -{% endautoescape %} -{{ var }} ---DATA-- -return array('var' => '
    ') ---EXPECT-- -<br /> - <br /> -
    - <br /> -
    - <br /> -<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test deleted file mode 100644 index e896aa41..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -"autoescape" tag applies escaping to object method calls ---TEMPLATE-- -{% autoescape 'html' %} -{{ user.name }} -{{ user.name|lower }} -{{ user }} -{% endautoescape %} ---DATA-- -class UserForAutoEscapeTest -{ - public function getName() - { - return 'Fabien
    '; - } - - public function __toString() - { - return 'Fabien
    '; - } -} -return array('user' => new UserForAutoEscapeTest()) ---EXPECT-- -Fabien<br /> -fabien<br /> -Fabien<br /> diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test deleted file mode 100644 index 9f1cedd3..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"autoescape" tag does not escape when raw is used as a filter ---TEMPLATE-- -{% autoescape 'html' %} -{{ var|raw }} -{% endautoescape %} ---DATA-- -return array('var' => '
    ') ---EXPECT-- -
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test deleted file mode 100644 index bbf1356e..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"autoescape" tag accepts an escaping strategy ---TEMPLATE-- -{% autoescape true js %}{{ var }}{% endautoescape %} - -{% autoescape true html %}{{ var }}{% endautoescape %} ---DATA-- -return array('var' => '
    "') ---EXPECT-- -\x3Cbr\x20\x2F\x3E\x22 -<br />" diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test deleted file mode 100644 index e496f608..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"autoescape" tag accepts an escaping strategy ---TEMPLATE-- -{% autoescape 'js' %}{{ var }}{% endautoescape %} - -{% autoescape 'html' %}{{ var }}{% endautoescape %} ---DATA-- -return array('var' => '
    "') ---EXPECT-- -\x3Cbr\x20\x2F\x3E\x22 -<br />" diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test deleted file mode 100644 index 4f415201..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test +++ /dev/null @@ -1,69 +0,0 @@ ---TEST-- -escape types ---TEMPLATE-- - -1. autoescape 'html' |escape('js') - -{% autoescape 'html' %} - -{% endautoescape %} - -2. autoescape 'html' |escape('js') - -{% autoescape 'html' %} - -{% endautoescape %} - -3. autoescape 'js' |escape('js') - -{% autoescape 'js' %} - -{% endautoescape %} - -4. no escape - -{% autoescape false %} - -{% endautoescape %} - -5. |escape('js')|escape('html') - -{% autoescape false %} - -{% endautoescape %} - -6. autoescape 'html' |escape('js')|escape('html') - -{% autoescape 'html' %} - -{% endautoescape %} - ---DATA-- -return array('msg' => "<>\n'\"") ---EXPECT-- - -1. autoescape 'html' |escape('js') - - - -2. autoescape 'html' |escape('js') - - - -3. autoescape 'js' |escape('js') - - - -4. no escape - - - -5. |escape('js')|escape('html') - - - -6. autoescape 'html' |escape('js')|escape('html') - - - diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test deleted file mode 100644 index 7821a9aa..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test +++ /dev/null @@ -1,131 +0,0 @@ ---TEST-- -"autoescape" tag applies escaping after calling filters ---TEMPLATE-- -{% autoescape 'html' %} - -(escape_and_nl2br is an escaper filter) - -1. Don't escape escaper filter output -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is not escaped ) -{{ var|escape_and_nl2br }} - -2. Don't escape escaper filter output -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is not escaped, |raw is redundant ) -{{ var|escape_and_nl2br|raw }} - -3. Explicit escape -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is explicitly escaped by |escape ) -{{ var|escape_and_nl2br|escape }} - -4. Escape non-escaper filter output -( var is upper-cased by |upper, - the output is auto-escaped ) -{{ var|upper }} - -5. Escape if last filter is not an escaper -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is upper-cased by |upper, - the output is auto-escaped as |upper is not an escaper ) -{{ var|escape_and_nl2br|upper }} - -6. Don't escape escaper filter output -( var is upper cased by upper, - the output is escaped by |escape_and_nl2br, line-breaks are added, - the output is not escaped as |escape_and_nl2br is an escaper ) -{{ var|upper|escape_and_nl2br }} - -7. Escape if last filter is not an escaper -( the output of |format is "" ~ var ~ "", - the output is auto-escaped ) -{{ "%s"|format(var) }} - -8. Escape if last filter is not an escaper -( the output of |format is "" ~ var ~ "", - |raw is redundant, - the output is auto-escaped ) -{{ "%s"|raw|format(var) }} - -9. Don't escape escaper filter output -( the output of |format is "" ~ var ~ "", - the output is not escaped due to |raw filter at the end ) -{{ "%s"|format(var)|raw }} - -10. Don't escape escaper filter output -( the output of |format is "" ~ var ~ "", - the output is not escaped due to |raw filter at the end, - the |raw filter on var is redundant ) -{{ "%s"|format(var|raw)|raw }} - -{% endautoescape %} ---DATA-- -return array('var' => "\nTwig") ---EXPECT-- - -(escape_and_nl2br is an escaper filter) - -1. Don't escape escaper filter output -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is not escaped ) -<Fabien>
    -Twig - -2. Don't escape escaper filter output -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is not escaped, |raw is redundant ) -<Fabien>
    -Twig - -3. Explicit escape -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is explicitly escaped by |escape ) -&lt;Fabien&gt;<br /> -Twig - -4. Escape non-escaper filter output -( var is upper-cased by |upper, - the output is auto-escaped ) -<FABIEN> -TWIG - -5. Escape if last filter is not an escaper -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is upper-cased by |upper, - the output is auto-escaped as |upper is not an escaper ) -&LT;FABIEN&GT;<BR /> -TWIG - -6. Don't escape escaper filter output -( var is upper cased by upper, - the output is escaped by |escape_and_nl2br, line-breaks are added, - the output is not escaped as |escape_and_nl2br is an escaper ) -<FABIEN>
    -TWIG - -7. Escape if last filter is not an escaper -( the output of |format is "" ~ var ~ "", - the output is auto-escaped ) -<b><Fabien> -Twig</b> - -8. Escape if last filter is not an escaper -( the output of |format is "" ~ var ~ "", - |raw is redundant, - the output is auto-escaped ) -<b><Fabien> -Twig</b> - -9. Don't escape escaper filter output -( the output of |format is "" ~ var ~ "", - the output is not escaped due to |raw filter at the end ) - -Twig - -10. Don't escape escaper filter output -( the output of |format is "" ~ var ~ "", - the output is not escaped due to |raw filter at the end, - the |raw filter on var is redundant ) - -Twig diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test deleted file mode 100644 index f58a1e09..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -"autoescape" tag do not applies escaping on filter arguments ---TEMPLATE-- -{% autoescape 'html' %} -{{ var|nl2br("
    ") }} -{{ var|nl2br("
    "|escape) }} -{{ var|nl2br(sep) }} -{{ var|nl2br(sep|raw) }} -{{ var|nl2br(sep|escape) }} -{% endautoescape %} ---DATA-- -return array('var' => "\nTwig", 'sep' => '
    ') ---EXPECT-- -<Fabien>
    -Twig -<Fabien><br /> -Twig -<Fabien>
    -Twig -<Fabien>
    -Twig -<Fabien><br /> -Twig diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test deleted file mode 100644 index 134c77ea..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test +++ /dev/null @@ -1,68 +0,0 @@ ---TEST-- -"autoescape" tag applies escaping after calling filters, and before calling pre_escape filters ---TEMPLATE-- -{% autoescape 'html' %} - -(nl2br is pre_escaped for "html" and declared safe for "html") - -1. Pre-escape and don't post-escape -( var|escape|nl2br ) -{{ var|nl2br }} - -2. Don't double-pre-escape -( var|escape|nl2br ) -{{ var|escape|nl2br }} - -3. Don't escape safe values -( var|raw|nl2br ) -{{ var|raw|nl2br }} - -4. Don't escape safe values -( var|escape|nl2br|nl2br ) -{{ var|nl2br|nl2br }} - -5. Re-escape values that are escaped for an other contexts -( var|escape_something|escape|nl2br ) -{{ var|escape_something|nl2br }} - -6. Still escape when using filters not declared safe -( var|escape|nl2br|upper|escape ) -{{ var|nl2br|upper }} - -{% endautoescape %} ---DATA-- -return array('var' => "\nTwig") ---EXPECT-- - -(nl2br is pre_escaped for "html" and declared safe for "html") - -1. Pre-escape and don't post-escape -( var|escape|nl2br ) -<Fabien>
    -Twig - -2. Don't double-pre-escape -( var|escape|nl2br ) -<Fabien>
    -Twig - -3. Don't escape safe values -( var|raw|nl2br ) -
    -Twig - -4. Don't escape safe values -( var|escape|nl2br|nl2br ) -<Fabien>

    -Twig - -5. Re-escape values that are escaped for an other contexts -( var|escape_something|escape|nl2br ) -<FABIEN>
    -TWIG - -6. Still escape when using filters not declared safe -( var|escape|nl2br|upper|escape ) -&LT;FABIEN&GT;<BR /> -TWIG - diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test deleted file mode 100644 index 32d3943b..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -"autoescape" tag handles filters preserving the safety ---TEMPLATE-- -{% autoescape 'html' %} - -(preserves_safety is preserving safety for "html") - -1. Unsafe values are still unsafe -( var|preserves_safety|escape ) -{{ var|preserves_safety }} - -2. Safe values are still safe -( var|escape|preserves_safety ) -{{ var|escape|preserves_safety }} - -3. Re-escape values that are escaped for an other contexts -( var|escape_something|preserves_safety|escape ) -{{ var|escape_something|preserves_safety }} - -4. Still escape when using filters not declared safe -( var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'})|escape ) -{{ var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'}) }} - -{% endautoescape %} ---DATA-- -return array('var' => "\nTwig") ---EXPECT-- - -(preserves_safety is preserving safety for "html") - -1. Unsafe values are still unsafe -( var|preserves_safety|escape ) -<FABIEN> -TWIG - -2. Safe values are still safe -( var|escape|preserves_safety ) -<FABIEN> -TWIG - -3. Re-escape values that are escaped for an other contexts -( var|escape_something|preserves_safety|escape ) -<FABIEN> -TWIG - -4. Still escape when using filters not declared safe -( var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'})|escape ) -&LT;FABPOT&GT; -TWIG - diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test deleted file mode 100644 index 360dcf03..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"block" tag ---TEMPLATE-- -{% block title1 %}FOO{% endblock %} -{% block title2 foo|lower %} ---TEMPLATE(foo.twig)-- -{% block content %}{% endblock %} ---DATA-- -return array('foo' => 'bar') ---EXPECT-- -FOObar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test deleted file mode 100644 index bc89ec82..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"block" tag ---TEMPLATE-- -{% block content %} - {% block content %} - {% endblock %} -{% endblock %} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Syntax: The block 'content' has already been defined line 2 in "index.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test deleted file mode 100644 index be17fedf..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"§" special chars in a block name ---TEMPLATE-- -{% block § %} -§ -{% endblock § %} ---DATA-- -return array() ---EXPECT-- -§ diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test deleted file mode 100644 index f44296ea..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -"embed" tag ---TEMPLATE-- -FOO -{% embed "foo.twig" %} - {% block c1 %} - {{ parent() }} - block1extended - {% endblock %} -{% endembed %} - -BAR ---TEMPLATE(foo.twig)-- -A -{% block c1 %} - block1 -{% endblock %} -B -{% block c2 %} - block2 -{% endblock %} -C ---DATA-- -return array() ---EXPECT-- -FOO - -A - block1 - - block1extended - B - block2 -C -BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test deleted file mode 100644 index 71ab2e01..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"embed" tag ---TEMPLATE(index.twig)-- -FOO -{% embed "foo.twig" %} - {% block c1 %} - {{ nothing }} - {% endblock %} -{% endembed %} -BAR ---TEMPLATE(foo.twig)-- -{% block c1 %}{% endblock %} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Runtime: Variable "nothing" does not exist in "index.twig" at line 5 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test deleted file mode 100644 index da161e6d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -"embed" tag ---TEMPLATE-- -FOO -{% embed "foo.twig" %} - {% block c1 %} - {{ parent() }} - block1extended - {% endblock %} -{% endembed %} - -{% embed "foo.twig" %} - {% block c1 %} - {{ parent() }} - block1extended - {% endblock %} -{% endembed %} - -BAR ---TEMPLATE(foo.twig)-- -A -{% block c1 %} - block1 -{% endblock %} -B -{% block c2 %} - block2 -{% endblock %} -C ---DATA-- -return array() ---EXPECT-- -FOO - -A - block1 - - block1extended - B - block2 -C - -A - block1 - - block1extended - B - block2 -C -BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test deleted file mode 100644 index 81563dce..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -"embed" tag ---TEMPLATE-- -{% embed "foo.twig" %} - {% block c1 %} - {{ parent() }} - {% embed "foo.twig" %} - {% block c1 %} - {{ parent() }} - block1extended - {% endblock %} - {% endembed %} - - {% endblock %} -{% endembed %} ---TEMPLATE(foo.twig)-- -A -{% block c1 %} - block1 -{% endblock %} -B -{% block c2 %} - block2 -{% endblock %} -C ---DATA-- -return array() ---EXPECT-- -A - block1 - - -A - block1 - - block1extended - B - block2 -C - B - block2 -C diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test deleted file mode 100644 index 2c1dd584..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -"embed" tag ---TEMPLATE-- -{% extends "base.twig" %} - -{% block c1 %} - {{ parent() }} - blockc1baseextended -{% endblock %} - -{% block c2 %} - {{ parent() }} - - {% embed "foo.twig" %} - {% block c1 %} - {{ parent() }} - block1extended - {% endblock %} - {% endembed %} - {{ parent() }} -{% endblock %} ---TEMPLATE(base.twig)-- -A -{% block c1 %} - blockc1base -{% endblock %} -{% block c2 %} - blockc2base -{% endblock %} -B ---TEMPLATE(foo.twig)-- -A -{% block c1 %} - block1 -{% endblock %} -B -{% block c2 %} - block2 -{% endblock %} -C ---DATA-- -return array() ---EXPECT-- -A - blockc1base - - blockc1baseextended - blockc2base - - - -A - block1 - - block1extended - B - block2 -C blockc2base - -B \ No newline at end of file diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test deleted file mode 100644 index 82094f2f..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"filter" tag applies a filter on its children ---TEMPLATE-- -{% filter upper %} -Some text with a {{ var }} -{% endfilter %} ---DATA-- -return array('var' => 'var') ---EXPECT-- -SOME TEXT WITH A VAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test deleted file mode 100644 index 3e7148bf..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"filter" tag applies a filter on its children ---TEMPLATE-- -{% filter json_encode|raw %}test{% endfilter %} ---DATA-- -return array() ---EXPECT-- -"test" diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test deleted file mode 100644 index 75512ef9..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"filter" tags accept multiple chained filters ---TEMPLATE-- -{% filter lower|title %} - {{ var }} -{% endfilter %} ---DATA-- -return array('var' => 'VAR') ---EXPECT-- - Var diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test deleted file mode 100644 index 7e4e4eb3..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"filter" tags can be nested at will ---TEMPLATE-- -{% filter lower|title %} - {{ var }} - {% filter upper %} - {{ var }} - {% endfilter %} - {{ var }} -{% endfilter %} ---DATA-- -return array('var' => 'var') ---EXPECT-- - Var - Var - Var diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test deleted file mode 100644 index 22745ead..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -"filter" tag applies the filter on "for" tags ---TEMPLATE-- -{% filter upper %} -{% for item in items %} -{{ item }} -{% endfor %} -{% endfilter %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- -A -B diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test deleted file mode 100644 index afd95b29..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -"filter" tag applies the filter on "if" tags ---TEMPLATE-- -{% filter upper %} -{% if items %} -{{ items|join(', ') }} -{% endif %} - -{% if items.3 is defined %} -FOO -{% else %} -{{ items.1 }} -{% endif %} - -{% if items.3 is defined %} -FOO -{% elseif items.1 %} -{{ items.0 }} -{% endif %} - -{% endfilter %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- -A, B - -B - -A diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test deleted file mode 100644 index 380531f7..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"for" tag takes a condition ---TEMPLATE-- -{% for i in 1..5 if i is odd -%} - {{ loop.index }}.{{ i }}{{ foo.bar }} -{% endfor %} ---DATA-- -return array('foo' => array('bar' => 'X')) ---CONFIG-- -return array('strict_variables' => false) ---EXPECT-- -1.1X -2.3X -3.5X diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test deleted file mode 100644 index ddc69307..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"for" tag keeps the context safe ---TEMPLATE-- -{% for item in items %} - {% for item in items %} - * {{ item }} - {% endfor %} - * {{ item }} -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- - * a - * b - * a - * a - * b - * b diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test deleted file mode 100644 index 20ccc880..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -"for" tag can use an "else" clause ---TEMPLATE-- -{% for item in items %} - * {{ item }} -{% else %} - no item -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- - * a - * b ---DATA-- -return array('items' => array()) ---EXPECT-- - no item ---DATA-- -return array() ---CONFIG-- -return array('strict_variables' => false) ---EXPECT-- - no item diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test deleted file mode 100644 index 49fb9ca6..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"for" tag does not reset inner variables ---TEMPLATE-- -{% for i in 1..2 %} - {% for j in 0..2 %} - {{k}}{% set k = k+1 %} {{ loop.parent.loop.index }} - {% endfor %} -{% endfor %} ---DATA-- -return array('k' => 0) ---EXPECT-- - 0 1 - 1 1 - 2 1 - 3 2 - 4 2 - 5 2 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test deleted file mode 100644 index 4e22cb47..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"for" tag can iterate over keys ---TEMPLATE-- -{% for key in items|keys %} - * {{ key }} -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- - * 0 - * 1 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test deleted file mode 100644 index 4c211689..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"for" tag can iterate over keys and values ---TEMPLATE-- -{% for key, item in items %} - * {{ key }}/{{ item }} -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- - * 0/a - * 1/b diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test deleted file mode 100644 index 93bc76a1..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -"for" tag adds a loop variable to the context ---TEMPLATE-- -{% for item in items %} - * {{ loop.index }}/{{ loop.index0 }} - * {{ loop.revindex }}/{{ loop.revindex0 }} - * {{ loop.first }}/{{ loop.last }}/{{ loop.length }} - -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- - * 1/0 - * 2/1 - * 1//2 - - * 2/1 - * 1/0 - * /1/2 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test deleted file mode 100644 index 58af2c32..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"for" tag adds a loop variable to the context locally ---TEMPLATE-- -{% for item in items %} -{% endfor %} -{% if loop is not defined %}WORKS{% endif %} ---DATA-- -return array('items' => array()) ---EXPECT-- -WORKS diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test deleted file mode 100644 index 6a2af63b..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"for" tag ---TEMPLATE-- -{% for i, item in items if i > 0 %} - {{ loop.last }} -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXCEPTION-- -Twig_Error_Syntax: The "loop.last" variable is not defined when looping with a condition in "index.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test deleted file mode 100644 index 1e819ca0..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test +++ /dev/null @@ -1,9 +0,0 @@ ---TEST-- -"for" tag ---TEMPLATE-- -{% for i, item in items if loop.last > 0 %} -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXCEPTION-- -Twig_Error_Syntax: The "loop" variable cannot be used in a looping condition in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test deleted file mode 100644 index f8b9f6bc..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"for" tag can use an "else" clause ---TEMPLATE-- -{% for item in items %} - {% for item in items1 %} - * {{ item }} - {% else %} - no {{ item }} - {% endfor %} -{% else %} - no item1 -{% endfor %} ---DATA-- -return array('items' => array('a', 'b'), 'items1' => array()) ---EXPECT-- -no a - no b diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test deleted file mode 100644 index 50344379..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -"for" tag iterates over iterable objects ---TEMPLATE-- -{% for item in items %} - * {{ item }} - * {{ loop.index }}/{{ loop.index0 }} - * {{ loop.first }} - -{% endfor %} - -{% for key, value in items %} - * {{ key }}/{{ value }} -{% endfor %} - -{% for key in items|keys %} - * {{ key }} -{% endfor %} ---DATA-- -class ItemsIterator implements Iterator -{ - protected $values = array('foo' => 'bar', 'bar' => 'foo'); - public function current() { return current($this->values); } - public function key() { return key($this->values); } - public function next() { return next($this->values); } - public function rewind() { return reset($this->values); } - public function valid() { return false !== current($this->values); } -} -return array('items' => new ItemsIterator()) ---EXPECT-- - * bar - * 1/0 - * 1 - - * foo - * 2/1 - * - - - * foo/bar - * bar/foo - - * foo - * bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test deleted file mode 100644 index 4a1ff611..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test +++ /dev/null @@ -1,47 +0,0 @@ ---TEST-- -"for" tag iterates over iterable and countable objects ---TEMPLATE-- -{% for item in items %} - * {{ item }} - * {{ loop.index }}/{{ loop.index0 }} - * {{ loop.revindex }}/{{ loop.revindex0 }} - * {{ loop.first }}/{{ loop.last }}/{{ loop.length }} - -{% endfor %} - -{% for key, value in items %} - * {{ key }}/{{ value }} -{% endfor %} - -{% for key in items|keys %} - * {{ key }} -{% endfor %} ---DATA-- -class ItemsIteratorCountable implements Iterator, Countable -{ - protected $values = array('foo' => 'bar', 'bar' => 'foo'); - public function current() { return current($this->values); } - public function key() { return key($this->values); } - public function next() { return next($this->values); } - public function rewind() { return reset($this->values); } - public function valid() { return false !== current($this->values); } - public function count() { return count($this->values); } -} -return array('items' => new ItemsIteratorCountable()) ---EXPECT-- - * bar - * 1/0 - * 2/1 - * 1//2 - - * foo - * 2/1 - * 1/0 - * /1/2 - - - * foo/bar - * bar/foo - - * foo - * bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test deleted file mode 100644 index 17b2e222..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"for" tags can be nested ---TEMPLATE-- -{% for key, item in items %} -* {{ key }} ({{ loop.length }}): -{% for value in item %} - * {{ value }} ({{ loop.length }}) -{% endfor %} -{% endfor %} ---DATA-- -return array('items' => array('a' => array('a1', 'a2', 'a3'), 'b' => array('b1'))) ---EXPECT-- -* a (2): - * a1 (3) - * a2 (3) - * a3 (3) -* b (2): - * b1 (1) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test deleted file mode 100644 index 82f2ae8a..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"for" tag iterates over item values ---TEMPLATE-- -{% for item in items %} - * {{ item }} -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- - * a - * b diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test deleted file mode 100644 index 5f5da0ec..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -global variables ---TEMPLATE-- -{% include "included.twig" %} -{% from "included.twig" import foobar %} -{{ foobar() }} ---TEMPLATE(included.twig)-- -{% macro foobar() %} -called foobar -{% endmacro %} ---DATA-- -return array(); ---EXPECT-- -called foobar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test deleted file mode 100644 index c1c3d276..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"if" creates a condition ---TEMPLATE-- -{% if a is defined %} - {{ a }} -{% elseif b is defined %} - {{ b }} -{% else %} - NOTHING -{% endif %} ---DATA-- -return array('a' => 'a') ---EXPECT-- - a ---DATA-- -return array('b' => 'b') ---EXPECT-- - b ---DATA-- -return array() ---EXPECT-- - NOTHING diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test deleted file mode 100644 index edfb73df..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"if" takes an expression as a test ---TEMPLATE-- -{% if a < 2 %} - A1 -{% elseif a > 10 %} - A2 -{% else %} - A3 -{% endif %} ---DATA-- -return array('a' => 1) ---EXPECT-- - A1 ---DATA-- -return array('a' => 12) ---EXPECT-- - A2 ---DATA-- -return array('a' => 7) ---EXPECT-- - A3 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test deleted file mode 100644 index 8fe1a6c1..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" tag ---TEMPLATE-- -FOO -{% include "foo.twig" %} - -BAR ---TEMPLATE(foo.twig)-- -FOOBAR ---DATA-- -return array() ---EXPECT-- -FOO - -FOOBAR -BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test deleted file mode 100644 index eaeeb112..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" tag allows expressions for the template to include ---TEMPLATE-- -FOO -{% include foo %} - -BAR ---TEMPLATE(foo.twig)-- -FOOBAR ---DATA-- -return array('foo' => 'foo.twig') ---EXPECT-- -FOO - -FOOBAR -BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test deleted file mode 100644 index 24aed06d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"include" tag ---TEMPLATE-- -{% include ["foo.twig", "bar.twig"] ignore missing %} -{% include "foo.twig" ignore missing %} -{% include "foo.twig" ignore missing with {} %} -{% include "foo.twig" ignore missing with {} only %} ---DATA-- -return array() ---EXPECT-- diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test deleted file mode 100644 index f25e8715..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"include" tag ---TEMPLATE-- -{% include "foo.twig" %} ---DATA-- -return array(); ---EXCEPTION-- -Twig_Error_Loader: Template "foo.twig" is not defined in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test deleted file mode 100644 index 86c18644..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" tag ---TEMPLATE-- -{% extends "base.twig" %} - -{% block content %} - {{ parent() }} -{% endblock %} ---TEMPLATE(base.twig)-- -{% block content %} - {% include "foo.twig" %} -{% endblock %} ---DATA-- -return array(); ---EXCEPTION-- -Twig_Error_Loader: Template "foo.twig" is not defined in "base.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test deleted file mode 100644 index 77760a09..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" tag accept variables and only ---TEMPLATE-- -{% include "foo.twig" %} -{% include "foo.twig" only %} -{% include "foo.twig" with {'foo1': 'bar'} %} -{% include "foo.twig" with {'foo1': 'bar'} only %} ---TEMPLATE(foo.twig)-- -{% for k, v in _context %}{{ k }},{% endfor %} ---DATA-- -return array('foo' => 'bar') ---EXPECT-- -foo,global,_parent, -global,_parent, -foo,global,foo1,_parent, -foo1,global,_parent, diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test deleted file mode 100644 index 6ba064a3..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"include" tag accepts Twig_Template instance ---TEMPLATE-- -{% include foo %} FOO ---TEMPLATE(foo.twig)-- -BAR ---DATA-- -return array('foo' => $twig->loadTemplate('foo.twig')) ---EXPECT-- -BAR FOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test deleted file mode 100644 index ab670ee0..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"include" tag ---TEMPLATE-- -{% include ["foo.twig", "bar.twig"] %} -{% include ["bar.twig", "foo.twig"] %} ---TEMPLATE(foo.twig)-- -foo ---DATA-- -return array() ---EXPECT-- -foo -foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test deleted file mode 100644 index 41384ac7..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"include" tag accept variables ---TEMPLATE-- -{% include "foo.twig" with {'foo': 'bar'} %} -{% include "foo.twig" with vars %} ---TEMPLATE(foo.twig)-- -{{ foo }} ---DATA-- -return array('vars' => array('foo' => 'bar')) ---EXPECT-- -bar -bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test deleted file mode 100644 index 0778a4b4..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "foo.twig" %} - -{% block content %} -FOO -{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %}{% endblock %} ---DATA-- -return array() ---EXPECT-- -FOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test deleted file mode 100644 index 9a81499a..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test +++ /dev/null @@ -1,32 +0,0 @@ ---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:
    Element:
    Element:
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test deleted file mode 100644 index 3e868c0d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test +++ /dev/null @@ -1,34 +0,0 @@ ---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:
    Element:
    Element:
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test deleted file mode 100644 index 8576e773..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends standalone ? foo : 'bar.twig' %} - -{% block content %}{{ parent() }}FOO{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %}FOO{% endblock %} ---TEMPLATE(bar.twig)-- -{% block content %}BAR{% endblock %} ---DATA-- -return array('foo' => 'foo.twig', 'standalone' => true) ---EXPECT-- -FOOFOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test deleted file mode 100644 index ee06ddce..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends foo %} - -{% block content %} -FOO -{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %}{% endblock %} ---DATA-- -return array('foo' => 'foo.twig') ---EXPECT-- -FOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test deleted file mode 100644 index 784f3571..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "foo.twig" %} ---TEMPLATE(foo.twig)-- -{% block content %}FOO{% endblock %} ---DATA-- -return array() ---EXPECT-- -FOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test deleted file mode 100644 index a1cb1ce8..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends ["foo.twig", "bar.twig"] %} ---TEMPLATE(bar.twig)-- -{% block content %} -foo -{% endblock %} ---DATA-- -return array() ---EXPECT-- -foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test deleted file mode 100644 index acc74f6a..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends ["", "bar.twig"] %} ---TEMPLATE(bar.twig)-- -{% block content %} -foo -{% endblock %} ---DATA-- -return array() ---EXPECT-- -foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test deleted file mode 100644 index cfa648d4..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends [null, "bar.twig"] %} ---TEMPLATE(bar.twig)-- -{% block content %} -foo -{% endblock %} ---DATA-- -return array() ---EXPECT-- -foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test deleted file mode 100644 index dfc2b6c4..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "layout.twig" %}{% block content %}{{ parent() }}index {% endblock %} ---TEMPLATE(layout.twig)-- -{% extends "base.twig" %}{% block content %}{{ parent() }}layout {% endblock %} ---TEMPLATE(base.twig)-- -{% block content %}base {% endblock %} ---DATA-- -return array() ---EXPECT-- -base layout index diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test deleted file mode 100644 index 1d3e639c..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% set foo = 1 %} -{{ include('parent.twig') }} -{{ include('parent.twig') }} -{% set foo = 2 %} -{{ include('parent.twig') }} ---TEMPLATE(parent.twig)-- -{% extends foo~'_parent.twig' %}{% block content %}{{ parent() }} parent{% endblock %} ---TEMPLATE(1_parent.twig)-- -{% block content %}1{% endblock %} ---TEMPLATE(2_parent.twig)-- -{% block content %}2{% endblock %} ---DATA-- -return array() ---EXPECT-- -1 parent - -1 parent - -2 parent diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test deleted file mode 100644 index faca9259..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"block" tag ---TEMPLATE-- -{% extends "foo.twig" %} - -{% block content %} - {% block subcontent %} - {% block subsubcontent %} - SUBSUBCONTENT - {% endblock %} - {% endblock %} -{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %} - {% block subcontent %} - SUBCONTENT - {% endblock %} -{% endblock %} ---DATA-- -return array() ---EXPECT-- -SUBSUBCONTENT diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test deleted file mode 100644 index 0ad11d0c..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -"block" tag ---TEMPLATE-- -{% block content %} - CONTENT - {%- block subcontent -%} - SUBCONTENT - {%- endblock -%} - ENDCONTENT -{% endblock %} ---TEMPLATE(foo.twig)-- ---DATA-- -return array() ---EXPECT-- -CONTENTSUBCONTENTENDCONTENT diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test deleted file mode 100644 index 71e3cdfd..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "layout.twig" %} -{% block inside %}INSIDE{% endblock inside %} ---TEMPLATE(layout.twig)-- -{% extends "base.twig" %} -{% block body %} - {% block inside '' %} -{% endblock body %} ---TEMPLATE(base.twig)-- -{% block body '' %} ---DATA-- -return array() ---EXPECT-- -INSIDE diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test deleted file mode 100644 index 4f975db8..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "foo.twig" %} - -{% block content %}{{ parent() }}FOO{{ parent() }}{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %}BAR{% endblock %} ---DATA-- -return array() ---EXPECT-- -BARFOOBAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test deleted file mode 100644 index a8bc90ce..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends foo ? 'foo.twig' : 'bar.twig' %} ---TEMPLATE(foo.twig)-- -FOO ---TEMPLATE(bar.twig)-- -BAR ---DATA-- -return array('foo' => true) ---EXPECT-- -FOO ---DATA-- -return array('foo' => false) ---EXPECT-- -BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test deleted file mode 100644 index cca6dbc9..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% block content %} - {% extends "foo.twig" %} -{% endblock %} ---EXCEPTION-- -Twig_Error_Syntax: Cannot extend from a block in "index.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test deleted file mode 100644 index 62816713..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "base.twig" %} -{% block content %}{% include "included.twig" %}{% endblock %} - -{% block footer %}Footer{% endblock %} ---TEMPLATE(included.twig)-- -{% extends "base.twig" %} -{% block content %}Included Content{% endblock %} ---TEMPLATE(base.twig)-- -{% block content %}Default Content{% endblock %} - -{% block footer %}Default Footer{% endblock %} ---DATA-- -return array() ---EXPECT-- -Included Content -Default Footer -Footer diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test deleted file mode 100644 index 71e7c208..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "foo.twig" %} - -{% block content %} - {% block inside %} - INSIDE OVERRIDDEN - {% endblock %} - - BEFORE - {{ parent() }} - AFTER -{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %} - BAR -{% endblock %} ---DATA-- -return array() ---EXPECT-- - -INSIDE OVERRIDDEN - - BEFORE - BAR - - AFTER diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test deleted file mode 100644 index e29b1ac4..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"parent" tag ---TEMPLATE-- -{% block content %} - {{ parent() }} -{% endblock %} ---EXCEPTION-- -Twig_Error_Syntax: Calling "parent" on a template that does not extend nor "use" another template is forbidden in "index.twig" at line 3. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test deleted file mode 100644 index 63c73055..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"parent" tag ---TEMPLATE-- -{% use 'foo.twig' %} - -{% block content %} - {{ parent() }} -{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %}BAR{% endblock %} ---DATA-- -return array() ---EXPECT-- -BAR diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test deleted file mode 100644 index d1876a52..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"extends" tag accepts Twig_Template instance ---TEMPLATE-- -{% extends foo %} - -{% block content %} -{{ parent() }}FOO -{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %}BAR{% endblock %} ---DATA-- -return array('foo' => $twig->loadTemplate('foo.twig')) ---EXPECT-- -BARFOO diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test deleted file mode 100644 index 8f9ece7c..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -"parent" function ---TEMPLATE-- -{% extends "parent.twig" %} - -{% use "use1.twig" %} -{% use "use2.twig" %} - -{% block content_parent %} - {{ parent() }} -{% endblock %} - -{% block content_use1 %} - {{ parent() }} -{% endblock %} - -{% block content_use2 %} - {{ parent() }} -{% endblock %} - -{% block content %} - {{ block('content_use1_only') }} - {{ block('content_use2_only') }} -{% endblock %} ---TEMPLATE(parent.twig)-- -{% block content_parent 'content_parent' %} -{% block content_use1 'content_parent' %} -{% block content_use2 'content_parent' %} -{% block content '' %} ---TEMPLATE(use1.twig)-- -{% block content_use1 'content_use1' %} -{% block content_use2 'content_use1' %} -{% block content_use1_only 'content_use1_only' %} ---TEMPLATE(use2.twig)-- -{% block content_use2 'content_use2' %} -{% block content_use2_only 'content_use2_only' %} ---DATA-- -return array() ---EXPECT-- - content_parent - content_use1 - content_use2 - content_use1_only - content_use2_only diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test deleted file mode 100644 index eef0c10d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"macro" tag ---TEMPLATE-- -{% import _self as macros %} - -{{ macros.input('username') }} -{{ macros.input('password', null, 'password', 1) }} - -{% macro input(name, value, type, size) %} - -{% endmacro %} ---DATA-- -return array() ---EXPECT-- - - - diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test deleted file mode 100644 index ae6203bb..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"macro" tag supports name for endmacro ---TEMPLATE-- -{% import _self as macros %} - -{{ macros.foo() }} -{{ macros.bar() }} - -{% macro foo() %}foo{% endmacro %} -{% macro bar() %}bar{% endmacro bar %} ---DATA-- -return array() ---EXPECT-- -foo -bar - diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test deleted file mode 100644 index 5cd3dae6..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"macro" tag ---TEMPLATE-- -{% import 'forms.twig' as forms %} - -{{ forms.input('username') }} -{{ forms.input('password', null, 'password', 1) }} ---TEMPLATE(forms.twig)-- -{% macro input(name, value, type, size) %} - -{% endmacro %} ---DATA-- -return array() ---EXPECT-- - - - diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test deleted file mode 100644 index 205f5918..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"macro" tag ---TEMPLATE-- -{% from 'forms.twig' import foo %} -{% from 'forms.twig' import foo as foobar, bar %} - -{{ foo('foo') }} -{{ foobar('foo') }} -{{ bar('foo') }} ---TEMPLATE(forms.twig)-- -{% macro foo(name) %}foo{{ name }}{% endmacro %} -{% macro bar(name) %}bar{{ name }}{% endmacro %} ---DATA-- -return array() ---EXPECT-- -foofoo -foofoo -barfoo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test deleted file mode 100644 index 2de9765f..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test +++ /dev/null @@ -1,9 +0,0 @@ ---TEST-- -"from" tag with reserved name ---TEMPLATE-- -{% from 'forms.twig' import templateName %} ---TEMPLATE(forms.twig)-- ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Syntax: "templateName" cannot be an imported macro as it is a reserved keyword in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test deleted file mode 100644 index 6b371768..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"macro" tag ---TEMPLATE-- -{% from 'forms.twig' import foo %} - -{{ foo('foo') }} -{{ foo() }} ---TEMPLATE(forms.twig)-- -{% macro foo(name) %}{{ name|default('foo') }}{{ global }}{% endmacro %} ---DATA-- -return array() ---EXPECT-- -fooglobal -fooglobal diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test deleted file mode 100644 index 7bd93c62..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"from" tag with reserved name ---TEMPLATE-- -{% import 'forms.twig' as macros %} - -{{ macros.parent() }} ---TEMPLATE(forms.twig)-- ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Syntax: "parent" cannot be called as macro as it is a reserved keyword in "index.twig" at line 4. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test deleted file mode 100644 index f7c102f0..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"macro" tag with reserved name ---TEMPLATE-- -{% macro parent(arg1, arg2) %} - parent -{% endmacro %} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Syntax: "parent" cannot be used as a macro name as it is a reserved keyword in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test deleted file mode 100644 index 17756cb6..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"macro" tag ---TEMPLATE-- -{% import _self as forms %} - -{{ forms.input('username') }} -{{ forms.input('password', null, 'password', 1) }} - -{% macro input(name, value, type, size) %} - -{% endmacro %} ---DATA-- -return array() ---EXPECT-- - - - diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test deleted file mode 100644 index 37217707..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"§" as a macro name ---TEMPLATE-- -{% import _self as macros %} - -{{ macros.§('foo') }} - -{% macro §(foo) %} - §{{ foo }}§ -{% endmacro %} ---DATA-- -return array() ---EXPECT-- -§foo§ diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test deleted file mode 100644 index 56794628..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test +++ /dev/null @@ -1,14 +0,0 @@ ---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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test deleted file mode 100644 index 0445e853..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"raw" tag ---TEMPLATE-- -{% raw %} -{{ foo }} -{% endraw %} ---DATA-- -return array() ---EXPECT-- -{{ foo }} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test deleted file mode 100644 index 99deefc3..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"raw" tag ---TEMPLATE-- -{% raw %} -{{ foo }} -{% endverbatim %} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Syntax: Unexpected end of file: Unclosed "raw" block in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test deleted file mode 100644 index 352bb187..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -"raw" tag ---TEMPLATE-- -1*** - -{%- raw %} - {{ 'bla' }} -{% endraw %} - -1*** -2*** - -{%- raw -%} - {{ 'bla' }} -{% endraw %} - -2*** -3*** - -{%- raw -%} - {{ 'bla' }} -{% endraw -%} - -3*** -4*** - -{%- raw -%} - {{ 'bla' }} -{%- endraw %} - -4*** -5*** - -{%- raw -%} - {{ 'bla' }} -{%- endraw -%} - -5*** ---DATA-- -return array() ---EXPECT-- -1*** - {{ 'bla' }} - - -1*** -2***{{ 'bla' }} - - -2*** -3***{{ 'bla' }} -3*** -4***{{ 'bla' }} - -4*** -5***{{ 'bla' }}5*** diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test deleted file mode 100644 index dfddc151..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -sandbox tag ---TEMPLATE-- -{%- sandbox %} - {%- include "foo.twig" %} - a -{%- endsandbox %} ---TEMPLATE(foo.twig)-- -foo ---EXCEPTION-- -Twig_Error_Syntax: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 4. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test deleted file mode 100644 index a33a13ee..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -sandbox tag ---TEMPLATE-- -{%- sandbox %} - {%- include "foo.twig" %} - - {% if 1 %} - {%- include "foo.twig" %} - {% endif %} -{%- endsandbox %} ---TEMPLATE(foo.twig)-- -foo ---EXCEPTION-- -Twig_Error_Syntax: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 5. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test deleted file mode 100644 index de20f3db..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -sandbox tag ---TEMPLATE-- -{%- sandbox %} - {%- include "foo.twig" %} -{%- endsandbox %} - -{%- sandbox %} - {%- include "foo.twig" %} - {%- include "foo.twig" %} -{%- endsandbox %} - -{%- sandbox %}{% include "foo.twig" %}{% endsandbox %} ---TEMPLATE(foo.twig)-- -foo ---DATA-- -return array() ---EXPECT-- -foo -foo -foo -foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test deleted file mode 100644 index a5a9f830..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -"set" tag ---TEMPLATE-- -{% set foo = 'foo' %} -{% set bar = 'foo
    ' %} - -{{ foo }} -{{ bar }} - -{% set foo, bar = 'foo', 'bar' %} - -{{ foo }}{{ bar }} ---DATA-- -return array() ---EXPECT-- -foo -foo<br /> - - -foobar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test deleted file mode 100644 index ec657f00..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test +++ /dev/null @@ -1,9 +0,0 @@ ---TEST-- -"set" tag block empty capture ---TEMPLATE-- -{% set foo %}{% endset %} - -{% if foo %}FAIL{% endif %} ---DATA-- -return array() ---EXPECT-- diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test deleted file mode 100644 index f156a1a7..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"set" tag block capture ---TEMPLATE-- -{% set foo %}f
    o
    o{% endset %} - -{{ foo }} ---DATA-- -return array() ---EXPECT-- -f
    o
    o diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test deleted file mode 100644 index 8ff434a0..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"set" tag ---TEMPLATE-- -{% set foo, bar = 'foo' ~ 'bar', 'bar' ~ 'foo' %} - -{{ foo }} -{{ bar }} ---DATA-- -return array() ---EXPECT-- -foobar -barfoo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test deleted file mode 100644 index dd06dec2..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"spaceless" tag removes whites between HTML tags ---TEMPLATE-- -{% spaceless %} - -
    foo
    - -{% endspaceless %} ---DATA-- -return array() ---EXPECT-- -
    foo
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test deleted file mode 100644 index 789b4ba8..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"§" custom tag ---TEMPLATE-- -{% § %} ---DATA-- -return array() ---EXPECT-- -§ diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test deleted file mode 100644 index 1d2273f8..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -Whitespace trimming on tags. ---TEMPLATE-- -{{ 5 * '{#-'|length }} -{{ '{{-'|length * 5 + '{%-'|length }} - -Trim on control tag: -{% for i in range(1, 9) -%} - {{ i }} -{%- endfor %} - - -Trim on output tag: -{% for i in range(1, 9) %} - {{- i -}} -{% endfor %} - - -Trim comments: - -{#- Invisible -#} - -After the comment. - -Trim leading space: -{% if leading %} - - {{- leading }} -{% endif %} - -{%- if leading %} - {{- leading }} - -{%- endif %} - - -Trim trailing space: -{% if trailing -%} - {{ trailing -}} - -{% endif -%} - -Combined: - -{%- if both -%} -
      -
    • {{- both -}}
    • -
    - -{%- endif -%} - -end ---DATA-- -return array('leading' => 'leading space', 'trailing' => 'trailing space', 'both' => 'both') ---EXPECT-- -15 -18 - -Trim on control tag: -123456789 - -Trim on output tag: -123456789 - -Trim comments:After the comment. - -Trim leading space: -leading space -leading space - -Trim trailing space: -trailing spaceCombined:
      -
    • both
    • -
    end diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test deleted file mode 100644 index f887006f..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "blocks.twig" with content as foo %} - -{{ block('foo') }} ---TEMPLATE(blocks.twig)-- -{% block content 'foo' %} ---DATA-- -return array() ---EXPECT-- -foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test deleted file mode 100644 index 7364d76d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "blocks.twig" %} - -{{ block('content') }} ---TEMPLATE(blocks.twig)-- -{% block content 'foo' %} ---DATA-- -return array() ---EXPECT-- -foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test deleted file mode 100644 index b551a1e6..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "foo.twig" %} - -{{ block('content') }} -{{ block('foo') }} -{{ block('bar') }} ---TEMPLATE(foo.twig)-- -{% use "bar.twig" %} - -{% block content 'foo' %} -{% block foo 'foo' %} ---TEMPLATE(bar.twig)-- -{% block content 'bar' %} -{% block bar 'bar' %} ---DATA-- -return array() ---EXPECT-- -foo -foo -bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test deleted file mode 100644 index 05cca682..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "foo.twig" %} ---TEMPLATE(foo.twig)-- -{% use "bar.twig" %} ---TEMPLATE(bar.twig)-- ---DATA-- -return array() ---EXPECT-- diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test deleted file mode 100644 index 0d0d470e..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "parent.twig" %} - -{{ block('container') }} ---TEMPLATE(parent.twig)-- -{% use "ancestor.twig" %} - -{% block sub_container %} -
    overridden sub_container
    -{% endblock %} ---TEMPLATE(ancestor.twig)-- -{% block container %} -
    {{ block('sub_container') }}
    -{% endblock %} - -{% block sub_container %} -
    sub_container
    -{% endblock %} ---DATA-- -return array() ---EXPECT-- -
    overridden sub_container
    -
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test deleted file mode 100644 index df95599c..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "ancestor.twig" %} -{% use "parent.twig" %} - -{{ block('container') }} ---TEMPLATE(parent.twig)-- -{% block sub_container %} -
    overridden sub_container
    -{% endblock %} ---TEMPLATE(ancestor.twig)-- -{% block container %} -
    {{ block('sub_container') }}
    -{% endblock %} - -{% block sub_container %} -
    sub_container
    -{% endblock %} ---DATA-- -return array() ---EXPECT-- -
    overridden sub_container
    -
    diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test deleted file mode 100644 index 198be0c5..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "foo.twig" %} -{% use "bar.twig" %} - -{{ block('content') }} -{{ block('foo') }} -{{ block('bar') }} ---TEMPLATE(foo.twig)-- -{% block content 'foo' %} -{% block foo 'foo' %} ---TEMPLATE(bar.twig)-- -{% block content 'bar' %} -{% block bar 'bar' %} ---DATA-- -return array() ---EXPECT-- -bar -foo -bar diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test deleted file mode 100644 index 8de871a8..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "foo.twig" with content as foo_content %} -{% use "bar.twig" %} - -{{ block('content') }} -{{ block('foo') }} -{{ block('bar') }} -{{ block('foo_content') }} ---TEMPLATE(foo.twig)-- -{% block content 'foo' %} -{% block foo 'foo' %} ---TEMPLATE(bar.twig)-- -{% block content 'bar' %} -{% block bar 'bar' %} ---DATA-- -return array() ---EXPECT-- -bar -foo -bar -foo diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test deleted file mode 100644 index 59db23d9..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test +++ /dev/null @@ -1,24 +0,0 @@ ---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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test deleted file mode 100644 index d3f302df..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test +++ /dev/null @@ -1,24 +0,0 @@ ---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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test deleted file mode 100644 index 95b55a46..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test +++ /dev/null @@ -1,38 +0,0 @@ ---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/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test deleted file mode 100644 index a95be557..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"verbatim" tag ---TEMPLATE-- -{% verbatim %} -{{ foo }} -{% endverbatim %} ---DATA-- -return array() ---EXPECT-- -{{ foo }} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test deleted file mode 100644 index 28626a81..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"verbatim" tag ---TEMPLATE-- -{% verbatim %} -{{ foo }} -{% endraw %} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Syntax: Unexpected end of file: Unclosed "verbatim" block in "index.twig" at line 2. diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test deleted file mode 100644 index eb610444..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -"verbatim" tag ---TEMPLATE-- -1*** - -{%- verbatim %} - {{ 'bla' }} -{% endverbatim %} - -1*** -2*** - -{%- verbatim -%} - {{ 'bla' }} -{% endverbatim %} - -2*** -3*** - -{%- verbatim -%} - {{ 'bla' }} -{% endverbatim -%} - -3*** -4*** - -{%- verbatim -%} - {{ 'bla' }} -{%- endverbatim %} - -4*** -5*** - -{%- verbatim -%} - {{ 'bla' }} -{%- endverbatim -%} - -5*** ---DATA-- -return array() ---EXPECT-- -1*** - {{ 'bla' }} - - -1*** -2***{{ 'bla' }} - - -2*** -3***{{ 'bla' }} -3*** -4***{{ 'bla' }} - -4*** -5***{{ 'bla' }}5*** diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test deleted file mode 100644 index 1429d375..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -array index test ---TEMPLATE-- -{% for key, value in days %} -{{ key }} -{% endfor %} ---DATA-- -return array('days' => array( - 1 => array('money' => 9), - 2 => array('money' => 21), - 3 => array('money' => 38), - 4 => array('money' => 6), - 18 => array('money' => 6), - 19 => array('money' => 3), - 31 => array('money' => 11), -)); ---EXPECT-- -1 -2 -3 -4 -18 -19 -31 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test deleted file mode 100644 index 60218ac0..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"const" test ---TEMPLATE-- -{{ 8 is constant('E_NOTICE') ? 'ok' : 'no' }} -{{ 'bar' is constant('TwigTestFoo::BAR_NAME') ? 'ok' : 'no' }} -{{ value is constant('TwigTestFoo::BAR_NAME') ? 'ok' : 'no' }} -{{ 2 is constant('ARRAY_AS_PROPS', object) ? 'ok' : 'no' }} ---DATA-- -return array('value' => 'bar', 'object' => new ArrayObject(array('hi'))); ---EXPECT-- -ok -ok -ok -ok \ No newline at end of file diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test deleted file mode 100644 index d4e204ef..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test +++ /dev/null @@ -1,129 +0,0 @@ ---TEST-- -"defined" test ---TEMPLATE-- -{{ definedVar is defined ? 'ok' : 'ko' }} -{{ definedVar is not defined ? 'ko' : 'ok' }} -{{ undefinedVar is defined ? 'ko' : 'ok' }} -{{ undefinedVar is not defined ? 'ok' : 'ko' }} -{{ zeroVar is defined ? 'ok' : 'ko' }} -{{ nullVar is defined ? 'ok' : 'ko' }} -{{ nested.definedVar is defined ? 'ok' : 'ko' }} -{{ nested['definedVar'] is defined ? 'ok' : 'ko' }} -{{ nested.definedVar is not defined ? 'ko' : 'ok' }} -{{ nested.undefinedVar is defined ? 'ko' : 'ok' }} -{{ nested['undefinedVar'] is defined ? 'ko' : 'ok' }} -{{ nested.undefinedVar is not defined ? 'ok' : 'ko' }} -{{ nested.zeroVar is defined ? 'ok' : 'ko' }} -{{ nested.nullVar is defined ? 'ok' : 'ko' }} -{{ nested.definedArray.0 is defined ? 'ok' : 'ko' }} -{{ nested['definedArray'][0] is defined ? 'ok' : 'ko' }} -{{ object.foo is defined ? 'ok' : 'ko' }} -{{ object.undefinedMethod is defined ? 'ko' : 'ok' }} -{{ object.getFoo() is defined ? 'ok' : 'ko' }} -{{ object.getFoo('a') is defined ? 'ok' : 'ko' }} -{{ object.undefinedMethod() is defined ? 'ko' : 'ok' }} -{{ object.undefinedMethod('a') is defined ? 'ko' : 'ok' }} -{{ object.self.foo is defined ? 'ok' : 'ko' }} -{{ object.self.undefinedMethod is defined ? 'ko' : 'ok' }} -{{ object.undefinedMethod.self is defined ? 'ko' : 'ok' }} -{{ 0 is defined ? 'ok' : 'ko' }} -{{ "foo" is defined ? 'ok' : 'ko' }} -{{ true is defined ? 'ok' : 'ko' }} -{{ false is defined ? 'ok' : 'ko' }} -{{ null is defined ? 'ok' : 'ko' }} -{{ [1, 2] is defined ? 'ok' : 'ko' }} -{{ { foo: "bar" } is defined ? 'ok' : 'ko' }} ---DATA-- -return array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'nullVar' => null, - 'nested' => array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'nullVar' => null, - 'definedArray' => array(0), - ), - 'object' => new TwigTestFoo(), -); ---EXPECT-- -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok ---DATA-- -return array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'nullVar' => null, - 'nested' => array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'nullVar' => null, - 'definedArray' => array(0), - ), - 'object' => new TwigTestFoo(), -); ---CONFIG-- -return array('strict_variables' => false) ---EXPECT-- -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test deleted file mode 100644 index a776d032..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -"empty" test ---TEMPLATE-- -{{ foo is empty ? 'ok' : 'ko' }} -{{ bar is empty ? 'ok' : 'ko' }} -{{ foobar is empty ? 'ok' : 'ko' }} -{{ array is empty ? 'ok' : 'ko' }} -{{ zero is empty ? 'ok' : 'ko' }} -{{ string is empty ? 'ok' : 'ko' }} -{{ countable_empty is empty ? 'ok' : 'ko' }} -{{ countable_not_empty is empty ? 'ok' : 'ko' }} -{{ markup_empty is empty ? 'ok' : 'ko' }} -{{ markup_not_empty is empty ? 'ok' : 'ko' }} ---DATA-- - -class CountableStub implements Countable -{ - private $items; - - public function __construct(array $items) - { - $this->items = $items; - } - - public function count() - { - return count($this->items); - } -} -return array( - 'foo' => '', 'bar' => null, 'foobar' => false, 'array' => array(), 'zero' => 0, 'string' => '0', - 'countable_empty' => new CountableStub(array()), 'countable_not_empty' => new CountableStub(array(1, 2)), - 'markup_empty' => new Twig_Markup('', 'UTF-8'), 'markup_not_empty' => new Twig_Markup('test', 'UTF-8'), -); ---EXPECT-- -ok -ok -ok -ok -ko -ko -ok -ko -ok -ko diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test deleted file mode 100644 index 695b4c2f..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"even" test ---TEMPLATE-- -{{ 1 is even ? 'ko' : 'ok' }} -{{ 2 is even ? 'ok' : 'ko' }} -{{ 1 is not even ? 'ok' : 'ko' }} -{{ 2 is not even ? 'ko' : 'ok' }} ---DATA-- -return array() ---EXPECT-- -ok -ok -ok -ok diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test deleted file mode 100644 index 545f51f8..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test +++ /dev/null @@ -1,128 +0,0 @@ ---TEST-- -Twig supports the in operator ---TEMPLATE-- -{% if bar in foo %} -TRUE -{% endif %} -{% if not (bar in foo) %} -{% else %} -TRUE -{% endif %} -{% if bar not in foo %} -{% else %} -TRUE -{% endif %} -{% if 'a' in bar %} -TRUE -{% endif %} -{% if 'c' not in bar %} -TRUE -{% endif %} -{% if '' in bar %} -TRUE -{% endif %} -{% if '' in '' %} -TRUE -{% endif %} -{% if '0' not in '' %} -TRUE -{% endif %} -{% if 'a' not in '0' %} -TRUE -{% endif %} -{% if '0' in '0' %} -TRUE -{% endif %} - -{{ false in [0, 1] ? 'TRUE' : 'FALSE' }} -{{ true in [0, 1] ? 'TRUE' : 'FALSE' }} -{{ '0' in [0, 1] ? 'TRUE' : 'FALSE' }} -{{ '' in [0, 1] ? 'TRUE' : 'FALSE' }} -{{ 0 in ['', 1] ? 'TRUE' : 'FALSE' }} - -{{ '' in 'foo' ? 'TRUE' : 'FALSE' }} -{{ 0 in 'foo' ? 'TRUE' : 'FALSE' }} -{{ false in 'foo' ? 'TRUE' : 'FALSE' }} -{{ false in '100' ? 'TRUE' : 'FALSE' }} -{{ true in '100' ? 'TRUE' : 'FALSE' }} - -{{ [] in [true, false] ? 'TRUE' : 'FALSE' }} -{{ [] in [true, ''] ? 'TRUE' : 'FALSE' }} -{{ [] in [true, []] ? 'TRUE' : 'FALSE' }} - -{{ resource ? 'TRUE' : 'FALSE' }} -{{ resource in 'foo'~resource ? 'TRUE' : 'FALSE' }} -{{ object in 'stdClass' ? 'TRUE' : 'FALSE' }} -{{ [] in 'Array' ? 'TRUE' : 'FALSE' }} -{{ dir_object in 'foo'~dir_object ? 'TRUE' : 'FALSE' }} - -{{ ''~resource in resource ? 'TRUE' : 'FALSE' }} -{{ 'stdClass' in object ? 'TRUE' : 'FALSE' }} -{{ 'Array' in [] ? 'TRUE' : 'FALSE' }} -{{ ''~dir_object in dir_object ? 'TRUE' : 'FALSE' }} - -{{ resource in [''~resource] ? 'TRUE' : 'FALSE' }} -{{ resource in [resource + 1 - 1] ? 'TRUE' : 'FALSE' }} -{{ dir_object in [''~dir_object] ? 'TRUE' : 'FALSE' }} - -{{ 5 in 125 ? 'TRUE' : 'FALSE' }} -{{ 5 in '125' ? 'TRUE' : 'FALSE' }} -{{ '5' in 125 ? 'TRUE' : 'FALSE' }} -{{ '5' in '125' ? 'TRUE' : 'FALSE' }} - -{{ 5.5 in 125.5 ? 'TRUE' : 'FALSE' }} -{{ 5.5 in '125.5' ? 'TRUE' : 'FALSE' }} -{{ '5.5' in 125.5 ? 'TRUE' : 'FALSE' }} ---DATA-- -return array('bar' => 'bar', 'foo' => array('bar' => 'bar'), 'dir_object' => new SplFileInfo(dirname(__FILE__)), 'object' => new stdClass(), 'resource' => opendir(dirname(__FILE__))) ---EXPECT-- -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE - -TRUE -TRUE -TRUE -TRUE -TRUE - -TRUE -FALSE -FALSE -FALSE -FALSE - -TRUE -FALSE -TRUE - -TRUE -FALSE -FALSE -FALSE -FALSE - -FALSE -FALSE -FALSE -FALSE - -FALSE -FALSE -FALSE - -FALSE -TRUE -FALSE -TRUE - -FALSE -TRUE -FALSE diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test deleted file mode 100644 index 8e08061b..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Twig supports the in operator when using objects ---TEMPLATE-- -{% if object in object_list %} -TRUE -{% endif %} ---DATA-- -$foo = new TwigTestFoo(); -$foo1 = new TwigTestFoo(); - -$foo->position = $foo1; -$foo1->position = $foo; - -return array( - 'object' => $foo, - 'object_list' => array($foo1, $foo), -); ---EXPECT-- -TRUE diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test deleted file mode 100644 index ec525501..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -"iterable" test ---TEMPLATE-- -{{ foo is iterable ? 'ok' : 'ko' }} -{{ traversable is iterable ? 'ok' : 'ko' }} -{{ obj is iterable ? 'ok' : 'ko' }} -{{ val is iterable ? 'ok' : 'ko' }} ---DATA-- -return array( - 'foo' => array(), - 'traversable' => new ArrayIterator(array()), - 'obj' => new stdClass(), - 'val' => 'test', -); ---EXPECT-- -ok -ok -ko -ko \ No newline at end of file diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test deleted file mode 100644 index 3d148c89..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Twig supports the ?? operator ---TEMPLATE-- -{{ 'OK' ?? 'KO' }} -{{ null ?? 'OK' }} -{{ bar ?? 'KO' }} -{{ baz ?? 'OK' }} -{{ foo.bar ?? 'KO' }} -{{ foo.missing ?? 'OK' }} -{{ foo.bar.baz.missing ?? 'OK' }} -{{ foo['bar'] ?? 'KO' }} -{{ foo['missing'] ?? 'OK' }} -{{ nope ?? nada ?? 'OK' }} -{{ 1 + nope ?? nada ?? 2 }} -{{ 1 + nope ?? 3 + nada ?? 2 }} ---DATA-- -return array('bar' => 'OK', 'foo' => array('bar' => 'OK')) ---EXPECT-- -OK -OK -OK -OK -OK -OK -OK -OK -OK -OK -3 -6 diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test deleted file mode 100644 index 1b8311e3..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"odd" test ---TEMPLATE-- -{{ 1 is odd ? 'ok' : 'ko' }} -{{ 2 is odd ? 'ko' : 'ok' }} ---DATA-- -return array() ---EXPECT-- -ok -ok \ No newline at end of file diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php deleted file mode 100644 index 1908bcdf..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php +++ /dev/null @@ -1,229 +0,0 @@ -position = 0; - } - - public function current() - { - return $this->array[$this->position]; - } - - public function key() - { - return 'a'; - } - - public function next() - { - ++$this->position; - } - - public function valid() - { - return isset($this->array[$this->position]); - } -} - -class TwigTestTokenParser_§ extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Print(new Twig_Node_Expression_Constant('§', -1), -1); - } - - public function getTag() - { - return '§'; - } -} - -class TwigTestExtension extends Twig_Extension -{ - public function getTokenParsers() - { - return array( - new TwigTestTokenParser_§(), - ); - } - - public function getFilters() - { - return array( - new Twig_SimpleFilter('§', array($this, '§Filter')), - new Twig_SimpleFilter('escape_and_nl2br', array($this, 'escape_and_nl2br'), array('needs_environment' => true, 'is_safe' => array('html'))), - new Twig_SimpleFilter('nl2br', array($this, 'nl2br'), array('pre_escape' => 'html', 'is_safe' => array('html'))), - new Twig_SimpleFilter('escape_something', array($this, 'escape_something'), array('is_safe' => array('something'))), - new Twig_SimpleFilter('preserves_safety', array($this, 'preserves_safety'), array('preserves_safety' => array('html'))), - new Twig_SimpleFilter('*_path', array($this, 'dynamic_path')), - new Twig_SimpleFilter('*_foo_*_bar', array($this, 'dynamic_foo')), - ); - } - - public function getFunctions() - { - return array( - new Twig_SimpleFunction('§', array($this, '§Function')), - new Twig_SimpleFunction('safe_br', array($this, 'br'), array('is_safe' => array('html'))), - new Twig_SimpleFunction('unsafe_br', array($this, 'br')), - new Twig_SimpleFunction('*_path', array($this, 'dynamic_path')), - new Twig_SimpleFunction('*_foo_*_bar', array($this, 'dynamic_foo')), - ); - } - - public function getTests() - { - return array( - new Twig_SimpleTest('multi word', array($this, 'is_multi_word')), - ); - } - - public function §Filter($value) - { - return "§{$value}§"; - } - - public function §Function($value) - { - return "§{$value}§"; - } - - /** - * nl2br which also escapes, for testing escaper filters. - */ - public function escape_and_nl2br($env, $value, $sep = '
    ') - { - return $this->nl2br(twig_escape_filter($env, $value, 'html'), $sep); - } - - /** - * nl2br only, for testing filters with pre_escape. - */ - public function nl2br($value, $sep = '
    ') - { - // not secure if $value contains html tags (not only entities) - // don't use - return str_replace("\n", "$sep\n", $value); - } - - public function dynamic_path($element, $item) - { - return $element.'/'.$item; - } - - public function dynamic_foo($foo, $bar, $item) - { - return $foo.'/'.$bar.'/'.$item; - } - - public function escape_something($value) - { - return strtoupper($value); - } - - public function preserves_safety($value) - { - return strtoupper($value); - } - - public function br() - { - return '
    '; - } - - public function is_multi_word($value) - { - return false !== strpos($value, ' '); - } - - public function getName() - { - return 'integration_test'; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test b/plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test deleted file mode 100644 index d9c1d508..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Old test classes usage ---TEMPLATE-- -{{ 'foo' is multi word ? 'yes' : 'no' }} ---DATA-- -return array() ---EXPECT-- -no diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php deleted file mode 100644 index 055a6170..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php +++ /dev/null @@ -1,54 +0,0 @@ - new Twig_Test_Method($this, 'is_multi_word'), - ); - } - - public function is_multi_word($value) - { - return false !== strpos($value, ' '); - } - - public function getName() - { - return 'legacy_integration_test'; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/LexerTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/LexerTest.php deleted file mode 100644 index 4945d224..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/LexerTest.php +++ /dev/null @@ -1,300 +0,0 @@ -getMock('Twig_LoaderInterface'))); - $stream = $lexer->tokenize($template); - - $stream->expect(Twig_Token::BLOCK_START_TYPE); - $this->assertSame('§', $stream->expect(Twig_Token::NAME_TYPE)->getValue()); - } - - public function testNameLabelForFunction() - { - $template = '{{ §() }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $stream = $lexer->tokenize($template); - - $stream->expect(Twig_Token::VAR_START_TYPE); - $this->assertSame('§', $stream->expect(Twig_Token::NAME_TYPE)->getValue()); - } - - public function testBracketsNesting() - { - $template = '{{ {"a":{"b":"c"}} }}'; - - $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '{')); - $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '}')); - } - - protected function countToken($template, $type, $value = null) - { - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $stream = $lexer->tokenize($template); - - $count = 0; - while (!$stream->isEOF()) { - $token = $stream->next(); - if ($type === $token->getType()) { - if (null === $value || $value === $token->getValue()) { - ++$count; - } - } - } - - return $count; - } - - public function testLineDirective() - { - $template = "foo\n" - ."bar\n" - ."{% line 10 %}\n" - ."{{\n" - ."baz\n" - ."}}\n"; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $stream = $lexer->tokenize($template); - - // foo\nbar\n - $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); - // \n (after {% line %}) - $this->assertSame(10, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); - // {{ - $this->assertSame(11, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine()); - // baz - $this->assertSame(12, $stream->expect(Twig_Token::NAME_TYPE)->getLine()); - } - - public function testLineDirectiveInline() - { - $template = "foo\n" - ."bar{% line 10 %}{{\n" - ."baz\n" - ."}}\n"; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $stream = $lexer->tokenize($template); - - // foo\nbar - $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); - // {{ - $this->assertSame(10, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine()); - // baz - $this->assertSame(11, $stream->expect(Twig_Token::NAME_TYPE)->getLine()); - } - - public function testLongComments() - { - $template = '{# '.str_repeat('*', 100000).' #}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $lexer->tokenize($template); - - // should not throw an exception - } - - public function testLongVerbatim() - { - $template = '{% verbatim %}'.str_repeat('*', 100000).'{% endverbatim %}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $lexer->tokenize($template); - - // should not throw an exception - } - - public function testLongVar() - { - $template = '{{ '.str_repeat('x', 100000).' }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $lexer->tokenize($template); - - // should not throw an exception - } - - public function testLongBlock() - { - $template = '{% '.str_repeat('x', 100000).' %}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $lexer->tokenize($template); - - // should not throw an exception - } - - public function testBigNumbers() - { - $template = '{{ 922337203685477580700 }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $stream = $lexer->tokenize($template); - $stream->next(); - $node = $stream->next(); - $this->assertEquals('922337203685477580700', $node->getValue()); - } - - public function testStringWithEscapedDelimiter() - { - $tests = array( - "{{ 'foo \' bar' }}" => 'foo \' bar', - '{{ "foo \" bar" }}' => 'foo " bar', - ); - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - foreach ($tests as $template => $expected) { - $stream = $lexer->tokenize($template); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, $expected); - } - } - - public function testStringWithInterpolation() - { - $template = 'foo {{ "bar #{ baz + 1 }" }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $stream = $lexer->tokenize($template); - $stream->expect(Twig_Token::TEXT_TYPE, 'foo '); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'bar '); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::NAME_TYPE, 'baz'); - $stream->expect(Twig_Token::OPERATOR_TYPE, '+'); - $stream->expect(Twig_Token::NUMBER_TYPE, '1'); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::VAR_END_TYPE); - } - - public function testStringWithEscapedInterpolation() - { - $template = '{{ "bar \#{baz+1}" }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $stream = $lexer->tokenize($template); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'bar #{baz+1}'); - $stream->expect(Twig_Token::VAR_END_TYPE); - } - - public function testStringWithHash() - { - $template = '{{ "bar # baz" }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $stream = $lexer->tokenize($template); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'bar # baz'); - $stream->expect(Twig_Token::VAR_END_TYPE); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unclosed """ - */ - public function testStringWithUnterminatedInterpolation() - { - $template = '{{ "bar #{x" }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $lexer->tokenize($template); - } - - public function testStringWithNestedInterpolations() - { - $template = '{{ "bar #{ "foo#{bar}" }" }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $stream = $lexer->tokenize($template); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'bar '); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'foo'); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::NAME_TYPE, 'bar'); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::VAR_END_TYPE); - } - - public function testStringWithNestedInterpolationsInBlock() - { - $template = '{% foo "bar #{ "foo#{bar}" }" %}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $stream = $lexer->tokenize($template); - $stream->expect(Twig_Token::BLOCK_START_TYPE); - $stream->expect(Twig_Token::NAME_TYPE, 'foo'); - $stream->expect(Twig_Token::STRING_TYPE, 'bar '); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'foo'); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::NAME_TYPE, 'bar'); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - } - - public function testOperatorEndingWithALetterAtTheEndOfALine() - { - $template = "{{ 1 and\n0}}"; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $stream = $lexer->tokenize($template); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::NUMBER_TYPE, 1); - $stream->expect(Twig_Token::OPERATOR_TYPE, 'and'); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unclosed "variable" at line 3 - */ - public function testUnterminatedVariable() - { - $template = ' - -{{ - -bar - - -'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $lexer->tokenize($template); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unclosed "block" at line 3 - */ - public function testUnterminatedBlock() - { - $template = ' - -{% - -bar - - -'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $lexer->tokenize($template); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php deleted file mode 100644 index 1369a6bd..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php +++ /dev/null @@ -1,97 +0,0 @@ - 'bar')); - - $this->assertEquals('bar', $loader->getSource('foo')); - } - - /** - * @expectedException Twig_Error_Loader - */ - public function testGetSourceWhenTemplateDoesNotExist() - { - $loader = new Twig_Loader_Array(array()); - - $loader->getSource('foo'); - } - - public function testGetCacheKey() - { - $loader = new Twig_Loader_Array(array('foo' => 'bar')); - - $this->assertEquals('bar', $loader->getCacheKey('foo')); - } - - /** - * @expectedException Twig_Error_Loader - */ - public function testGetCacheKeyWhenTemplateDoesNotExist() - { - $loader = new Twig_Loader_Array(array()); - - $loader->getCacheKey('foo'); - } - - public function testSetTemplate() - { - $loader = new Twig_Loader_Array(array()); - $loader->setTemplate('foo', 'bar'); - - $this->assertEquals('bar', $loader->getSource('foo')); - } - - public function testIsFresh() - { - $loader = new Twig_Loader_Array(array('foo' => 'bar')); - $this->assertTrue($loader->isFresh('foo', time())); - } - - /** - * @expectedException Twig_Error_Loader - */ - public function testIsFreshWhenTemplateDoesNotExist() - { - $loader = new Twig_Loader_Array(array()); - - $loader->isFresh('foo', time()); - } - - public function testTemplateReference() - { - $name = new Twig_Test_Loader_TemplateReference('foo'); - $loader = new Twig_Loader_Array(array('foo' => 'bar')); - - $loader->getCacheKey($name); - $loader->getSource($name); - $loader->isFresh($name, time()); - $loader->setTemplate($name, 'foobar'); - } -} - -class Twig_Test_Loader_TemplateReference -{ - private $name; - - public function __construct($name) - { - $this->name = $name; - } - - public function __toString() - { - return $this->name; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php deleted file mode 100644 index 4fe0db94..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php +++ /dev/null @@ -1,79 +0,0 @@ - 'bar')), - new Twig_Loader_Array(array('foo' => 'foobar', 'bar' => 'foo')), - )); - - $this->assertEquals('bar', $loader->getSource('foo')); - $this->assertEquals('foo', $loader->getSource('bar')); - } - - /** - * @expectedException Twig_Error_Loader - */ - public function testGetSourceWhenTemplateDoesNotExist() - { - $loader = new Twig_Loader_Chain(array()); - - $loader->getSource('foo'); - } - - public function testGetCacheKey() - { - $loader = new Twig_Loader_Chain(array( - new Twig_Loader_Array(array('foo' => 'bar')), - new Twig_Loader_Array(array('foo' => 'foobar', 'bar' => 'foo')), - )); - - $this->assertEquals('bar', $loader->getCacheKey('foo')); - $this->assertEquals('foo', $loader->getCacheKey('bar')); - } - - /** - * @expectedException Twig_Error_Loader - */ - public function testGetCacheKeyWhenTemplateDoesNotExist() - { - $loader = new Twig_Loader_Chain(array()); - - $loader->getCacheKey('foo'); - } - - public function testAddLoader() - { - $loader = new Twig_Loader_Chain(); - $loader->addLoader(new Twig_Loader_Array(array('foo' => 'bar'))); - - $this->assertEquals('bar', $loader->getSource('foo')); - } - - public function testExists() - { - $loader1 = $this->getMock('Twig_Loader_Array', array('exists', 'getSource'), array(), '', false); - $loader1->expects($this->once())->method('exists')->will($this->returnValue(false)); - $loader1->expects($this->never())->method('getSource'); - - $loader2 = $this->getMock('Twig_LoaderInterface'); - $loader2->expects($this->once())->method('getSource')->will($this->returnValue('content')); - - $loader = new Twig_Loader_Chain(); - $loader->addLoader($loader1); - $loader->addLoader($loader2); - - $this->assertTrue($loader->exists('foo')); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php deleted file mode 100644 index e07f374a..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php +++ /dev/null @@ -1,175 +0,0 @@ -getCacheKey($template); - $this->fail(); - } catch (Twig_Error_Loader $e) { - $this->assertNotContains('Unable to find template', $e->getMessage()); - } - } - - public function getSecurityTests() - { - return array( - array("AutoloaderTest\0.php"), - array('..\\AutoloaderTest.php'), - array('..\\\\\\AutoloaderTest.php'), - array('../AutoloaderTest.php'), - array('..////AutoloaderTest.php'), - array('./../AutoloaderTest.php'), - array('.\\..\\AutoloaderTest.php'), - array('././././././../AutoloaderTest.php'), - array('.\\./.\\./.\\./../AutoloaderTest.php'), - array('foo/../../AutoloaderTest.php'), - array('foo\\..\\..\\AutoloaderTest.php'), - array('foo/../bar/../../AutoloaderTest.php'), - array('foo/bar/../../../AutoloaderTest.php'), - array('filters/../../AutoloaderTest.php'), - array('filters//..//..//AutoloaderTest.php'), - array('filters\\..\\..\\AutoloaderTest.php'), - array('filters\\\\..\\\\..\\\\AutoloaderTest.php'), - array('filters\\//../\\/\\..\\AutoloaderTest.php'), - array('/../AutoloaderTest.php'), - ); - } - - public function testPaths() - { - $basePath = dirname(__FILE__).'/Fixtures'; - - $loader = new Twig_Loader_Filesystem(array($basePath.'/normal', $basePath.'/normal_bis')); - $loader->setPaths(array($basePath.'/named', $basePath.'/named_bis'), 'named'); - $loader->addPath($basePath.'/named_ter', 'named'); - $loader->addPath($basePath.'/normal_ter'); - $loader->prependPath($basePath.'/normal_final'); - $loader->prependPath($basePath.'/named/../named_quater', 'named'); - $loader->prependPath($basePath.'/named_final', 'named'); - - $this->assertEquals(array( - $basePath.'/normal_final', - $basePath.'/normal', - $basePath.'/normal_bis', - $basePath.'/normal_ter', - ), $loader->getPaths()); - $this->assertEquals(array( - $basePath.'/named_final', - $basePath.'/named/../named_quater', - $basePath.'/named', - $basePath.'/named_bis', - $basePath.'/named_ter', - ), $loader->getPaths('named')); - - $this->assertEquals( - realpath($basePath.'/named_quater/named_absolute.html'), - realpath($loader->getCacheKey('@named/named_absolute.html')) - ); - $this->assertEquals("path (final)\n", $loader->getSource('index.html')); - $this->assertEquals("path (final)\n", $loader->getSource('@__main__/index.html')); - $this->assertEquals("named path (final)\n", $loader->getSource('@named/index.html')); - } - - public function testEmptyConstructor() - { - $loader = new Twig_Loader_Filesystem(); - $this->assertEquals(array(), $loader->getPaths()); - } - - public function testGetNamespaces() - { - $loader = new Twig_Loader_Filesystem(sys_get_temp_dir()); - $this->assertEquals(array(Twig_Loader_Filesystem::MAIN_NAMESPACE), $loader->getNamespaces()); - - $loader->addPath(sys_get_temp_dir(), 'named'); - $this->assertEquals(array(Twig_Loader_Filesystem::MAIN_NAMESPACE, 'named'), $loader->getNamespaces()); - } - - public function testFindTemplateExceptionNamespace() - { - $basePath = dirname(__FILE__).'/Fixtures'; - - $loader = new Twig_Loader_Filesystem(array($basePath.'/normal')); - $loader->addPath($basePath.'/named', 'named'); - - try { - $loader->getSource('@named/nowhere.html'); - } catch (Exception $e) { - $this->assertInstanceof('Twig_Error_Loader', $e); - $this->assertContains('Unable to find template "@named/nowhere.html"', $e->getMessage()); - } - } - - public function testFindTemplateWithCache() - { - $basePath = dirname(__FILE__).'/Fixtures'; - - $loader = new Twig_Loader_Filesystem(array($basePath.'/normal')); - $loader->addPath($basePath.'/named', 'named'); - - // prime the cache for index.html in the named namespace - $namedSource = $loader->getSource('@named/index.html'); - $this->assertEquals("named path\n", $namedSource); - - // get index.html from the main namespace - $this->assertEquals("path\n", $loader->getSource('index.html')); - } - - public function testLoadTemplateAndRenderBlockWithCache() - { - $loader = new Twig_Loader_Filesystem(array()); - $loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme2'); - $loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme1'); - $loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme1', 'default_theme'); - - $twig = new Twig_Environment($loader); - - $template = $twig->loadTemplate('blocks.html.twig'); - $this->assertSame('block from theme 1', $template->renderBlock('b1', array())); - - $template = $twig->loadTemplate('blocks.html.twig'); - $this->assertSame('block from theme 2', $template->renderBlock('b2', array())); - } - - public function getArrayInheritanceTests() - { - return array( - 'valid array inheritance' => array('array_inheritance_valid_parent.html.twig'), - 'array inheritance with null first template' => array('array_inheritance_null_parent.html.twig'), - 'array inheritance with empty first template' => array('array_inheritance_empty_parent.html.twig'), - 'array inheritance with non-existent first template' => array('array_inheritance_nonexistent_parent.html.twig'), - ); - } - - /** - * @dataProvider getArrayInheritanceTests - * - * @param $templateName string Template name with array inheritance - */ - public function testArrayInheritance($templateName) - { - $loader = new Twig_Loader_Filesystem(array()); - $loader->addPath(dirname(__FILE__).'/Fixtures/inheritance'); - - $twig = new Twig_Environment($loader); - - $template = $twig->loadTemplate($templateName); - $this->assertSame('VALID Child', $template->renderBlock('body', array())); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig deleted file mode 100644 index 6977ebf6..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% extends ['','parent.html.twig'] %} - -{% block body %}{{ parent() }} Child{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig deleted file mode 100644 index 5b50a8b2..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% extends ['nonexistent.html.twig','parent.html.twig'] %} - -{% block body %}{{ parent() }} Child{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig deleted file mode 100644 index a16b3ade..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% extends [null,'parent.html.twig'] %} - -{% block body %}{{ parent() }} Child{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig deleted file mode 100644 index 4940dad4..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% extends ['parent.html.twig','spare_parent.html.twig'] %} - -{% block body %}{{ parent() }} Child{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig deleted file mode 100644 index d594c0ed..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% block body %}VALID{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig deleted file mode 100644 index 70b7360a..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% block body %}SPARE PARENT{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html deleted file mode 100644 index 9e5449c7..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html +++ /dev/null @@ -1 +0,0 @@ -named path diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html deleted file mode 100644 index d3a272b1..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html +++ /dev/null @@ -1 +0,0 @@ -named path (bis) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html deleted file mode 100644 index 9f05d150..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html +++ /dev/null @@ -1 +0,0 @@ -named path (final) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html deleted file mode 100644 index b1fb5f5d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html +++ /dev/null @@ -1 +0,0 @@ -named path (quater) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html deleted file mode 100644 index 24fb68ad..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html +++ /dev/null @@ -1 +0,0 @@ -named path (ter) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html deleted file mode 100644 index e7a8fd4d..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html +++ /dev/null @@ -1 +0,0 @@ -path diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html deleted file mode 100644 index bfa91604..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html +++ /dev/null @@ -1 +0,0 @@ -path (bis) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html deleted file mode 100644 index 73a089bb..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html +++ /dev/null @@ -1 +0,0 @@ -path (final) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html deleted file mode 100644 index b7ad97d8..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html +++ /dev/null @@ -1 +0,0 @@ -path (ter) diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig deleted file mode 100644 index dd0cbc2e..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% block b1 %}block from theme 1{% endblock %} - -{% block b2 %}block from theme 1{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig deleted file mode 100644 index 07cf9db0..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% use '@default_theme/blocks.html.twig' %} - -{% block b2 %}block from theme 2{% endblock %} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php deleted file mode 100644 index 942aff9e..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php +++ /dev/null @@ -1,33 +0,0 @@ -markTestSkipped('Skip under HHVM as the behavior is not the same as plain PHP (which is an edge case anyway)'); - } - - $twig = new Twig_Environment(new Twig_Loader_Array(array('index' => '{{ d1.date }}{{ d2.date }}')), array( - 'debug' => true, - 'cache' => false, - 'autoescape' => false, - )); - - $d1 = new DateTime(); - $d2 = new DateTime(); - $output = $twig->render('index', compact('d1', 'd2')); - - // If it fails, PHP will crash. - $this->assertEquals($output, $d1->date.$d2->date); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php deleted file mode 100644 index 25d16023..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php +++ /dev/null @@ -1,32 +0,0 @@ -assertEquals($body, $node->getNode('body')); - $this->assertTrue($node->getAttribute('value')); - } - - public function getTests() - { - $body = new Twig_Node(array(new Twig_Node_Text('foo', 1))); - $node = new Twig_Node_AutoEscape(true, $body, 1); - - return array( - array($node, "// line 1\necho \"foo\";"), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php deleted file mode 100644 index 84dac9bf..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php +++ /dev/null @@ -1,31 +0,0 @@ -assertEquals('foo', $node->getAttribute('name')); - } - - public function getTests() - { - return array( - array(new Twig_Node_BlockReference('foo', 1), <<displayBlock('foo', \$context, \$blocks); -EOF - ), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php deleted file mode 100644 index e7246dcc..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php +++ /dev/null @@ -1,39 +0,0 @@ -assertEquals($body, $node->getNode('body')); - $this->assertEquals('foo', $node->getAttribute('name')); - } - - public function getTests() - { - $body = new Twig_Node_Text('foo', 1); - $node = new Twig_Node_Block('foo', $body, 1); - - return array( - array($node, <<assertEquals($expr, $node->getNode('expr')); - } - - public function getTests() - { - $tests = array(); - - $expr = new Twig_Node_Expression_Constant('foo', 1); - $node = new Twig_Node_Do($expr, 1); - $tests[] = array($node, "// line 1\n\"foo\";"); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php deleted file mode 100644 index 4f83ab17..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php +++ /dev/null @@ -1,37 +0,0 @@ -assertEquals($foo, $node->getNode(1)); - } - - public function getTests() - { - $elements = array( - new Twig_Node_Expression_Constant('foo', 1), - new Twig_Node_Expression_Constant('bar', 1), - - new Twig_Node_Expression_Constant('bar', 1), - new Twig_Node_Expression_Constant('foo', 1), - ); - $node = new Twig_Node_Expression_Array($elements, 1); - - return array( - array($node, 'array("foo" => "bar", "bar" => "foo")'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php deleted file mode 100644 index bf365de4..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php +++ /dev/null @@ -1,29 +0,0 @@ -assertEquals('foo', $node->getAttribute('name')); - } - - public function getTests() - { - $node = new Twig_Node_Expression_AssignName('foo', 1); - - return array( - array($node, '$context["foo"]'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php deleted file mode 100644 index 02310a1b..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Add($left, $right, 1); - - return array( - array($node, '(1 + 2)'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php deleted file mode 100644 index 2df3c8e4..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_And($left, $right, 1); - - return array( - array($node, '(1 && 2)'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php deleted file mode 100644 index 759e4828..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Concat($left, $right, 1); - - return array( - array($node, '(1 . 2)'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php deleted file mode 100644 index 0e54b10a..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Div($left, $right, 1); - - return array( - array($node, '(1 / 2)'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php deleted file mode 100644 index 602888fd..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_FloorDiv($left, $right, 1); - - return array( - array($node, 'intval(floor((1 / 2)))'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php deleted file mode 100644 index 4c663c78..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Mod($left, $right, 1); - - return array( - array($node, '(1 % 2)'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php deleted file mode 100644 index e92c95e6..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Mul($left, $right, 1); - - return array( - array($node, '(1 * 2)'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php deleted file mode 100644 index ec37c83e..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Or($left, $right, 1); - - return array( - array($node, '(1 || 2)'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php deleted file mode 100644 index 061cb270..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Sub($left, $right, 1); - - return array( - array($node, '(1 - 2)'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php deleted file mode 100644 index 43afcd29..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php +++ /dev/null @@ -1,116 +0,0 @@ - 'function', 'name' => 'date')); - $this->assertEquals(array('U', null), $node->getArguments('date', array('format' => 'U', 'timestamp' => null))); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Positional arguments cannot be used after named arguments for function "date". - */ - public function testGetArgumentsWhenPositionalArgumentsAfterNamedArguments() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); - $node->getArguments('date', array('timestamp' => 123456, 'Y-m-d')); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Argument "format" is defined twice for function "date". - */ - public function testGetArgumentsWhenArgumentIsDefinedTwice() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); - $node->getArguments('date', array('Y-m-d', 'format' => 'U')); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown argument "unknown" for function "date(format, timestamp)". - */ - public function testGetArgumentsWithWrongNamedArgumentName() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); - $node->getArguments('date', array('Y-m-d', 'timestamp' => null, 'unknown' => '')); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown arguments "unknown1", "unknown2" for function "date(format, timestamp)". - */ - public function testGetArgumentsWithWrongNamedArgumentNames() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); - $node->getArguments('date', array('Y-m-d', 'timestamp' => null, 'unknown1' => '', 'unknown2' => '')); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Argument "case_sensitivity" could not be assigned for function "substr_compare(main_str, str, offset, length, case_sensitivity)" because it is mapped to an internal PHP function which cannot determine default value for optional argument "length". - */ - public function testResolveArgumentsWithMissingValueForOptionalArgument() - { - 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)'); - } - - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'substr_compare')); - $node->getArguments('substr_compare', array('abcd', 'bc', 'offset' => 1, 'case_sensitivity' => true)); - } - - public function testResolveArgumentsOnlyNecessaryArgumentsForCustomFunction() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'custom_function')); - - $this->assertEquals(array('arg1'), $node->getArguments(array($this, 'customFunction'), array('arg1' => 'arg1'))); - } - - public function testGetArgumentsForStaticMethod() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'custom_static_function')); - $this->assertEquals(array('arg1'), $node->getArguments(__CLASS__.'::customStaticFunction', array('arg1' => 'arg1'))); - } - - /** - * @expectedException LogicException - * @expectedExceptionMessage The last parameter of "Twig_Tests_Node_Expression_CallTest::customFunctionWithArbitraryArguments" for function "foo" must be an array with default value, eg. "array $arg = array()". - */ - public function testResolveArgumentsWithMissingParameterForArbitraryArguments() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'foo', 'is_variadic' => true)); - $node->getArguments(array($this, 'customFunctionWithArbitraryArguments'), array()); - } - - public static function customStaticFunction($arg1, $arg2 = 'default', $arg3 = array()) - { - } - - public function customFunction($arg1, $arg2 = 'default', $arg3 = array()) - { - } - - public function customFunctionWithArbitraryArguments() - { - } -} - -class Twig_Tests_Node_Expression_Call extends Twig_Node_Expression_Call -{ - public function getArguments($callable, $arguments) - { - return parent::getArguments($callable, $arguments); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php deleted file mode 100644 index a3e8badf..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php +++ /dev/null @@ -1,38 +0,0 @@ -assertEquals($expr1, $node->getNode('expr1')); - $this->assertEquals($expr2, $node->getNode('expr2')); - $this->assertEquals($expr3, $node->getNode('expr3')); - } - - public function getTests() - { - $tests = array(); - - $expr1 = new Twig_Node_Expression_Constant(1, 1); - $expr2 = new Twig_Node_Expression_Constant(2, 1); - $expr3 = new Twig_Node_Expression_Constant(3, 1); - $node = new Twig_Node_Expression_Conditional($expr1, $expr2, $expr3, 1); - $tests[] = array($node, '((1) ? (2) : (3))'); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php deleted file mode 100644 index 2ff93182..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php +++ /dev/null @@ -1,30 +0,0 @@ -assertEquals('foo', $node->getAttribute('value')); - } - - public function getTests() - { - $tests = array(); - - $node = new Twig_Node_Expression_Constant('foo', 1); - $tests[] = array($node, '"foo"'); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php deleted file mode 100644 index d5ffb244..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php +++ /dev/null @@ -1,154 +0,0 @@ -assertEquals($expr, $node->getNode('node')); - $this->assertEquals($name, $node->getNode('filter')); - $this->assertEquals($args, $node->getNode('arguments')); - } - - public function getTests() - { - $environment = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $environment->addFilter(new Twig_SimpleFilter('bar', 'bar', array('needs_environment' => true))); - $environment->addFilter(new Twig_SimpleFilter('barbar', 'twig_tests_filter_barbar', array('needs_context' => true, 'is_variadic' => true))); - - $tests = array(); - - $expr = new Twig_Node_Expression_Constant('foo', 1); - $node = $this->createFilter($expr, 'upper'); - $node = $this->createFilter($node, 'number_format', array(new Twig_Node_Expression_Constant(2, 1), new Twig_Node_Expression_Constant('.', 1), new Twig_Node_Expression_Constant(',', 1))); - - if (function_exists('mb_get_info')) { - $tests[] = array($node, 'twig_number_format_filter($this->env, twig_upper_filter($this->env, "foo"), 2, ".", ",")'); - } else { - $tests[] = array($node, 'twig_number_format_filter($this->env, strtoupper("foo"), 2, ".", ",")'); - } - - // named arguments - $date = new Twig_Node_Expression_Constant(0, 1); - $node = $this->createFilter($date, 'date', array( - 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), - 'format' => new Twig_Node_Expression_Constant('d/m/Y H:i:s P', 1), - )); - $tests[] = array($node, 'twig_date_format_filter($this->env, 0, "d/m/Y H:i:s P", "America/Chicago")'); - - // skip an optional argument - $date = new Twig_Node_Expression_Constant(0, 1); - $node = $this->createFilter($date, 'date', array( - 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), - )); - $tests[] = array($node, 'twig_date_format_filter($this->env, 0, null, "America/Chicago")'); - - // underscores vs camelCase for named arguments - $string = new Twig_Node_Expression_Constant('abc', 1); - $node = $this->createFilter($string, 'reverse', array( - 'preserve_keys' => new Twig_Node_Expression_Constant(true, 1), - )); - $tests[] = array($node, 'twig_reverse_filter($this->env, "abc", true)'); - $node = $this->createFilter($string, 'reverse', array( - 'preserveKeys' => new Twig_Node_Expression_Constant(true, 1), - )); - $tests[] = array($node, 'twig_reverse_filter($this->env, "abc", true)'); - - // filter as an anonymous function - if (PHP_VERSION_ID >= 50300) { - $node = $this->createFilter(new Twig_Node_Expression_Constant('foo', 1), 'anonymous'); - $tests[] = array($node, 'call_user_func_array($this->env->getFilter(\'anonymous\')->getCallable(), array("foo"))'); - } - - // needs environment - $node = $this->createFilter($string, 'bar'); - $tests[] = array($node, 'bar($this->env, "abc")', $environment); - - $node = $this->createFilter($string, 'bar', array(new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'bar($this->env, "abc", "bar")', $environment); - - // arbitrary named arguments - $node = $this->createFilter($string, 'barbar'); - $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc")', $environment); - - $node = $this->createFilter($string, 'barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", null, null, array("foo" => "bar"))', $environment); - - $node = $this->createFilter($string, 'barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", null, "bar")', $environment); - - $node = $this->createFilter($string, 'barbar', array( - new Twig_Node_Expression_Constant('1', 1), - new Twig_Node_Expression_Constant('2', 1), - new Twig_Node_Expression_Constant('3', 1), - 'foo' => new Twig_Node_Expression_Constant('bar', 1), - )); - $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", "1", "2", array(0 => "3", "foo" => "bar"))', $environment); - - return $tests; - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown argument "foobar" for filter "date(format, timezone)" at line 1. - */ - public function testCompileWithWrongNamedArgumentName() - { - $date = new Twig_Node_Expression_Constant(0, 1); - $node = $this->createFilter($date, 'date', array( - 'foobar' => new Twig_Node_Expression_Constant('America/Chicago', 1), - )); - - $compiler = $this->getCompiler(); - $compiler->compile($node); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Value for argument "from" is required for filter "replace". - */ - public function testCompileWithMissingNamedArgument() - { - $value = new Twig_Node_Expression_Constant(0, 1); - $node = $this->createFilter($value, 'replace', array( - 'to' => new Twig_Node_Expression_Constant('foo', 1), - )); - - $compiler = $this->getCompiler(); - $compiler->compile($node); - } - - protected function createFilter($node, $name, array $arguments = array()) - { - $name = new Twig_Node_Expression_Constant($name, 1); - $arguments = new Twig_Node($arguments); - - return new Twig_Node_Expression_Filter($node, $name, $arguments, 1); - } - - protected function getEnvironment() - { - if (PHP_VERSION_ID >= 50300) { - return include 'PHP53/FilterInclude.php'; - } - - return parent::getEnvironment(); - } -} - -function twig_tests_filter_barbar($context, $string, $arg1 = null, $arg2 = null, array $args = array()) -{ -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php deleted file mode 100644 index de2e0f8e..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php +++ /dev/null @@ -1,110 +0,0 @@ -assertEquals($name, $node->getAttribute('name')); - $this->assertEquals($args, $node->getNode('arguments')); - } - - public function getTests() - { - $environment = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $environment->addFunction(new Twig_SimpleFunction('foo', 'foo', array())); - $environment->addFunction(new Twig_SimpleFunction('bar', 'bar', array('needs_environment' => true))); - $environment->addFunction(new Twig_SimpleFunction('foofoo', 'foofoo', array('needs_context' => true))); - $environment->addFunction(new Twig_SimpleFunction('foobar', 'foobar', array('needs_environment' => true, 'needs_context' => true))); - $environment->addFunction(new Twig_SimpleFunction('barbar', 'twig_tests_function_barbar', array('is_variadic' => true))); - - $tests = array(); - - $node = $this->createFunction('foo'); - $tests[] = array($node, 'foo()', $environment); - - $node = $this->createFunction('foo', array(new Twig_Node_Expression_Constant('bar', 1), new Twig_Node_Expression_Constant('foobar', 1))); - $tests[] = array($node, 'foo("bar", "foobar")', $environment); - - $node = $this->createFunction('bar'); - $tests[] = array($node, 'bar($this->env)', $environment); - - $node = $this->createFunction('bar', array(new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'bar($this->env, "bar")', $environment); - - $node = $this->createFunction('foofoo'); - $tests[] = array($node, 'foofoo($context)', $environment); - - $node = $this->createFunction('foofoo', array(new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'foofoo($context, "bar")', $environment); - - $node = $this->createFunction('foobar'); - $tests[] = array($node, 'foobar($this->env, $context)', $environment); - - $node = $this->createFunction('foobar', array(new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'foobar($this->env, $context, "bar")', $environment); - - // named arguments - $node = $this->createFunction('date', array( - 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), - 'date' => new Twig_Node_Expression_Constant(0, 1), - )); - $tests[] = array($node, 'twig_date_converter($this->env, 0, "America/Chicago")'); - - // arbitrary named arguments - $node = $this->createFunction('barbar'); - $tests[] = array($node, 'twig_tests_function_barbar()', $environment); - - $node = $this->createFunction('barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_function_barbar(null, null, array("foo" => "bar"))', $environment); - - $node = $this->createFunction('barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_function_barbar(null, "bar")', $environment); - - $node = $this->createFunction('barbar', array( - new Twig_Node_Expression_Constant('1', 1), - new Twig_Node_Expression_Constant('2', 1), - new Twig_Node_Expression_Constant('3', 1), - 'foo' => new Twig_Node_Expression_Constant('bar', 1), - )); - $tests[] = array($node, 'twig_tests_function_barbar("1", "2", array(0 => "3", "foo" => "bar"))', $environment); - - // function as an anonymous function - if (PHP_VERSION_ID >= 50300) { - $node = $this->createFunction('anonymous', array(new Twig_Node_Expression_Constant('foo', 1))); - $tests[] = array($node, 'call_user_func_array($this->env->getFunction(\'anonymous\')->getCallable(), array("foo"))'); - } - - return $tests; - } - - protected function createFunction($name, array $arguments = array()) - { - return new Twig_Node_Expression_Function($name, new Twig_Node($arguments), 1); - } - - protected function getEnvironment() - { - if (PHP_VERSION_ID >= 50300) { - return include 'PHP53/FunctionInclude.php'; - } - - return parent::getEnvironment(); - } -} - -function twig_tests_function_barbar($arg1 = null, $arg2 = null, array $args = array()) -{ -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php deleted file mode 100644 index 2764478c..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php +++ /dev/null @@ -1,50 +0,0 @@ -addElement(new Twig_Node_Expression_Name('foo', 1)); - $args->addElement(new Twig_Node_Expression_Constant('bar', 1)); - $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ARRAY_CALL, 1); - - $this->assertEquals($expr, $node->getNode('node')); - $this->assertEquals($attr, $node->getNode('attribute')); - $this->assertEquals($args, $node->getNode('arguments')); - $this->assertEquals(Twig_Template::ARRAY_CALL, $node->getAttribute('type')); - } - - public function getTests() - { - $tests = array(); - - $expr = new Twig_Node_Expression_Name('foo', 1); - $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", array())', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))); - - $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', 1))); - - $args = new Twig_Node_Expression_Array(array(), 1); - $args->addElement(new Twig_Node_Expression_Name('foo', 1)); - $args->addElement(new Twig_Node_Expression_Constant('bar', 1)); - $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::METHOD_CALL, 1); - $tests[] = array($node, sprintf('%s%s, "bar", array(0 => %s, 1 => "bar"), "method")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1), $this->getVariableGetter('foo'))); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php deleted file mode 100644 index 8cbb2f76..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php +++ /dev/null @@ -1,35 +0,0 @@ -assertEquals('foo', $node->getAttribute('name')); - } - - public function getTests() - { - $node = new Twig_Node_Expression_Name('foo', 1); - $context = new Twig_Node_Expression_Name('_context', 1); - - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('strict_variables' => true)); - $env1 = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('strict_variables' => false)); - - return array( - array($node, "// line 1\n".(PHP_VERSION_ID >= 50400 ? '(isset($context["foo"]) ? $context["foo"] : $this->getContext($context, "foo"))' : '$this->getContext($context, "foo")'), $env), - array($node, $this->getVariableGetter('foo', 1), $env1), - array($context, "// line 1\n\$context"), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php deleted file mode 100644 index b5394bcf..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php +++ /dev/null @@ -1,6 +0,0 @@ -addFilter(new Twig_SimpleFilter('anonymous', function () {})); - -return $env; diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php deleted file mode 100644 index e8f68c72..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php +++ /dev/null @@ -1,6 +0,0 @@ -addFunction(new Twig_SimpleFunction('anonymous', function () {})); - -return $env; diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php deleted file mode 100644 index 9f818bc4..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php +++ /dev/null @@ -1,6 +0,0 @@ -addTest(new Twig_SimpleTest('anonymous', function () {})); - -return $env; diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php deleted file mode 100644 index ab2bbe07..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php +++ /dev/null @@ -1,28 +0,0 @@ -assertEquals('foo', $node->getAttribute('name')); - } - - public function getTests() - { - $tests = array(); - $tests[] = array(new Twig_Node_Expression_Parent('foo', 1), '$this->renderParentBlock("foo", $context, $blocks)'); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php deleted file mode 100644 index 55d3fcbf..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php +++ /dev/null @@ -1,82 +0,0 @@ -assertEquals($expr, $node->getNode('node')); - $this->assertEquals($args, $node->getNode('arguments')); - $this->assertEquals($name, $node->getAttribute('name')); - } - - public function getTests() - { - $environment = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $environment->addTest(new Twig_SimpleTest('barbar', 'twig_tests_test_barbar', array('is_variadic' => true, 'need_context' => true))); - - $tests = array(); - - $expr = new Twig_Node_Expression_Constant('foo', 1); - $node = new Twig_Node_Expression_Test_Null($expr, 'null', new Twig_Node(array()), 1); - $tests[] = array($node, '(null === "foo")'); - - // test as an anonymous function - if (PHP_VERSION_ID >= 50300) { - $node = $this->createTest(new Twig_Node_Expression_Constant('foo', 1), 'anonymous', array(new Twig_Node_Expression_Constant('foo', 1))); - $tests[] = array($node, 'call_user_func_array($this->env->getTest(\'anonymous\')->getCallable(), array("foo", "foo"))'); - } - - // arbitrary named arguments - $string = new Twig_Node_Expression_Constant('abc', 1); - $node = $this->createTest($string, 'barbar'); - $tests[] = array($node, 'twig_tests_test_barbar("abc")', $environment); - - $node = $this->createTest($string, 'barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_test_barbar("abc", null, null, array("foo" => "bar"))', $environment); - - $node = $this->createTest($string, 'barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_test_barbar("abc", null, "bar")', $environment); - - $node = $this->createTest($string, 'barbar', array( - new Twig_Node_Expression_Constant('1', 1), - new Twig_Node_Expression_Constant('2', 1), - new Twig_Node_Expression_Constant('3', 1), - 'foo' => new Twig_Node_Expression_Constant('bar', 1), - )); - $tests[] = array($node, 'twig_tests_test_barbar("abc", "1", "2", array(0 => "3", "foo" => "bar"))', $environment); - - return $tests; - } - - protected function createTest($node, $name, array $arguments = array()) - { - return new Twig_Node_Expression_Test($node, $name, new Twig_Node($arguments), 1); - } - - protected function getEnvironment() - { - if (PHP_VERSION_ID >= 50300) { - return include 'PHP53/TestInclude.php'; - } - - return parent::getEnvironment(); - } -} - -function twig_tests_test_barbar($string, $arg1 = null, $arg2 = null, array $args = array()) -{ -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php deleted file mode 100644 index b6333711..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php +++ /dev/null @@ -1,32 +0,0 @@ -assertEquals($expr, $node->getNode('node')); - } - - public function getTests() - { - $node = new Twig_Node_Expression_Constant(1, 1); - $node = new Twig_Node_Expression_Unary_Neg($node, 1); - - return array( - array($node, '-1'), - array(new Twig_Node_Expression_Unary_Neg($node, 1), '- -1'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php deleted file mode 100644 index d7c6f85e..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php +++ /dev/null @@ -1,31 +0,0 @@ -assertEquals($expr, $node->getNode('node')); - } - - public function getTests() - { - $node = new Twig_Node_Expression_Constant(1, 1); - $node = new Twig_Node_Expression_Unary_Not($node, 1); - - return array( - array($node, '!1'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php deleted file mode 100644 index 057250f3..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php +++ /dev/null @@ -1,31 +0,0 @@ -assertEquals($expr, $node->getNode('node')); - } - - public function getTests() - { - $node = new Twig_Node_Expression_Constant(1, 1); - $node = new Twig_Node_Expression_Unary_Pos($node, 1); - - return array( - array($node, '+1'), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php deleted file mode 100644 index b2c6fa42..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php +++ /dev/null @@ -1,191 +0,0 @@ -setAttribute('with_loop', false); - - $this->assertEquals($keyTarget, $node->getNode('key_target')); - $this->assertEquals($valueTarget, $node->getNode('value_target')); - $this->assertEquals($seq, $node->getNode('seq')); - $this->assertTrue($node->getAttribute('ifexpr')); - $this->assertEquals('Twig_Node_If', get_class($node->getNode('body'))); - $this->assertEquals($body, $node->getNode('body')->getNode('tests')->getNode(1)->getNode(0)); - $this->assertNull($node->getNode('else')); - - $else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1); - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); - $node->setAttribute('with_loop', false); - $this->assertEquals($else, $node->getNode('else')); - } - - public function getTests() - { - $tests = array(); - - $keyTarget = new Twig_Node_Expression_AssignName('key', 1); - $valueTarget = new Twig_Node_Expression_AssignName('item', 1); - $seq = new Twig_Node_Expression_Name('items', 1); - $ifexpr = null; - $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); - $else = null; - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); - $node->setAttribute('with_loop', false); - - $tests[] = array($node, <<getVariableGetter('items')}); -foreach (\$context['_seq'] as \$context["key"] => \$context["item"]) { - echo {$this->getVariableGetter('foo')}; -} -\$_parent = \$context['_parent']; -unset(\$context['_seq'], \$context['_iterated'], \$context['key'], \$context['item'], \$context['_parent'], \$context['loop']); -\$context = array_intersect_key(\$context, \$_parent) + \$_parent; -EOF - ); - - $keyTarget = new Twig_Node_Expression_AssignName('k', 1); - $valueTarget = new Twig_Node_Expression_AssignName('v', 1); - $seq = new Twig_Node_Expression_Name('values', 1); - $ifexpr = null; - $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); - $else = null; - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); - $node->setAttribute('with_loop', true); - - $tests[] = array($node, <<getVariableGetter('values')}); -\$context['loop'] = array( - 'parent' => \$context['_parent'], - 'index0' => 0, - 'index' => 1, - 'first' => true, -); -if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) { - \$length = count(\$context['_seq']); - \$context['loop']['revindex0'] = \$length - 1; - \$context['loop']['revindex'] = \$length; - \$context['loop']['length'] = \$length; - \$context['loop']['last'] = 1 === \$length; -} -foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { - echo {$this->getVariableGetter('foo')}; - ++\$context['loop']['index0']; - ++\$context['loop']['index']; - \$context['loop']['first'] = false; - if (isset(\$context['loop']['length'])) { - --\$context['loop']['revindex0']; - --\$context['loop']['revindex']; - \$context['loop']['last'] = 0 === \$context['loop']['revindex0']; - } -} -\$_parent = \$context['_parent']; -unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); -\$context = array_intersect_key(\$context, \$_parent) + \$_parent; -EOF - ); - - $keyTarget = new Twig_Node_Expression_AssignName('k', 1); - $valueTarget = new Twig_Node_Expression_AssignName('v', 1); - $seq = new Twig_Node_Expression_Name('values', 1); - $ifexpr = new Twig_Node_Expression_Constant(true, 1); - $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); - $else = null; - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); - $node->setAttribute('with_loop', true); - - $tests[] = array($node, <<getVariableGetter('values')}); -\$context['loop'] = array( - 'parent' => \$context['_parent'], - 'index0' => 0, - 'index' => 1, - 'first' => true, -); -foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { - if (true) { - echo {$this->getVariableGetter('foo')}; - ++\$context['loop']['index0']; - ++\$context['loop']['index']; - \$context['loop']['first'] = false; - } -} -\$_parent = \$context['_parent']; -unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); -\$context = array_intersect_key(\$context, \$_parent) + \$_parent; -EOF - ); - - $keyTarget = new Twig_Node_Expression_AssignName('k', 1); - $valueTarget = new Twig_Node_Expression_AssignName('v', 1); - $seq = new Twig_Node_Expression_Name('values', 1); - $ifexpr = null; - $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); - $else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1); - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); - $node->setAttribute('with_loop', true); - - $tests[] = array($node, <<getVariableGetter('values')}); -\$context['_iterated'] = false; -\$context['loop'] = array( - 'parent' => \$context['_parent'], - 'index0' => 0, - 'index' => 1, - 'first' => true, -); -if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) { - \$length = count(\$context['_seq']); - \$context['loop']['revindex0'] = \$length - 1; - \$context['loop']['revindex'] = \$length; - \$context['loop']['length'] = \$length; - \$context['loop']['last'] = 1 === \$length; -} -foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { - echo {$this->getVariableGetter('foo')}; - \$context['_iterated'] = true; - ++\$context['loop']['index0']; - ++\$context['loop']['index']; - \$context['loop']['first'] = false; - if (isset(\$context['loop']['length'])) { - --\$context['loop']['revindex0']; - --\$context['loop']['revindex']; - \$context['loop']['last'] = 0 === \$context['loop']['revindex0']; - } -} -if (!\$context['_iterated']) { - echo {$this->getVariableGetter('foo')}; -} -\$_parent = \$context['_parent']; -unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); -\$context = array_intersect_key(\$context, \$_parent) + \$_parent; -EOF - ); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php deleted file mode 100644 index e47dd654..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php +++ /dev/null @@ -1,88 +0,0 @@ -assertEquals($t, $node->getNode('tests')); - $this->assertNull($node->getNode('else')); - - $else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1); - $node = new Twig_Node_If($t, $else, 1); - $this->assertEquals($else, $node->getNode('else')); - } - - public function getTests() - { - $tests = array(); - - $t = new Twig_Node(array( - new Twig_Node_Expression_Constant(true, 1), - new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1), - ), array(), 1); - $else = null; - $node = new Twig_Node_If($t, $else, 1); - - $tests[] = array($node, <<getVariableGetter('foo')}; -} -EOF - ); - - $t = new Twig_Node(array( - new Twig_Node_Expression_Constant(true, 1), - new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1), - new Twig_Node_Expression_Constant(false, 1), - new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1), - ), array(), 1); - $else = null; - $node = new Twig_Node_If($t, $else, 1); - - $tests[] = array($node, <<getVariableGetter('foo')}; -} elseif (false) { - echo {$this->getVariableGetter('bar')}; -} -EOF - ); - - $t = new Twig_Node(array( - new Twig_Node_Expression_Constant(true, 1), - new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1), - ), array(), 1); - $else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1); - $node = new Twig_Node_If($t, $else, 1); - - $tests[] = array($node, <<getVariableGetter('foo')}; -} else { - echo {$this->getVariableGetter('bar')}; -} -EOF - ); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php deleted file mode 100644 index 36525b25..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php +++ /dev/null @@ -1,40 +0,0 @@ -assertEquals($macro, $node->getNode('expr')); - $this->assertEquals($var, $node->getNode('var')); - } - - public function getTests() - { - $tests = array(); - - $macro = new Twig_Node_Expression_Constant('foo.twig', 1); - $var = new Twig_Node_Expression_AssignName('macro', 1); - $node = new Twig_Node_Import($macro, $var, 1); - - $tests[] = array($node, <<loadTemplate("foo.twig", null, 1); -EOF - ); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php deleted file mode 100644 index 6fe5c17b..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php +++ /dev/null @@ -1,83 +0,0 @@ -assertNull($node->getNode('variables')); - $this->assertEquals($expr, $node->getNode('expr')); - $this->assertFalse($node->getAttribute('only')); - - $vars = new Twig_Node_Expression_Array(array(new Twig_Node_Expression_Constant('foo', 1), new Twig_Node_Expression_Constant(true, 1)), 1); - $node = new Twig_Node_Include($expr, $vars, true, false, 1); - $this->assertEquals($vars, $node->getNode('variables')); - $this->assertTrue($node->getAttribute('only')); - } - - public function getTests() - { - $tests = array(); - - $expr = new Twig_Node_Expression_Constant('foo.twig', 1); - $node = new Twig_Node_Include($expr, null, false, false, 1); - $tests[] = array($node, <<loadTemplate("foo.twig", null, 1)->display(\$context); -EOF - ); - - $expr = new Twig_Node_Expression_Conditional( - new Twig_Node_Expression_Constant(true, 1), - new Twig_Node_Expression_Constant('foo', 1), - new Twig_Node_Expression_Constant('foo', 1), - 0 - ); - $node = new Twig_Node_Include($expr, null, false, false, 1); - $tests[] = array($node, <<loadTemplate(((true) ? ("foo") : ("foo")), null, 1)->display(\$context); -EOF - ); - - $expr = new Twig_Node_Expression_Constant('foo.twig', 1); - $vars = new Twig_Node_Expression_Array(array(new Twig_Node_Expression_Constant('foo', 1), new Twig_Node_Expression_Constant(true, 1)), 1); - $node = new Twig_Node_Include($expr, $vars, false, false, 1); - $tests[] = array($node, <<loadTemplate("foo.twig", null, 1)->display(array_merge(\$context, array("foo" => true))); -EOF - ); - - $node = new Twig_Node_Include($expr, $vars, true, false, 1); - $tests[] = array($node, <<loadTemplate("foo.twig", null, 1)->display(array("foo" => true)); -EOF - ); - - $node = new Twig_Node_Include($expr, $vars, true, true, 1); - $tests[] = array($node, <<loadTemplate("foo.twig", null, 1)->display(array("foo" => true)); -} catch (Twig_Error_Loader \$e) { - // ignore missing template -} -EOF - ); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php deleted file mode 100644 index 901e57b9..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php +++ /dev/null @@ -1,70 +0,0 @@ -assertEquals($body, $node->getNode('body')); - $this->assertEquals($arguments, $node->getNode('arguments')); - $this->assertEquals('foo', $node->getAttribute('name')); - } - - public function getTests() - { - $body = new Twig_Node_Text('foo', 1); - $arguments = new Twig_Node(array( - 'foo' => new Twig_Node_Expression_Constant(null, 1), - 'bar' => new Twig_Node_Expression_Constant('Foo', 1), - ), array(), 1); - $node = new Twig_Node_Macro('foo', $body, $arguments, 1); - - if (PHP_VERSION_ID >= 50600) { - $declaration = ', ...$__varargs__'; - $varargs = '$__varargs__'; - } else { - $declaration = ''; - $varargs = 'func_num_args() > 2 ? array_slice(func_get_args(), 2) : array()'; - } - - return array( - array($node, <<env->mergeGlobals(array( - "foo" => \$__foo__, - "bar" => \$__bar__, - "varargs" => $varargs, - )); - - \$blocks = array(); - - ob_start(); - try { - echo "foo"; - } catch (Exception \$e) { - ob_end_clean(); - - throw \$e; - } - - return ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset()); -} -EOF - ), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php deleted file mode 100644 index 35b3e2e8..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php +++ /dev/null @@ -1,183 +0,0 @@ -assertEquals($body, $node->getNode('body')); - $this->assertEquals($blocks, $node->getNode('blocks')); - $this->assertEquals($macros, $node->getNode('macros')); - $this->assertEquals($parent, $node->getNode('parent')); - $this->assertEquals($filename, $node->getAttribute('filename')); - } - - public function getTests() - { - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - - $tests = array(); - - $body = new Twig_Node_Text('foo', 1); - $extends = null; - $blocks = new Twig_Node(); - $macros = new Twig_Node(); - $traits = new Twig_Node(); - $filename = 'foo.twig'; - - $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); - $tests[] = array($node, <<parent = false; - - \$this->blocks = array( - ); - } - - protected function doDisplay(array \$context, array \$blocks = array()) - { - // line 1 - echo "foo"; - } - - public function getTemplateName() - { - return "foo.twig"; - } - - public function getDebugInfo() - { - return array ( 19 => 1,); - } -} -EOF - , $twig, true); - - $import = new Twig_Node_Import(new Twig_Node_Expression_Constant('foo.twig', 1), new Twig_Node_Expression_AssignName('macro', 1), 2); - - $body = new Twig_Node(array($import)); - $extends = new Twig_Node_Expression_Constant('layout.twig', 1); - - $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); - $tests[] = array($node, <<parent = \$this->loadTemplate("layout.twig", "foo.twig", 1); - \$this->blocks = array( - ); - } - - protected function doGetParent(array \$context) - { - return "layout.twig"; - } - - protected function doDisplay(array \$context, array \$blocks = array()) - { - // line 2 - \$context["macro"] = \$this->loadTemplate("foo.twig", "foo.twig", 2); - // line 1 - \$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks)); - } - - public function getTemplateName() - { - return "foo.twig"; - } - - public function isTraitable() - { - return false; - } - - public function getDebugInfo() - { - return array ( 26 => 1, 24 => 2, 11 => 1,); - } -} -EOF - , $twig, true); - - $set = new Twig_Node_Set(false, new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 4))), new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 4))), 4); - $body = new Twig_Node(array($set)); - $extends = new Twig_Node_Expression_Conditional( - new Twig_Node_Expression_Constant(true, 2), - new Twig_Node_Expression_Constant('foo', 2), - new Twig_Node_Expression_Constant('foo', 2), - 2 - ); - - $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); - $tests[] = array($node, <<loadTemplate(((true) ? ("foo") : ("foo")), "foo.twig", 2); - } - - protected function doDisplay(array \$context, array \$blocks = array()) - { - // line 4 - \$context["foo"] = "foo"; - // line 2 - \$this->getParent(\$context)->display(\$context, array_merge(\$this->blocks, \$blocks)); - } - - public function getTemplateName() - { - return "foo.twig"; - } - - public function isTraitable() - { - return false; - } - - public function getDebugInfo() - { - return array ( 17 => 2, 15 => 4, 9 => 2,); - } -} -EOF - , $twig, true); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php deleted file mode 100644 index 4e0990fa..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php +++ /dev/null @@ -1,29 +0,0 @@ -assertEquals($expr, $node->getNode('expr')); - } - - public function getTests() - { - $tests = array(); - $tests[] = array(new Twig_Node_Print(new Twig_Node_Expression_Constant('foo', 1), 1), "// line 1\necho \"foo\";"); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php deleted file mode 100644 index 46ecf973..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php +++ /dev/null @@ -1,44 +0,0 @@ -assertEquals($body, $node->getNode('body')); - } - - public function getTests() - { - $tests = array(); - - $body = new Twig_Node_Text('foo', 1); - $node = new Twig_Node_Sandbox($body, 1); - - $tests[] = array($node, <<env->getExtension('sandbox'); -if (!\$alreadySandboxed = \$sandbox->isSandboxed()) { - \$sandbox->enableSandbox(); -} -echo "foo"; -if (!\$alreadySandboxed) { - \$sandbox->disableSandbox(); -} -EOF - ); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php deleted file mode 100644 index 05e1854c..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php +++ /dev/null @@ -1,33 +0,0 @@ -assertEquals($expr, $node->getNode('expr')); - } - - public function getTests() - { - $tests = array(); - - $tests[] = array(new Twig_Node_SandboxedPrint(new Twig_Node_Expression_Constant('foo', 1), 1), <<env->getExtension('sandbox')->ensureToStringAllowed("foo"); -EOF - ); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php deleted file mode 100644 index 62ad2803..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php +++ /dev/null @@ -1,69 +0,0 @@ -assertEquals($names, $node->getNode('names')); - $this->assertEquals($values, $node->getNode('values')); - $this->assertFalse($node->getAttribute('capture')); - } - - public function getTests() - { - $tests = array(); - - $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1); - $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 1)), array(), 1); - $node = new Twig_Node_Set(false, $names, $values, 1); - $tests[] = array($node, <<env->getCharset()); -EOF - ); - - $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1); - $values = new Twig_Node_Text('foo', 1); - $node = new Twig_Node_Set(true, $names, $values, 1); - $tests[] = array($node, <<env->getCharset()); -EOF - ); - - $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1), new Twig_Node_Expression_AssignName('bar', 1)), array(), 1); - $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 1), new Twig_Node_Expression_Name('bar', 1)), array(), 1); - $node = new Twig_Node_Set(false, $names, $values, 1); - $tests[] = array($node, <<getVariableGetter('bar')}); -EOF - ); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php deleted file mode 100644 index 222ca092..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php +++ /dev/null @@ -1,37 +0,0 @@ -
    foo
    ', 1))); - $node = new Twig_Node_Spaceless($body, 1); - - $this->assertEquals($body, $node->getNode('body')); - } - - public function getTests() - { - $body = new Twig_Node(array(new Twig_Node_Text('
    foo
    ', 1))); - $node = new Twig_Node_Spaceless($body, 1); - - return array( - array($node, <<
    foo
    "; -echo trim(preg_replace('/>\s+<', ob_get_clean())); -EOF - ), - ); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php deleted file mode 100644 index ceaf67f4..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php +++ /dev/null @@ -1,28 +0,0 @@ -assertEquals('foo', $node->getAttribute('data')); - } - - public function getTests() - { - $tests = array(); - $tests[] = array(new Twig_Node_Text('foo', 1), "// line 1\necho \"foo\";"); - - return $tests; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php deleted file mode 100644 index b5ea7aac..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php +++ /dev/null @@ -1,124 +0,0 @@ -getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - - $stream = $env->parse($env->tokenize('{{ block("foo") }}', 'index')); - - $node = $stream->getNode('body')->getNode(0); - - $this->assertEquals('Twig_Node_Expression_BlockReference', get_class($node)); - $this->assertTrue($node->getAttribute('output')); - } - - public function testRenderParentBlockOptimizer() - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - - $stream = $env->parse($env->tokenize('{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}', 'index')); - - $node = $stream->getNode('blocks')->getNode('content')->getNode(0)->getNode('body'); - - $this->assertEquals('Twig_Node_Expression_Parent', get_class($node)); - $this->assertTrue($node->getAttribute('output')); - } - - public function testRenderVariableBlockOptimizer() - { - if (PHP_VERSION_ID >= 50400) { - return; - } - - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false)); - $stream = $env->parse($env->tokenize('{{ block(name|lower) }}', 'index')); - - $node = $stream->getNode('body')->getNode(0)->getNode(1); - - $this->assertEquals('Twig_Node_Expression_BlockReference', get_class($node)); - $this->assertTrue($node->getAttribute('output')); - } - - /** - * @dataProvider getTestsForForOptimizer - */ - public function testForOptimizer($template, $expected) - { - $env = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false)); - - $stream = $env->parse($env->tokenize($template, 'index')); - - foreach ($expected as $target => $withLoop) { - $this->assertTrue($this->checkForConfiguration($stream, $target, $withLoop), sprintf('variable %s is %soptimized', $target, $withLoop ? 'not ' : '')); - } - } - - public function getTestsForForOptimizer() - { - return array( - array('{% for i in foo %}{% endfor %}', array('i' => false)), - - array('{% for i in foo %}{{ loop.index }}{% endfor %}', array('i' => true)), - - array('{% for i in foo %}{% for j in foo %}{% endfor %}{% endfor %}', array('i' => false, 'j' => false)), - - array('{% for i in foo %}{% include "foo" %}{% endfor %}', array('i' => true)), - - array('{% for i in foo %}{% include "foo" only %}{% endfor %}', array('i' => false)), - - array('{% for i in foo %}{% include "foo" with { "foo": "bar" } only %}{% endfor %}', array('i' => false)), - - array('{% for i in foo %}{% include "foo" with { "foo": loop.index } only %}{% endfor %}', array('i' => true)), - - array('{% for i in foo %}{% for j in foo %}{{ loop.index }}{% endfor %}{% endfor %}', array('i' => false, 'j' => true)), - - array('{% for i in foo %}{% for j in foo %}{{ loop.parent.loop.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => true)), - - array('{% for i in foo %}{% set l = loop %}{% for j in foo %}{{ l.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => false)), - - array('{% for i in foo %}{% for j in foo %}{{ foo.parent.loop.index }}{% endfor %}{% endfor %}', array('i' => false, 'j' => false)), - - array('{% for i in foo %}{% for j in foo %}{{ loop["parent"].loop.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => true)), - - array('{% for i in foo %}{{ include("foo") }}{% endfor %}', array('i' => true)), - - array('{% for i in foo %}{{ include("foo", with_context = false) }}{% endfor %}', array('i' => false)), - - array('{% for i in foo %}{{ include("foo", with_context = true) }}{% endfor %}', array('i' => true)), - - array('{% for i in foo %}{{ include("foo", { "foo": "bar" }, with_context = false) }}{% endfor %}', array('i' => false)), - - array('{% for i in foo %}{{ include("foo", { "foo": loop.index }, with_context = false) }}{% endfor %}', array('i' => true)), - ); - } - - public function checkForConfiguration(Twig_NodeInterface $node = null, $target, $withLoop) - { - if (null === $node) { - return; - } - - foreach ($node as $n) { - if ($n instanceof Twig_Node_For) { - if ($target === $n->getNode('value_target')->getAttribute('name')) { - return $withLoop == $n->getAttribute('with_loop'); - } - } - - $ret = $this->checkForConfiguration($n, $target, $withLoop); - if (null !== $ret) { - return $ret; - } - } - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/ParserTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/ParserTest.php deleted file mode 100644 index 01daf309..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/ParserTest.php +++ /dev/null @@ -1,196 +0,0 @@ -getParser(); - $parser->setMacro('parent', $this->getMock('Twig_Node_Macro', array(), array(), '', null)); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "foo" tag. Did you mean "for" at line 1? - */ - public function testUnknownTag() - { - $stream = new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 1), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), - new Twig_Token(Twig_Token::EOF_TYPE, '', 1), - )); - $parser = new Twig_Parser(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $parser->parse($stream); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "foobar" tag at line 1. - */ - public function testUnknownTagWithoutSuggestions() - { - $stream = new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'foobar', 1), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), - new Twig_Token(Twig_Token::EOF_TYPE, '', 1), - )); - $parser = new Twig_Parser(new Twig_Environment($this->getMock('Twig_LoaderInterface'))); - $parser->parse($stream); - } - - /** - * @dataProvider getFilterBodyNodesData - */ - public function testFilterBodyNodes($input, $expected) - { - $parser = $this->getParser(); - - $this->assertEquals($expected, $parser->filterBodyNodes($input)); - } - - public function getFilterBodyNodesData() - { - return array( - array( - new Twig_Node(array(new Twig_Node_Text(' ', 1))), - new Twig_Node(array()), - ), - array( - $input = new Twig_Node(array(new Twig_Node_Set(false, new Twig_Node(), new Twig_Node(), 1))), - $input, - ), - array( - $input = new Twig_Node(array(new Twig_Node_Set(true, new Twig_Node(), new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 1))))), 1))), - $input, - ), - ); - } - - /** - * @dataProvider getFilterBodyNodesDataThrowsException - * @expectedException Twig_Error_Syntax - */ - public function testFilterBodyNodesThrowsException($input) - { - $parser = $this->getParser(); - - $parser->filterBodyNodes($input); - } - - public function getFilterBodyNodesDataThrowsException() - { - return array( - array(new Twig_Node_Text('foo', 1)), - array(new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 1)))))), - ); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage A template that extends another one cannot have a body but a byte order mark (BOM) has been detected; it must be removed at line 1. - */ - public function testFilterBodyNodesWithBOM() - { - $parser = $this->getParser(); - $parser->filterBodyNodes(new Twig_Node_Text(chr(0xEF).chr(0xBB).chr(0xBF), 1)); - } - - public function testParseIsReentrant() - { - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array( - 'autoescape' => false, - 'optimizations' => 0, - )); - $twig->addTokenParser(new TestTokenParser()); - - $parser = new Twig_Parser($twig); - - $parser->parse(new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'test', 1), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), - new Twig_Token(Twig_Token::VAR_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 1), - new Twig_Token(Twig_Token::VAR_END_TYPE, '', 1), - new Twig_Token(Twig_Token::EOF_TYPE, '', 1), - ))); - - $this->assertNull($parser->getParent()); - } - - // The getVarName() must not depend on the template loaders, - // If this test does not throw any exception, that's good. - // see https://github.com/symfony/symfony/issues/4218 - public function testGetVarName() - { - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array( - 'autoescape' => false, - 'optimizations' => 0, - )); - - $twig->parse($twig->tokenize(<<getMock('Twig_LoaderInterface'))); - $parser->setParent(new Twig_Node()); - $parser->stream = $this->getMockBuilder('Twig_TokenStream')->disableOriginalConstructor()->getMock(); - - return $parser; - } -} - -class TestParser extends Twig_Parser -{ - public $stream; - - public function filterBodyNodes(Twig_NodeInterface $node) - { - return parent::filterBodyNodes($node); - } -} - -class TestTokenParser extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - // simulate the parsing of another template right in the middle of the parsing of the current template - $this->parser->parse(new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'extends', 1), - new Twig_Token(Twig_Token::STRING_TYPE, 'base', 1), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), - new Twig_Token(Twig_Token::EOF_TYPE, '', 1), - ))); - - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node(array()); - } - - public function getTag() - { - return 'test'; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php deleted file mode 100644 index da97f478..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php +++ /dev/null @@ -1,101 +0,0 @@ -getMockBuilder('Twig_Profiler_Profile')->disableOriginalConstructor()->getMock(); - - $profile->expects($this->any())->method('isRoot')->will($this->returnValue(true)); - $profile->expects($this->any())->method('getName')->will($this->returnValue('main')); - $profile->expects($this->any())->method('getDuration')->will($this->returnValue(1)); - $profile->expects($this->any())->method('getMemoryUsage')->will($this->returnValue(0)); - $profile->expects($this->any())->method('getPeakMemoryUsage')->will($this->returnValue(0)); - - $subProfiles = array( - $this->getIndexProfile( - array( - $this->getEmbeddedBlockProfile(), - $this->getEmbeddedTemplateProfile( - array( - $this->getIncludedTemplateProfile(), - ) - ), - $this->getMacroProfile(), - $this->getEmbeddedTemplateProfile( - array( - $this->getIncludedTemplateProfile(), - ) - ), - ) - ), - ); - - $profile->expects($this->any())->method('getProfiles')->will($this->returnValue($subProfiles)); - $profile->expects($this->any())->method('getIterator')->will($this->returnValue(new ArrayIterator($subProfiles))); - - return $profile; - } - - private function getIndexProfile(array $subProfiles = array()) - { - return $this->generateProfile('main', 1, true, 'template', 'index.twig', $subProfiles); - } - - private function getEmbeddedBlockProfile(array $subProfiles = array()) - { - return $this->generateProfile('body', 0.0001, false, 'block', 'embedded.twig', $subProfiles); - } - - private function getEmbeddedTemplateProfile(array $subProfiles = array()) - { - return $this->generateProfile('main', 0.0001, true, 'template', 'embedded.twig', $subProfiles); - } - - private function getIncludedTemplateProfile(array $subProfiles = array()) - { - return $this->generateProfile('main', 0.0001, true, 'template', 'included.twig', $subProfiles); - } - - private function getMacroProfile(array $subProfiles = array()) - { - return $this->generateProfile('foo', 0.0001, false, 'macro', 'index.twig', $subProfiles); - } - - /** - * @param string $name - * @param float $duration - * @param bool $isTemplate - * @param string $type - * @param string $templateName - * @param array $subProfiles - * - * @return Twig_Profiler_Profile - */ - private function generateProfile($name, $duration, $isTemplate, $type, $templateName, array $subProfiles = array()) - { - $profile = $this->getMockBuilder('Twig_Profiler_Profile')->disableOriginalConstructor()->getMock(); - - $profile->expects($this->any())->method('isRoot')->will($this->returnValue(false)); - $profile->expects($this->any())->method('getName')->will($this->returnValue($name)); - $profile->expects($this->any())->method('getDuration')->will($this->returnValue($duration)); - $profile->expects($this->any())->method('getMemoryUsage')->will($this->returnValue(0)); - $profile->expects($this->any())->method('getPeakMemoryUsage')->will($this->returnValue(0)); - $profile->expects($this->any())->method('isTemplate')->will($this->returnValue($isTemplate)); - $profile->expects($this->any())->method('getType')->will($this->returnValue($type)); - $profile->expects($this->any())->method('getTemplate')->will($this->returnValue($templateName)); - $profile->expects($this->any())->method('getProfiles')->will($this->returnValue($subProfiles)); - $profile->expects($this->any())->method('getIterator')->will($this->returnValue(new ArrayIterator($subProfiles))); - - return $profile; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php deleted file mode 100644 index 1a1b9d29..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php +++ /dev/null @@ -1,32 +0,0 @@ -assertStringMatchesFormat(<<index.twig//1 %d %d %d -index.twig==>embedded.twig::block(body)//1 %d %d 0 -index.twig==>embedded.twig//2 %d %d %d -embedded.twig==>included.twig//2 %d %d %d -index.twig==>index.twig::macro(foo)//1 %d %d %d -EOF - , $dumper->dump($this->getProfile())); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php deleted file mode 100644 index 66a68c4b..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php +++ /dev/null @@ -1,30 +0,0 @@ -assertStringMatchesFormat(<<main %d.%dms/%d% -└ index.twig %d.%dms/%d% - └ embedded.twig::block(body) - └ embedded.twig - │ └ included.twig - └ index.twig::macro(foo) - └ embedded.twig - └ included.twig - -EOF - , $dumper->dump($this->getProfile())); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php deleted file mode 100644 index e2ea165a..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php +++ /dev/null @@ -1,30 +0,0 @@ -assertStringMatchesFormat(<<dump($this->getProfile())); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php deleted file mode 100644 index f786f06c..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php +++ /dev/null @@ -1,100 +0,0 @@ -assertEquals('template', $profile->getTemplate()); - $this->assertEquals('type', $profile->getType()); - $this->assertEquals('name', $profile->getName()); - } - - public function testIsRoot() - { - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); - $this->assertTrue($profile->isRoot()); - - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::TEMPLATE); - $this->assertFalse($profile->isRoot()); - } - - public function testIsTemplate() - { - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::TEMPLATE); - $this->assertTrue($profile->isTemplate()); - - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); - $this->assertFalse($profile->isTemplate()); - } - - public function testIsBlock() - { - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::BLOCK); - $this->assertTrue($profile->isBlock()); - - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); - $this->assertFalse($profile->isBlock()); - } - - public function testIsMacro() - { - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::MACRO); - $this->assertTrue($profile->isMacro()); - - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); - $this->assertFalse($profile->isMacro()); - } - - public function testGetAddProfile() - { - $profile = new Twig_Profiler_Profile(); - $profile->addProfile($a = new Twig_Profiler_Profile()); - $profile->addProfile($b = new Twig_Profiler_Profile()); - - $this->assertSame(array($a, $b), $profile->getProfiles()); - $this->assertSame(array($a, $b), iterator_to_array($profile)); - } - - public function testGetDuration() - { - $profile = new Twig_Profiler_Profile(); - usleep(1); - $profile->leave(); - - $this->assertTrue($profile->getDuration() > 0, sprintf('Expected duration > 0, got: %f', $profile->getDuration())); - } - - public function testSerialize() - { - $profile = new Twig_Profiler_Profile('template', 'type', 'name'); - $profile1 = new Twig_Profiler_Profile('template1', 'type1', 'name1'); - $profile->addProfile($profile1); - $profile->leave(); - $profile1->leave(); - - $profile2 = unserialize(serialize($profile)); - $profiles = $profile->getProfiles(); - $this->assertCount(1, $profiles); - $profile3 = $profiles[0]; - - $this->assertEquals($profile->getTemplate(), $profile2->getTemplate()); - $this->assertEquals($profile->getType(), $profile2->getType()); - $this->assertEquals($profile->getName(), $profile2->getName()); - $this->assertEquals($profile->getDuration(), $profile2->getDuration()); - - $this->assertEquals($profile1->getTemplate(), $profile3->getTemplate()); - $this->assertEquals($profile1->getType(), $profile3->getType()); - $this->assertEquals($profile1->getName(), $profile3->getName()); - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/TemplateTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/TemplateTest.php deleted file mode 100644 index f0146649..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/TemplateTest.php +++ /dev/null @@ -1,693 +0,0 @@ -getMockForAbstractClass('Twig_Template', array(), '', false); - $template->displayBlock('foo', array(), array('foo' => array(new stdClass(), 'foo'))); - } - - /** - * @dataProvider getAttributeExceptions - */ - public function testGetAttributeExceptions($template, $message, $useExt) - { - $name = 'index_'.($useExt ? 1 : 0); - $templates = array( - $name => $template.$useExt, // appending $useExt makes the template content unique - ); - - $env = new Twig_Environment(new Twig_Loader_Array($templates), array('strict_variables' => true)); - if (!$useExt) { - $env->addNodeVisitor(new CExtDisablingNodeVisitor()); - } - $template = $env->loadTemplate($name); - - $context = array( - 'string' => 'foo', - 'null' => null, - 'empty_array' => array(), - 'array' => array('foo' => 'foo'), - 'array_access' => new Twig_TemplateArrayAccessObject(), - 'magic_exception' => new Twig_TemplateMagicPropertyObjectWithException(), - 'object' => new stdClass(), - ); - - try { - $template->render($context); - $this->fail('Accessing an invalid attribute should throw an exception.'); - } catch (Twig_Error_Runtime $e) { - $this->assertSame(sprintf($message, $name), $e->getMessage()); - } - } - - 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 }}', 'Method "a" for object "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1', false), - array('{% from _self import foo %}{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ foo(array_access) }}', 'Method "missing_method" for object "Twig_TemplateArrayAccessObject" does not exist 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), - ); - - if (function_exists('twig_template_get_attributes')) { - foreach (array_slice($tests, 0) as $test) { - $test[2] = true; - $tests[] = $test; - } - } - - return $tests; - } - - public function testGetSource() - { - $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), false); - - $this->assertSame("\n", $template->getSource()); - } - - /** - * @dataProvider getGetAttributeWithSandbox - */ - public function testGetAttributeWithSandbox($object, $item, $allowed, $useExt) - { - $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $policy = new Twig_Sandbox_SecurityPolicy(array(), array(), array(/*method*/), array(/*prop*/), array()); - $twig->addExtension(new Twig_Extension_Sandbox($policy, !$allowed)); - $template = new Twig_TemplateTest($twig, $useExt); - - try { - $template->getAttribute($object, $item, array(), 'any'); - - if (!$allowed) { - $this->fail(); - } - } catch (Twig_Sandbox_SecurityError $e) { - if ($allowed) { - $this->fail(); - } - - $this->assertContains('is not allowed', $e->getMessage()); - } - } - - public function getGetAttributeWithSandbox() - { - $tests = array( - array(new Twig_TemplatePropertyObject(), 'defined', false, false), - array(new Twig_TemplatePropertyObject(), 'defined', true, false), - array(new Twig_TemplateMethodObject(), 'defined', false, false), - array(new Twig_TemplateMethodObject(), 'defined', true, false), - ); - - if (function_exists('twig_template_get_attributes')) { - foreach (array_slice($tests, 0) as $test) { - $test[3] = true; - $tests[] = $test; - } - } - - return $tests; - } - - /** - * @dataProvider getGetAttributeWithTemplateAsObject - */ - public function testGetAttributeWithTemplateAsObject($useExt) - { - $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), $useExt); - $template1 = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), false); - - $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string')); - $this->assertEquals('some_string', $template->getAttribute($template1, 'string')); - - $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'true')); - $this->assertEquals('1', $template->getAttribute($template1, 'true')); - - $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'zero')); - $this->assertEquals('0', $template->getAttribute($template1, 'zero')); - - $this->assertNotInstanceof('Twig_Markup', $template->getAttribute($template1, 'empty')); - $this->assertSame('', $template->getAttribute($template1, 'empty')); - - $this->assertFalse($template->getAttribute($template1, 'env', array(), Twig_Template::ANY_CALL, true)); - $this->assertFalse($template->getAttribute($template1, 'environment', array(), Twig_Template::ANY_CALL, true)); - $this->assertFalse($template->getAttribute($template1, 'getEnvironment', array(), Twig_Template::METHOD_CALL, true)); - $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', array(), Twig_Template::METHOD_CALL, true)); - } - - public function getGetAttributeWithTemplateAsObject() - { - $bools = array( - array(false), - ); - - if (function_exists('twig_template_get_attributes')) { - $bools[] = array(true); - } - - return $bools; - } - - /** - * @dataProvider getTestsDependingOnExtensionAvailability - */ - public function testGetAttributeOnArrayWithConfusableKey($useExt = false) - { - $template = new Twig_TemplateTest( - new Twig_Environment($this->getMock('Twig_LoaderInterface')), - $useExt - ); - - $array = array('Zero', 'One', -1 => 'MinusOne', '' => 'EmptyString', '1.5' => 'FloatButString', '01' => 'IntegerButStringWithLeadingZeros'); - - $this->assertSame('Zero', $array[false]); - $this->assertSame('One', $array[true]); - $this->assertSame('One', $array[1.5]); - $this->assertSame('One', $array['1']); - $this->assertSame('MinusOne', $array[-1.5]); - $this->assertSame('FloatButString', $array['1.5']); - $this->assertSame('IntegerButStringWithLeadingZeros', $array['01']); - $this->assertSame('EmptyString', $array[null]); - - $this->assertSame('Zero', $template->getAttribute($array, false), 'false is treated as 0 when accessing an array (equals PHP behavior)'); - $this->assertSame('One', $template->getAttribute($array, true), 'true is treated as 1 when accessing an array (equals PHP behavior)'); - $this->assertSame('One', $template->getAttribute($array, 1.5), 'float is casted to int when accessing an array (equals PHP behavior)'); - $this->assertSame('One', $template->getAttribute($array, '1'), '"1" is treated as integer 1 when accessing an array (equals PHP behavior)'); - $this->assertSame('MinusOne', $template->getAttribute($array, -1.5), 'negative float is casted to int when accessing an array (equals PHP behavior)'); - $this->assertSame('FloatButString', $template->getAttribute($array, '1.5'), '"1.5" is treated as-is when accessing an array (equals PHP behavior)'); - $this->assertSame('IntegerButStringWithLeadingZeros', $template->getAttribute($array, '01'), '"01" is treated as-is when accessing an array (equals PHP behavior)'); - $this->assertSame('EmptyString', $template->getAttribute($array, null), 'null is treated as "" when accessing an array (equals PHP behavior)'); - } - - public function getTestsDependingOnExtensionAvailability() - { - if (function_exists('twig_template_get_attributes')) { - return array(array(false), array(true)); - } - - return array(array(false)); - } - - /** - * @dataProvider getGetAttributeTests - */ - public function testGetAttribute($defined, $value, $object, $item, $arguments, $type, $useExt = false) - { - $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), $useExt); - - $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); - } - - /** - * @dataProvider getGetAttributeTests - */ - public function testGetAttributeStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false, $exceptionMessage = null) - { - $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('strict_variables' => true)), $useExt); - - if ($defined) { - $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); - } else { - try { - $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); - - throw new Exception('Expected Twig_Error_Runtime exception.'); - } catch (Twig_Error_Runtime $e) { - if (null !== $exceptionMessage) { - $this->assertSame($exceptionMessage, $e->getMessage()); - } - } - } - } - - /** - * @dataProvider getGetAttributeTests - */ - public function testGetAttributeDefined($defined, $value, $object, $item, $arguments, $type, $useExt = false) - { - $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), $useExt); - - $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true)); - } - - /** - * @dataProvider getGetAttributeTests - */ - public function testGetAttributeDefinedStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false) - { - $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('strict_variables' => true)), $useExt); - - $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true)); - } - - /** - * @dataProvider getTestsDependingOnExtensionAvailability - */ - public function testGetAttributeCallExceptions($useExt = false) - { - $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), $useExt); - - $object = new Twig_TemplateMagicMethodExceptionObject(); - - $this->assertNull($template->getAttribute($object, 'foo')); - } - - public function getGetAttributeTests() - { - $array = array( - 'defined' => 'defined', - 'zero' => 0, - 'null' => null, - '1' => 1, - 'bar' => true, - '09' => '09', - '+4' => '+4', - ); - - $objectArray = new Twig_TemplateArrayAccessObject(); - $stdObject = (object) $array; - $magicPropertyObject = new Twig_TemplateMagicPropertyObject(); - $propertyObject = new Twig_TemplatePropertyObject(); - $propertyObject1 = new Twig_TemplatePropertyObjectAndIterator(); - $propertyObject2 = new Twig_TemplatePropertyObjectAndArrayAccess(); - $propertyObject3 = new Twig_TemplatePropertyObjectDefinedWithUndefinedValue(); - $methodObject = new Twig_TemplateMethodObject(); - $magicMethodObject = new Twig_TemplateMagicMethodObject(); - - $anyType = Twig_Template::ANY_CALL; - $methodType = Twig_Template::METHOD_CALL; - $arrayType = Twig_Template::ARRAY_CALL; - - $basicTests = array( - // array(defined, value, property to fetch) - array(true, 'defined', 'defined'), - array(false, null, 'undefined'), - array(false, null, 'protected'), - array(true, 0, 'zero'), - array(true, 1, 1), - array(true, 1, 1.0), - array(true, null, 'null'), - array(true, true, 'bar'), - array(true, '09', '09'), - array(true, '+4', '+4'), - ); - $testObjects = array( - // array(object, type of fetch) - array($array, $arrayType), - array($objectArray, $arrayType), - array($stdObject, $anyType), - array($magicPropertyObject, $anyType), - array($methodObject, $methodType), - array($methodObject, $anyType), - array($propertyObject, $anyType), - array($propertyObject1, $anyType), - array($propertyObject2, $anyType), - ); - - $tests = array(); - foreach ($testObjects as $testObject) { - foreach ($basicTests as $test) { - // properties cannot be numbers - if (($testObject[0] instanceof stdClass || $testObject[0] instanceof Twig_TemplatePropertyObject) && is_numeric($test[2])) { - continue; - } - - if ('+4' === $test[2] && $methodObject === $testObject[0]) { - continue; - } - - $tests[] = array($test[0], $test[1], $testObject[0], $test[2], array(), $testObject[1]); - } - } - - // additional properties tests - $tests = array_merge($tests, array( - array(true, null, $propertyObject3, 'foo', array(), $anyType), - )); - - // additional method tests - $tests = array_merge($tests, array( - array(true, 'defined', $methodObject, 'defined', array(), $methodType), - array(true, 'defined', $methodObject, 'DEFINED', array(), $methodType), - array(true, 'defined', $methodObject, 'getDefined', array(), $methodType), - array(true, 'defined', $methodObject, 'GETDEFINED', array(), $methodType), - array(true, 'static', $methodObject, 'static', array(), $methodType), - array(true, 'static', $methodObject, 'getStatic', array(), $methodType), - - array(true, '__call_undefined', $magicMethodObject, 'undefined', array(), $methodType), - array(true, '__call_UNDEFINED', $magicMethodObject, 'UNDEFINED', array(), $methodType), - )); - - // add the same tests for the any type - foreach ($tests as $test) { - if ($anyType !== $test[5]) { - $test[5] = $anyType; - $tests[] = $test; - } - } - - $methodAndPropObject = new Twig_TemplateMethodAndPropObject(); - - // additional method tests - $tests = array_merge($tests, array( - array(true, 'a', $methodAndPropObject, 'a', array(), $anyType), - array(true, 'a', $methodAndPropObject, 'a', array(), $methodType), - array(false, null, $methodAndPropObject, 'a', array(), $arrayType), - - array(true, 'b_prop', $methodAndPropObject, 'b', array(), $anyType), - array(true, 'b', $methodAndPropObject, 'B', array(), $anyType), - array(true, 'b', $methodAndPropObject, 'b', array(), $methodType), - array(true, 'b', $methodAndPropObject, 'B', array(), $methodType), - array(false, null, $methodAndPropObject, 'b', array(), $arrayType), - - array(false, null, $methodAndPropObject, 'c', array(), $anyType), - array(false, null, $methodAndPropObject, 'c', array(), $methodType), - array(false, null, $methodAndPropObject, 'c', array(), $arrayType), - - )); - - // 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'), - )); - - // add twig_template_get_attributes tests - - if (function_exists('twig_template_get_attributes')) { - foreach (array_slice($tests, 0) as $test) { - $test = array_pad($test, 7, null); - $test[6] = true; - $tests[] = $test; - } - } - - return $tests; - } -} - -class Twig_TemplateTest extends Twig_Template -{ - protected $useExtGetAttribute = false; - - public function __construct(Twig_Environment $env, $useExtGetAttribute = false) - { - parent::__construct($env); - $this->useExtGetAttribute = $useExtGetAttribute; - self::$cache = array(); - } - - public function getZero() - { - return 0; - } - - public function getEmpty() - { - return ''; - } - - public function getString() - { - return 'some_string'; - } - - public function getTrue() - { - return true; - } - - public function getTemplateName() - { - } - - public function getDebugInfo() - { - return array(); - } - - protected function doGetParent(array $context) - { - } - - protected function doDisplay(array $context, array $blocks = array()) - { - } - - public function getAttribute($object, $item, array $arguments = array(), $type = Twig_Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) - { - if ($this->useExtGetAttribute) { - return twig_template_get_attributes($this, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); - } else { - return parent::getAttribute($object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); - } - } -} -/* */ -/* */ - -class Twig_TemplateArrayAccessObject implements ArrayAccess -{ - protected $protected = 'protected'; - - public $attributes = array( - 'defined' => 'defined', - 'zero' => 0, - 'null' => null, - '1' => 1, - 'bar' => true, - '09' => '09', - '+4' => '+4', - ); - - public function offsetExists($name) - { - return array_key_exists($name, $this->attributes); - } - - public function offsetGet($name) - { - return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; - } - - public function offsetSet($name, $value) - { - } - - public function offsetUnset($name) - { - } -} - -class Twig_TemplateMagicPropertyObject -{ - public $defined = 'defined'; - - public $attributes = array( - 'zero' => 0, - 'null' => null, - '1' => 1, - 'bar' => true, - '09' => '09', - '+4' => '+4', - ); - - protected $protected = 'protected'; - - public function __isset($name) - { - return array_key_exists($name, $this->attributes); - } - - public function __get($name) - { - return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; - } -} - -class Twig_TemplateMagicPropertyObjectWithException -{ - public function __isset($key) - { - throw new Exception('Hey! Don\'t try to isset me!'); - } -} - -class Twig_TemplatePropertyObject -{ - public $defined = 'defined'; - public $zero = 0; - public $null = null; - public $bar = true; - - protected $protected = 'protected'; -} - -class Twig_TemplatePropertyObjectAndIterator extends Twig_TemplatePropertyObject implements IteratorAggregate -{ - public function getIterator() - { - return new ArrayIterator(array('foo', 'bar')); - } -} - -class Twig_TemplatePropertyObjectAndArrayAccess extends Twig_TemplatePropertyObject implements ArrayAccess -{ - private $data = array(); - - public function offsetExists($offset) - { - return array_key_exists($offset, $this->data); - } - - public function offsetGet($offset) - { - return $this->offsetExists($offset) ? $this->data[$offset] : 'n/a'; - } - - public function offsetSet($offset, $value) - { - } - - public function offsetUnset($offset) - { - } -} - -class Twig_TemplatePropertyObjectDefinedWithUndefinedValue -{ - public $foo; - - public function __construct() - { - $this->foo = @$notExist; - } -} - -class Twig_TemplateMethodObject -{ - public function getDefined() - { - return 'defined'; - } - - public function get1() - { - return 1; - } - - public function get09() - { - return '09'; - } - - public function getZero() - { - return 0; - } - - public function getNull() - { - } - - public function isBar() - { - return true; - } - - protected function getProtected() - { - return 'protected'; - } - - public static function getStatic() - { - return 'static'; - } -} - -class Twig_TemplateMethodAndPropObject -{ - private $a = 'a_prop'; - public function getA() - { - return 'a'; - } - - public $b = 'b_prop'; - public function getB() - { - return 'b'; - } - - private $c = 'c_prop'; - private function getC() - { - return 'c'; - } -} - -class Twig_TemplateMagicMethodObject -{ - public function __call($method, $arguments) - { - return '__call_'.$method; - } -} - -class Twig_TemplateMagicMethodExceptionObject -{ - public function __call($method, $arguments) - { - throw new BadMethodCallException(sprintf('Unknown method "%s".', $method)); - } -} - -class CExtDisablingNodeVisitor implements Twig_NodeVisitorInterface -{ - public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Expression_GetAttr) { - $node->setAttribute('disable_c_ext', true); - } - - return $node; - } - - public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) - { - return $node; - } - - public function getPriority() - { - return 0; - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php deleted file mode 100644 index 5ac3a286..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php +++ /dev/null @@ -1,70 +0,0 @@ -isEOF()) { - $token = $stream->next(); - - $repr[] = $token->getValue(); - } - $this->assertEquals('1, 2, 3, 4, 5, 6, 7', implode(', ', $repr), '->next() advances the pointer and returns the current token'); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedMessage Unexpected end of template - */ - public function testEndOfTemplateNext() - { - $stream = new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, 1, 1), - )); - while (!$stream->isEOF()) { - $stream->next(); - } - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedMessage Unexpected end of template - */ - public function testEndOfTemplateLook() - { - $stream = new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, 1, 1), - )); - while (!$stream->isEOF()) { - $stream->look(); - $stream->next(); - } - } -} diff --git a/plugins/twig/vendor/twig/twig/test/Twig/Tests/escapingTest.php b/plugins/twig/vendor/twig/twig/test/Twig/Tests/escapingTest.php deleted file mode 100644 index abf62364..00000000 --- a/plugins/twig/vendor/twig/twig/test/Twig/Tests/escapingTest.php +++ /dev/null @@ -1,320 +0,0 @@ - ''', - '"' => '"', - '<' => '<', - '>' => '>', - '&' => '&', - ); - - protected $htmlAttrSpecialChars = array( - '\'' => ''', - /* Characters beyond ASCII value 255 to unicode escape */ - 'Ā' => 'Ā', - /* Immune chars excluded */ - ',' => ',', - '.' => '.', - '-' => '-', - '_' => '_', - /* Basic alnums excluded */ - 'a' => 'a', - 'A' => 'A', - 'z' => 'z', - 'Z' => 'Z', - '0' => '0', - '9' => '9', - /* Basic control characters and null */ - "\r" => ' ', - "\n" => ' ', - "\t" => ' ', - "\0" => '�', // should use Unicode replacement char - /* Encode chars as named entities where possible */ - '<' => '<', - '>' => '>', - '&' => '&', - '"' => '"', - /* Encode spaces for quoteless attribute protection */ - ' ' => ' ', - ); - - protected $jsSpecialChars = array( - /* HTML special chars - escape without exception to hex */ - '<' => '\\x3C', - '>' => '\\x3E', - '\'' => '\\x27', - '"' => '\\x22', - '&' => '\\x26', - /* Characters beyond ASCII value 255 to unicode escape */ - 'Ā' => '\\u0100', - /* Immune chars excluded */ - ',' => ',', - '.' => '.', - '_' => '_', - /* Basic alnums excluded */ - 'a' => 'a', - 'A' => 'A', - 'z' => 'z', - 'Z' => 'Z', - '0' => '0', - '9' => '9', - /* Basic control characters and null */ - "\r" => '\\x0D', - "\n" => '\\x0A', - "\t" => '\\x09', - "\0" => '\\x00', - /* Encode spaces for quoteless attribute protection */ - ' ' => '\\x20', - ); - - protected $urlSpecialChars = array( - /* HTML special chars - escape without exception to percent encoding */ - '<' => '%3C', - '>' => '%3E', - '\'' => '%27', - '"' => '%22', - '&' => '%26', - /* Characters beyond ASCII value 255 to hex sequence */ - 'Ā' => '%C4%80', - /* Punctuation and unreserved check */ - ',' => '%2C', - '.' => '.', - '_' => '_', - '-' => '-', - ':' => '%3A', - ';' => '%3B', - '!' => '%21', - /* Basic alnums excluded */ - 'a' => 'a', - 'A' => 'A', - 'z' => 'z', - 'Z' => 'Z', - '0' => '0', - '9' => '9', - /* Basic control characters and null */ - "\r" => '%0D', - "\n" => '%0A', - "\t" => '%09', - "\0" => '%00', - /* PHP quirks from the past */ - ' ' => '%20', - '~' => '~', - '+' => '%2B', - ); - - protected $cssSpecialChars = array( - /* HTML special chars - escape without exception to hex */ - '<' => '\\3C ', - '>' => '\\3E ', - '\'' => '\\27 ', - '"' => '\\22 ', - '&' => '\\26 ', - /* Characters beyond ASCII value 255 to unicode escape */ - 'Ā' => '\\100 ', - /* Immune chars excluded */ - ',' => '\\2C ', - '.' => '\\2E ', - '_' => '\\5F ', - /* Basic alnums excluded */ - 'a' => 'a', - 'A' => 'A', - 'z' => 'z', - 'Z' => 'Z', - '0' => '0', - '9' => '9', - /* Basic control characters and null */ - "\r" => '\\D ', - "\n" => '\\A ', - "\t" => '\\9 ', - "\0" => '\\0 ', - /* Encode spaces for quoteless attribute protection */ - ' ' => '\\20 ', - ); - - protected $env; - - protected function setUp() - { - $this->env = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - } - - public function testHtmlEscapingConvertsSpecialChars() - { - foreach ($this->htmlSpecialChars as $key => $value) { - $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html'), 'Failed to escape: '.$key); - } - } - - public function testHtmlAttributeEscapingConvertsSpecialChars() - { - foreach ($this->htmlAttrSpecialChars as $key => $value) { - $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html_attr'), 'Failed to escape: '.$key); - } - } - - public function testJavascriptEscapingConvertsSpecialChars() - { - foreach ($this->jsSpecialChars as $key => $value) { - $this->assertEquals($value, twig_escape_filter($this->env, $key, 'js'), 'Failed to escape: '.$key); - } - } - - public function testJavascriptEscapingReturnsStringIfZeroLength() - { - $this->assertEquals('', twig_escape_filter($this->env, '', 'js')); - } - - public function testJavascriptEscapingReturnsStringIfContainsOnlyDigits() - { - $this->assertEquals('123', twig_escape_filter($this->env, '123', 'js')); - } - - public function testCssEscapingConvertsSpecialChars() - { - foreach ($this->cssSpecialChars as $key => $value) { - $this->assertEquals($value, twig_escape_filter($this->env, $key, 'css'), 'Failed to escape: '.$key); - } - } - - public function testCssEscapingReturnsStringIfZeroLength() - { - $this->assertEquals('', twig_escape_filter($this->env, '', 'css')); - } - - public function testCssEscapingReturnsStringIfContainsOnlyDigits() - { - $this->assertEquals('123', twig_escape_filter($this->env, '123', 'css')); - } - - public function testUrlEscapingConvertsSpecialChars() - { - foreach ($this->urlSpecialChars as $key => $value) { - $this->assertEquals($value, twig_escape_filter($this->env, $key, 'url'), 'Failed to escape: '.$key); - } - } - - /** - * Range tests to confirm escaped range of characters is within OWASP recommendation. - */ - - /** - * Only testing the first few 2 ranges on this prot. function as that's all these - * other range tests require. - */ - public function testUnicodeCodepointConversionToUtf8() - { - $expected = ' ~ޙ'; - $codepoints = array(0x20, 0x7e, 0x799); - $result = ''; - foreach ($codepoints as $value) { - $result .= $this->codepointToUtf8($value); - } - $this->assertEquals($expected, $result); - } - - /** - * Convert a Unicode Codepoint to a literal UTF-8 character. - * - * @param int $codepoint Unicode codepoint in hex notation - * - * @return string UTF-8 literal string - */ - protected function codepointToUtf8($codepoint) - { - if ($codepoint < 0x80) { - return chr($codepoint); - } - if ($codepoint < 0x800) { - return chr($codepoint >> 6 & 0x3f | 0xc0) - .chr($codepoint & 0x3f | 0x80); - } - if ($codepoint < 0x10000) { - return chr($codepoint >> 12 & 0x0f | 0xe0) - .chr($codepoint >> 6 & 0x3f | 0x80) - .chr($codepoint & 0x3f | 0x80); - } - if ($codepoint < 0x110000) { - return chr($codepoint >> 18 & 0x07 | 0xf0) - .chr($codepoint >> 12 & 0x3f | 0x80) - .chr($codepoint >> 6 & 0x3f | 0x80) - .chr($codepoint & 0x3f | 0x80); - } - throw new Exception('Codepoint requested outside of Unicode range'); - } - - public function testJavascriptEscapingEscapesOwaspRecommendedRanges() - { - $immune = array(',', '.', '_'); // Exceptions to escaping ranges - for ($chr = 0; $chr < 0xFF; ++$chr) { - if ($chr >= 0x30 && $chr <= 0x39 - || $chr >= 0x41 && $chr <= 0x5A - || $chr >= 0x61 && $chr <= 0x7A) { - $literal = $this->codepointToUtf8($chr); - $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js')); - } else { - $literal = $this->codepointToUtf8($chr); - if (in_array($literal, $immune)) { - $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js')); - } else { - $this->assertNotEquals( - $literal, - twig_escape_filter($this->env, $literal, 'js'), - "$literal should be escaped!"); - } - } - } - } - - public function testHtmlAttributeEscapingEscapesOwaspRecommendedRanges() - { - $immune = array(',', '.', '-', '_'); // Exceptions to escaping ranges - for ($chr = 0; $chr < 0xFF; ++$chr) { - if ($chr >= 0x30 && $chr <= 0x39 - || $chr >= 0x41 && $chr <= 0x5A - || $chr >= 0x61 && $chr <= 0x7A) { - $literal = $this->codepointToUtf8($chr); - $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr')); - } else { - $literal = $this->codepointToUtf8($chr); - if (in_array($literal, $immune)) { - $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr')); - } else { - $this->assertNotEquals( - $literal, - twig_escape_filter($this->env, $literal, 'html_attr'), - "$literal should be escaped!"); - } - } - } - } - - public function testCssEscapingEscapesOwaspRecommendedRanges() - { - // CSS has no exceptions to escaping ranges - for ($chr = 0; $chr < 0xFF; ++$chr) { - if ($chr >= 0x30 && $chr <= 0x39 - || $chr >= 0x41 && $chr <= 0x5A - || $chr >= 0x61 && $chr <= 0x7A) { - $literal = $this->codepointToUtf8($chr); - $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'css')); - } else { - $literal = $this->codepointToUtf8($chr); - $this->assertNotEquals( - $literal, - twig_escape_filter($this->env, $literal, 'css'), - "$literal should be escaped!"); - } - } - } -} diff --git a/plugins/twig/vendor/twig/twig/test/bootstrap.php b/plugins/twig/vendor/twig/twig/test/bootstrap.php deleted file mode 100644 index aecb976f..00000000 --- a/plugins/twig/vendor/twig/twig/test/bootstrap.php +++ /dev/null @@ -1,13 +0,0 @@ - Date: Tue, 8 Mar 2016 18:54:46 +0100 Subject: [PATCH 17/17] git-ignore twig folders --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index add2b052..252fcdec 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,7 @@ cache/twig/ # Tests /src/Tests + +# twig test and doc folders +plugins/twig/vendor/twig/twig/doc/ +plugins/twig/vendor/twig/twig/test/