Timber - Version 1.11.0

Version Description

General Note - If you use WPML with Timber, please upgrade to WPML 4.2.8. The WPML team has removed their included Twig version which means no more conflicts!

Fixes and improvements - Fix to menu items getting incorrect classes in WPML and others #1974 - Fixed issue with Timber not respecting comment order #1731 #2015

Changes for Theme Developers - Theme methods (theme.get and theme.display) for headers are now exposed by Timber\Theme #2051 (thanks @dtvn)

Download this release

Release Info

Developer jarednova
Plugin Icon 128x128 Timber
Version 1.11.0
Comparing to
See all releases

Code changes from version 1.10.0 to 1.11.0

Files changed (682) hide show
  1. README.md +1 -1
  2. lib/CommentThread.php +2 -3
  3. lib/Menu.php +5 -3
  4. lib/MenuItem.php +8 -3
  5. lib/Theme.php +38 -1
  6. lib/Timber.php +1 -1
  7. readme.txt +15 -4
  8. timber-starter-theme/.travis.yml +5 -1
  9. timber-starter-theme/bin/install-wp-tests.sh +0 -112
  10. timber-starter-theme/composer.json +0 -32
  11. timber-starter-theme/functions.php +16 -1
  12. timber-starter-theme/page.php +1 -1
  13. timber-starter-theme/single.php +1 -1
  14. timber-starter-theme/templates/base.twig +1 -1
  15. timber-starter-theme/templates/menu.twig +2 -2
  16. timber-starter-theme/templates/partial/pagination.twig +10 -6
  17. timber-starter-theme/tests/bootstrap.php +0 -5
  18. timber-starter-theme/tests/test-timber-starter-theme.php +11 -23
  19. timber-starter-theme/timber-starter-theme/.gitignore +2 -0
  20. timber-starter-theme/timber-starter-theme/.travis.yml +22 -0
  21. timber-starter-theme/timber-starter-theme/404.php +13 -0
  22. timber-starter-theme/timber-starter-theme/LICENSE +7 -0
  23. timber-starter-theme/timber-starter-theme/README.md +35 -0
  24. timber-starter-theme/timber-starter-theme/archive.php +40 -0
  25. timber-starter-theme/timber-starter-theme/author.php +21 -0
  26. timber-starter-theme/timber-starter-theme/footer.php +21 -0
  27. timber-starter-theme/timber-starter-theme/functions.php +159 -0
  28. timber-starter-theme/timber-starter-theme/header.php +15 -0
  29. timber-starter-theme/timber-starter-theme/humans.txt +10 -0
  30. timber-starter-theme/timber-starter-theme/index.php +23 -0
  31. timber-starter-theme/timber-starter-theme/page.php +28 -0
  32. timber-starter-theme/timber-starter-theme/phpunit.xml +20 -0
  33. timber-starter-theme/timber-starter-theme/screenshot.png +0 -0
  34. timber-starter-theme/timber-starter-theme/search.php +18 -0
  35. timber-starter-theme/timber-starter-theme/sidebar.php +9 -0
  36. timber-starter-theme/timber-starter-theme/single.php +20 -0
  37. timber-starter-theme/timber-starter-theme/static/no-timber.html +10 -0
  38. timber-starter-theme/timber-starter-theme/static/site.js +5 -0
  39. timber-starter-theme/timber-starter-theme/style.css +5 -0
  40. timber-starter-theme/timber-starter-theme/templates/404.twig +5 -0
  41. timber-starter-theme/timber-starter-theme/templates/archive.twig +9 -0
  42. timber-starter-theme/timber-starter-theme/templates/author.twig +7 -0
  43. timber-starter-theme/timber-starter-theme/templates/base.twig +45 -0
  44. timber-starter-theme/timber-starter-theme/templates/comment-form.twig +28 -0
  45. timber-starter-theme/timber-starter-theme/templates/comment.twig +21 -0
  46. timber-starter-theme/timber-starter-theme/templates/footer.twig +1 -0
  47. timber-starter-theme/timber-starter-theme/templates/html-header.twig +15 -0
  48. timber-starter-theme/timber-starter-theme/templates/index.twig +11 -0
  49. timber-starter-theme/timber-starter-theme/templates/menu.twig +10 -0
  50. timber-starter-theme/timber-starter-theme/templates/page-plugin.twig +7 -0
  51. timber-starter-theme/timber-starter-theme/templates/page.twig +14 -0
  52. timber-starter-theme/timber-starter-theme/templates/partial/pagination.twig +64 -0
  53. timber-starter-theme/timber-starter-theme/templates/search.twig +13 -0
  54. timber-starter-theme/timber-starter-theme/templates/sidebar.twig +1 -0
  55. timber-starter-theme/timber-starter-theme/templates/single-password.twig +9 -0
  56. timber-starter-theme/timber-starter-theme/templates/single.twig +39 -0
  57. timber-starter-theme/timber-starter-theme/templates/tease-post.twig +9 -0
  58. timber-starter-theme/timber-starter-theme/templates/tease.twig +9 -0
  59. timber-starter-theme/timber-starter-theme/tests/bootstrap.php +22 -0
  60. timber-starter-theme/timber-starter-theme/tests/test-timber-starter-theme.php +42 -0
  61. timber.php +1 -1
  62. vendor/autoload.php +2 -2
  63. vendor/composer/ClassLoader.php +46 -14
  64. vendor/composer/LICENSE +1 -1
  65. vendor/composer/autoload_classmap.php +4 -0
  66. vendor/composer/autoload_real.php +28 -17
  67. vendor/composer/autoload_static.php +626 -0
  68. vendor/composer/installed.json +171 -169
  69. vendor/composer/installers/composer.json +2 -0
  70. vendor/composer/installers/src/Composer/Installers/DframeInstaller.php +10 -0
  71. vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php +12 -8
  72. vendor/composer/installers/src/Composer/Installers/Installer.php +4 -0
  73. vendor/composer/installers/src/Composer/Installers/KnownInstaller.php +11 -0
  74. vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php +54 -46
  75. vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php +1 -0
  76. vendor/composer/installers/src/Composer/Installers/Redaxo5Installer.php +10 -0
  77. vendor/composer/installers/src/Composer/Installers/TaoInstaller.php +12 -0
  78. vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php +12 -1
  79. vendor/symfony/polyfill-ctype/composer.json +1 -1
  80. vendor/twig/twig/.gitignore +1 -0
  81. vendor/twig/twig/.php_cs.dist +2 -0
  82. vendor/twig/twig/.travis.yml +6 -4
  83. vendor/twig/twig/CHANGELOG +12 -0
  84. vendor/twig/twig/README.rst +9 -0
  85. vendor/twig/twig/composer.json +8 -3
  86. vendor/twig/twig/doc/advanced.rst +4 -47
  87. vendor/twig/twig/doc/advanced_legacy.rst +11 -12
  88. vendor/twig/twig/doc/filters/date.rst +1 -1
  89. vendor/twig/twig/doc/filters/date_modify.rst +1 -1
  90. vendor/twig/twig/doc/filters/map.rst +1 -1
  91. vendor/twig/twig/doc/filters/number_format.rst +1 -1
  92. vendor/twig/twig/doc/internals.rst +1 -1
  93. vendor/twig/twig/doc/intro.rst +1 -1
  94. vendor/twig/twig/doc/recipes.rst +4 -4
  95. vendor/twig/twig/doc/tags/extends.rst +1 -3
  96. vendor/twig/twig/doc/tags/include.rst +1 -1
  97. vendor/twig/twig/doc/tags/macro.rst +2 -4
  98. vendor/twig/twig/doc/templates.rst +1 -1
  99. vendor/twig/twig/ext/twig/php_twig.h +1 -1
  100. vendor/twig/twig/phpunit.xml.dist +1 -1
  101. vendor/twig/twig/src/Cache/FilesystemCache.php +2 -2
  102. vendor/twig/twig/src/Environment.php +3 -3
  103. vendor/twig/twig/src/Extension/CoreExtension.php +5 -1
  104. vendor/twig/twig/src/Extension/DebugExtension.php +1 -1
  105. vendor/twig/twig/src/Loader/FilesystemLoader.php +0 -1
  106. vendor/twig/twig/src/Node/MacroNode.php +7 -1
  107. vendor/twig/twig/src/Node/SetNode.php +5 -1
  108. vendor/twig/twig/src/Node/SpacelessNode.php +7 -1
  109. vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php +1 -1
  110. vendor/twig/twig/src/Template.php +17 -5
  111. vendor/twig/twig/src/TemplateWrapper.php +5 -1
  112. vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php +0 -24
  113. vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php +0 -195
  114. vendor/twig/twig/test/Twig/Tests/CompilerTest.php +0 -36
  115. vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php +0 -42
  116. vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php +0 -96
  117. vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php +0 -677
  118. vendor/twig/twig/test/Twig/Tests/ErrorTest.php +0 -218
  119. vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php +0 -387
  120. vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php +0 -371
  121. vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php +0 -364
  122. vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php +0 -34
  123. vendor/twig/twig/test/Twig/Tests/FileCachingTest.php +0 -66
  124. vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php +0 -53
  125. vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php +0 -30
  126. vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test +0 -28
  127. vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test +0 -150
  128. vendor/twig/twig/test/Twig/Tests/Fixtures/filters/filter.test +0 -46
  129. vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test +0 -38
  130. vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test +0 -40
  131. vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test +0 -20
  132. vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test +0 -18
  133. vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test +0 -14
  134. vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test +0 -129
  135. vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test +0 -42
  136. vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test +0 -19
  137. vendor/twig/twig/test/Twig/Tests/IntegrationTest.php +0 -384
  138. vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php +0 -57
  139. vendor/twig/twig/test/Twig/Tests/LexerTest.php +0 -379
  140. vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php +0 -139
  141. vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php +0 -132
  142. vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php +0 -245
  143. vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php +0 -39
  144. vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php +0 -37
  145. vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php +0 -34
  146. vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php +0 -43
  147. vendor/twig/twig/test/Twig/Tests/Node/DeprecatedTest.php +0 -80
  148. vendor/twig/twig/test/Twig/Tests/Node/DoTest.php +0 -36
  149. vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php +0 -41
  150. vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php +0 -32
  151. vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php +0 -38
  152. vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php +0 -38
  153. vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php +0 -38
  154. vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php +0 -38
  155. vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php +0 -38
  156. vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php +0 -38
  157. vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php +0 -38
  158. vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php +0 -38
  159. vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php +0 -38
  160. vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php +0 -145
  161. vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php +0 -42
  162. vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php +0 -33
  163. vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php +0 -161
  164. vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php +0 -117
  165. vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php +0 -57
  166. vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php +0 -47
  167. vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php +0 -36
  168. vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php +0 -6
  169. vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php +0 -6
  170. vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php +0 -6
  171. vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php +0 -31
  172. vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php +0 -90
  173. vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php +0 -36
  174. vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php +0 -35
  175. vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php +0 -35
  176. vendor/twig/twig/test/Twig/Tests/Node/ForTest.php +0 -199
  177. vendor/twig/twig/test/Twig/Tests/Node/IfTest.php +0 -95
  178. vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php +0 -45
  179. vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php +0 -93
  180. vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php +0 -81
  181. vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php +0 -268
  182. vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php +0 -33
  183. vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php +0 -47
  184. vendor/twig/twig/test/Twig/Tests/Node/SetTest.php +0 -78
  185. vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php +0 -42
  186. vendor/twig/twig/test/Twig/Tests/Node/TextTest.php +0 -31
  187. vendor/twig/twig/test/Twig/Tests/NodeTraverserTest.php +0 -47
  188. vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php +0 -129
  189. vendor/twig/twig/test/Twig/Tests/ParserTest.php +0 -217
  190. vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php +0 -105
  191. vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php +0 -34
  192. vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php +0 -32
  193. vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php +0 -32
  194. vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php +0 -112
  195. vendor/twig/twig/test/Twig/Tests/TemplateTest.php +0 -812
  196. vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php +0 -68
  197. vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php +0 -85
  198. vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php +0 -46
  199. vendor/twig/twig/test/Twig/Tests/escapingTest.php +0 -325
  200. vendor/twig/twig/tests/AutoloaderTest.php +26 -0
  201. vendor/twig/twig/tests/Cache/FilesystemTest.php +193 -0
  202. vendor/twig/twig/tests/CompilerTest.php +38 -0
  203. vendor/twig/twig/tests/ContainerRuntimeLoaderTest.php +44 -0
  204. vendor/twig/twig/tests/CustomExtensionTest.php +94 -0
  205. vendor/twig/twig/tests/EnvironmentTest.php +678 -0
  206. vendor/twig/twig/tests/ErrorTest.php +234 -0
  207. vendor/twig/twig/tests/ExpressionParserTest.php +382 -0
  208. vendor/twig/twig/tests/Extension/CoreTest.php +371 -0
  209. vendor/twig/twig/tests/Extension/SandboxTest.php +365 -0
  210. vendor/twig/twig/tests/FactoryRuntimeLoaderTest.php +36 -0
  211. vendor/twig/twig/tests/FileCachingTest.php +66 -0
  212. vendor/twig/twig/tests/FileExtensionEscapingStrategyTest.php +55 -0
  213. vendor/twig/twig/tests/FilesystemHelper.php +32 -0
  214. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/autoescape/block.test +0 -0
  215. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/autoescape/name.test +0 -0
  216. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/errors/base.html +0 -0
  217. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/errors/index.html +0 -0
  218. vendor/twig/twig/tests/Fixtures/errors/leak-output.php +33 -0
  219. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/child_contents_outside_blocks.test +0 -0
  220. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/exception_in_extension_extends.test +0 -0
  221. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/exception_in_extension_include.test +0 -0
  222. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/multiline_array_with_undefined_variable.test +0 -0
  223. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test +0 -0
  224. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/multiline_function_with_undefined_variable.test +0 -0
  225. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/multiline_function_with_unknown_argument.test +0 -0
  226. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/multiline_tag_with_undefined_variable.test +0 -0
  227. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/strict_comparison_operator.test +0 -0
  228. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/syntax_error_in_reused_template.test +0 -0
  229. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/unclosed_tag.test +0 -0
  230. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/undefined_parent.test +0 -0
  231. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/undefined_template_in_child_template.test +0 -0
  232. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/undefined_trait.test +0 -0
  233. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/_self.test +0 -0
  234. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/array.test +0 -0
  235. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/array_call.test +0 -0
  236. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/binary.test +0 -0
  237. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/bitwise.test +0 -0
  238. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/call_argument_defined_twice.test +0 -0
  239. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/call_positional_arg_after_named_arg.test +0 -0
  240. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/comparison.test +0 -0
  241. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/divisibleby.test +0 -0
  242. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/dotdot.test +0 -0
  243. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/ends_with.test +0 -0
  244. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/floats.test +0 -0
  245. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/grouping.test +0 -0
  246. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/literals.test +0 -0
  247. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/magic_call.test +0 -0
  248. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/matches.test +0 -0
  249. vendor/twig/twig/tests/Fixtures/expressions/method_call.test +28 -0
  250. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/negative_numbers.test +0 -0
  251. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/not_arrow_fn.test +0 -0
  252. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/operators_as_variables.test +0 -0
  253. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/postfix.test +0 -0
  254. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/power.test +0 -0
  255. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/sameas.test +0 -0
  256. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/starts_with.test +0 -0
  257. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/string_operator_as_var_assignment.test +0 -0
  258. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/strings.test +0 -0
  259. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/ternary_operator.test +0 -0
  260. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/ternary_operator_noelse.test +0 -0
  261. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/ternary_operator_nothen.test +0 -0
  262. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/two_word_operators_as_variables.test +0 -0
  263. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/unary.test +0 -0
  264. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/unary_macro_arguments.test +0 -0
  265. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/unary_precedence.test +0 -0
  266. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/abs.test +0 -0
  267. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch.test +0 -0
  268. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_float.test +0 -0
  269. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_with_empty_fill.test +0 -0
  270. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_with_exact_elements.test +0 -0
  271. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_with_fill.test +0 -0
  272. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_with_keys.test +0 -0
  273. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_with_more_elements.test +0 -0
  274. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_with_zero_elements.test +0 -0
  275. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/convert_encoding.test +0 -0
  276. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date.test +0 -0
  277. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date_default_format.test +0 -0
  278. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date_default_format_interval.test +0 -0
  279. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date_immutable.test +0 -0
  280. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date_interval.test +0 -0
  281. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date_modify.test +0 -0
  282. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date_namedargs.test +0 -0
  283. vendor/twig/twig/tests/Fixtures/filters/default.test +150 -0
  284. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/dynamic_filter.test +0 -0
  285. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/escape.test +0 -0
  286. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/escape_html_attr.test +0 -0
  287. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/escape_javascript.test +0 -0
  288. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/escape_non_supported_charset.test +0 -0
  289. vendor/twig/twig/tests/Fixtures/filters/filter.test +46 -0
  290. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/filter_php_55.test +0 -0
  291. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/filter_php_56.test +0 -0
  292. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/first.test +0 -0
  293. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/force_escape.test +0 -0
  294. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/format.test +0 -0
  295. vendor/twig/twig/tests/Fixtures/filters/join.test +38 -0
  296. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/json_encode.test +0 -0
  297. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/last.test +0 -0
  298. vendor/twig/twig/tests/Fixtures/filters/length.test +40 -0
  299. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/length_utf8.test +0 -0
  300. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/map.test +0 -0
  301. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/merge.test +0 -0
  302. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/nl2br.test +0 -0
  303. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/number_format.test +0 -0
  304. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/number_format_default.test +0 -0
  305. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/reduce.test +0 -0
  306. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/replace.test +0 -0
  307. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/replace_invalid_arg.test +0 -0
  308. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/reverse.test +0 -0
  309. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/round.test +0 -0
  310. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/slice.test +0 -0
  311. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/sort.test +0 -0
  312. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/spaceless.test +0 -0
  313. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/special_chars.test +0 -0
  314. vendor/twig/twig/tests/Fixtures/filters/split.test +22 -0
  315. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/split_utf8.test +0 -0
  316. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/static_calls.test +0 -0
  317. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/trim.test +0 -0
  318. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/urlencode.test +0 -0
  319. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/urlencode_deprecated.test +0 -0
  320. vendor/twig/twig/tests/Fixtures/functions/attribute.test +18 -0
  321. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/block.test +0 -0
  322. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/block_with_template.test +0 -0
  323. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/block_without_name.test +0 -0
  324. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/constant.test +0 -0
  325. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/cycle.test +0 -0
  326. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/date.test +0 -0
  327. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/date_namedargs.test +0 -0
  328. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/dump.test +0 -0
  329. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/dump_array.test +0 -0
  330. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/dynamic_function.test +0 -0
  331. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/assignment.test +0 -0
  332. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/autoescaping.test +0 -0
  333. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/basic.test +0 -0
  334. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/expression.test +0 -0
  335. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/ignore_missing.test +0 -0
  336. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/ignore_missing_exists.test +0 -0
  337. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/include_missing_extends.test +0 -0
  338. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/missing.test +0 -0
  339. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/missing_nested.test +0 -0
  340. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/sandbox.test +0 -0
  341. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/sandbox_disabling.test +0 -0
  342. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/sandbox_disabling_ignore_missing.test +0 -0
  343. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/template_instance.test +0 -0
  344. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/templates_as_array.test +0 -0
  345. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/with_context.test +0 -0
  346. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/with_variables.test +0 -0
  347. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include_template_from_string.test +0 -0
  348. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/magic_call.test +0 -0
  349. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/magic_call53.test +0 -0
  350. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/max.test +0 -0
  351. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/min.test +0 -0
  352. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/range.test +0 -0
  353. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/recursive_block_with_inheritance.test +0 -0
  354. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/source.test +0 -0
  355. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/special_chars.test +0 -0
  356. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/static_calls.test +0 -0
  357. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/template_from_string.test +0 -0
  358. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/template_from_string_error.test +0 -0
  359. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/default_values.test +0 -0
  360. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/nested_calls.test +0 -0
  361. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/reserved_variables.test +0 -0
  362. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/simple.test +0 -0
  363. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/varargs.test +0 -0
  364. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/varargs_argument.test +0 -0
  365. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/with_filters.test +0 -0
  366. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/block_names_unicity.test +0 -0
  367. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/combined_debug_info.test +0 -0
  368. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/empty_token.test +0 -0
  369. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/issue_1143.test +0 -0
  370. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/multi_word_tests.test +0 -0
  371. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/simple_xml_element.test +0 -0
  372. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/strings_like_numbers.test +0 -0
  373. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/basic.test +0 -0
  374. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/json_encode.test +0 -0
  375. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/multiple.test +0 -0
  376. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/nested.test +0 -0
  377. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/scope.test +0 -0
  378. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/with_for_tag.test +0 -0
  379. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/with_if_tag.test +0 -0
  380. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/basic.test +0 -0
  381. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/blocks.test +0 -0
  382. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/double_escaping.test +0 -0
  383. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/functions.test +0 -0
  384. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/literal.test +0 -0
  385. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/nested.test +0 -0
  386. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/objects.test +0 -0
  387. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/raw.test +0 -0
  388. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/strategy.legacy.test +0 -0
  389. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/strategy.test +0 -0
  390. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/type.test +0 -0
  391. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/with_filters.test +0 -0
  392. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/with_filters_arguments.test +0 -0
  393. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/with_pre_escape_filters.test +0 -0
  394. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/with_preserves_safety_filters.test +0 -0
  395. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/block/basic.test +0 -0
  396. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/block/block_unique_name.test +0 -0
  397. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/block/special_chars.test +0 -0
  398. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/deprecated/block.legacy.test +0 -0
  399. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/deprecated/macro.legacy.test +0 -0
  400. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/deprecated/template.legacy.test +0 -0
  401. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/basic.test +0 -0
  402. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/complex_dynamic_parent.test +0 -0
  403. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/dynamic_parent.test +0 -0
  404. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/error_line.test +0 -0
  405. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/multiple.test +0 -0
  406. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/nested.test +0 -0
  407. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/with_extends.test +0 -0
  408. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/basic.test +0 -0
  409. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/json_encode.test +0 -0
  410. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/multiple.test +0 -0
  411. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/nested.test +0 -0
  412. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/scope.test +0 -0
  413. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/with_for_tag.test +0 -0
  414. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/with_if_tag.test +0 -0
  415. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/condition.test +0 -0
  416. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/context.test +0 -0
  417. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/else.test +0 -0
  418. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/inner_variables.test +0 -0
  419. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/keys.test +0 -0
  420. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/keys_and_values.test +0 -0
  421. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/loop_context.test +0 -0
  422. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/loop_context_local.test +0 -0
  423. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/loop_not_defined.test +0 -0
  424. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/loop_not_defined_cond.test +0 -0
  425. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/nested_else.test +0 -0
  426. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/objects.test +0 -0
  427. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/objects_countable.test +0 -0
  428. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/recursive.test +0 -0
  429. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/values.test +0 -0
  430. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/from.test +0 -0
  431. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/if/basic.test +0 -0
  432. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/if/expression.test +0 -0
  433. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/basic.test +0 -0
  434. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/expression.test +0 -0
  435. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/ignore_missing.test +0 -0
  436. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/ignore_missing_exists.test +0 -0
  437. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/include_missing_extends.test +0 -0
  438. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/missing.test +0 -0
  439. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/missing_nested.test +0 -0
  440. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/only.test +0 -0
  441. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/template_instance.test +0 -0
  442. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/templates_as_array.test +0 -0
  443. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/with_variables.test +0 -0
  444. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/basic.test +0 -0
  445. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/block_expr.test +0 -0
  446. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/block_expr2.test +0 -0
  447. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/conditional.test +0 -0
  448. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/dynamic.test +0 -0
  449. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/empty.test +0 -0
  450. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/extends_as_array.test +0 -0
  451. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test +0 -0
  452. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/extends_as_array_with_null_name.test +0 -0
  453. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/extends_in_block.test +0 -0
  454. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/extends_in_macro.test +0 -0
  455. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/multiple.test +0 -0
  456. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/multiple_dynamic.test +0 -0
  457. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/nested_blocks.test +0 -0
  458. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/nested_blocks_parent_only.test +0 -0
  459. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/nested_inheritance.test +0 -0
  460. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent.test +0 -0
  461. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent_as_template_wrapper.test +0 -0
  462. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent_change.test +0 -0
  463. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent_isolation.test +0 -0
  464. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent_nested.test +0 -0
  465. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent_without_extends.test +0 -0
  466. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent_without_extends_but_traits.test +0 -0
  467. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/template_instance.test +0 -0
  468. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/use.test +0 -0
  469. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/basic.test +0 -0
  470. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/endmacro_name.test +0 -0
  471. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/external.test +0 -0
  472. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from.test +0 -0
  473. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_in_block_is_local.test +0 -0
  474. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_local_override.test +0 -0
  475. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_macro_in_a_macro.test +0 -0
  476. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_nested_blocks.test +0 -0
  477. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_nested_blocks_with_global_macro.test +0 -0
  478. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_syntax_error.test +0 -0
  479. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_with_reserved_name.test +0 -0
  480. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/global.test +0 -0
  481. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_and_blocks.test +0 -0
  482. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_from_string_template.test +0 -0
  483. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_in_block_is_local.test +0 -0
  484. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_local_override.test +0 -0
  485. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_macro_in_a_macro.test +0 -0
  486. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_nested_blocks.legacy.test +0 -0
  487. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_nested_blocks_with_global_macro.legacy.test +0 -0
  488. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_self_parent.test +0 -0
  489. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_syntax_error.test +0 -0
  490. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_with_reserved_name.test +0 -0
  491. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/reserved_name.test +0 -0
  492. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/self_import.test +0 -0
  493. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/special_chars.test +0 -0
  494. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/super_globals.test +0 -0
  495. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/raw/basic.legacy.test +0 -0
  496. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test +0 -0
  497. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/raw/whitespace_control.legacy.test +0 -0
  498. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/sandbox/array.test +0 -0
  499. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/sandbox/not_valid1.test +0 -0
  500. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/sandbox/not_valid2.test +0 -0
  501. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/sandbox/simple.test +0 -0
  502. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/basic.test +0 -0
  503. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/capture-empty.test +0 -0
  504. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/capture.test +0 -0
  505. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/capture_scope.test +0 -0
  506. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/expression.test +0 -0
  507. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/inheritance.test +0 -0
  508. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/inheritance_overriding.test +0 -0
  509. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/mutating.test +0 -0
  510. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/spaceless/simple.test +0 -0
  511. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/special_chars.test +0 -0
  512. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/aliases.test +0 -0
  513. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/basic.test +0 -0
  514. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/deep.test +0 -0
  515. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/deep_empty.test +0 -0
  516. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/inheritance.test +0 -0
  517. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/inheritance2.test +0 -0
  518. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/multiple.test +0 -0
  519. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/multiple_aliases.test +0 -0
  520. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/parent_block.test +0 -0
  521. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/parent_block2.test +0 -0
  522. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/parent_block3.test +0 -0
  523. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/use_with_parent.test +0 -0
  524. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/verbatim/basic.test +0 -0
  525. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/verbatim/mixed_usage_with_raw.test +0 -0
  526. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/verbatim/whitespace_control.test +0 -0
  527. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/basic.test +0 -0
  528. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/expression.test +0 -0
  529. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/globals.test +0 -0
  530. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/iterable.test +0 -0
  531. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/nested.test +0 -0
  532. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/with_no_hash.test +0 -0
  533. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/with_only.test +0 -0
  534. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/array.test +0 -0
  535. vendor/twig/twig/tests/Fixtures/tests/constant.test +14 -0
  536. vendor/twig/twig/tests/Fixtures/tests/defined.test +129 -0
  537. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/defined_for_attribute.test +0 -0
  538. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/defined_for_blocks.test +0 -0
  539. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/defined_for_blocks_with_template.test +0 -0
  540. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/defined_for_constants.test +0 -0
  541. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/defined_on_complex_expr.test +0 -0
  542. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/dynamic_test.test +0 -0
  543. vendor/twig/twig/tests/Fixtures/tests/empty.test +54 -0
  544. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/even.test +0 -0
  545. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/in.test +0 -0
  546. vendor/twig/twig/tests/Fixtures/tests/in_with_objects.test +19 -0
  547. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/iterable.test +0 -0
  548. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/null_coalesce.test +0 -0
  549. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/odd.test +0 -0
  550. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/whitespace/trim_block.test +0 -0
  551. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/whitespace/trim_delimiter_as_strings.test +0 -0
  552. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/whitespace/trim_left.test +0 -0
  553. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/whitespace/trim_line_left.test +0 -0
  554. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/whitespace/trim_line_right.test +0 -0
  555. vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/whitespace/trim_right.test +0 -0
  556. vendor/twig/twig/tests/IntegrationTest.php +386 -0
  557. vendor/twig/twig/{test/Twig/Tests → tests}/LegacyFixtures/autoescape/filename.legacy.test +0 -0
  558. vendor/twig/twig/{test/Twig/Tests → tests}/LegacyFixtures/functions/undefined_block.legacy.test +0 -0
  559. vendor/twig/twig/{test/Twig/Tests → tests}/LegacyFixtures/test.legacy.test +0 -0
  560. vendor/twig/twig/tests/LegacyIntegrationTest.php +59 -0
  561. vendor/twig/twig/tests/LexerTest.php +378 -0
  562. vendor/twig/twig/tests/Loader/ArrayTest.php +139 -0
  563. vendor/twig/twig/tests/Loader/ChainTest.php +133 -0
  564. vendor/twig/twig/tests/Loader/FilesystemTest.php +247 -0
  565. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig +0 -0
  566. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig +0 -0
  567. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig +0 -0
  568. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig +0 -0
  569. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/inheritance/parent.html.twig +0 -0
  570. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/inheritance/spare_parent.html.twig +0 -0
  571. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/named/index.html +0 -0
  572. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/named_bis/index.html +0 -0
  573. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/named_final/index.html +0 -0
  574. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/named_quater/named_absolute.html +0 -0
  575. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/named_ter/index.html +0 -0
  576. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/normal/index.html +0 -0
  577. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/normal_bis/index.html +0 -0
  578. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/normal_final/index.html +0 -0
  579. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/normal_ter/index.html +0 -0
  580. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/phar/phar-sample.phar +0 -0
  581. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/themes/theme1/blocks.html.twig +0 -0
  582. vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/themes/theme2/blocks.html.twig +0 -0
  583. vendor/twig/twig/tests/NativeExtensionTest.php +43 -0
  584. vendor/twig/twig/tests/Node/AutoEscapeTest.php +39 -0
  585. vendor/twig/twig/tests/Node/BlockReferenceTest.php +36 -0
  586. vendor/twig/twig/tests/Node/BlockTest.php +45 -0
  587. vendor/twig/twig/tests/Node/DeprecatedTest.php +82 -0
  588. vendor/twig/twig/tests/Node/DoTest.php +38 -0
  589. vendor/twig/twig/tests/Node/Expression/ArrayTest.php +43 -0
  590. vendor/twig/twig/tests/Node/Expression/AssignNameTest.php +34 -0
  591. vendor/twig/twig/tests/Node/Expression/Binary/AddTest.php +40 -0
  592. vendor/twig/twig/tests/Node/Expression/Binary/AndTest.php +40 -0
  593. vendor/twig/twig/tests/Node/Expression/Binary/ConcatTest.php +40 -0
  594. vendor/twig/twig/tests/Node/Expression/Binary/DivTest.php +40 -0
  595. vendor/twig/twig/tests/Node/Expression/Binary/FloorDivTest.php +40 -0
  596. vendor/twig/twig/tests/Node/Expression/Binary/ModTest.php +40 -0
  597. vendor/twig/twig/tests/Node/Expression/Binary/MulTest.php +40 -0
  598. vendor/twig/twig/tests/Node/Expression/Binary/OrTest.php +40 -0
  599. vendor/twig/twig/tests/Node/Expression/Binary/SubTest.php +40 -0
  600. vendor/twig/twig/tests/Node/Expression/CallTest.php +139 -0
  601. vendor/twig/twig/tests/Node/Expression/ConditionalTest.php +44 -0
  602. vendor/twig/twig/tests/Node/Expression/ConstantTest.php +35 -0
  603. vendor/twig/twig/tests/Node/Expression/FilterTest.php +161 -0
  604. vendor/twig/twig/tests/Node/Expression/FunctionTest.php +119 -0
  605. vendor/twig/twig/tests/Node/Expression/GetAttrTest.php +59 -0
  606. vendor/twig/twig/tests/Node/Expression/NameTest.php +49 -0
  607. vendor/twig/twig/tests/Node/Expression/NullCoalesceTest.php +38 -0
  608. vendor/twig/twig/tests/Node/Expression/PHP53/FilterInclude.php +8 -0
  609. vendor/twig/twig/tests/Node/Expression/PHP53/FunctionInclude.php +8 -0
  610. vendor/twig/twig/tests/Node/Expression/PHP53/TestInclude.php +8 -0
  611. vendor/twig/twig/tests/Node/Expression/ParentTest.php +33 -0
  612. vendor/twig/twig/tests/Node/Expression/TestTest.php +92 -0
  613. vendor/twig/twig/tests/Node/Expression/Unary/NegTest.php +38 -0
  614. vendor/twig/twig/tests/Node/Expression/Unary/NotTest.php +37 -0
  615. vendor/twig/twig/tests/Node/Expression/Unary/PosTest.php +37 -0
  616. vendor/twig/twig/tests/Node/ForTest.php +201 -0
  617. vendor/twig/twig/tests/Node/IfTest.php +97 -0
  618. vendor/twig/twig/tests/Node/ImportTest.php +47 -0
  619. vendor/twig/twig/tests/Node/IncludeTest.php +95 -0
  620. vendor/twig/twig/tests/Node/MacroTest.php +83 -0
  621. vendor/twig/twig/tests/Node/ModuleTest.php +270 -0
  622. vendor/twig/twig/tests/Node/PrintTest.php +35 -0
  623. vendor/twig/twig/tests/Node/SandboxTest.php +49 -0
  624. vendor/twig/twig/tests/Node/SetTest.php +80 -0
  625. vendor/twig/twig/tests/Node/SpacelessTest.php +44 -0
  626. vendor/twig/twig/tests/Node/TextTest.php +33 -0
  627. vendor/twig/twig/tests/NodeTraverserTest.php +49 -0
  628. vendor/twig/twig/tests/NodeVisitor/OptimizerTest.php +116 -0
  629. vendor/twig/twig/tests/ParserTest.php +218 -0
  630. vendor/twig/twig/tests/Profiler/Dumper/AbstractTest.php +107 -0
  631. vendor/twig/twig/tests/Profiler/Dumper/BlackfireTest.php +36 -0
  632. vendor/twig/twig/tests/Profiler/Dumper/HtmlTest.php +34 -0
  633. vendor/twig/twig/tests/Profiler/Dumper/TextTest.php +34 -0
  634. vendor/twig/twig/tests/Profiler/ProfileTest.php +114 -0
  635. vendor/twig/twig/tests/TemplateTest.php +809 -0
  636. vendor/twig/twig/tests/TemplateWrapperTest.php +70 -0
  637. vendor/twig/twig/tests/TokenStreamTest.php +85 -0
  638. vendor/twig/twig/tests/Util/DeprecationCollectorTest.php +48 -0
  639. vendor/twig/twig/tests/escapingTest.php +327 -0
  640. vendor/vendor/altorouter/altorouter/AltoRouter.php +294 -0
  641. vendor/vendor/altorouter/altorouter/README.md +53 -0
  642. vendor/vendor/altorouter/altorouter/composer.json +35 -0
  643. vendor/vendor/asm89/twig-cache-extension/.gitignore +4 -0
  644. vendor/vendor/asm89/twig-cache-extension/.travis.yml +36 -0
  645. vendor/vendor/asm89/twig-cache-extension/LICENSE +19 -0
  646. vendor/vendor/asm89/twig-cache-extension/README.md +238 -0
  647. vendor/vendor/asm89/twig-cache-extension/composer.json +39 -0
  648. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheProvider/DoctrineCacheAdapter.php +49 -0
  649. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheProvider/PsrCacheAdapter.php +68 -0
  650. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheProviderInterface.php +36 -0
  651. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/BlackholeCacheStrategy.php +53 -0
  652. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/GenerationalCacheStrategy.php +79 -0
  653. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/IndexedChainingCacheStrategy.php +76 -0
  654. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/KeyGeneratorInterface.php +29 -0
  655. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/LifetimeCacheStrategy.php +68 -0
  656. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategyInterface.php +49 -0
  657. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/BaseException.php +20 -0
  658. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/InvalidCacheKeyException.php +23 -0
  659. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/InvalidCacheLifetimeException.php +23 -0
  660. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/NonExistingStrategyException.php +23 -0
  661. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/NonExistingStrategyKeyException.php +23 -0
  662. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Extension.php +59 -0
  663. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Node/CacheNode.php +71 -0
  664. vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/TokenParser/Cache.php +59 -0
  665. vendor/vendor/asm89/twig-cache-extension/phpunit.xml.dist +25 -0
  666. vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/CacheProvider/DoctrineCacheAdapterTest.php +46 -0
  667. vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/CacheStrategy/GenerationCacheStrategyTest.php +80 -0
  668. vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/CacheStrategy/IndexedChainingCacheStrategyTest.php +80 -0
  669. vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/CacheStrategy/LifetimeCacheStrategyTest.php +68 -0
  670. vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/FunctionalExtensionTest.php +182 -0
  671. vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/annotation_expression.twig +3 -0
  672. vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/annotation_not_string.twig +2 -0
  673. vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/gcs_value.twig +1 -0
  674. vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/gcs_value_v2.twig +1 -0
  675. vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/ics_no_key.twig +1 -0
  676. vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/ics_value.twig +1 -0
  677. vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/lcs_value.twig +1 -0
  678. vendor/vendor/asm89/twig-cache-extension/test/bootstrap.php +16 -0
  679. vendor/vendor/autoload.php +7 -0
  680. vendor/vendor/composer/ClassLoader.php +445 -0
  681. vendor/vendor/composer/LICENSE +21 -0
  682. vendor/vendor/composer/autoload_classmap.php +449 -0
README.md CHANGED
@@ -121,7 +121,7 @@ Please post on [StackOverflow under the "Timber" tag](http://stackoverflow.com/q
121
  It's MIT-licensed, so please use in personal or commercial work. Just don't re-sell it. Timber is used on [tens of thousands of sites](https://www.upstatement.com/timber/#showcase) (and tons more we don't know about)
122
 
123
  #### Contributing
124
- We love PRs! Read the [Contributor Guidelines](https://github.com/timber/timber/blob/master/CONTRIBUTING.md).
125
 
126
  ## Documentation
127
 
121
  It's MIT-licensed, so please use in personal or commercial work. Just don't re-sell it. Timber is used on [tens of thousands of sites](https://www.upstatement.com/timber/#showcase) (and tons more we don't know about)
122
 
123
  #### Contributing
124
+ We love PRs! Read the [Contributor Guidelines](https://github.com/timber/timber/blob/master/CONTRIBUTING.md) for more info.
125
 
126
  ## Documentation
127
 
lib/CommentThread.php CHANGED
@@ -75,9 +75,8 @@ class CommentThread extends \ArrayObject {
75
  * @internal
76
  */
77
  protected function merge_args( $args ) {
78
- $base = array('status' => 'approve');
79
- $overrides = array('order' => $this->_order);
80
- return array_merge($base, $args, $overrides);
81
  }
82
 
83
  /**
75
  * @internal
76
  */
77
  protected function merge_args( $args ) {
78
+ $base = array('status' => 'approve', 'order' => $this->_order);
79
+ return array_merge($base, $args);
 
80
  }
81
 
82
  /**
lib/Menu.php CHANGED
@@ -270,6 +270,7 @@ class Menu extends Core {
270
  protected function order_children( $items ) {
271
  $index = array();
272
  $menu = array();
 
273
  foreach ( $items as $item ) {
274
  if ( isset($item->title) ) {
275
  // Items from WordPress can come with a $title property which conflicts with methods
@@ -278,13 +279,14 @@ class Menu extends Core {
278
  }
279
  if ( isset($item->ID) ) {
280
  if ( is_object($item) && get_class($item) == 'WP_Post' ) {
281
- $old_menu_item = $item;
282
  $item = new $this->PostClass($item);
283
  }
284
  $menu_item = $this->create_menu_item($item);
285
- if ( isset($old_menu_item) ) {
286
- $menu_item->import_classes($old_menu_item);
287
  }
 
288
  $index[$item->ID] = $menu_item;
289
  }
290
  }
270
  protected function order_children( $items ) {
271
  $index = array();
272
  $menu = array();
273
+ $wp_post_menu_item = null;
274
  foreach ( $items as $item ) {
275
  if ( isset($item->title) ) {
276
  // Items from WordPress can come with a $title property which conflicts with methods
279
  }
280
  if ( isset($item->ID) ) {
281
  if ( is_object($item) && get_class($item) == 'WP_Post' ) {
282
+ $wp_post_menu_item = $item;
283
  $item = new $this->PostClass($item);
284
  }
285
  $menu_item = $this->create_menu_item($item);
286
+ if ( $wp_post_menu_item ) {
287
+ $menu_item->import_classes($wp_post_menu_item);
288
  }
289
+ $wp_post_menu_item = null;
290
  $index[$item->ID] = $menu_item;
291
  }
292
  }
lib/MenuItem.php CHANGED
@@ -79,7 +79,7 @@ class MenuItem extends Core implements CoreInterface {
79
  * @param array|object $data
80
  * @param \Timber\Menu $menu The `Timber\Menu` object the menu item is associated with.
81
  */
82
- public function __construct( $data, $menu ) {
83
  $this->menu = $menu;
84
  $data = (object) $data;
85
 
@@ -251,6 +251,12 @@ class MenuItem extends Core implements CoreInterface {
251
  $this->classes = array_merge($this->classes, $data->classes);
252
  $this->classes = array_unique($this->classes);
253
 
 
 
 
 
 
 
254
  /**
255
  * Filters the CSS classes applied to a menu item’s list item.
256
  *
@@ -267,8 +273,7 @@ class MenuItem extends Core implements CoreInterface {
267
  'nav_menu_css_class',
268
  $this->classes,
269
  $this,
270
- // The options need to be an object.
271
- (object) $this->menu->options,
272
  0
273
  );
274
 
79
  * @param array|object $data
80
  * @param \Timber\Menu $menu The `Timber\Menu` object the menu item is associated with.
81
  */
82
+ public function __construct( $data, $menu = null ) {
83
  $this->menu = $menu;
84
  $data = (object) $data;
85
 
251
  $this->classes = array_merge($this->classes, $data->classes);
252
  $this->classes = array_unique($this->classes);
253
 
254
+ $options = new \stdClass();
255
+ if ( isset( $this->menu->options ) ) {
256
+ // The options need to be an object.
257
+ $options = (object) $this->menu->options;
258
+ }
259
+
260
  /**
261
  * Filters the CSS classes applied to a menu item’s list item.
262
  *
273
  'nav_menu_css_class',
274
  $this->classes,
275
  $this,
276
+ $options,
 
277
  0
278
  );
279
 
lib/Theme.php CHANGED
@@ -95,7 +95,7 @@ class Theme extends Core {
95
 
96
  $this->uri = $this->theme->get_template_directory_uri();
97
 
98
- if ( $this->theme->parent()) {
99
  $this->parent_slug = $this->theme->parent()->get_stylesheet();
100
  $this->parent = new Theme($this->parent_slug);
101
  }
@@ -135,5 +135,42 @@ class Theme extends Core {
135
  return get_theme_mods();
136
  }
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  }
139
 
95
 
96
  $this->uri = $this->theme->get_template_directory_uri();
97
 
98
+ if ( $this->theme->parent() ) {
99
  $this->parent_slug = $this->theme->parent()->get_stylesheet();
100
  $this->parent = new Theme($this->parent_slug);
101
  }
135
  return get_theme_mods();
136
  }
137
 
138
+ /**
139
+ * Gets a raw, unformatted theme header.
140
+ *
141
+ * @api
142
+ * @see \WP_Theme::get()
143
+ * @example
144
+ * ```twig
145
+ * {{ theme.get('Version') }}
146
+ * ```
147
+ *
148
+ * @param string $header Name of the theme header. Name, Description, Author, Version,
149
+ * ThemeURI, AuthorURI, Status, Tags.
150
+ *
151
+ * @return false|string String on success, false on failure.
152
+ */
153
+ public function get( $header ) {
154
+ return $this->theme->get( $header );
155
+ }
156
+
157
+ /**
158
+ * Gets a theme header, formatted and translated for display.
159
+ *
160
+ * @api
161
+ * @see \WP_Theme::display()
162
+ * @example
163
+ * ```twig
164
+ * {{ theme.display('Description') }}
165
+ * ```
166
+ *
167
+ * @param string $header Name of the theme header. Name, Description, Author, Version,
168
+ * ThemeURI, AuthorURI, Status, Tags.
169
+ *
170
+ * @return false|string
171
+ */
172
+ public function display( $header ) {
173
+ return $this->theme->display( $header );
174
+ }
175
  }
176
 
lib/Timber.php CHANGED
@@ -35,7 +35,7 @@ use Timber\Loader;
35
  */
36
  class Timber {
37
 
38
- public static $version = '1.10.0';
39
  public static $locations;
40
  public static $dirname = 'views';
41
  public static $twig_cache = false;
35
  */
36
  class Timber {
37
 
38
+ public static $version = '1.11.0';
39
  public static $locations;
40
  public static $dirname = 'views';
41
  public static $twig_cache = false;
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Timber ===
2
- Contributors: jarednova, connorjburton, lggorman
3
  Tags: template engine, templates, twig
4
  Requires at least: 4.7.12
5
- Tested up to: 5.2.1
6
- Stable tag: 1.10.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -30,9 +30,20 @@ _Twig is the template language powering Timber; if you need a little background
30
 
31
  = Develop (next release) =
32
 
 
 
 
 
33
  **Fixes and improvements**
 
 
34
 
35
  **Changes for Theme Developers**
 
 
 
 
 
36
 
37
  = 1.10.0 =
38
  **Important Note**
@@ -41,7 +52,7 @@ If you use WPML, please do not upgrade to 1.10.* yet. Because WPML also uses Twi
41
  **Fixes and improvements**
42
  - You can now skip the eager loading of meta vars through a filter #2014 (thanks @aj-adl @gchtr)
43
  - Use Twig 1.38 to prevent compatibility issues with WPML and other plug-ins
44
- - This restores the prior behavior before #1813 / 1.9.3 when using Timber::get_posts. This is now controllable by devs
45
  - Add support for non-cookied comment awaiting moderation message #1954 (thanks @codeclarified)
46
  - Avoids a potential WSOD when incorrectly specifying template filenames #1984 (thanks @aj-adl)
47
  - Fixes a bug introduced in #1813 that was watching for the query param of `supress_filters` (instead of the correct spelling: `suppress_filters`)
1
  === Timber ===
2
+ Contributors: jarednova
3
  Tags: template engine, templates, twig
4
  Requires at least: 4.7.12
5
+ Tested up to: 5.2.3
6
+ Stable tag: 1.11.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
30
 
31
  = Develop (next release) =
32
 
33
+ = 1.11.0 =
34
+ **General Note**
35
+ - If you use WPML with Timber, please upgrade to WPML 4.2.8. The WPML team has removed their included Twig version which means no more conflicts!
36
+
37
  **Fixes and improvements**
38
+ - Fix to menu items getting incorrect classes in WPML and others #1974
39
+ - Fixed issue with Timber not respecting comment order #1731 #2015
40
 
41
  **Changes for Theme Developers**
42
+ - Theme methods (theme.get and theme.display) for headers are now exposed by Timber\Theme #2051 (thanks @dtvn)
43
+
44
+ = 1.10.1 =
45
+ **Fixes and improvements**
46
+ - Allows for a MenuItem's Menu to be unknown #2024 #2025
47
 
48
  = 1.10.0 =
49
  **Important Note**
52
  **Fixes and improvements**
53
  - You can now skip the eager loading of meta vars through a filter #2014 (thanks @aj-adl @gchtr)
54
  - Use Twig 1.38 to prevent compatibility issues with WPML and other plug-ins
55
+ - This restores the prior behavior before #1813 / 1.9.3 when using Timber::get_posts. This is now controllable by devs via a filter #1989 (thanks @palmiak)
56
  - Add support for non-cookied comment awaiting moderation message #1954 (thanks @codeclarified)
57
  - Avoids a potential WSOD when incorrectly specifying template filenames #1984 (thanks @aj-adl)
58
  - Fixes a bug introduced in #1813 that was watching for the query param of `supress_filters` (instead of the correct spelling: `suppress_filters`)
timber-starter-theme/.travis.yml CHANGED
@@ -1,5 +1,9 @@
1
  sudo: false
2
 
 
 
 
 
3
  language: php
4
 
5
  php:
@@ -12,7 +16,7 @@ env:
12
 
13
  before_script:
14
  - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
15
- - composer install --dev
16
 
17
  script:
18
  - vendor/phpunit/phpunit/phpunit
1
  sudo: false
2
 
3
+ dist: xenial
4
+
5
+ services: mysql
6
+
7
  language: php
8
 
9
  php:
16
 
17
  before_script:
18
  - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
19
+ - composer install
20
 
21
  script:
22
  - vendor/phpunit/phpunit/phpunit
timber-starter-theme/bin/install-wp-tests.sh DELETED
@@ -1,112 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- if [ $# -lt 3 ]; then
4
- echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version]"
5
- exit 1
6
- fi
7
-
8
- DB_NAME=$1
9
- DB_USER=$2
10
- DB_PASS=$3
11
- DB_HOST=${4-localhost}
12
- WP_VERSION=${5-latest}
13
-
14
- WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
15
- WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}
16
-
17
- download() {
18
- if [ `which curl` ]; then
19
- curl -s "$1" > "$2";
20
- elif [ `which wget` ]; then
21
- wget -nv -O "$2" "$1"
22
- fi
23
- }
24
-
25
- if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then
26
- WP_TESTS_TAG="tags/$WP_VERSION"
27
- else
28
- # http serves a single offer, whereas https serves multiple. we only want one
29
- download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
30
- grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
31
- LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
32
- if [[ -z "$LATEST_VERSION" ]]; then
33
- echo "Latest WordPress version could not be found"
34
- exit 1
35
- fi
36
- WP_TESTS_TAG="tags/$LATEST_VERSION"
37
- fi
38
-
39
- set -ex
40
-
41
- install_wp() {
42
-
43
- if [ -d $WP_CORE_DIR ]; then
44
- return;
45
- fi
46
-
47
- mkdir -p $WP_CORE_DIR
48
-
49
- if [ $WP_VERSION == 'latest' ]; then
50
- local ARCHIVE_NAME='latest'
51
- else
52
- local ARCHIVE_NAME="wordpress-$WP_VERSION"
53
- fi
54
-
55
- download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz
56
- tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
57
-
58
- download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
59
- }
60
-
61
- install_test_suite() {
62
- # portable in-place argument for both GNU sed and Mac OSX sed
63
- if [[ $(uname -s) == 'Darwin' ]]; then
64
- local ioption='-i .bak'
65
- else
66
- local ioption='-i'
67
- fi
68
-
69
- # set up testing suite if it doesn't yet exist
70
- if [ ! -d $WP_TESTS_DIR ]; then
71
- # set up testing suite
72
- mkdir -p $WP_TESTS_DIR
73
- svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
74
- fi
75
-
76
- cd $WP_TESTS_DIR
77
-
78
- if [ ! -f wp-tests-config.php ]; then
79
- download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
80
- sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" "$WP_TESTS_DIR"/wp-tests-config.php
81
- sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
82
- sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
83
- sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
84
- sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
85
- fi
86
-
87
- }
88
-
89
- install_db() {
90
- # parse DB_HOST for port or socket references
91
- local PARTS=(${DB_HOST//\:/ })
92
- local DB_HOSTNAME=${PARTS[0]};
93
- local DB_SOCK_OR_PORT=${PARTS[1]};
94
- local EXTRA=""
95
-
96
- if ! [ -z $DB_HOSTNAME ] ; then
97
- if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
98
- EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
99
- elif ! [ -z $DB_SOCK_OR_PORT ] ; then
100
- EXTRA=" --socket=$DB_SOCK_OR_PORT"
101
- elif ! [ -z $DB_HOSTNAME ] ; then
102
- EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
103
- fi
104
- fi
105
-
106
- # create database
107
- mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
108
- }
109
-
110
- install_wp
111
- install_test_suite
112
- install_db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
timber-starter-theme/composer.json DELETED
@@ -1,32 +0,0 @@
1
- {
2
- "name": "upstatement/timber-starter-theme",
3
- "description": "Starter theme to build a Timber theme",
4
- "type":"wordpress-theme",
5
- "minimum-stability" : "stable",
6
- "authors": [
7
- {
8
- "name": "jarednova",
9
- "email": "jared@upstatement.com"
10
- }
11
- ],
12
- "repositories": [
13
- {
14
- "type": "composer",
15
- "url": "https://wpackagist.org"
16
- }
17
- ],
18
- "extra": {
19
- "installer-paths": {
20
- "../../plugins/{$name}/": [
21
- "wpackagist-plugin/*",
22
- "type:wordpress-plugin"
23
- ]
24
- }
25
- },
26
- "require": {
27
- "wpackagist-plugin/timber-library": "1.*"
28
- },
29
- "require-dev": {
30
- "phpunit/phpunit": "5.7.16|6.*"
31
- }
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
timber-starter-theme/functions.php CHANGED
@@ -8,7 +8,23 @@
8
  * @since Timber 0.1
9
  */
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  if ( ! class_exists( 'Timber' ) ) {
 
12
  add_action( 'admin_notices', function() {
13
  echo '<div class="error"><p>Timber not activated. Make sure you activate the plugin in <a href="' . esc_url( admin_url( 'plugins.php#timber' ) ) . '">' . esc_url( admin_url( 'plugins.php' ) ) . '</a></p></div>';
14
  });
@@ -16,7 +32,6 @@ if ( ! class_exists( 'Timber' ) ) {
16
  add_filter('template_include', function( $template ) {
17
  return get_stylesheet_directory() . '/static/no-timber.html';
18
  });
19
-
20
  return;
21
  }
22
 
8
  * @since Timber 0.1
9
  */
10
 
11
+ /**
12
+ * If you are installing Timber as a Composer dependency in your theme, you'll need this block
13
+ * to load your dependencies and initialize Timber. If you are using Timber via the WordPress.org
14
+ * plug-in, you can safely delete this block.
15
+ */
16
+ $composer_autoload = __DIR__ . '/vendor/autoload.php';
17
+ if ( file_exists($composer_autoload) ) {
18
+ require_once( $composer_autoload );
19
+ $timber = new Timber\Timber();
20
+ }
21
+
22
+ /**
23
+ * This ensures that Timber is loaded and available as a PHP class.
24
+ * If not, it gives an error message to help direct developers on where to activate
25
+ */
26
  if ( ! class_exists( 'Timber' ) ) {
27
+
28
  add_action( 'admin_notices', function() {
29
  echo '<div class="error"><p>Timber not activated. Make sure you activate the plugin in <a href="' . esc_url( admin_url( 'plugins.php#timber' ) ) . '">' . esc_url( admin_url( 'plugins.php' ) ) . '</a></p></div>';
30
  });
32
  add_filter('template_include', function( $template ) {
33
  return get_stylesheet_directory() . '/static/no-timber.html';
34
  });
 
35
  return;
36
  }
37
 
timber-starter-theme/page.php CHANGED
@@ -8,7 +8,7 @@
8
  * different template.
9
  *
10
  * To generate specific templates for your pages you can use:
11
- * /mytheme/views/page-mypage.twig
12
  * (which will still route through this PHP file)
13
  * OR
14
  * /mytheme/page-mypage.php
8
  * different template.
9
  *
10
  * To generate specific templates for your pages you can use:
11
+ * /mytheme/templates/page-mypage.twig
12
  * (which will still route through this PHP file)
13
  * OR
14
  * /mytheme/page-mypage.php
timber-starter-theme/single.php CHANGED
@@ -16,5 +16,5 @@ $context['post'] = $timber_post;
16
  if ( post_password_required( $timber_post->ID ) ) {
17
  Timber::render( 'single-password.twig', $context );
18
  } else {
19
- Timber::render( array( 'single-' . $timber_post->ID . '.twig', 'single-' . $timber_post->post_type . '.twig', 'single.twig' ), $context );
20
  }
16
  if ( post_password_required( $timber_post->ID ) ) {
17
  Timber::render( 'single-password.twig', $context );
18
  } else {
19
+ Timber::render( array( 'single-' . $timber_post->ID . '.twig', 'single-' . $timber_post->post_type . '.twig', 'single-' . $timber_post->slug . '.twig', 'single.twig' ), $context );
20
  }
timber-starter-theme/templates/base.twig CHANGED
@@ -15,7 +15,7 @@
15
  <a class="hdr-logo-link" href="{{site.url}}" rel="home">{{site.name}}</a>
16
  </h1>
17
  <nav id="nav-main" class="nav-main" role="navigation">
18
- {% include "menu.twig" with {'menu': menu.get_items} %}
19
  </nav><!-- #nav -->
20
  </div>
21
  {% endblock %}
15
  <a class="hdr-logo-link" href="{{site.url}}" rel="home">{{site.name}}</a>
16
  </h1>
17
  <nav id="nav-main" class="nav-main" role="navigation">
18
+ {% include "menu.twig" with {'items': menu.get_items} %}
19
  </nav><!-- #nav -->
20
  </div>
21
  {% endblock %}
timber-starter-theme/templates/menu.twig CHANGED
@@ -1,9 +1,9 @@
1
  {% if menu %}
2
  <ul>
3
- {% for item in menu %}
4
  <li class="{{ item.classes | join(' ') }}">
5
  <a target="{{ item.target }}" href="{{ item.link }}">{{ item.title }}</a>
6
- {% include "menu.twig" with {'menu': item.children} %}
7
  </li>
8
  {% endfor %}
9
  </ul>
1
  {% if menu %}
2
  <ul>
3
+ {% for item in items %}
4
  <li class="{{ item.classes | join(' ') }}">
5
  <a target="{{ item.target }}" href="{{ item.link }}">{{ item.title }}</a>
6
+ {% include "menu.twig" with {'items': item.children} %}
7
  </li>
8
  {% endfor %}
9
  </ul>
timber-starter-theme/templates/partial/pagination.twig CHANGED
@@ -1,6 +1,8 @@
1
  {% if posts.pagination.pages is not empty %}
2
  <nav class="pagination-block">
3
  <ul class="pagination">
 
 
4
  {% if pagination.pages|first and pagination.pages|first.current != true %}
5
  <li class="first btn">
6
  <a href="{{ pagination.pages|first.link }}">First</a>
@@ -11,6 +13,7 @@
11
  </li>
12
  {% endif %}
13
 
 
14
  {% if pagination.prev %}
15
  <li class="prev btn">
16
  <a href="{{ pagination.prev.link }}">Previous</a>
@@ -21,6 +24,7 @@
21
  </li>
22
  {% endif %}
23
 
 
24
  {% for page in pagination.pages %}
25
  {% if page.link %}
26
  <li>
@@ -33,19 +37,18 @@
33
  {% endif %}
34
  {% endfor %}
35
 
 
36
  {% if pagination.next %}
37
  <li class="next btn">
38
- <a href="{{ pagination.next.link }}">
39
- Next
40
- </a>
41
  </li>
42
  {% else %}
43
  <li class="next btn disabled">
44
- <button disabled>
45
- Next
46
- </button>
47
  </li>
48
  {% endif %}
 
 
49
  {% if pagination.pages|last and pagination.pages|last.current != true %}
50
  <li class="last btn">
51
  <a href="{{ pagination.pages|last.link }}">Last</a>
@@ -55,6 +58,7 @@
55
  <button disabled>Last</button>
56
  </li>
57
  {% endif %}
 
58
  </ul>
59
  </nav>
60
  {% endif %}
1
  {% if posts.pagination.pages is not empty %}
2
  <nav class="pagination-block">
3
  <ul class="pagination">
4
+
5
+ {# First #}
6
  {% if pagination.pages|first and pagination.pages|first.current != true %}
7
  <li class="first btn">
8
  <a href="{{ pagination.pages|first.link }}">First</a>
13
  </li>
14
  {% endif %}
15
 
16
+ {# Previous #}
17
  {% if pagination.prev %}
18
  <li class="prev btn">
19
  <a href="{{ pagination.prev.link }}">Previous</a>
24
  </li>
25
  {% endif %}
26
 
27
+ {# Pages #}
28
  {% for page in pagination.pages %}
29
  {% if page.link %}
30
  <li>
37
  {% endif %}
38
  {% endfor %}
39
 
40
+ {# Next #}
41
  {% if pagination.next %}
42
  <li class="next btn">
43
+ <a href="{{ pagination.next.link }}">Next</a>
 
 
44
  </li>
45
  {% else %}
46
  <li class="next btn disabled">
47
+ <button disabled>Next</button>
 
 
48
  </li>
49
  {% endif %}
50
+
51
+ {# Last #}
52
  {% if pagination.pages|last and pagination.pages|last.current != true %}
53
  <li class="last btn">
54
  <a href="{{ pagination.pages|last.link }}">Last</a>
58
  <button disabled>Last</button>
59
  </li>
60
  {% endif %}
61
+
62
  </ul>
63
  </nav>
64
  {% endif %}
timber-starter-theme/tests/bootstrap.php CHANGED
@@ -1,10 +1,5 @@
1
  <?php
2
 
3
- if ( file_exists($composer_autoload = __DIR__ . '/../vendor/autoload.php') ) {
4
- require_once($composer_autoload);
5
- }
6
-
7
-
8
  $_tests_dir = getenv('WP_TESTS_DIR');
9
  if ( !$_tests_dir ) $_tests_dir = '/tmp/wordpress-tests-lib';
10
 
1
  <?php
2
 
 
 
 
 
 
3
  $_tests_dir = getenv('WP_TESTS_DIR');
4
  if ( !$_tests_dir ) $_tests_dir = '/tmp/wordpress-tests-lib';
5
 
timber-starter-theme/tests/test-timber-starter-theme.php CHANGED
@@ -4,13 +4,19 @@
4
 
5
  function setUp() {
6
  self::_setupStarterTheme();
7
- require_once(get_template_directory().'/functions.php');
 
8
  }
9
 
10
  function tearDown() {
11
  switch_theme('twentythirteen');
12
  }
13
 
 
 
 
 
 
14
  function testFunctionsPHP() {
15
  $context = Timber::context();
16
  $this->assertEquals('StarterSite', get_class($context['site']));
@@ -25,30 +31,12 @@
25
  }
26
 
27
  static function _setupStarterTheme(){
28
- $dest = WP_CONTENT_DIR.'/themes/starter-theme/';
29
- $src = __DIR__.'/../../starter-theme/';
30
- if (is_dir($src)) {
31
- self::_copyDirectory($src, $dest);
32
- switch_theme('starter-theme');
33
- } else {
34
- echo 'no its not';
35
  }
36
  }
37
 
38
- static function _copyDirectory($src, $dst){
39
- $dir = opendir($src);
40
- @mkdir($dst);
41
- while(false !== ( $file = readdir($dir)) ) {
42
- if (( $file != '.' ) && ( $file != '..' )) {
43
- if ( is_dir($src . '/' . $file) ) {
44
- self::_copyDirectory($src . '/' . $file,$dst . '/' . $file);
45
- }
46
- else {
47
- copy($src . '/' . $file,$dst . '/' . $file);
48
- }
49
- }
50
- }
51
- closedir($dir);
52
- }
53
 
54
  }
4
 
5
  function setUp() {
6
  self::_setupStarterTheme();
7
+ switch_theme( basename( dirname( dirname( __FILE__ ) ) ) );
8
+ require_once(__DIR__.'/../functions.php');
9
  }
10
 
11
  function tearDown() {
12
  switch_theme('twentythirteen');
13
  }
14
 
15
+ function testTimberExists() {
16
+ $context = Timber::context();
17
+ $this->assertTrue(is_array($context));
18
+ }
19
+
20
  function testFunctionsPHP() {
21
  $context = Timber::context();
22
  $this->assertEquals('StarterSite', get_class($context['site']));
31
  }
32
 
33
  static function _setupStarterTheme(){
34
+ $dest = WP_CONTENT_DIR . '/themes/' . basename( dirname( dirname( __FILE__ ) ) );
35
+ $src = realpath( __DIR__ . '/../../' . basename( dirname( dirname( __FILE__ ) ) ) );
36
+ if ( is_dir($src) && !file_exists($dest) ) {
37
+ symlink($src, $dest);
 
 
 
38
  }
39
  }
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  }
timber-starter-theme/timber-starter-theme/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
1
+ vendor
2
+ wp-content
timber-starter-theme/timber-starter-theme/.travis.yml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ sudo: false
2
+
3
+ dist: xenial
4
+
5
+ services: mysql
6
+
7
+ language: php
8
+
9
+ php:
10
+ - 5.6.30
11
+ - 7.3
12
+
13
+ env:
14
+ - WP_VERSION=latest WP_MULTISITE=0
15
+ - WP_VERSION=latest WP_MULTISITE=1
16
+
17
+ before_script:
18
+ - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
19
+ - composer install
20
+
21
+ script:
22
+ - vendor/phpunit/phpunit/phpunit
timber-starter-theme/timber-starter-theme/404.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template for displaying 404 pages (Not Found)
4
+ *
5
+ * Methods for TimberHelper can be found in the /functions sub-directory
6
+ *
7
+ * @package WordPress
8
+ * @subpackage Timber
9
+ * @since Timber 0.1
10
+ */
11
+
12
+ $context = Timber::context();
13
+ Timber::render( '404.twig', $context );
timber-starter-theme/timber-starter-theme/LICENSE ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ Copyright (c) 2012-2013 Jared Novack
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
timber-starter-theme/timber-starter-theme/README.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # The Timber Starter Theme
3
+
4
+ The "_s" for Timber: a dead-simple theme that you can build from. The primary purpose of this theme is to provide a file structure rather than a framework for markup or styles. Configure your Sass, scripts, and task runners however you would like!
5
+
6
+ [![Build Status](https://travis-ci.org/timber/starter-theme.svg)](https://travis-ci.org/timber/starter-theme)
7
+
8
+ ## Installing the Theme
9
+
10
+ Install this theme as you would any other, and be sure the Timber plugin is activated. But hey, let's break it down into some bullets:
11
+
12
+ 1. Make sure you have installed the plugin for the [Timber Library](https://wordpress.org/plugins/timber-library/) (and Advanced Custom Fields - they [play quite nicely](https://timber.github.io/docs/guides/acf-cookbook/#nav) together).
13
+ 2. Download the zip for this theme (or clone it) and move it to `wp-content/themes` in your WordPress installation.
14
+ 3. Rename the folder to something that makes sense for your website (generally no spaces and all lowercase). You could keep the name `timber-starter-theme` but the point of a starter theme is to make it your own!
15
+ 4. Activate the theme in Appearance > Themes.
16
+ 5. Do your thing! And read [the docs](https://github.com/jarednova/timber/wiki).
17
+
18
+ ## What's here?
19
+
20
+ `static/` is where you can keep your static front-end scripts, styles, or images. In other words, your Sass files, JS files, fonts, and SVGs would live here.
21
+
22
+ `templates/` contains all of your Twig templates. These pretty much correspond 1 to 1 with the PHP files that respond to the WordPress template hierarchy. At the end of each PHP template, you'll notice a `Timber::render()` function whose first parameter is the Twig file where that data (or `$context`) will be used. Just an FYI.
23
+
24
+ `bin/` and `tests/` ... basically don't worry about (or remove) these unless you know what they are and want to.
25
+
26
+ ## Other Resources
27
+
28
+ The [main Timber Wiki](https://github.com/jarednova/timber/wiki) is super great, so reference those often. Also, check out these articles and projects for more info:
29
+
30
+ * [This branch](https://github.com/laras126/timber-starter-theme/tree/tackle-box) of the starter theme has some more example code with ACF and a slightly different set up.
31
+ * [Twig for Timber Cheatsheet](http://notlaura.com/the-twig-for-timber-cheatsheet/)
32
+ * [Timber and Twig Reignited My Love for WordPress](https://css-tricks.com/timber-and-twig-reignited-my-love-for-wordpress/) on CSS-Tricks
33
+ * [A real live Timber theme](https://github.com/laras126/yuling-theme).
34
+ * [Timber Video Tutorials](http://timber.github.io/timber/#video-tutorials) and [an incomplete set of screencasts](https://www.youtube.com/playlist?list=PLuIlodXmVQ6pkqWyR6mtQ5gQZ6BrnuFx-) for building a Timber theme from scratch.
35
+
timber-starter-theme/timber-starter-theme/archive.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template for displaying Archive pages.
4
+ *
5
+ * Used to display archive-type pages if nothing more specific matches a query.
6
+ * For example, puts together date-based pages if no date.php file exists.
7
+ *
8
+ * Learn more: http://codex.wordpress.org/Template_Hierarchy
9
+ *
10
+ * Methods for TimberHelper can be found in the /lib sub-directory
11
+ *
12
+ * @package WordPress
13
+ * @subpackage Timber
14
+ * @since Timber 0.2
15
+ */
16
+
17
+ $templates = array( 'archive.twig', 'index.twig' );
18
+
19
+ $context = Timber::context();
20
+
21
+ $context['title'] = 'Archive';
22
+ if ( is_day() ) {
23
+ $context['title'] = 'Archive: ' . get_the_date( 'D M Y' );
24
+ } else if ( is_month() ) {
25
+ $context['title'] = 'Archive: ' . get_the_date( 'M Y' );
26
+ } else if ( is_year() ) {
27
+ $context['title'] = 'Archive: ' . get_the_date( 'Y' );
28
+ } else if ( is_tag() ) {
29
+ $context['title'] = single_tag_title( '', false );
30
+ } else if ( is_category() ) {
31
+ $context['title'] = single_cat_title( '', false );
32
+ array_unshift( $templates, 'archive-' . get_query_var( 'cat' ) . '.twig' );
33
+ } else if ( is_post_type_archive() ) {
34
+ $context['title'] = post_type_archive_title( '', false );
35
+ array_unshift( $templates, 'archive-' . get_post_type() . '.twig' );
36
+ }
37
+
38
+ $context['posts'] = new Timber\PostQuery();
39
+
40
+ Timber::render( $templates, $context );
timber-starter-theme/timber-starter-theme/author.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template for displaying Author Archive pages
4
+ *
5
+ * Methods for TimberHelper can be found in the /lib sub-directory
6
+ *
7
+ * @package WordPress
8
+ * @subpackage Timber
9
+ * @since Timber 0.1
10
+ */
11
+
12
+ global $wp_query;
13
+
14
+ $context = Timber::context();
15
+ $context['posts'] = new Timber\PostQuery();
16
+ if ( isset( $wp_query->query_vars['author'] ) ) {
17
+ $author = new Timber\User( $wp_query->query_vars['author'] );
18
+ $context['author'] = $author;
19
+ $context['title'] = 'Author Archives: ' . $author->name();
20
+ }
21
+ Timber::render( array( 'author.twig', 'archive.twig' ), $context );
timber-starter-theme/timber-starter-theme/footer.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Third party plugins that hijack the theme will call wp_footer() to get the footer template.
4
+ * We use this to end our output buffer (started in header.php) and render into the view/page-plugin.twig template.
5
+ *
6
+ * If you're not using a plugin that requries this behavior (ones that do include Events Calendar Pro and
7
+ * WooCommerce) you can delete this file and header.php
8
+ *
9
+ * @package WordPress
10
+ * @subpackage Timber
11
+ * @since Timber 0.1
12
+ */
13
+
14
+ $timberContext = $GLOBALS['timberContext']; // @codingStandardsIgnoreFile
15
+ if ( ! isset( $timberContext ) ) {
16
+ throw new \Exception( 'Timber context not set in footer.' );
17
+ }
18
+ $timberContext['content'] = ob_get_contents();
19
+ ob_end_clean();
20
+ $templates = array( 'page-plugin.twig' );
21
+ Timber::render( $templates, $timberContext );
timber-starter-theme/timber-starter-theme/functions.php ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Timber starter-theme
4
+ * https://github.com/timber/starter-theme
5
+ *
6
+ * @package WordPress
7
+ * @subpackage Timber
8
+ * @since Timber 0.1
9
+ */
10
+
11
+ /**
12
+ * If you are installing Timber as a Composer dependency in your theme, you'll need this block
13
+ * to load your dependencies and initialize Timber. If you are using Timber via the WordPress.org
14
+ * plug-in, you can safely delete this block.
15
+ */
16
+ $composer_autoload = __DIR__ . '/vendor/autoload.php';
17
+ if ( file_exists($composer_autoload) ) {
18
+ require_once( $composer_autoload );
19
+ $timber = new Timber\Timber();
20
+ }
21
+
22
+ /**
23
+ * This ensures that Timber is loaded and available as a PHP class.
24
+ * If not, it gives an error message to help direct developers on where to activate
25
+ */
26
+ if ( ! class_exists( 'Timber' ) ) {
27
+
28
+ add_action( 'admin_notices', function() {
29
+ echo '<div class="error"><p>Timber not activated. Make sure you activate the plugin in <a href="' . esc_url( admin_url( 'plugins.php#timber' ) ) . '">' . esc_url( admin_url( 'plugins.php' ) ) . '</a></p></div>';
30
+ });
31
+
32
+ add_filter('template_include', function( $template ) {
33
+ return get_stylesheet_directory() . '/static/no-timber.html';
34
+ });
35
+ return;
36
+ }
37
+
38
+ /**
39
+ * Sets the directories (inside your theme) to find .twig files
40
+ */
41
+ Timber::$dirname = array( 'templates', 'views' );
42
+
43
+ /**
44
+ * By default, Timber does NOT autoescape values. Want to enable Twig's autoescape?
45
+ * No prob! Just set this value to true
46
+ */
47
+ Timber::$autoescape = false;
48
+
49
+
50
+ /**
51
+ * We're going to configure our theme inside of a subclass of Timber\Site
52
+ * You can move this to its own file and include here via php's include("MySite.php")
53
+ */
54
+ class StarterSite extends Timber\Site {
55
+ /** Add timber support. */
56
+ public function __construct() {
57
+ add_action( 'after_setup_theme', array( $this, 'theme_supports' ) );
58
+ add_filter( 'timber/context', array( $this, 'add_to_context' ) );
59
+ add_filter( 'timber/twig', array( $this, 'add_to_twig' ) );
60
+ add_action( 'init', array( $this, 'register_post_types' ) );
61
+ add_action( 'init', array( $this, 'register_taxonomies' ) );
62
+ parent::__construct();
63
+ }
64
+ /** This is where you can register custom post types. */
65
+ public function register_post_types() {
66
+
67
+ }
68
+ /** This is where you can register custom taxonomies. */
69
+ public function register_taxonomies() {
70
+
71
+ }
72
+
73
+ /** This is where you add some context
74
+ *
75
+ * @param string $context context['this'] Being the Twig's {{ this }}.
76
+ */
77
+ public function add_to_context( $context ) {
78
+ $context['foo'] = 'bar';
79
+ $context['stuff'] = 'I am a value set in your functions.php file';
80
+ $context['notes'] = 'These values are available everytime you call Timber::context();';
81
+ $context['menu'] = new Timber\Menu();
82
+ $context['site'] = $this;
83
+ return $context;
84
+ }
85
+
86
+ public function theme_supports() {
87
+ // Add default posts and comments RSS feed links to head.
88
+ add_theme_support( 'automatic-feed-links' );
89
+
90
+ /*
91
+ * Let WordPress manage the document title.
92
+ * By adding theme support, we declare that this theme does not use a
93
+ * hard-coded <title> tag in the document head, and expect WordPress to
94
+ * provide it for us.
95
+ */
96
+ add_theme_support( 'title-tag' );
97
+
98
+ /*
99
+ * Enable support for Post Thumbnails on posts and pages.
100
+ *
101
+ * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
102
+ */
103
+ add_theme_support( 'post-thumbnails' );
104
+
105
+ /*
106
+ * Switch default core markup for search form, comment form, and comments
107
+ * to output valid HTML5.
108
+ */
109
+ add_theme_support(
110
+ 'html5', array(
111
+ 'comment-form',
112
+ 'comment-list',
113
+ 'gallery',
114
+ 'caption',
115
+ )
116
+ );
117
+
118
+ /*
119
+ * Enable support for Post Formats.
120
+ *
121
+ * See: https://codex.wordpress.org/Post_Formats
122
+ */
123
+ add_theme_support(
124
+ 'post-formats', array(
125
+ 'aside',
126
+ 'image',
127
+ 'video',
128
+ 'quote',
129
+ 'link',
130
+ 'gallery',
131
+ 'audio',
132
+ )
133
+ );
134
+
135
+ add_theme_support( 'menus' );
136
+ }
137
+
138
+ /** This Would return 'foo bar!'.
139
+ *
140
+ * @param string $text being 'foo', then returned 'foo bar!'.
141
+ */
142
+ public function myfoo( $text ) {
143
+ $text .= ' bar!';
144
+ return $text;
145
+ }
146
+
147
+ /** This is where you can add your own functions to twig.
148
+ *
149
+ * @param string $twig get extension.
150
+ */
151
+ public function add_to_twig( $twig ) {
152
+ $twig->addExtension( new Twig_Extension_StringLoader() );
153
+ $twig->addFilter( new Twig_SimpleFilter( 'myfoo', array( $this, 'myfoo' ) ) );
154
+ return $twig;
155
+ }
156
+
157
+ }
158
+
159
+ new StarterSite();
timber-starter-theme/timber-starter-theme/header.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Third party plugins that hijack the theme will call wp_head() to get the header template.
4
+ * We use this to start our output buffer and render into the view/page-plugin.twig template in footer.php
5
+ *
6
+ * If you're not using a plugin that requries this behavior (ones that do include Events Calendar Pro and
7
+ * WooCommerce) you can delete this file and footer.php
8
+ *
9
+ * @package WordPress
10
+ * @subpackage Timber
11
+ * @since Timber 0.1
12
+ */
13
+
14
+ $GLOBALS['timberContext'] = Timber::context();
15
+ ob_start();
timber-starter-theme/timber-starter-theme/humans.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ ## Team
2
+
3
+ Your name or company
4
+ http://yoursite.org
5
+ @you_on_twitter
6
+
7
+
8
+ ## Site
9
+
10
+ Software: Built with [Timber](http://upstatement.com/timber) by Upstatement
timber-starter-theme/timber-starter-theme/index.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The main template file
4
+ * This is the most generic template file in a WordPress theme
5
+ * and one of the two required files for a theme (the other being style.css).
6
+ * It is used to display a page when nothing more specific matches a query.
7
+ * E.g., it puts together the home page when no home.php file exists
8
+ *
9
+ * Methods for TimberHelper can be found in the /lib sub-directory
10
+ *
11
+ * @package WordPress
12
+ * @subpackage Timber
13
+ * @since Timber 0.1
14
+ */
15
+
16
+ $context = Timber::context();
17
+ $context['posts'] = new Timber\PostQuery();
18
+ $context['foo'] = 'bar';
19
+ $templates = array( 'index.twig' );
20
+ if ( is_home() ) {
21
+ array_unshift( $templates, 'front-page.twig', 'home.twig' );
22
+ }
23
+ Timber::render( $templates, $context );
timber-starter-theme/timber-starter-theme/page.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template for displaying all pages.
4
+ *
5
+ * This is the template that displays all pages by default.
6
+ * Please note that this is the WordPress construct of pages
7
+ * and that other 'pages' on your WordPress site will use a
8
+ * different template.
9
+ *
10
+ * To generate specific templates for your pages you can use:
11
+ * /mytheme/templates/page-mypage.twig
12
+ * (which will still route through this PHP file)
13
+ * OR
14
+ * /mytheme/page-mypage.php
15
+ * (in which case you'll want to duplicate this file and save to the above path)
16
+ *
17
+ * Methods for TimberHelper can be found in the /lib sub-directory
18
+ *
19
+ * @package WordPress
20
+ * @subpackage Timber
21
+ * @since Timber 0.1
22
+ */
23
+
24
+ $context = Timber::context();
25
+
26
+ $timber_post = new Timber\Post();
27
+ $context['post'] = $timber_post;
28
+ Timber::render( array( 'page-' . $timber_post->post_name . '.twig', 'page.twig' ), $context );
timber-starter-theme/timber-starter-theme/phpunit.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <phpunit
2
+ bootstrap="tests/bootstrap.php"
3
+ backupGlobals="false"
4
+ colors="true"
5
+ convertErrorsToExceptions="true"
6
+ convertNoticesToExceptions="true"
7
+ convertWarningsToExceptions="true"
8
+ >
9
+ <testsuites>
10
+ <testsuite>
11
+ <directory prefix="test-" suffix=".php">./tests/</directory>
12
+ </testsuite>
13
+ <!-- The suite below HAS to be last to run,
14
+ as it includes a test that sets some const and would contaminate
15
+ the other tests as well. -->
16
+ <testsuite>
17
+ <directory prefix="testX-" suffix=".php">./tests/</directory>
18
+ </testsuite>
19
+ </testsuites>
20
+ </phpunit>
timber-starter-theme/timber-starter-theme/screenshot.png ADDED
Binary file
timber-starter-theme/timber-starter-theme/search.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Search results page
4
+ *
5
+ * Methods for TimberHelper can be found in the /lib sub-directory
6
+ *
7
+ * @package WordPress
8
+ * @subpackage Timber
9
+ * @since Timber 0.1
10
+ */
11
+
12
+ $templates = array( 'search.twig', 'archive.twig', 'index.twig' );
13
+
14
+ $context = Timber::context();
15
+ $context['title'] = 'Search results for ' . get_search_query();
16
+ $context['posts'] = new Timber\PostQuery();
17
+
18
+ Timber::render( $templates, $context );
timber-starter-theme/timber-starter-theme/sidebar.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The Template for the sidebar containing the main widget area
4
+ *
5
+ * @package WordPress
6
+ * @subpackage Timber
7
+ */
8
+
9
+ Timber::render( array( 'sidebar.twig' ), $data );
timber-starter-theme/timber-starter-theme/single.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The Template for displaying all single posts
4
+ *
5
+ * Methods for TimberHelper can be found in the /lib sub-directory
6
+ *
7
+ * @package WordPress
8
+ * @subpackage Timber
9
+ * @since Timber 0.1
10
+ */
11
+
12
+ $context = Timber::context();
13
+ $timber_post = Timber::query_post();
14
+ $context['post'] = $timber_post;
15
+
16
+ if ( post_password_required( $timber_post->ID ) ) {
17
+ Timber::render( 'single-password.twig', $context );
18
+ } else {
19
+ Timber::render( array( 'single-' . $timber_post->ID . '.twig', 'single-' . $timber_post->post_type . '.twig', 'single-' . $timber_post->slug . '.twig', 'single.twig' ), $context );
20
+ }
timber-starter-theme/timber-starter-theme/static/no-timber.html ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Timber not active</title>
5
+ </head>
6
+
7
+ <body>
8
+ <p>Timber not activated</p>
9
+ </body>
10
+ </html>
timber-starter-theme/timber-starter-theme/static/site.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ jQuery( document ).ready( function( $ ) {
2
+
3
+ // Your JavaScript goes here
4
+
5
+ });
timber-starter-theme/timber-starter-theme/style.css ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ /*
2
+ * Theme Name: My Timber Starter Theme
3
+ * Description: Starter Theme to use with Timber
4
+ * Author: Upstatement and YOU!
5
+ */
timber-starter-theme/timber-starter-theme/templates/404.twig ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ {% extends "base.twig" %}
2
+
3
+ {% block content %}
4
+ Sorry, we couldn't find what you're looking for.
5
+ {% endblock %}
timber-starter-theme/timber-starter-theme/templates/archive.twig ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ {# This file demonstrates using most of the index.twig template and modifying
2
+ just a small part. See `search.twig` for an example of another approach #}
3
+
4
+ {% extends "index.twig" %}
5
+
6
+ {% block content %}
7
+ <h3>This is my archive</h3>
8
+ {{ parent() }}
9
+ {% endblock %}
timber-starter-theme/timber-starter-theme/templates/author.twig ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ {% extends "base.twig" %}
2
+
3
+ {% block content %}
4
+ {% for post in posts %}
5
+ {% include ["tease-"~post.post_type~".twig", "tease.twig"] %}
6
+ {% endfor %}
7
+ {% endblock %}
timber-starter-theme/timber-starter-theme/templates/base.twig ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% block html_head_container %}
2
+
3
+ {% include 'html-header.twig' %}
4
+ {% block head %}
5
+ {% endblock %}
6
+ </head>
7
+ {% endblock %}
8
+
9
+ <body class="{{body_class}}" data-template="base.twig">
10
+ <a class="skip-link screen-reader-text" href="#content">{{ _e( 'Skip to content') }}</a>
11
+ <header class="header" >
12
+ {% block header %}
13
+ <div class="wrapper">
14
+ <h1 class="hdr-logo" role="banner">
15
+ <a class="hdr-logo-link" href="{{site.url}}" rel="home">{{site.name}}</a>
16
+ </h1>
17
+ <nav id="nav-main" class="nav-main" role="navigation">
18
+ {% include "menu.twig" with {'items': menu.get_items} %}
19
+ </nav><!-- #nav -->
20
+ </div>
21
+ {% endblock %}
22
+ </header>
23
+
24
+ <section id="content" role="main" class="content-wrapper">
25
+ {% if title %}<h1>{{title}}</h1>{% endif %}
26
+ <div class="wrapper {{sidebar_class}}">
27
+ {% block content %}
28
+ Sorry, no content
29
+ {% endblock %}
30
+ </div>
31
+ {% if sidebar %}
32
+ <aside class="layout-sidebar">
33
+ {{sidebar}}
34
+ </aside>
35
+ {% endif %}
36
+ </section>
37
+
38
+ {% block footer %}
39
+ <footer id="footer">
40
+ {% include 'footer.twig' %}
41
+ </footer>
42
+ {{ function('wp_footer') }}
43
+ {% endblock %}
44
+ </body>
45
+ </html>
timber-starter-theme/timber-starter-theme/templates/comment-form.twig ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="comment-form">
2
+ <h3>Add comment</h3>
3
+ <form class="comment-form" method="post" action="{{ site.site_url~'/wp-comments-post.php' }}">
4
+ {% if user %}
5
+ <input type="hidden" name="email" value="{{ user.email }}">
6
+ <input type="hidden" name="author" value="{{ user.name }}">
7
+ <input type="hidden" name="url" value="{{ user.link }}">
8
+ {% else %}
9
+ <label>Email<br>
10
+ <input required name="email" type="email" id="email">
11
+ </label>
12
+ <label>Name<br>
13
+ <input required name="author" type="text">
14
+ </label>
15
+ <label>Website<br>
16
+ <input name="url" type="url">
17
+ </label>
18
+ {% endif %}
19
+ <label>Comment<br>
20
+ <textarea placeholder="Leave a comment..." name="comment" cols="60" rows="3"></textarea>
21
+ </label>
22
+ <input name="comment_post_ID" value="{{ post.id }}" type="hidden">
23
+ <input name="comment_parent" value="{{ comment.ID|default('0') }}" type="hidden">
24
+ <button type="submit" name="Submit" class="btn">Send</button>
25
+ <button type="reset">Cancel</button>
26
+ <p>Your comment will be revised by the site if needed.</p>
27
+ </form>
28
+ </div>
timber-starter-theme/timber-starter-theme/templates/comment.twig ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="blog-comment {{comment.comment_type}}" id="blog-comment-{{comment.ID}}">
2
+ <h5 class="comment-author">{{comment.author.name}} says</h5>
3
+ <div class="comment-content">{{comment.comment_content|wpautop}}</div>
4
+
5
+ <section class="comment-box">
6
+
7
+ <!-- comment form -->
8
+ {% include "comment-form.twig" %}
9
+
10
+ <!-- child comments -->
11
+ {% if post.comments %}
12
+ <h4> replies </h4>
13
+ <div class="comments">
14
+ {% for cmt in comment.children %}
15
+ {% include "comment.twig" with {comment:cmt} %}
16
+ {% endfor %}
17
+ </div>
18
+ {% endif %}
19
+
20
+ </section>
21
+ </div>
timber-starter-theme/timber-starter-theme/templates/footer.twig ADDED
@@ -0,0 +1 @@
 
1
+ Copyright {{"now"|date('Y')}}
timber-starter-theme/timber-starter-theme/templates/html-header.twig ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <!--[if lt IE 9]><html class="no-js no-svg ie lt-ie9 lt-ie8 lt-ie7" {{ site.language_attributes }}> <![endif]-->
3
+ <!--[if IE 9]><html class="no-js no-svg ie ie9 lt-ie9 lt-ie8" {{ site.language_attributes }}> <![endif]-->
4
+ <!--[if gt IE 9]><!--><html class="no-js no-svg" {{ site.language_attributes }}> <!--<![endif]-->
5
+ <head>
6
+ <meta charset="{{ site.charset }}" />
7
+ <meta name="description" content="{{ site.description }}">
8
+ <link rel="stylesheet" href="{{ site.theme.link }}/style.css" type="text/css" media="screen" />
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
11
+ <meta name="viewport" content="width=device-width, initial-scale=1">
12
+ <link rel="author" href="{{ site.theme.link }}/humans.txt" />
13
+ <link rel="pingback" href="{{ site.pingback_url }}" />
14
+ <link rel="profile" href="http://gmpg.org/xfn/11">
15
+ {{function('wp_head')}}
timber-starter-theme/timber-starter-theme/templates/index.twig ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends "base.twig" %}
2
+
3
+ {% block content %}
4
+ <h2>{{ foo }}</h2>
5
+ <p>{{ qux }}</p>
6
+ {% for post in posts %}
7
+ {% include ['tease-'~post.post_type~'.twig', 'tease.twig'] %}
8
+ {% endfor %}
9
+
10
+ {% include 'partial/pagination.twig' with { pagination: posts.pagination({show_all: false, mid_size: 3, end_size: 2}) } %}
11
+ {% endblock %}
timber-starter-theme/timber-starter-theme/templates/menu.twig ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ {% if menu %}
2
+ <ul>
3
+ {% for item in items %}
4
+ <li class="{{ item.classes | join(' ') }}">
5
+ <a target="{{ item.target }}" href="{{ item.link }}">{{ item.title }}</a>
6
+ {% include "menu.twig" with {'items': item.children} %}
7
+ </li>
8
+ {% endfor %}
9
+ </ul>
10
+ {% endif %}
timber-starter-theme/timber-starter-theme/templates/page-plugin.twig ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ {% extends "base.twig" %}
2
+
3
+ {% block content %}
4
+ <div class="container content-wrapper">
5
+ {{content}}
6
+ </div><!-- /content-wrapper -->
7
+ {% endblock %}
timber-starter-theme/timber-starter-theme/templates/page.twig ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends "base.twig" %}
2
+
3
+ {% block content %}
4
+ <div class="content-wrapper">
5
+ <article class="post-type-{{post.post_type}}" id="post-{{post.ID}}">
6
+ <section class="article-content">
7
+ <h1 class="article-h1">{{post.title}}</h1>
8
+ <div class="article-body">
9
+ {{post.content}}
10
+ </div>
11
+ </section>
12
+ </article>
13
+ </div><!-- /content-wrapper -->
14
+ {% endblock %}
timber-starter-theme/timber-starter-theme/templates/partial/pagination.twig ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% if posts.pagination.pages is not empty %}
2
+ <nav class="pagination-block">
3
+ <ul class="pagination">
4
+
5
+ {# First #}
6
+ {% if pagination.pages|first and pagination.pages|first.current != true %}
7
+ <li class="first btn">
8
+ <a href="{{ pagination.pages|first.link }}">First</a>
9
+ </li>
10
+ {% else %}
11
+ <li class="first btn disabled">
12
+ <button disabled>First</button>
13
+ </li>
14
+ {% endif %}
15
+
16
+ {# Previous #}
17
+ {% if pagination.prev %}
18
+ <li class="prev btn">
19
+ <a href="{{ pagination.prev.link }}">Previous</a>
20
+ </li>
21
+ {% else %}
22
+ <li class="prev btn disabled">
23
+ <button disabled>Previous</button>
24
+ </li>
25
+ {% endif %}
26
+
27
+ {# Pages #}
28
+ {% for page in pagination.pages %}
29
+ {% if page.link %}
30
+ <li>
31
+ <a href="{{ page.link }}" class="{{ page.class }}">{{ page.title }}</a>
32
+ </li>
33
+ {% else %}
34
+ <li class="current">
35
+ <span class="{{ page.class }}">{{ page.title }}</span>
36
+ </li>
37
+ {% endif %}
38
+ {% endfor %}
39
+
40
+ {# Next #}
41
+ {% if pagination.next %}
42
+ <li class="next btn">
43
+ <a href="{{ pagination.next.link }}">Next</a>
44
+ </li>
45
+ {% else %}
46
+ <li class="next btn disabled">
47
+ <button disabled>Next</button>
48
+ </li>
49
+ {% endif %}
50
+
51
+ {# Last #}
52
+ {% if pagination.pages|last and pagination.pages|last.current != true %}
53
+ <li class="last btn">
54
+ <a href="{{ pagination.pages|last.link }}">Last</a>
55
+ </li>
56
+ {% else %}
57
+ <li class="last btn disabled">
58
+ <button disabled>Last</button>
59
+ </li>
60
+ {% endif %}
61
+
62
+ </ul>
63
+ </nav>
64
+ {% endif %}
timber-starter-theme/timber-starter-theme/templates/search.twig ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {# see `archive.twig` for an alternative strategy of extending templates #}
2
+ {% extends "base.twig" %}
3
+
4
+ {% block content %}
5
+ {# see `base.twig:27` for where this block's content will be inserted #}
6
+ <div class="content-wrapper">
7
+ {% for post in posts %}
8
+ {% include ['tease-'~post.post_type~'.twig', 'tease.twig'] %}
9
+ {% endfor %}
10
+
11
+ {% include 'partial/pagination.twig' with { pagination: posts.pagination({show_all: false, mid_size: 3, end_size: 2}) } %}
12
+ </div>
13
+ {% endblock %}
timber-starter-theme/timber-starter-theme/templates/sidebar.twig ADDED
@@ -0,0 +1 @@
 
1
+ Sidebar in Timber. Add HTML to your hearts content.
timber-starter-theme/timber-starter-theme/templates/single-password.twig ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ {% extends "base.twig" %}
2
+
3
+ {% block content %}
4
+ <form class="password-form" action="{{site.site_url}}/wp-login.php?action=postpass" method="post">
5
+ <label for="pwbox-{{post.ID}}">Password:</label>
6
+ <input class="password-box" name="post_password" id="pwbox-{{post.ID}}" type="password" placeholder="Password" size="20" maxlength="20" />
7
+ <input class="password-btn" type="submit" name="Submit" value="Submit" />
8
+ </form>
9
+ {% endblock %}
timber-starter-theme/timber-starter-theme/templates/single.twig ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends "base.twig" %}
2
+
3
+ {% block content %}
4
+ <div class="content-wrapper">
5
+ <article class="post-type-{{ post.post_type }}" id="post-{{ post.ID }}">
6
+ <img src="{{ post.thumbnail.src|resize(1200, 300) }}">
7
+ <section class="article-content">
8
+ <h1 class="article-h1">{{ post.title }}</h1>
9
+ <a href="{{ post.link }}">{{ _e('edit') }}</a>
10
+ <p class="blog-author">
11
+ <span>By</span><a href="{{post.author.path}}"> {{ post.author.name }} </a><span>&bull;</span> {{ post.date }}
12
+ </p>
13
+ <div class="article-body">
14
+ {{post.content}}
15
+ </div>
16
+ </section>
17
+
18
+ <!-- comment box -->
19
+ <section class="comment-box">
20
+ <!-- comments -->
21
+ <div class="comments">
22
+ {% if post.comments %}
23
+ <h3> comments </h3>
24
+ {% for cmt in post.comments %}
25
+ {% include "comment.twig" with {comment:cmt} %}
26
+ {% endfor %}
27
+ {% endif %}
28
+ </div>
29
+
30
+ {% if post.comment_status == "closed" %}
31
+ <p> comments for this post are closed </p>
32
+ {% else %}
33
+ <!-- comment form -->
34
+ {% include "comment-form.twig" %}
35
+ {% endif %}
36
+ </section>
37
+ </article>
38
+ </div><!-- /content-wrapper -->
39
+ {% endblock %}
timber-starter-theme/timber-starter-theme/templates/tease-post.twig ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ {% extends "tease.twig" %}
2
+
3
+ {% block content %}
4
+ <h2 class="h2"><a href="{{post.link}}">{{post.title}}</a></h2>
5
+ <p>{{post.preview.length(25)}}</p>
6
+ {% if post.thumbnail.src %}
7
+ <img src="{{post.thumbnail.src}}" />
8
+ {% endif %}
9
+ {% endblock %}
timber-starter-theme/timber-starter-theme/templates/tease.twig ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <article class="tease tease-{{post.post_type}}" id="tease-{{post.ID}}">
2
+ {% block content %}
3
+ <h2 class="h2"><a href="{{post.link}}">{{post.title}}</a></h2>
4
+ <p>{{post.preview}}</p>
5
+ {% if post.get_thumbnail %}
6
+ <img src="{{post.thumbnail.src}}" />
7
+ {% endif %}
8
+ {% endblock %}
9
+ </article>
timber-starter-theme/timber-starter-theme/tests/bootstrap.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $_tests_dir = getenv('WP_TESTS_DIR');
4
+ if ( !$_tests_dir ) $_tests_dir = '/tmp/wordpress-tests-lib';
5
+
6
+ require_once $_tests_dir . '/includes/functions.php';
7
+
8
+ function _manually_load_plugin() {
9
+ $plugins_dir = dirname( __FILE__ ).'/../../../plugins';
10
+ $timber = $plugins_dir.'/timber/timber.php';
11
+ if ( file_exists($timber) ) {
12
+ require_once($timber);
13
+ } else {
14
+ $timber_library = $plugins_dir.'/timber-library/timber.php';
15
+ if ( file_exists($timber_library) ) {
16
+ require_once($timber_library);
17
+ }
18
+ }
19
+ }
20
+
21
+ tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
22
+ require $_tests_dir . '/includes/bootstrap.php';
timber-starter-theme/timber-starter-theme/tests/test-timber-starter-theme.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class TestTimberStarterTheme extends WP_UnitTestCase {
4
+
5
+ function setUp() {
6
+ self::_setupStarterTheme();
7
+ switch_theme( basename( dirname( dirname( __FILE__ ) ) ) );
8
+ require_once(__DIR__.'/../functions.php');
9
+ }
10
+
11
+ function tearDown() {
12
+ switch_theme('twentythirteen');
13
+ }
14
+
15
+ function testTimberExists() {
16
+ $context = Timber::context();
17
+ $this->assertTrue(is_array($context));
18
+ }
19
+
20
+ function testFunctionsPHP() {
21
+ $context = Timber::context();
22
+ $this->assertEquals('StarterSite', get_class($context['site']));
23
+ $this->assertTrue(current_theme_supports('post-thumbnails'));
24
+ $this->assertEquals('bar', $context['foo']);
25
+ }
26
+
27
+ function testLoading() {
28
+ $str = Timber::compile('tease.twig');
29
+ $this->assertStringStartsWith('<article class="tease tease-" id="tease-">', $str);
30
+ $this->assertStringEndsWith('</article>', $str);
31
+ }
32
+
33
+ static function _setupStarterTheme(){
34
+ $dest = WP_CONTENT_DIR . '/themes/' . basename( dirname( dirname( __FILE__ ) ) );
35
+ $src = realpath( __DIR__ . '/../../' . basename( dirname( dirname( __FILE__ ) ) ) );
36
+ if ( is_dir($src) && !file_exists($dest) ) {
37
+ symlink($src, $dest);
38
+ }
39
+ }
40
+
41
+
42
+ }
timber.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Timber
4
  Description: The WordPress Timber Library allows you to write themes using the power of Twig templates.
5
  Plugin URI: http://timber.upstatement.com
6
  Author: Jared Novack + Upstatement
7
- Version: 1.10.0
8
  Author URI: http://upstatement.com/
9
  */
10
  // we look for Composer files first in the plugins dir.
4
  Description: The WordPress Timber Library allows you to write themes using the power of Twig templates.
5
  Plugin URI: http://timber.upstatement.com
6
  Author: Jared Novack + Upstatement
7
+ Version: 1.11.0
8
  Author URI: http://upstatement.com/
9
  */
10
  // we look for Composer files first in the plugins dir.
vendor/autoload.php CHANGED
@@ -2,6 +2,6 @@
2
 
3
  // autoload.php @generated by Composer
4
 
5
- require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitf0f9f7ac76f36e7488b1be44267f4705::getLoader();
2
 
3
  // autoload.php @generated by Composer
4
 
5
+ require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit6567439c14f5705c1376d806b5d78dc2::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -53,8 +53,9 @@ class ClassLoader
53
 
54
  private $useIncludePath = false;
55
  private $classMap = array();
56
-
57
  private $classMapAuthoritative = false;
 
 
58
 
59
  public function getPrefixes()
60
  {
@@ -271,6 +272,26 @@ class ClassLoader
271
  return $this->classMapAuthoritative;
272
  }
273
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  /**
275
  * Registers this instance as an autoloader.
276
  *
@@ -313,29 +334,34 @@ class ClassLoader
313
  */
314
  public function findFile($class)
315
  {
316
- // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
317
- if ('\\' == $class[0]) {
318
- $class = substr($class, 1);
319
- }
320
-
321
  // class map lookup
322
  if (isset($this->classMap[$class])) {
323
  return $this->classMap[$class];
324
  }
325
- if ($this->classMapAuthoritative) {
326
  return false;
327
  }
 
 
 
 
 
 
328
 
329
  $file = $this->findFileWithExtension($class, '.php');
330
 
331
  // Search for Hack files if we are running on HHVM
332
- if ($file === null && defined('HHVM_VERSION')) {
333
  $file = $this->findFileWithExtension($class, '.hh');
334
  }
335
 
336
- if ($file === null) {
 
 
 
 
337
  // Remember that this class does not exist.
338
- return $this->classMap[$class] = false;
339
  }
340
 
341
  return $file;
@@ -348,10 +374,14 @@ class ClassLoader
348
 
349
  $first = $class[0];
350
  if (isset($this->prefixLengthsPsr4[$first])) {
351
- foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
352
- if (0 === strpos($class, $prefix)) {
353
- foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
354
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
 
 
 
 
355
  return $file;
356
  }
357
  }
@@ -399,6 +429,8 @@ class ClassLoader
399
  if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
  return $file;
401
  }
 
 
402
  }
403
  }
404
 
53
 
54
  private $useIncludePath = false;
55
  private $classMap = array();
 
56
  private $classMapAuthoritative = false;
57
+ private $missingClasses = array();
58
+ private $apcuPrefix;
59
 
60
  public function getPrefixes()
61
  {
272
  return $this->classMapAuthoritative;
273
  }
274
 
275
+ /**
276
+ * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
+ *
278
+ * @param string|null $apcuPrefix
279
+ */
280
+ public function setApcuPrefix($apcuPrefix)
281
+ {
282
+ $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
283
+ }
284
+
285
+ /**
286
+ * The APCu prefix in use, or null if APCu caching is not enabled.
287
+ *
288
+ * @return string|null
289
+ */
290
+ public function getApcuPrefix()
291
+ {
292
+ return $this->apcuPrefix;
293
+ }
294
+
295
  /**
296
  * Registers this instance as an autoloader.
297
  *
334
  */
335
  public function findFile($class)
336
  {
 
 
 
 
 
337
  // class map lookup
338
  if (isset($this->classMap[$class])) {
339
  return $this->classMap[$class];
340
  }
341
+ if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342
  return false;
343
  }
344
+ if (null !== $this->apcuPrefix) {
345
+ $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
+ if ($hit) {
347
+ return $file;
348
+ }
349
+ }
350
 
351
  $file = $this->findFileWithExtension($class, '.php');
352
 
353
  // Search for Hack files if we are running on HHVM
354
+ if (false === $file && defined('HHVM_VERSION')) {
355
  $file = $this->findFileWithExtension($class, '.hh');
356
  }
357
 
358
+ if (null !== $this->apcuPrefix) {
359
+ apcu_add($this->apcuPrefix.$class, $file);
360
+ }
361
+
362
+ if (false === $file) {
363
  // Remember that this class does not exist.
364
+ $this->missingClasses[$class] = true;
365
  }
366
 
367
  return $file;
374
 
375
  $first = $class[0];
376
  if (isset($this->prefixLengthsPsr4[$first])) {
377
+ $subPath = $class;
378
+ while (false !== $lastPos = strrpos($subPath, '\\')) {
379
+ $subPath = substr($subPath, 0, $lastPos);
380
+ $search = $subPath . '\\';
381
+ if (isset($this->prefixDirsPsr4[$search])) {
382
+ $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
+ foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
+ if (file_exists($file = $dir . $pathEnd)) {
385
  return $file;
386
  }
387
  }
429
  if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
430
  return $file;
431
  }
432
+
433
+ return false;
434
  }
435
  }
436
 
vendor/composer/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
 
2
- Copyright (c) 2016 Nils Adermann, Jordi Boggiano
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
1
 
2
+ Copyright (c) Nils Adermann, Jordi Boggiano
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
vendor/composer/autoload_classmap.php CHANGED
@@ -42,6 +42,7 @@ return array(
42
  'Composer\\Installers\\CraftInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CraftInstaller.php',
43
  'Composer\\Installers\\CroogoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CroogoInstaller.php',
44
  'Composer\\Installers\\DecibelInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DecibelInstaller.php',
 
45
  'Composer\\Installers\\DokuWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DokuWikiInstaller.php',
46
  'Composer\\Installers\\DolibarrInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DolibarrInstaller.php',
47
  'Composer\\Installers\\DrupalInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DrupalInstaller.php',
@@ -59,6 +60,7 @@ return array(
59
  'Composer\\Installers\\JoomlaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/JoomlaInstaller.php',
60
  'Composer\\Installers\\KanboardInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KanboardInstaller.php',
61
  'Composer\\Installers\\KirbyInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KirbyInstaller.php',
 
62
  'Composer\\Installers\\KodiCMSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KodiCMSInstaller.php',
63
  'Composer\\Installers\\KohanaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KohanaInstaller.php',
64
  'Composer\\Installers\\LanManagementSystemInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php',
@@ -93,6 +95,7 @@ return array(
93
  'Composer\\Installers\\PxcmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PxcmsInstaller.php',
94
  'Composer\\Installers\\RadPHPInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RadPHPInstaller.php',
95
  'Composer\\Installers\\ReIndexInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ReIndexInstaller.php',
 
96
  'Composer\\Installers\\RedaxoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RedaxoInstaller.php',
97
  'Composer\\Installers\\RoundcubeInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RoundcubeInstaller.php',
98
  'Composer\\Installers\\SMFInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SMFInstaller.php',
@@ -103,6 +106,7 @@ return array(
103
  'Composer\\Installers\\Symfony1Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Symfony1Installer.php',
104
  'Composer\\Installers\\TYPO3CmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php',
105
  'Composer\\Installers\\TYPO3FlowInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php',
 
106
  'Composer\\Installers\\TheliaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TheliaInstaller.php',
107
  'Composer\\Installers\\TuskInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TuskInstaller.php',
108
  'Composer\\Installers\\UserFrostingInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/UserFrostingInstaller.php',
42
  'Composer\\Installers\\CraftInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CraftInstaller.php',
43
  'Composer\\Installers\\CroogoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CroogoInstaller.php',
44
  'Composer\\Installers\\DecibelInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DecibelInstaller.php',
45
+ 'Composer\\Installers\\DframeInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DframeInstaller.php',
46
  'Composer\\Installers\\DokuWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DokuWikiInstaller.php',
47
  'Composer\\Installers\\DolibarrInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DolibarrInstaller.php',
48
  'Composer\\Installers\\DrupalInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DrupalInstaller.php',
60
  'Composer\\Installers\\JoomlaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/JoomlaInstaller.php',
61
  'Composer\\Installers\\KanboardInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KanboardInstaller.php',
62
  'Composer\\Installers\\KirbyInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KirbyInstaller.php',
63
+ 'Composer\\Installers\\KnownInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KnownInstaller.php',
64
  'Composer\\Installers\\KodiCMSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KodiCMSInstaller.php',
65
  'Composer\\Installers\\KohanaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KohanaInstaller.php',
66
  'Composer\\Installers\\LanManagementSystemInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php',
95
  'Composer\\Installers\\PxcmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PxcmsInstaller.php',
96
  'Composer\\Installers\\RadPHPInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RadPHPInstaller.php',
97
  'Composer\\Installers\\ReIndexInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ReIndexInstaller.php',
98
+ 'Composer\\Installers\\Redaxo5Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Redaxo5Installer.php',
99
  'Composer\\Installers\\RedaxoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RedaxoInstaller.php',
100
  'Composer\\Installers\\RoundcubeInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RoundcubeInstaller.php',
101
  'Composer\\Installers\\SMFInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SMFInstaller.php',
106
  'Composer\\Installers\\Symfony1Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Symfony1Installer.php',
107
  'Composer\\Installers\\TYPO3CmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php',
108
  'Composer\\Installers\\TYPO3FlowInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php',
109
+ 'Composer\\Installers\\TaoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TaoInstaller.php',
110
  'Composer\\Installers\\TheliaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TheliaInstaller.php',
111
  'Composer\\Installers\\TuskInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TuskInstaller.php',
112
  'Composer\\Installers\\UserFrostingInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/UserFrostingInstaller.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitf0f9f7ac76f36e7488b1be44267f4705
6
  {
7
  private static $loader;
8
 
@@ -19,37 +19,48 @@ class ComposerAutoloaderInitf0f9f7ac76f36e7488b1be44267f4705
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitf0f9f7ac76f36e7488b1be44267f4705', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitf0f9f7ac76f36e7488b1be44267f4705', 'loadClassLoader'));
25
 
26
- $map = require __DIR__ . '/autoload_namespaces.php';
27
- foreach ($map as $namespace => $path) {
28
- $loader->set($namespace, $path);
29
- }
30
 
31
- $map = require __DIR__ . '/autoload_psr4.php';
32
- foreach ($map as $namespace => $path) {
33
- $loader->setPsr4($namespace, $path);
34
- }
 
 
35
 
36
- $classMap = require __DIR__ . '/autoload_classmap.php';
37
- if ($classMap) {
38
- $loader->addClassMap($classMap);
 
 
 
 
 
 
39
  }
40
 
41
  $loader->register(true);
42
 
43
- $includeFiles = require __DIR__ . '/autoload_files.php';
 
 
 
 
44
  foreach ($includeFiles as $fileIdentifier => $file) {
45
- composerRequiref0f9f7ac76f36e7488b1be44267f4705($fileIdentifier, $file);
46
  }
47
 
48
  return $loader;
49
  }
50
  }
51
 
52
- function composerRequiref0f9f7ac76f36e7488b1be44267f4705($fileIdentifier, $file)
53
  {
54
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit6567439c14f5705c1376d806b5d78dc2
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit6567439c14f5705c1376d806b5d78dc2', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit6567439c14f5705c1376d806b5d78dc2', 'loadClassLoader'));
25
 
26
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
+ if ($useStaticLoader) {
28
+ require_once __DIR__ . '/autoload_static.php';
 
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit6567439c14f5705c1376d806b5d78dc2::getInitializer($loader));
31
+ } else {
32
+ $map = require __DIR__ . '/autoload_namespaces.php';
33
+ foreach ($map as $namespace => $path) {
34
+ $loader->set($namespace, $path);
35
+ }
36
 
37
+ $map = require __DIR__ . '/autoload_psr4.php';
38
+ foreach ($map as $namespace => $path) {
39
+ $loader->setPsr4($namespace, $path);
40
+ }
41
+
42
+ $classMap = require __DIR__ . '/autoload_classmap.php';
43
+ if ($classMap) {
44
+ $loader->addClassMap($classMap);
45
+ }
46
  }
47
 
48
  $loader->register(true);
49
 
50
+ if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit6567439c14f5705c1376d806b5d78dc2::$files;
52
+ } else {
53
+ $includeFiles = require __DIR__ . '/autoload_files.php';
54
+ }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire6567439c14f5705c1376d806b5d78dc2($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire6567439c14f5705c1376d806b5d78dc2($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
vendor/composer/autoload_static.php ADDED
@@ -0,0 +1,626 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_static.php @generated by Composer
4
+
5
+ namespace Composer\Autoload;
6
+
7
+ class ComposerStaticInit6567439c14f5705c1376d806b5d78dc2
8
+ {
9
+ public static $files = array (
10
+ '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
11
+ );
12
+
13
+ public static $prefixLengthsPsr4 = array (
14
+ 'T' =>
15
+ array (
16
+ 'Twig\\' => 5,
17
+ 'Timber\\' => 7,
18
+ ),
19
+ 'S' =>
20
+ array (
21
+ 'Symfony\\Polyfill\\Ctype\\' => 23,
22
+ ),
23
+ 'C' =>
24
+ array (
25
+ 'Composer\\Installers\\' => 20,
26
+ ),
27
+ );
28
+
29
+ public static $prefixDirsPsr4 = array (
30
+ 'Twig\\' =>
31
+ array (
32
+ 0 => __DIR__ . '/..' . '/twig/twig/src',
33
+ ),
34
+ 'Timber\\' =>
35
+ array (
36
+ 0 => __DIR__ . '/../..' . '/lib',
37
+ ),
38
+ 'Symfony\\Polyfill\\Ctype\\' =>
39
+ array (
40
+ 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
41
+ ),
42
+ 'Composer\\Installers\\' =>
43
+ array (
44
+ 0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
45
+ ),
46
+ );
47
+
48
+ public static $fallbackDirsPsr4 = array (
49
+ 0 => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib',
50
+ );
51
+
52
+ public static $prefixesPsr0 = array (
53
+ 'T' =>
54
+ array (
55
+ 'Twig_' =>
56
+ array (
57
+ 0 => __DIR__ . '/..' . '/twig/twig/lib',
58
+ ),
59
+ ),
60
+ 'R' =>
61
+ array (
62
+ 'Routes' =>
63
+ array (
64
+ 0 => __DIR__ . '/..' . '/upstatement/routes',
65
+ ),
66
+ ),
67
+ );
68
+
69
+ public static $classMap = array (
70
+ 'AltoRouter' => __DIR__ . '/..' . '/altorouter/altorouter/AltoRouter.php',
71
+ 'Asm89\\Twig\\CacheExtension\\CacheProviderInterface' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheProviderInterface.php',
72
+ 'Asm89\\Twig\\CacheExtension\\CacheProvider\\DoctrineCacheAdapter' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheProvider/DoctrineCacheAdapter.php',
73
+ 'Asm89\\Twig\\CacheExtension\\CacheProvider\\PsrCacheAdapter' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheProvider/PsrCacheAdapter.php',
74
+ 'Asm89\\Twig\\CacheExtension\\CacheStrategyInterface' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategyInterface.php',
75
+ 'Asm89\\Twig\\CacheExtension\\CacheStrategy\\BlackholeCacheStrategy' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/BlackholeCacheStrategy.php',
76
+ 'Asm89\\Twig\\CacheExtension\\CacheStrategy\\GenerationalCacheStrategy' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/GenerationalCacheStrategy.php',
77
+ 'Asm89\\Twig\\CacheExtension\\CacheStrategy\\IndexedChainingCacheStrategy' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/IndexedChainingCacheStrategy.php',
78
+ 'Asm89\\Twig\\CacheExtension\\CacheStrategy\\KeyGeneratorInterface' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/KeyGeneratorInterface.php',
79
+ 'Asm89\\Twig\\CacheExtension\\CacheStrategy\\LifetimeCacheStrategy' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/LifetimeCacheStrategy.php',
80
+ 'Asm89\\Twig\\CacheExtension\\Exception\\BaseException' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/BaseException.php',
81
+ 'Asm89\\Twig\\CacheExtension\\Exception\\InvalidCacheKeyException' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/InvalidCacheKeyException.php',
82
+ 'Asm89\\Twig\\CacheExtension\\Exception\\InvalidCacheLifetimeException' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/InvalidCacheLifetimeException.php',
83
+ 'Asm89\\Twig\\CacheExtension\\Exception\\NonExistingStrategyException' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/NonExistingStrategyException.php',
84
+ 'Asm89\\Twig\\CacheExtension\\Exception\\NonExistingStrategyKeyException' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/NonExistingStrategyKeyException.php',
85
+ 'Asm89\\Twig\\CacheExtension\\Extension' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Extension.php',
86
+ 'Asm89\\Twig\\CacheExtension\\Node\\CacheNode' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Node/CacheNode.php',
87
+ 'Asm89\\Twig\\CacheExtension\\TokenParser\\Cache' => __DIR__ . '/..' . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/TokenParser/Cache.php',
88
+ 'Composer\\Installers\\AglInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AglInstaller.php',
89
+ 'Composer\\Installers\\AimeosInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AimeosInstaller.php',
90
+ 'Composer\\Installers\\AnnotateCmsInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php',
91
+ 'Composer\\Installers\\AsgardInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AsgardInstaller.php',
92
+ 'Composer\\Installers\\AttogramInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AttogramInstaller.php',
93
+ 'Composer\\Installers\\BaseInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/BaseInstaller.php',
94
+ 'Composer\\Installers\\BitrixInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/BitrixInstaller.php',
95
+ 'Composer\\Installers\\BonefishInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/BonefishInstaller.php',
96
+ 'Composer\\Installers\\CakePHPInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CakePHPInstaller.php',
97
+ 'Composer\\Installers\\ChefInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ChefInstaller.php',
98
+ 'Composer\\Installers\\CiviCrmInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CiviCrmInstaller.php',
99
+ 'Composer\\Installers\\ClanCatsFrameworkInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php',
100
+ 'Composer\\Installers\\CockpitInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CockpitInstaller.php',
101
+ 'Composer\\Installers\\CodeIgniterInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php',
102
+ 'Composer\\Installers\\Concrete5Installer' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Concrete5Installer.php',
103
+ 'Composer\\Installers\\CraftInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CraftInstaller.php',
104
+ 'Composer\\Installers\\CroogoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CroogoInstaller.php',
105
+ 'Composer\\Installers\\DecibelInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DecibelInstaller.php',
106
+ 'Composer\\Installers\\DframeInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DframeInstaller.php',
107
+ 'Composer\\Installers\\DokuWikiInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DokuWikiInstaller.php',
108
+ 'Composer\\Installers\\DolibarrInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DolibarrInstaller.php',
109
+ 'Composer\\Installers\\DrupalInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DrupalInstaller.php',
110
+ 'Composer\\Installers\\ElggInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ElggInstaller.php',
111
+ 'Composer\\Installers\\EliasisInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/EliasisInstaller.php',
112
+ 'Composer\\Installers\\ExpressionEngineInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php',
113
+ 'Composer\\Installers\\EzPlatformInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/EzPlatformInstaller.php',
114
+ 'Composer\\Installers\\FuelInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/FuelInstaller.php',
115
+ 'Composer\\Installers\\FuelphpInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/FuelphpInstaller.php',
116
+ 'Composer\\Installers\\GravInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/GravInstaller.php',
117
+ 'Composer\\Installers\\HuradInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/HuradInstaller.php',
118
+ 'Composer\\Installers\\ImageCMSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ImageCMSInstaller.php',
119
+ 'Composer\\Installers\\Installer' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Installer.php',
120
+ 'Composer\\Installers\\ItopInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ItopInstaller.php',
121
+ 'Composer\\Installers\\JoomlaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/JoomlaInstaller.php',
122
+ 'Composer\\Installers\\KanboardInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/KanboardInstaller.php',
123
+ 'Composer\\Installers\\KirbyInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/KirbyInstaller.php',
124
+ 'Composer\\Installers\\KnownInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/KnownInstaller.php',
125
+ 'Composer\\Installers\\KodiCMSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/KodiCMSInstaller.php',
126
+ 'Composer\\Installers\\KohanaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/KohanaInstaller.php',
127
+ 'Composer\\Installers\\LanManagementSystemInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php',
128
+ 'Composer\\Installers\\LaravelInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/LaravelInstaller.php',
129
+ 'Composer\\Installers\\LavaLiteInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/LavaLiteInstaller.php',
130
+ 'Composer\\Installers\\LithiumInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/LithiumInstaller.php',
131
+ 'Composer\\Installers\\MODULEWorkInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php',
132
+ 'Composer\\Installers\\MODXEvoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MODXEvoInstaller.php',
133
+ 'Composer\\Installers\\MagentoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MagentoInstaller.php',
134
+ 'Composer\\Installers\\MajimaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MajimaInstaller.php',
135
+ 'Composer\\Installers\\MakoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MakoInstaller.php',
136
+ 'Composer\\Installers\\MauticInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MauticInstaller.php',
137
+ 'Composer\\Installers\\MayaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MayaInstaller.php',
138
+ 'Composer\\Installers\\MediaWikiInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MediaWikiInstaller.php',
139
+ 'Composer\\Installers\\MicroweberInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MicroweberInstaller.php',
140
+ 'Composer\\Installers\\ModxInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ModxInstaller.php',
141
+ 'Composer\\Installers\\MoodleInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MoodleInstaller.php',
142
+ 'Composer\\Installers\\OctoberInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/OctoberInstaller.php',
143
+ 'Composer\\Installers\\OntoWikiInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/OntoWikiInstaller.php',
144
+ 'Composer\\Installers\\OsclassInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/OsclassInstaller.php',
145
+ 'Composer\\Installers\\OxidInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/OxidInstaller.php',
146
+ 'Composer\\Installers\\PPIInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PPIInstaller.php',
147
+ 'Composer\\Installers\\PhiftyInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PhiftyInstaller.php',
148
+ 'Composer\\Installers\\PhpBBInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PhpBBInstaller.php',
149
+ 'Composer\\Installers\\PimcoreInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PimcoreInstaller.php',
150
+ 'Composer\\Installers\\PiwikInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PiwikInstaller.php',
151
+ 'Composer\\Installers\\PlentymarketsInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php',
152
+ 'Composer\\Installers\\Plugin' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Plugin.php',
153
+ 'Composer\\Installers\\PortoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PortoInstaller.php',
154
+ 'Composer\\Installers\\PrestashopInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PrestashopInstaller.php',
155
+ 'Composer\\Installers\\PuppetInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PuppetInstaller.php',
156
+ 'Composer\\Installers\\PxcmsInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PxcmsInstaller.php',
157
+ 'Composer\\Installers\\RadPHPInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/RadPHPInstaller.php',
158
+ 'Composer\\Installers\\ReIndexInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ReIndexInstaller.php',
159
+ 'Composer\\Installers\\Redaxo5Installer' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Redaxo5Installer.php',
160
+ 'Composer\\Installers\\RedaxoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/RedaxoInstaller.php',
161
+ 'Composer\\Installers\\RoundcubeInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/RoundcubeInstaller.php',
162
+ 'Composer\\Installers\\SMFInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/SMFInstaller.php',
163
+ 'Composer\\Installers\\ShopwareInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ShopwareInstaller.php',
164
+ 'Composer\\Installers\\SilverStripeInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/SilverStripeInstaller.php',
165
+ 'Composer\\Installers\\SiteDirectInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/SiteDirectInstaller.php',
166
+ 'Composer\\Installers\\SyDESInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/SyDESInstaller.php',
167
+ 'Composer\\Installers\\Symfony1Installer' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Symfony1Installer.php',
168
+ 'Composer\\Installers\\TYPO3CmsInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php',
169
+ 'Composer\\Installers\\TYPO3FlowInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php',
170
+ 'Composer\\Installers\\TaoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/TaoInstaller.php',
171
+ 'Composer\\Installers\\TheliaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/TheliaInstaller.php',
172
+ 'Composer\\Installers\\TuskInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/TuskInstaller.php',
173
+ 'Composer\\Installers\\UserFrostingInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/UserFrostingInstaller.php',
174
+ 'Composer\\Installers\\VanillaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/VanillaInstaller.php',
175
+ 'Composer\\Installers\\VgmcpInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/VgmcpInstaller.php',
176
+ 'Composer\\Installers\\WHMCSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/WHMCSInstaller.php',
177
+ 'Composer\\Installers\\WolfCMSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/WolfCMSInstaller.php',
178
+ 'Composer\\Installers\\WordPressInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/WordPressInstaller.php',
179
+ 'Composer\\Installers\\YawikInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/YawikInstaller.php',
180
+ 'Composer\\Installers\\ZendInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ZendInstaller.php',
181
+ 'Composer\\Installers\\ZikulaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ZikulaInstaller.php',
182
+ 'Routes' => __DIR__ . '/..' . '/upstatement/routes/Routes.php',
183
+ 'Symfony\\Polyfill\\Ctype\\Ctype' => __DIR__ . '/..' . '/symfony/polyfill-ctype/Ctype.php',
184
+ 'Timber\\Admin' => __DIR__ . '/../..' . '/lib/Admin.php',
185
+ 'Timber\\Archives' => __DIR__ . '/../..' . '/lib/Archives.php',
186
+ 'Timber\\Cache\\Cleaner' => __DIR__ . '/../..' . '/lib/Cache/Cleaner.php',
187
+ 'Timber\\Cache\\KeyGenerator' => __DIR__ . '/../..' . '/lib/Cache/KeyGenerator.php',
188
+ 'Timber\\Cache\\TimberKeyGeneratorInterface' => __DIR__ . '/../..' . '/lib/Cache/TimberKeyGeneratorInterface.php',
189
+ 'Timber\\Cache\\WPObjectCacheAdapter' => __DIR__ . '/../..' . '/lib/Cache/WPObjectCacheAdapter.php',
190
+ 'Timber\\Comment' => __DIR__ . '/../..' . '/lib/Comment.php',
191
+ 'Timber\\CommentThread' => __DIR__ . '/../..' . '/lib/CommentThread.php',
192
+ 'Timber\\Core' => __DIR__ . '/../..' . '/lib/Core.php',
193
+ 'Timber\\CoreInterface' => __DIR__ . '/../..' . '/lib/CoreInterface.php',
194
+ 'Timber\\FunctionWrapper' => __DIR__ . '/../..' . '/lib/FunctionWrapper.php',
195
+ 'Timber\\Helper' => __DIR__ . '/../..' . '/lib/Helper.php',
196
+ 'Timber\\Image' => __DIR__ . '/../..' . '/lib/Image.php',
197
+ 'Timber\\ImageHelper' => __DIR__ . '/../..' . '/lib/ImageHelper.php',
198
+ 'Timber\\Image\\Operation' => __DIR__ . '/../..' . '/lib/Image/Operation.php',
199
+ 'Timber\\Image\\Operation\\Letterbox' => __DIR__ . '/../..' . '/lib/Image/Operation/Letterbox.php',
200
+ 'Timber\\Image\\Operation\\Resize' => __DIR__ . '/../..' . '/lib/Image/Operation/Resize.php',
201
+ 'Timber\\Image\\Operation\\Retina' => __DIR__ . '/../..' . '/lib/Image/Operation/Retina.php',
202
+ 'Timber\\Image\\Operation\\ToJpg' => __DIR__ . '/../..' . '/lib/Image/Operation/ToJpg.php',
203
+ 'Timber\\Image\\Operation\\ToWebp' => __DIR__ . '/../..' . '/lib/Image/Operation/ToWebp.php',
204
+ 'Timber\\Integrations' => __DIR__ . '/../..' . '/lib/Integrations.php',
205
+ 'Timber\\Integrations\\ACF' => __DIR__ . '/../..' . '/lib/Integrations/ACF.php',
206
+ 'Timber\\Integrations\\CoAuthorsPlus' => __DIR__ . '/../..' . '/lib/Integrations/CoAuthorsPlus.php',
207
+ 'Timber\\Integrations\\CoAuthorsPlusUser' => __DIR__ . '/../..' . '/lib/Integrations/CoAuthorsPlusUser.php',
208
+ 'Timber\\Integrations\\Command' => __DIR__ . '/../..' . '/lib/Integrations/Command.php',
209
+ 'Timber\\Integrations\\Timber_WP_CLI_Command' => __DIR__ . '/../..' . '/lib/Integrations/Timber_WP_CLI_Command.php',
210
+ 'Timber\\Integrations\\WPML' => __DIR__ . '/../..' . '/lib/Integrations/WPML.php',
211
+ 'Timber\\Loader' => __DIR__ . '/../..' . '/lib/Loader.php',
212
+ 'Timber\\LocationManager' => __DIR__ . '/../..' . '/lib/LocationManager.php',
213
+ 'Timber\\Menu' => __DIR__ . '/../..' . '/lib/Menu.php',
214
+ 'Timber\\MenuItem' => __DIR__ . '/../..' . '/lib/MenuItem.php',
215
+ 'Timber\\Pagination' => __DIR__ . '/../..' . '/lib/Pagination.php',
216
+ 'Timber\\Post' => __DIR__ . '/../..' . '/lib/Post.php',
217
+ 'Timber\\PostCollection' => __DIR__ . '/../..' . '/lib/PostCollection.php',
218
+ 'Timber\\PostGetter' => __DIR__ . '/../..' . '/lib/PostGetter.php',
219
+ 'Timber\\PostPreview' => __DIR__ . '/../..' . '/lib/PostPreview.php',
220
+ 'Timber\\PostQuery' => __DIR__ . '/../..' . '/lib/PostQuery.php',
221
+ 'Timber\\PostType' => __DIR__ . '/../..' . '/lib/PostType.php',
222
+ 'Timber\\PostsIterator' => __DIR__ . '/../..' . '/lib/PostsIterator.php',
223
+ 'Timber\\QueryIterator' => __DIR__ . '/../..' . '/lib/QueryIterator.php',
224
+ 'Timber\\Request' => __DIR__ . '/../..' . '/lib/Request.php',
225
+ 'Timber\\Site' => __DIR__ . '/../..' . '/lib/Site.php',
226
+ 'Timber\\Term' => __DIR__ . '/../..' . '/lib/Term.php',
227
+ 'Timber\\TermGetter' => __DIR__ . '/../..' . '/lib/TermGetter.php',
228
+ 'Timber\\TextHelper' => __DIR__ . '/../..' . '/lib/TextHelper.php',
229
+ 'Timber\\Theme' => __DIR__ . '/../..' . '/lib/Theme.php',
230
+ 'Timber\\Timber' => __DIR__ . '/../..' . '/lib/Timber.php',
231
+ 'Timber\\Twig' => __DIR__ . '/../..' . '/lib/Twig.php',
232
+ 'Timber\\Twig_Filter' => __DIR__ . '/../..' . '/lib/Twig_Filter.php',
233
+ 'Timber\\Twig_Function' => __DIR__ . '/../..' . '/lib/Twig_Function.php',
234
+ 'Timber\\URLHelper' => __DIR__ . '/../..' . '/lib/URLHelper.php',
235
+ 'Timber\\User' => __DIR__ . '/../..' . '/lib/User.php',
236
+ 'Twig\\Cache\\CacheInterface' => __DIR__ . '/..' . '/twig/twig/src/Cache/CacheInterface.php',
237
+ 'Twig\\Cache\\FilesystemCache' => __DIR__ . '/..' . '/twig/twig/src/Cache/FilesystemCache.php',
238
+ 'Twig\\Cache\\NullCache' => __DIR__ . '/..' . '/twig/twig/src/Cache/NullCache.php',
239
+ 'Twig\\Compiler' => __DIR__ . '/..' . '/twig/twig/src/Compiler.php',
240
+ 'Twig\\Environment' => __DIR__ . '/..' . '/twig/twig/src/Environment.php',
241
+ 'Twig\\Error\\Error' => __DIR__ . '/..' . '/twig/twig/src/Error/Error.php',
242
+ 'Twig\\Error\\LoaderError' => __DIR__ . '/..' . '/twig/twig/src/Error/LoaderError.php',
243
+ 'Twig\\Error\\RuntimeError' => __DIR__ . '/..' . '/twig/twig/src/Error/RuntimeError.php',
244
+ 'Twig\\Error\\SyntaxError' => __DIR__ . '/..' . '/twig/twig/src/Error/SyntaxError.php',
245
+ 'Twig\\ExpressionParser' => __DIR__ . '/..' . '/twig/twig/src/ExpressionParser.php',
246
+ 'Twig\\Extension\\AbstractExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/AbstractExtension.php',
247
+ 'Twig\\Extension\\CoreExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/CoreExtension.php',
248
+ 'Twig\\Extension\\DebugExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/DebugExtension.php',
249
+ 'Twig\\Extension\\EscaperExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/EscaperExtension.php',
250
+ 'Twig\\Extension\\ExtensionInterface' => __DIR__ . '/..' . '/twig/twig/src/Extension/ExtensionInterface.php',
251
+ 'Twig\\Extension\\GlobalsInterface' => __DIR__ . '/..' . '/twig/twig/src/Extension/GlobalsInterface.php',
252
+ 'Twig\\Extension\\InitRuntimeInterface' => __DIR__ . '/..' . '/twig/twig/src/Extension/InitRuntimeInterface.php',
253
+ 'Twig\\Extension\\OptimizerExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/OptimizerExtension.php',
254
+ 'Twig\\Extension\\ProfilerExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/ProfilerExtension.php',
255
+ 'Twig\\Extension\\RuntimeExtensionInterface' => __DIR__ . '/..' . '/twig/twig/src/Extension/RuntimeExtensionInterface.php',
256
+ 'Twig\\Extension\\SandboxExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/SandboxExtension.php',
257
+ 'Twig\\Extension\\StagingExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/StagingExtension.php',
258
+ 'Twig\\Extension\\StringLoaderExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/StringLoaderExtension.php',
259
+ 'Twig\\FileExtensionEscapingStrategy' => __DIR__ . '/..' . '/twig/twig/src/FileExtensionEscapingStrategy.php',
260
+ 'Twig\\Lexer' => __DIR__ . '/..' . '/twig/twig/src/Lexer.php',
261
+ 'Twig\\Loader\\ArrayLoader' => __DIR__ . '/..' . '/twig/twig/src/Loader/ArrayLoader.php',
262
+ 'Twig\\Loader\\ChainLoader' => __DIR__ . '/..' . '/twig/twig/src/Loader/ChainLoader.php',
263
+ 'Twig\\Loader\\ExistsLoaderInterface' => __DIR__ . '/..' . '/twig/twig/src/Loader/ExistsLoaderInterface.php',
264
+ 'Twig\\Loader\\FilesystemLoader' => __DIR__ . '/..' . '/twig/twig/src/Loader/FilesystemLoader.php',
265
+ 'Twig\\Loader\\LoaderInterface' => __DIR__ . '/..' . '/twig/twig/src/Loader/LoaderInterface.php',
266
+ 'Twig\\Loader\\SourceContextLoaderInterface' => __DIR__ . '/..' . '/twig/twig/src/Loader/SourceContextLoaderInterface.php',
267
+ 'Twig\\Markup' => __DIR__ . '/..' . '/twig/twig/src/Markup.php',
268
+ 'Twig\\NodeTraverser' => __DIR__ . '/..' . '/twig/twig/src/NodeTraverser.php',
269
+ 'Twig\\NodeVisitor\\AbstractNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php',
270
+ 'Twig\\NodeVisitor\\EscaperNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php',
271
+ 'Twig\\NodeVisitor\\NodeVisitorInterface' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/NodeVisitorInterface.php',
272
+ 'Twig\\NodeVisitor\\OptimizerNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php',
273
+ 'Twig\\NodeVisitor\\SafeAnalysisNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php',
274
+ 'Twig\\NodeVisitor\\SandboxNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php',
275
+ 'Twig\\Node\\AutoEscapeNode' => __DIR__ . '/..' . '/twig/twig/src/Node/AutoEscapeNode.php',
276
+ 'Twig\\Node\\BlockNode' => __DIR__ . '/..' . '/twig/twig/src/Node/BlockNode.php',
277
+ 'Twig\\Node\\BlockReferenceNode' => __DIR__ . '/..' . '/twig/twig/src/Node/BlockReferenceNode.php',
278
+ 'Twig\\Node\\BodyNode' => __DIR__ . '/..' . '/twig/twig/src/Node/BodyNode.php',
279
+ 'Twig\\Node\\CheckSecurityNode' => __DIR__ . '/..' . '/twig/twig/src/Node/CheckSecurityNode.php',
280
+ 'Twig\\Node\\CheckToStringNode' => __DIR__ . '/..' . '/twig/twig/src/Node/CheckToStringNode.php',
281
+ 'Twig\\Node\\DeprecatedNode' => __DIR__ . '/..' . '/twig/twig/src/Node/DeprecatedNode.php',
282
+ 'Twig\\Node\\DoNode' => __DIR__ . '/..' . '/twig/twig/src/Node/DoNode.php',
283
+ 'Twig\\Node\\EmbedNode' => __DIR__ . '/..' . '/twig/twig/src/Node/EmbedNode.php',
284
+ 'Twig\\Node\\Expression\\AbstractExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/AbstractExpression.php',
285
+ 'Twig\\Node\\Expression\\ArrayExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/ArrayExpression.php',
286
+ 'Twig\\Node\\Expression\\ArrowFunctionExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/ArrowFunctionExpression.php',
287
+ 'Twig\\Node\\Expression\\AssignNameExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/AssignNameExpression.php',
288
+ 'Twig\\Node\\Expression\\Binary\\AbstractBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/AbstractBinary.php',
289
+ 'Twig\\Node\\Expression\\Binary\\AddBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/AddBinary.php',
290
+ 'Twig\\Node\\Expression\\Binary\\AndBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/AndBinary.php',
291
+ 'Twig\\Node\\Expression\\Binary\\BitwiseAndBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php',
292
+ 'Twig\\Node\\Expression\\Binary\\BitwiseOrBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php',
293
+ 'Twig\\Node\\Expression\\Binary\\BitwiseXorBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php',
294
+ 'Twig\\Node\\Expression\\Binary\\ConcatBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/ConcatBinary.php',
295
+ 'Twig\\Node\\Expression\\Binary\\DivBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/DivBinary.php',
296
+ 'Twig\\Node\\Expression\\Binary\\EndsWithBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php',
297
+ 'Twig\\Node\\Expression\\Binary\\EqualBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/EqualBinary.php',
298
+ 'Twig\\Node\\Expression\\Binary\\FloorDivBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php',
299
+ 'Twig\\Node\\Expression\\Binary\\GreaterBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/GreaterBinary.php',
300
+ 'Twig\\Node\\Expression\\Binary\\GreaterEqualBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php',
301
+ 'Twig\\Node\\Expression\\Binary\\InBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/InBinary.php',
302
+ 'Twig\\Node\\Expression\\Binary\\LessBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/LessBinary.php',
303
+ 'Twig\\Node\\Expression\\Binary\\LessEqualBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php',
304
+ 'Twig\\Node\\Expression\\Binary\\MatchesBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/MatchesBinary.php',
305
+ 'Twig\\Node\\Expression\\Binary\\ModBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/ModBinary.php',
306
+ 'Twig\\Node\\Expression\\Binary\\MulBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/MulBinary.php',
307
+ 'Twig\\Node\\Expression\\Binary\\NotEqualBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php',
308
+ 'Twig\\Node\\Expression\\Binary\\NotInBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/NotInBinary.php',
309
+ 'Twig\\Node\\Expression\\Binary\\OrBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/OrBinary.php',
310
+ 'Twig\\Node\\Expression\\Binary\\PowerBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/PowerBinary.php',
311
+ 'Twig\\Node\\Expression\\Binary\\RangeBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/RangeBinary.php',
312
+ 'Twig\\Node\\Expression\\Binary\\StartsWithBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php',
313
+ 'Twig\\Node\\Expression\\Binary\\SubBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/SubBinary.php',
314
+ 'Twig\\Node\\Expression\\BlockReferenceExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/BlockReferenceExpression.php',
315
+ 'Twig\\Node\\Expression\\CallExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/CallExpression.php',
316
+ 'Twig\\Node\\Expression\\ConditionalExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/ConditionalExpression.php',
317
+ 'Twig\\Node\\Expression\\ConstantExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/ConstantExpression.php',
318
+ 'Twig\\Node\\Expression\\FilterExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/FilterExpression.php',
319
+ 'Twig\\Node\\Expression\\Filter\\DefaultFilter' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Filter/DefaultFilter.php',
320
+ 'Twig\\Node\\Expression\\FunctionExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/FunctionExpression.php',
321
+ 'Twig\\Node\\Expression\\GetAttrExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/GetAttrExpression.php',
322
+ 'Twig\\Node\\Expression\\InlinePrint' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/InlinePrint.php',
323
+ 'Twig\\Node\\Expression\\MethodCallExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/MethodCallExpression.php',
324
+ 'Twig\\Node\\Expression\\NameExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/NameExpression.php',
325
+ 'Twig\\Node\\Expression\\NullCoalesceExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/NullCoalesceExpression.php',
326
+ 'Twig\\Node\\Expression\\ParentExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/ParentExpression.php',
327
+ 'Twig\\Node\\Expression\\TempNameExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/TempNameExpression.php',
328
+ 'Twig\\Node\\Expression\\TestExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/TestExpression.php',
329
+ 'Twig\\Node\\Expression\\Test\\ConstantTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/ConstantTest.php',
330
+ 'Twig\\Node\\Expression\\Test\\DefinedTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/DefinedTest.php',
331
+ 'Twig\\Node\\Expression\\Test\\DivisiblebyTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php',
332
+ 'Twig\\Node\\Expression\\Test\\EvenTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/EvenTest.php',
333
+ 'Twig\\Node\\Expression\\Test\\NullTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/NullTest.php',
334
+ 'Twig\\Node\\Expression\\Test\\OddTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/OddTest.php',
335
+ 'Twig\\Node\\Expression\\Test\\SameasTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/SameasTest.php',
336
+ 'Twig\\Node\\Expression\\Unary\\AbstractUnary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Unary/AbstractUnary.php',
337
+ 'Twig\\Node\\Expression\\Unary\\NegUnary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Unary/NegUnary.php',
338
+ 'Twig\\Node\\Expression\\Unary\\NotUnary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Unary/NotUnary.php',
339
+ 'Twig\\Node\\Expression\\Unary\\PosUnary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Unary/PosUnary.php',
340
+ 'Twig\\Node\\FlushNode' => __DIR__ . '/..' . '/twig/twig/src/Node/FlushNode.php',
341
+ 'Twig\\Node\\ForLoopNode' => __DIR__ . '/..' . '/twig/twig/src/Node/ForLoopNode.php',
342
+ 'Twig\\Node\\ForNode' => __DIR__ . '/..' . '/twig/twig/src/Node/ForNode.php',
343
+ 'Twig\\Node\\IfNode' => __DIR__ . '/..' . '/twig/twig/src/Node/IfNode.php',
344
+ 'Twig\\Node\\ImportNode' => __DIR__ . '/..' . '/twig/twig/src/Node/ImportNode.php',
345
+ 'Twig\\Node\\IncludeNode' => __DIR__ . '/..' . '/twig/twig/src/Node/IncludeNode.php',
346
+ 'Twig\\Node\\MacroNode' => __DIR__ . '/..' . '/twig/twig/src/Node/MacroNode.php',
347
+ 'Twig\\Node\\ModuleNode' => __DIR__ . '/..' . '/twig/twig/src/Node/ModuleNode.php',
348
+ 'Twig\\Node\\Node' => __DIR__ . '/..' . '/twig/twig/src/Node/Node.php',
349
+ 'Twig\\Node\\NodeCaptureInterface' => __DIR__ . '/..' . '/twig/twig/src/Node/NodeCaptureInterface.php',
350
+ 'Twig\\Node\\NodeOutputInterface' => __DIR__ . '/..' . '/twig/twig/src/Node/NodeOutputInterface.php',
351
+ 'Twig\\Node\\PrintNode' => __DIR__ . '/..' . '/twig/twig/src/Node/PrintNode.php',
352
+ 'Twig\\Node\\SandboxNode' => __DIR__ . '/..' . '/twig/twig/src/Node/SandboxNode.php',
353
+ 'Twig\\Node\\SandboxedPrintNode' => __DIR__ . '/..' . '/twig/twig/src/Node/SandboxedPrintNode.php',
354
+ 'Twig\\Node\\SetNode' => __DIR__ . '/..' . '/twig/twig/src/Node/SetNode.php',
355
+ 'Twig\\Node\\SetTempNode' => __DIR__ . '/..' . '/twig/twig/src/Node/SetTempNode.php',
356
+ 'Twig\\Node\\SpacelessNode' => __DIR__ . '/..' . '/twig/twig/src/Node/SpacelessNode.php',
357
+ 'Twig\\Node\\TextNode' => __DIR__ . '/..' . '/twig/twig/src/Node/TextNode.php',
358
+ 'Twig\\Node\\WithNode' => __DIR__ . '/..' . '/twig/twig/src/Node/WithNode.php',
359
+ 'Twig\\Parser' => __DIR__ . '/..' . '/twig/twig/src/Parser.php',
360
+ 'Twig\\Profiler\\Dumper\\BaseDumper' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Dumper/BaseDumper.php',
361
+ 'Twig\\Profiler\\Dumper\\BlackfireDumper' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Dumper/BlackfireDumper.php',
362
+ 'Twig\\Profiler\\Dumper\\HtmlDumper' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Dumper/HtmlDumper.php',
363
+ 'Twig\\Profiler\\Dumper\\TextDumper' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Dumper/TextDumper.php',
364
+ 'Twig\\Profiler\\NodeVisitor\\ProfilerNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php',
365
+ 'Twig\\Profiler\\Node\\EnterProfileNode' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Node/EnterProfileNode.php',
366
+ 'Twig\\Profiler\\Node\\LeaveProfileNode' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Node/LeaveProfileNode.php',
367
+ 'Twig\\Profiler\\Profile' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Profile.php',
368
+ 'Twig\\RuntimeLoader\\ContainerRuntimeLoader' => __DIR__ . '/..' . '/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php',
369
+ 'Twig\\RuntimeLoader\\FactoryRuntimeLoader' => __DIR__ . '/..' . '/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php',
370
+ 'Twig\\RuntimeLoader\\RuntimeLoaderInterface' => __DIR__ . '/..' . '/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php',
371
+ 'Twig\\Sandbox\\SecurityError' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityError.php',
372
+ 'Twig\\Sandbox\\SecurityNotAllowedFilterError' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php',
373
+ 'Twig\\Sandbox\\SecurityNotAllowedFunctionError' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php',
374
+ 'Twig\\Sandbox\\SecurityNotAllowedMethodError' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php',
375
+ 'Twig\\Sandbox\\SecurityNotAllowedPropertyError' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php',
376
+ 'Twig\\Sandbox\\SecurityNotAllowedTagError' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php',
377
+ 'Twig\\Sandbox\\SecurityPolicy' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityPolicy.php',
378
+ 'Twig\\Sandbox\\SecurityPolicyInterface' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityPolicyInterface.php',
379
+ 'Twig\\Source' => __DIR__ . '/..' . '/twig/twig/src/Source.php',
380
+ 'Twig\\Template' => __DIR__ . '/..' . '/twig/twig/src/Template.php',
381
+ 'Twig\\TemplateWrapper' => __DIR__ . '/..' . '/twig/twig/src/TemplateWrapper.php',
382
+ 'Twig\\Test\\IntegrationTestCase' => __DIR__ . '/..' . '/twig/twig/src/Test/IntegrationTestCase.php',
383
+ 'Twig\\Test\\NodeTestCase' => __DIR__ . '/..' . '/twig/twig/src/Test/NodeTestCase.php',
384
+ 'Twig\\Token' => __DIR__ . '/..' . '/twig/twig/src/Token.php',
385
+ 'Twig\\TokenParser\\AbstractTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/AbstractTokenParser.php',
386
+ 'Twig\\TokenParser\\ApplyTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/ApplyTokenParser.php',
387
+ 'Twig\\TokenParser\\AutoEscapeTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/AutoEscapeTokenParser.php',
388
+ 'Twig\\TokenParser\\BlockTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/BlockTokenParser.php',
389
+ 'Twig\\TokenParser\\DeprecatedTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/DeprecatedTokenParser.php',
390
+ 'Twig\\TokenParser\\DoTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/DoTokenParser.php',
391
+ 'Twig\\TokenParser\\EmbedTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/EmbedTokenParser.php',
392
+ 'Twig\\TokenParser\\ExtendsTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/ExtendsTokenParser.php',
393
+ 'Twig\\TokenParser\\FilterTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/FilterTokenParser.php',
394
+ 'Twig\\TokenParser\\FlushTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/FlushTokenParser.php',
395
+ 'Twig\\TokenParser\\ForTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/ForTokenParser.php',
396
+ 'Twig\\TokenParser\\FromTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/FromTokenParser.php',
397
+ 'Twig\\TokenParser\\IfTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/IfTokenParser.php',
398
+ 'Twig\\TokenParser\\ImportTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/ImportTokenParser.php',
399
+ 'Twig\\TokenParser\\IncludeTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/IncludeTokenParser.php',
400
+ 'Twig\\TokenParser\\MacroTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/MacroTokenParser.php',
401
+ 'Twig\\TokenParser\\SandboxTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/SandboxTokenParser.php',
402
+ 'Twig\\TokenParser\\SetTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/SetTokenParser.php',
403
+ 'Twig\\TokenParser\\SpacelessTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/SpacelessTokenParser.php',
404
+ 'Twig\\TokenParser\\TokenParserInterface' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/TokenParserInterface.php',
405
+ 'Twig\\TokenParser\\UseTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/UseTokenParser.php',
406
+ 'Twig\\TokenParser\\WithTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/WithTokenParser.php',
407
+ 'Twig\\TokenStream' => __DIR__ . '/..' . '/twig/twig/src/TokenStream.php',
408
+ 'Twig\\TwigFilter' => __DIR__ . '/..' . '/twig/twig/src/TwigFilter.php',
409
+ 'Twig\\TwigFunction' => __DIR__ . '/..' . '/twig/twig/src/TwigFunction.php',
410
+ 'Twig\\TwigTest' => __DIR__ . '/..' . '/twig/twig/src/TwigTest.php',
411
+ 'Twig\\Util\\DeprecationCollector' => __DIR__ . '/..' . '/twig/twig/src/Util/DeprecationCollector.php',
412
+ 'Twig\\Util\\TemplateDirIterator' => __DIR__ . '/..' . '/twig/twig/src/Util/TemplateDirIterator.php',
413
+ 'Twig_Autoloader' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Autoloader.php',
414
+ 'Twig_BaseNodeVisitor' => __DIR__ . '/..' . '/twig/twig/lib/Twig/BaseNodeVisitor.php',
415
+ 'Twig_CacheInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/CacheInterface.php',
416
+ 'Twig_Cache_Filesystem' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Cache/Filesystem.php',
417
+ 'Twig_Cache_Null' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Cache/Null.php',
418
+ 'Twig_Compiler' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Compiler.php',
419
+ 'Twig_CompilerInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/CompilerInterface.php',
420
+ 'Twig_ContainerRuntimeLoader' => __DIR__ . '/..' . '/twig/twig/lib/Twig/ContainerRuntimeLoader.php',
421
+ 'Twig_Environment' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Environment.php',
422
+ 'Twig_Error' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Error.php',
423
+ 'Twig_Error_Loader' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Error/Loader.php',
424
+ 'Twig_Error_Runtime' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Error/Runtime.php',
425
+ 'Twig_Error_Syntax' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Error/Syntax.php',
426
+ 'Twig_ExistsLoaderInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/ExistsLoaderInterface.php',
427
+ 'Twig_ExpressionParser' => __DIR__ . '/..' . '/twig/twig/lib/Twig/ExpressionParser.php',
428
+ 'Twig_Extension' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension.php',
429
+ 'Twig_ExtensionInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/ExtensionInterface.php',
430
+ 'Twig_Extension_Core' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension/Core.php',
431
+ 'Twig_Extension_Debug' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension/Debug.php',
432
+ 'Twig_Extension_Escaper' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension/Escaper.php',
433
+ 'Twig_Extension_GlobalsInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension/GlobalsInterface.php',
434
+ 'Twig_Extension_InitRuntimeInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php',
435
+ 'Twig_Extension_Optimizer' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension/Optimizer.php',
436
+ 'Twig_Extension_Profiler' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension/Profiler.php',
437
+ 'Twig_Extension_Sandbox' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension/Sandbox.php',
438
+ 'Twig_Extension_Staging' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension/Staging.php',
439
+ 'Twig_Extension_StringLoader' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension/StringLoader.php',
440
+ 'Twig_FactoryRuntimeLoader' => __DIR__ . '/..' . '/twig/twig/lib/Twig/FactoryRuntimeLoader.php',
441
+ 'Twig_FileExtensionEscapingStrategy' => __DIR__ . '/..' . '/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php',
442
+ 'Twig_Filter' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Filter.php',
443
+ 'Twig_FilterCallableInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/FilterCallableInterface.php',
444
+ 'Twig_FilterInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/FilterInterface.php',
445
+ 'Twig_Filter_Function' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Filter/Function.php',
446
+ 'Twig_Filter_Method' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Filter/Method.php',
447
+ 'Twig_Filter_Node' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Filter/Node.php',
448
+ 'Twig_Function' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Function.php',
449
+ 'Twig_FunctionCallableInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/FunctionCallableInterface.php',
450
+ 'Twig_FunctionInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/FunctionInterface.php',
451
+ 'Twig_Function_Function' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Function/Function.php',
452
+ 'Twig_Function_Method' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Function/Method.php',
453
+ 'Twig_Function_Node' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Function/Node.php',
454
+ 'Twig_Lexer' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Lexer.php',
455
+ 'Twig_LexerInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/LexerInterface.php',
456
+ 'Twig_LoaderInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/LoaderInterface.php',
457
+ 'Twig_Loader_Array' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Loader/Array.php',
458
+ 'Twig_Loader_Chain' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Loader/Chain.php',
459
+ 'Twig_Loader_Filesystem' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Loader/Filesystem.php',
460
+ 'Twig_Loader_String' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Loader/String.php',
461
+ 'Twig_Markup' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Markup.php',
462
+ 'Twig_Node' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node.php',
463
+ 'Twig_NodeCaptureInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeCaptureInterface.php',
464
+ 'Twig_NodeInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeInterface.php',
465
+ 'Twig_NodeOutputInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeOutputInterface.php',
466
+ 'Twig_NodeTraverser' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeTraverser.php',
467
+ 'Twig_NodeVisitorInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeVisitorInterface.php',
468
+ 'Twig_NodeVisitor_Escaper' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeVisitor/Escaper.php',
469
+ 'Twig_NodeVisitor_Optimizer' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeVisitor/Optimizer.php',
470
+ 'Twig_NodeVisitor_SafeAnalysis' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php',
471
+ 'Twig_NodeVisitor_Sandbox' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeVisitor/Sandbox.php',
472
+ 'Twig_Node_AutoEscape' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/AutoEscape.php',
473
+ 'Twig_Node_Block' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Block.php',
474
+ 'Twig_Node_BlockReference' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/BlockReference.php',
475
+ 'Twig_Node_Body' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Body.php',
476
+ 'Twig_Node_CheckSecurity' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/CheckSecurity.php',
477
+ 'Twig_Node_Deprecated' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Deprecated.php',
478
+ 'Twig_Node_Do' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Do.php',
479
+ 'Twig_Node_Embed' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Embed.php',
480
+ 'Twig_Node_Expression' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression.php',
481
+ 'Twig_Node_Expression_Array' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Array.php',
482
+ 'Twig_Node_Expression_AssignName' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/AssignName.php',
483
+ 'Twig_Node_Expression_Binary' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary.php',
484
+ 'Twig_Node_Expression_Binary_Add' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/Add.php',
485
+ 'Twig_Node_Expression_Binary_And' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/And.php',
486
+ 'Twig_Node_Expression_Binary_BitwiseAnd' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php',
487
+ 'Twig_Node_Expression_Binary_BitwiseOr' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php',
488
+ 'Twig_Node_Expression_Binary_BitwiseXor' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php',
489
+ 'Twig_Node_Expression_Binary_Concat' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php',
490
+ 'Twig_Node_Expression_Binary_Div' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/Div.php',
491
+ 'Twig_Node_Expression_Binary_EndsWith' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php',
492
+ 'Twig_Node_Expression_Binary_Equal' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php',
493
+ 'Twig_Node_Expression_Binary_FloorDiv' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php',
494
+ 'Twig_Node_Expression_Binary_Greater' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php',
495
+ 'Twig_Node_Expression_Binary_GreaterEqual' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php',
496
+ 'Twig_Node_Expression_Binary_In' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/In.php',
497
+ 'Twig_Node_Expression_Binary_Less' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/Less.php',
498
+ 'Twig_Node_Expression_Binary_LessEqual' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php',
499
+ 'Twig_Node_Expression_Binary_Matches' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php',
500
+ 'Twig_Node_Expression_Binary_Mod' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php',
501
+ 'Twig_Node_Expression_Binary_Mul' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php',
502
+ 'Twig_Node_Expression_Binary_NotEqual' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php',
503
+ 'Twig_Node_Expression_Binary_NotIn' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php',
504
+ 'Twig_Node_Expression_Binary_Or' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/Or.php',
505
+ 'Twig_Node_Expression_Binary_Power' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/Power.php',
506
+ 'Twig_Node_Expression_Binary_Range' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/Range.php',
507
+ 'Twig_Node_Expression_Binary_StartsWith' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php',
508
+ 'Twig_Node_Expression_Binary_Sub' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php',
509
+ 'Twig_Node_Expression_BlockReference' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/BlockReference.php',
510
+ 'Twig_Node_Expression_Call' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Call.php',
511
+ 'Twig_Node_Expression_Conditional' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Conditional.php',
512
+ 'Twig_Node_Expression_Constant' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Constant.php',
513
+ 'Twig_Node_Expression_ExtensionReference' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php',
514
+ 'Twig_Node_Expression_Filter' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Filter.php',
515
+ 'Twig_Node_Expression_Filter_Default' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Filter/Default.php',
516
+ 'Twig_Node_Expression_Function' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Function.php',
517
+ 'Twig_Node_Expression_GetAttr' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/GetAttr.php',
518
+ 'Twig_Node_Expression_MethodCall' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/MethodCall.php',
519
+ 'Twig_Node_Expression_Name' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Name.php',
520
+ 'Twig_Node_Expression_NullCoalesce' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php',
521
+ 'Twig_Node_Expression_Parent' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Parent.php',
522
+ 'Twig_Node_Expression_TempName' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/TempName.php',
523
+ 'Twig_Node_Expression_Test' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Test.php',
524
+ 'Twig_Node_Expression_Test_Constant' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Test/Constant.php',
525
+ 'Twig_Node_Expression_Test_Defined' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Test/Defined.php',
526
+ 'Twig_Node_Expression_Test_Divisibleby' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php',
527
+ 'Twig_Node_Expression_Test_Even' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Test/Even.php',
528
+ 'Twig_Node_Expression_Test_Null' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Test/Null.php',
529
+ 'Twig_Node_Expression_Test_Odd' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Test/Odd.php',
530
+ 'Twig_Node_Expression_Test_Sameas' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php',
531
+ 'Twig_Node_Expression_Unary' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Unary.php',
532
+ 'Twig_Node_Expression_Unary_Neg' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php',
533
+ 'Twig_Node_Expression_Unary_Not' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Unary/Not.php',
534
+ 'Twig_Node_Expression_Unary_Pos' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php',
535
+ 'Twig_Node_Flush' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Flush.php',
536
+ 'Twig_Node_For' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/For.php',
537
+ 'Twig_Node_ForLoop' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/ForLoop.php',
538
+ 'Twig_Node_If' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/If.php',
539
+ 'Twig_Node_Import' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Import.php',
540
+ 'Twig_Node_Include' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Include.php',
541
+ 'Twig_Node_Macro' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Macro.php',
542
+ 'Twig_Node_Module' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Module.php',
543
+ 'Twig_Node_Print' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Print.php',
544
+ 'Twig_Node_Sandbox' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Sandbox.php',
545
+ 'Twig_Node_SandboxedPrint' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/SandboxedPrint.php',
546
+ 'Twig_Node_Set' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Set.php',
547
+ 'Twig_Node_SetTemp' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/SetTemp.php',
548
+ 'Twig_Node_Spaceless' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Spaceless.php',
549
+ 'Twig_Node_Text' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Text.php',
550
+ 'Twig_Node_With' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/With.php',
551
+ 'Twig_Parser' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Parser.php',
552
+ 'Twig_ParserInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/ParserInterface.php',
553
+ 'Twig_Profiler_Dumper_Base' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Profiler/Dumper/Base.php',
554
+ 'Twig_Profiler_Dumper_Blackfire' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php',
555
+ 'Twig_Profiler_Dumper_Html' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Profiler/Dumper/Html.php',
556
+ 'Twig_Profiler_Dumper_Text' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Profiler/Dumper/Text.php',
557
+ 'Twig_Profiler_NodeVisitor_Profiler' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php',
558
+ 'Twig_Profiler_Node_EnterProfile' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php',
559
+ 'Twig_Profiler_Node_LeaveProfile' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php',
560
+ 'Twig_Profiler_Profile' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Profiler/Profile.php',
561
+ 'Twig_RuntimeLoaderInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/RuntimeLoaderInterface.php',
562
+ 'Twig_Sandbox_SecurityError' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Sandbox/SecurityError.php',
563
+ 'Twig_Sandbox_SecurityNotAllowedFilterError' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php',
564
+ 'Twig_Sandbox_SecurityNotAllowedFunctionError' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php',
565
+ 'Twig_Sandbox_SecurityNotAllowedMethodError' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php',
566
+ 'Twig_Sandbox_SecurityNotAllowedPropertyError' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php',
567
+ 'Twig_Sandbox_SecurityNotAllowedTagError' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php',
568
+ 'Twig_Sandbox_SecurityPolicy' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php',
569
+ 'Twig_Sandbox_SecurityPolicyInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php',
570
+ 'Twig_SimpleFilter' => __DIR__ . '/..' . '/twig/twig/lib/Twig/SimpleFilter.php',
571
+ 'Twig_SimpleFunction' => __DIR__ . '/..' . '/twig/twig/lib/Twig/SimpleFunction.php',
572
+ 'Twig_SimpleTest' => __DIR__ . '/..' . '/twig/twig/lib/Twig/SimpleTest.php',
573
+ 'Twig_Source' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Source.php',
574
+ 'Twig_SourceContextLoaderInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/SourceContextLoaderInterface.php',
575
+ 'Twig_Template' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Template.php',
576
+ 'Twig_TemplateInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TemplateInterface.php',
577
+ 'Twig_TemplateWrapper' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TemplateWrapper.php',
578
+ 'Twig_Test' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test.php',
579
+ 'Twig_TestCallableInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TestCallableInterface.php',
580
+ 'Twig_TestInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TestInterface.php',
581
+ 'Twig_Test_Function' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/Function.php',
582
+ 'Twig_Test_IntegrationTestCase' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/IntegrationTestCase.php',
583
+ 'Twig_Test_Method' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/Method.php',
584
+ 'Twig_Test_Node' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/Node.php',
585
+ 'Twig_Test_NodeTestCase' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/NodeTestCase.php',
586
+ 'Twig_Token' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Token.php',
587
+ 'Twig_TokenParser' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser.php',
588
+ 'Twig_TokenParserBroker' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParserBroker.php',
589
+ 'Twig_TokenParserBrokerInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParserBrokerInterface.php',
590
+ 'Twig_TokenParserInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParserInterface.php',
591
+ 'Twig_TokenParser_AutoEscape' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/AutoEscape.php',
592
+ 'Twig_TokenParser_Block' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Block.php',
593
+ 'Twig_TokenParser_Deprecated' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Deprecated.php',
594
+ 'Twig_TokenParser_Do' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Do.php',
595
+ 'Twig_TokenParser_Embed' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Embed.php',
596
+ 'Twig_TokenParser_Extends' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Extends.php',
597
+ 'Twig_TokenParser_Filter' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Filter.php',
598
+ 'Twig_TokenParser_Flush' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Flush.php',
599
+ 'Twig_TokenParser_For' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/For.php',
600
+ 'Twig_TokenParser_From' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/From.php',
601
+ 'Twig_TokenParser_If' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/If.php',
602
+ 'Twig_TokenParser_Import' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Import.php',
603
+ 'Twig_TokenParser_Include' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Include.php',
604
+ 'Twig_TokenParser_Macro' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Macro.php',
605
+ 'Twig_TokenParser_Sandbox' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Sandbox.php',
606
+ 'Twig_TokenParser_Set' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Set.php',
607
+ 'Twig_TokenParser_Spaceless' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Spaceless.php',
608
+ 'Twig_TokenParser_Use' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Use.php',
609
+ 'Twig_TokenParser_With' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/With.php',
610
+ 'Twig_TokenStream' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenStream.php',
611
+ 'Twig_Util_DeprecationCollector' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Util/DeprecationCollector.php',
612
+ 'Twig_Util_TemplateDirIterator' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Util/TemplateDirIterator.php',
613
+ );
614
+
615
+ public static function getInitializer(ClassLoader $loader)
616
+ {
617
+ return \Closure::bind(function () use ($loader) {
618
+ $loader->prefixLengthsPsr4 = ComposerStaticInit6567439c14f5705c1376d806b5d78dc2::$prefixLengthsPsr4;
619
+ $loader->prefixDirsPsr4 = ComposerStaticInit6567439c14f5705c1376d806b5d78dc2::$prefixDirsPsr4;
620
+ $loader->fallbackDirsPsr4 = ComposerStaticInit6567439c14f5705c1376d806b5d78dc2::$fallbackDirsPsr4;
621
+ $loader->prefixesPsr0 = ComposerStaticInit6567439c14f5705c1376d806b5d78dc2::$prefixesPsr0;
622
+ $loader->classMap = ComposerStaticInit6567439c14f5705c1376d806b5d78dc2::$classMap;
623
+
624
+ }, null, ClassLoader::class);
625
+ }
626
+ }
vendor/composer/installed.json CHANGED
@@ -1,17 +1,130 @@
1
  [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  {
3
  "name": "composer/installers",
4
- "version": "v1.6.0",
5
- "version_normalized": "1.6.0.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/composer/installers.git",
9
- "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b",
14
- "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b",
15
  "shasum": ""
16
  },
17
  "require": {
@@ -25,7 +138,7 @@
25
  "composer/composer": "1.0.*@dev",
26
  "phpunit/phpunit": "^4.8.36"
27
  },
28
- "time": "2018-08-27 06:10:37",
29
  "type": "composer-plugin",
30
  "extra": {
31
  "class": "Composer\\Installers\\Plugin",
@@ -69,6 +182,7 @@
69
  "RadPHP",
70
  "SMF",
71
  "Thelia",
 
72
  "WolfCMS",
73
  "agl",
74
  "aimeos",
@@ -91,6 +205,7 @@
91
  "installer",
92
  "itop",
93
  "joomla",
 
94
  "kohana",
95
  "laravel",
96
  "lavalite",
@@ -121,129 +236,19 @@
121
  "zikula"
122
  ]
123
  },
124
- {
125
- "name": "altorouter/altorouter",
126
- "version": "v1.2.0",
127
- "version_normalized": "1.2.0.0",
128
- "source": {
129
- "type": "git",
130
- "url": "https://github.com/dannyvankooten/AltoRouter.git",
131
- "reference": "39c50092470128c12284d332bb57f306bb5b58e4"
132
- },
133
- "dist": {
134
- "type": "zip",
135
- "url": "https://api.github.com/repos/dannyvankooten/AltoRouter/zipball/39c50092470128c12284d332bb57f306bb5b58e4",
136
- "reference": "39c50092470128c12284d332bb57f306bb5b58e4",
137
- "shasum": ""
138
- },
139
- "require": {
140
- "php": ">=5.3.0"
141
- },
142
- "require-dev": {
143
- "codeclimate/php-test-reporter": "dev-master",
144
- "phpunit/phpunit": "4.5.*"
145
- },
146
- "time": "2015-11-30 00:47:43",
147
- "type": "library",
148
- "installation-source": "dist",
149
- "autoload": {
150
- "classmap": [
151
- "AltoRouter.php"
152
- ]
153
- },
154
- "notification-url": "https://packagist.org/downloads/",
155
- "license": [
156
- "MIT"
157
- ],
158
- "authors": [
159
- {
160
- "name": "Danny van Kooten",
161
- "email": "dannyvankooten@gmail.com",
162
- "homepage": "http://dannyvankooten.com/"
163
- },
164
- {
165
- "name": "Koen Punt",
166
- "homepage": "https://github.com/koenpunt"
167
- },
168
- {
169
- "name": "niahoo",
170
- "homepage": "https://github.com/niahoo"
171
- }
172
- ],
173
- "description": "A lightning fast router for PHP",
174
- "homepage": "https://github.com/dannyvankooten/AltoRouter",
175
- "keywords": [
176
- "lightweight",
177
- "router",
178
- "routing"
179
- ]
180
- },
181
- {
182
- "name": "upstatement/routes",
183
- "version": "0.5",
184
- "version_normalized": "0.5.0.0",
185
- "source": {
186
- "type": "git",
187
- "url": "https://github.com/Upstatement/routes.git",
188
- "reference": "3267d28be0a73f197087d58384e1a358d85671b6"
189
- },
190
- "dist": {
191
- "type": "zip",
192
- "url": "https://api.github.com/repos/Upstatement/routes/zipball/3267d28be0a73f197087d58384e1a358d85671b6",
193
- "reference": "3267d28be0a73f197087d58384e1a358d85671b6",
194
- "shasum": ""
195
- },
196
- "require": {
197
- "altorouter/altorouter": "^1.1.0",
198
- "composer/installers": "~1.0",
199
- "php": ">=5.3.0"
200
- },
201
- "require-dev": {
202
- "phpunit/phpunit": "3.7.*",
203
- "satooshi/php-coveralls": "dev-master",
204
- "wp-cli/wp-cli": "*"
205
- },
206
- "time": "2018-12-04 01:13:41",
207
- "type": "library",
208
- "installation-source": "dist",
209
- "autoload": {
210
- "psr-0": {
211
- "Routes": ""
212
- }
213
- },
214
- "notification-url": "https://packagist.org/downloads/",
215
- "license": [
216
- "MIT"
217
- ],
218
- "authors": [
219
- {
220
- "name": "Jared Novack",
221
- "email": "jared@upstatement.com",
222
- "homepage": "http://upstatement.com"
223
- }
224
- ],
225
- "description": "Manage rewrites and routes in WordPress with this dead-simple plugin",
226
- "homepage": "http://routes.upstatement.com",
227
- "keywords": [
228
- "redirects",
229
- "rewrite",
230
- "routes",
231
- "routing"
232
- ]
233
- },
234
  {
235
  "name": "symfony/polyfill-ctype",
236
- "version": "v1.11.0",
237
- "version_normalized": "1.11.0.0",
238
  "source": {
239
  "type": "git",
240
  "url": "https://github.com/symfony/polyfill-ctype.git",
241
- "reference": "82ebae02209c21113908c229e9883c419720738a"
242
  },
243
  "dist": {
244
  "type": "zip",
245
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a",
246
- "reference": "82ebae02209c21113908c229e9883c419720738a",
247
  "shasum": ""
248
  },
249
  "require": {
@@ -252,11 +257,11 @@
252
  "suggest": {
253
  "ext-ctype": "For best performance"
254
  },
255
- "time": "2019-02-06 07:57:58",
256
  "type": "library",
257
  "extra": {
258
  "branch-alias": {
259
- "dev-master": "1.11-dev"
260
  }
261
  },
262
  "installation-source": "dist",
@@ -273,13 +278,13 @@
273
  "MIT"
274
  ],
275
  "authors": [
276
- {
277
- "name": "Symfony Community",
278
- "homepage": "https://symfony.com/contributors"
279
- },
280
  {
281
  "name": "Gert de Pagter",
282
  "email": "BackEndTea@gmail.com"
 
 
 
 
283
  }
284
  ],
285
  "description": "Symfony polyfill for ctype functions",
@@ -293,29 +298,29 @@
293
  },
294
  {
295
  "name": "twig/twig",
296
- "version": "v1.42.1",
297
- "version_normalized": "1.42.1.0",
298
  "source": {
299
  "type": "git",
300
  "url": "https://github.com/twigphp/Twig.git",
301
- "reference": "671347603760a88b1e7288aaa9378f33687d7edf"
302
  },
303
  "dist": {
304
  "type": "zip",
305
- "url": "https://api.github.com/repos/twigphp/Twig/zipball/671347603760a88b1e7288aaa9378f33687d7edf",
306
- "reference": "671347603760a88b1e7288aaa9378f33687d7edf",
307
  "shasum": ""
308
  },
309
  "require": {
310
- "php": ">=5.4.0",
311
  "symfony/polyfill-ctype": "^1.8"
312
  },
313
  "require-dev": {
314
  "psr/container": "^1.0",
315
- "symfony/debug": "^2.7",
316
- "symfony/phpunit-bridge": "^3.4.19|^4.1.8|^5.0"
317
  },
318
- "time": "2019-06-04 11:31:08",
319
  "type": "library",
320
  "extra": {
321
  "branch-alias": {
@@ -342,15 +347,15 @@
342
  "homepage": "http://fabien.potencier.org",
343
  "role": "Lead Developer"
344
  },
345
- {
346
- "name": "Armin Ronacher",
347
- "email": "armin.ronacher@active-4.com",
348
- "role": "Project Founder"
349
- },
350
  {
351
  "name": "Twig Team",
352
  "homepage": "https://twig.symfony.com/contributors",
353
  "role": "Contributors"
 
 
 
 
 
354
  }
355
  ],
356
  "description": "Twig, the flexible, fast, and secure template language for PHP",
@@ -360,41 +365,36 @@
360
  ]
361
  },
362
  {
363
- "name": "asm89/twig-cache-extension",
364
- "version": "1.3.2",
365
- "version_normalized": "1.3.2.0",
366
  "source": {
367
  "type": "git",
368
- "url": "https://github.com/asm89/twig-cache-extension.git",
369
- "reference": "630ea7abdc3fc62ba6786c02590a1560e449cf55"
370
  },
371
  "dist": {
372
  "type": "zip",
373
- "url": "https://api.github.com/repos/asm89/twig-cache-extension/zipball/630ea7abdc3fc62ba6786c02590a1560e449cf55",
374
- "reference": "630ea7abdc3fc62ba6786c02590a1560e449cf55",
375
  "shasum": ""
376
  },
377
  "require": {
378
- "php": ">=5.3.2",
379
- "twig/twig": "^1.0|^2.0"
 
380
  },
381
  "require-dev": {
382
- "doctrine/cache": "~1.0"
383
- },
384
- "suggest": {
385
- "psr/cache-implementation": "To make use of PSR-6 cache implementation via PsrCacheAdapter."
386
  },
387
- "time": "2017-01-10 22:04:15",
388
  "type": "library",
389
- "extra": {
390
- "branch-alias": {
391
- "dev-master": "1.3-dev"
392
- }
393
- },
394
  "installation-source": "dist",
395
  "autoload": {
396
- "psr-4": {
397
- "": "lib/"
398
  }
399
  },
400
  "notification-url": "https://packagist.org/downloads/",
@@ -403,16 +403,18 @@
403
  ],
404
  "authors": [
405
  {
406
- "name": "Alexander",
407
- "email": "iam.asm89@gmail.com"
 
408
  }
409
  ],
410
- "description": "Cache fragments of templates directly within Twig.",
411
- "homepage": "https://github.com/asm89/twig-cache-extension",
412
  "keywords": [
413
- "cache",
414
- "extension",
415
- "twig"
 
416
  ]
417
  }
418
  ]
1
  [
2
+ {
3
+ "name": "altorouter/altorouter",
4
+ "version": "v1.2.0",
5
+ "version_normalized": "1.2.0.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/dannyvankooten/AltoRouter.git",
9
+ "reference": "39c50092470128c12284d332bb57f306bb5b58e4"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/dannyvankooten/AltoRouter/zipball/39c50092470128c12284d332bb57f306bb5b58e4",
14
+ "reference": "39c50092470128c12284d332bb57f306bb5b58e4",
15
+ "shasum": ""
16
+ },
17
+ "require": {
18
+ "php": ">=5.3.0"
19
+ },
20
+ "require-dev": {
21
+ "codeclimate/php-test-reporter": "dev-master",
22
+ "phpunit/phpunit": "4.5.*"
23
+ },
24
+ "time": "2015-11-30T00:47:43+00:00",
25
+ "type": "library",
26
+ "installation-source": "dist",
27
+ "autoload": {
28
+ "classmap": [
29
+ "AltoRouter.php"
30
+ ]
31
+ },
32
+ "notification-url": "https://packagist.org/downloads/",
33
+ "license": [
34
+ "MIT"
35
+ ],
36
+ "authors": [
37
+ {
38
+ "name": "Danny van Kooten",
39
+ "email": "dannyvankooten@gmail.com",
40
+ "homepage": "http://dannyvankooten.com/"
41
+ },
42
+ {
43
+ "name": "Koen Punt",
44
+ "homepage": "https://github.com/koenpunt"
45
+ },
46
+ {
47
+ "name": "niahoo",
48
+ "homepage": "https://github.com/niahoo"
49
+ }
50
+ ],
51
+ "description": "A lightning fast router for PHP",
52
+ "homepage": "https://github.com/dannyvankooten/AltoRouter",
53
+ "keywords": [
54
+ "lightweight",
55
+ "router",
56
+ "routing"
57
+ ]
58
+ },
59
+ {
60
+ "name": "asm89/twig-cache-extension",
61
+ "version": "1.3.2",
62
+ "version_normalized": "1.3.2.0",
63
+ "source": {
64
+ "type": "git",
65
+ "url": "https://github.com/asm89/twig-cache-extension.git",
66
+ "reference": "630ea7abdc3fc62ba6786c02590a1560e449cf55"
67
+ },
68
+ "dist": {
69
+ "type": "zip",
70
+ "url": "https://api.github.com/repos/asm89/twig-cache-extension/zipball/630ea7abdc3fc62ba6786c02590a1560e449cf55",
71
+ "reference": "630ea7abdc3fc62ba6786c02590a1560e449cf55",
72
+ "shasum": ""
73
+ },
74
+ "require": {
75
+ "php": ">=5.3.2",
76
+ "twig/twig": "^1.0|^2.0"
77
+ },
78
+ "require-dev": {
79
+ "doctrine/cache": "~1.0"
80
+ },
81
+ "suggest": {
82
+ "psr/cache-implementation": "To make use of PSR-6 cache implementation via PsrCacheAdapter."
83
+ },
84
+ "time": "2017-01-10T22:04:15+00:00",
85
+ "type": "library",
86
+ "extra": {
87
+ "branch-alias": {
88
+ "dev-master": "1.3-dev"
89
+ }
90
+ },
91
+ "installation-source": "dist",
92
+ "autoload": {
93
+ "psr-4": {
94
+ "": "lib/"
95
+ }
96
+ },
97
+ "notification-url": "https://packagist.org/downloads/",
98
+ "license": [
99
+ "MIT"
100
+ ],
101
+ "authors": [
102
+ {
103
+ "name": "Alexander",
104
+ "email": "iam.asm89@gmail.com"
105
+ }
106
+ ],
107
+ "description": "Cache fragments of templates directly within Twig.",
108
+ "homepage": "https://github.com/asm89/twig-cache-extension",
109
+ "keywords": [
110
+ "cache",
111
+ "extension",
112
+ "twig"
113
+ ]
114
+ },
115
  {
116
  "name": "composer/installers",
117
+ "version": "v1.7.0",
118
+ "version_normalized": "1.7.0.0",
119
  "source": {
120
  "type": "git",
121
  "url": "https://github.com/composer/installers.git",
122
+ "reference": "141b272484481432cda342727a427dc1e206bfa0"
123
  },
124
  "dist": {
125
  "type": "zip",
126
+ "url": "https://api.github.com/repos/composer/installers/zipball/141b272484481432cda342727a427dc1e206bfa0",
127
+ "reference": "141b272484481432cda342727a427dc1e206bfa0",
128
  "shasum": ""
129
  },
130
  "require": {
138
  "composer/composer": "1.0.*@dev",
139
  "phpunit/phpunit": "^4.8.36"
140
  },
141
+ "time": "2019-08-12T15:00:31+00:00",
142
  "type": "composer-plugin",
143
  "extra": {
144
  "class": "Composer\\Installers\\Plugin",
182
  "RadPHP",
183
  "SMF",
184
  "Thelia",
185
+ "Whmcs",
186
  "WolfCMS",
187
  "agl",
188
  "aimeos",
205
  "installer",
206
  "itop",
207
  "joomla",
208
+ "known",
209
  "kohana",
210
  "laravel",
211
  "lavalite",
236
  "zikula"
237
  ]
238
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  {
240
  "name": "symfony/polyfill-ctype",
241
+ "version": "v1.12.0",
242
+ "version_normalized": "1.12.0.0",
243
  "source": {
244
  "type": "git",
245
  "url": "https://github.com/symfony/polyfill-ctype.git",
246
+ "reference": "550ebaac289296ce228a706d0867afc34687e3f4"
247
  },
248
  "dist": {
249
  "type": "zip",
250
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4",
251
+ "reference": "550ebaac289296ce228a706d0867afc34687e3f4",
252
  "shasum": ""
253
  },
254
  "require": {
257
  "suggest": {
258
  "ext-ctype": "For best performance"
259
  },
260
+ "time": "2019-08-06T08:03:45+00:00",
261
  "type": "library",
262
  "extra": {
263
  "branch-alias": {
264
+ "dev-master": "1.12-dev"
265
  }
266
  },
267
  "installation-source": "dist",
278
  "MIT"
279
  ],
280
  "authors": [
 
 
 
 
281
  {
282
  "name": "Gert de Pagter",
283
  "email": "BackEndTea@gmail.com"
284
+ },
285
+ {
286
+ "name": "Symfony Community",
287
+ "homepage": "https://symfony.com/contributors"
288
  }
289
  ],
290
  "description": "Symfony polyfill for ctype functions",
298
  },
299
  {
300
  "name": "twig/twig",
301
+ "version": "v1.42.3",
302
+ "version_normalized": "1.42.3.0",
303
  "source": {
304
  "type": "git",
305
  "url": "https://github.com/twigphp/Twig.git",
306
+ "reference": "201baee843e0ffe8b0b956f336dd42b2a92fae4e"
307
  },
308
  "dist": {
309
  "type": "zip",
310
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/201baee843e0ffe8b0b956f336dd42b2a92fae4e",
311
+ "reference": "201baee843e0ffe8b0b956f336dd42b2a92fae4e",
312
  "shasum": ""
313
  },
314
  "require": {
315
+ "php": ">=5.5.0",
316
  "symfony/polyfill-ctype": "^1.8"
317
  },
318
  "require-dev": {
319
  "psr/container": "^1.0",
320
+ "symfony/debug": "^3.4|^4.2",
321
+ "symfony/phpunit-bridge": "^4.4@dev|^5.0"
322
  },
323
+ "time": "2019-08-24T12:51:03+00:00",
324
  "type": "library",
325
  "extra": {
326
  "branch-alias": {
347
  "homepage": "http://fabien.potencier.org",
348
  "role": "Lead Developer"
349
  },
 
 
 
 
 
350
  {
351
  "name": "Twig Team",
352
  "homepage": "https://twig.symfony.com/contributors",
353
  "role": "Contributors"
354
+ },
355
+ {
356
+ "name": "Armin Ronacher",
357
+ "email": "armin.ronacher@active-4.com",
358
+ "role": "Project Founder"
359
  }
360
  ],
361
  "description": "Twig, the flexible, fast, and secure template language for PHP",
365
  ]
366
  },
367
  {
368
+ "name": "upstatement/routes",
369
+ "version": "0.5",
370
+ "version_normalized": "0.5.0.0",
371
  "source": {
372
  "type": "git",
373
+ "url": "https://github.com/Upstatement/routes.git",
374
+ "reference": "3267d28be0a73f197087d58384e1a358d85671b6"
375
  },
376
  "dist": {
377
  "type": "zip",
378
+ "url": "https://api.github.com/repos/Upstatement/routes/zipball/3267d28be0a73f197087d58384e1a358d85671b6",
379
+ "reference": "3267d28be0a73f197087d58384e1a358d85671b6",
380
  "shasum": ""
381
  },
382
  "require": {
383
+ "altorouter/altorouter": "^1.1.0",
384
+ "composer/installers": "~1.0",
385
+ "php": ">=5.3.0"
386
  },
387
  "require-dev": {
388
+ "phpunit/phpunit": "3.7.*",
389
+ "satooshi/php-coveralls": "dev-master",
390
+ "wp-cli/wp-cli": "*"
 
391
  },
392
+ "time": "2018-12-04T01:13:41+00:00",
393
  "type": "library",
 
 
 
 
 
394
  "installation-source": "dist",
395
  "autoload": {
396
+ "psr-0": {
397
+ "Routes": ""
398
  }
399
  },
400
  "notification-url": "https://packagist.org/downloads/",
403
  ],
404
  "authors": [
405
  {
406
+ "name": "Jared Novack",
407
+ "email": "jared@upstatement.com",
408
+ "homepage": "http://upstatement.com"
409
  }
410
  ],
411
+ "description": "Manage rewrites and routes in WordPress with this dead-simple plugin",
412
+ "homepage": "http://routes.upstatement.com",
413
  "keywords": [
414
+ "redirects",
415
+ "rewrite",
416
+ "routes",
417
+ "routing"
418
  ]
419
  }
420
  ]
vendor/composer/installers/composer.json CHANGED
@@ -31,6 +31,7 @@
31
  "iTop",
32
  "Joomla",
33
  "Kanboard",
 
34
  "Kohana",
35
  "Lan Management System",
36
  "Laravel",
@@ -65,6 +66,7 @@
65
  "symfony",
66
  "Thelia",
67
  "TYPO3",
 
68
  "WolfCMS",
69
  "WordPress",
70
  "YAWIK",
31
  "iTop",
32
  "Joomla",
33
  "Kanboard",
34
+ "Known",
35
  "Kohana",
36
  "Lan Management System",
37
  "Laravel",
66
  "symfony",
67
  "Thelia",
68
  "TYPO3",
69
+ "WHMCS",
70
  "WolfCMS",
71
  "WordPress",
72
  "YAWIK",
vendor/composer/installers/src/Composer/Installers/DframeInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ class DframeInstaller extends BaseInstaller
6
+ {
7
+ protected $locations = array(
8
+ 'module' => 'modules/{$vendor}/{$name}/',
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php CHANGED
@@ -4,13 +4,17 @@ namespace Composer\Installers;
4
  class DrupalInstaller extends BaseInstaller
5
  {
6
  protected $locations = array(
7
- 'core' => 'core/',
8
- 'module' => 'modules/{$name}/',
9
- 'theme' => 'themes/{$name}/',
10
- 'library' => 'libraries/{$name}/',
11
- 'profile' => 'profiles/{$name}/',
12
- 'drush' => 'drush/{$name}/',
13
- 'custom-theme' => 'themes/custom/{$name}/',
14
- 'custom-module' => 'modules/custom/{$name}/',
 
 
 
 
15
  );
16
  }
4
  class DrupalInstaller extends BaseInstaller
5
  {
6
  protected $locations = array(
7
+ 'core' => 'core/',
8
+ 'module' => 'modules/{$name}/',
9
+ 'theme' => 'themes/{$name}/',
10
+ 'library' => 'libraries/{$name}/',
11
+ 'profile' => 'profiles/{$name}/',
12
+ 'drush' => 'drush/{$name}/',
13
+ 'custom-theme' => 'themes/custom/{$name}/',
14
+ 'custom-module' => 'modules/custom/{$name}/',
15
+ 'custom-profile' => 'profiles/custom/{$name}/',
16
+ 'drupal-multisite' => 'sites/{$name}/',
17
+ 'console' => 'console/{$name}/',
18
+ 'console-language' => 'console/language/{$name}/',
19
  );
20
  }
vendor/composer/installers/src/Composer/Installers/Installer.php CHANGED
@@ -35,6 +35,7 @@ class Installer extends LibraryInstaller
35
  'concrete5' => 'Concrete5Installer',
36
  'craft' => 'CraftInstaller',
37
  'croogo' => 'CroogoInstaller',
 
38
  'dokuwiki' => 'DokuWikiInstaller',
39
  'dolibarr' => 'DolibarrInstaller',
40
  'decibel' => 'DecibelInstaller',
@@ -53,6 +54,7 @@ class Installer extends LibraryInstaller
53
  'joomla' => 'JoomlaInstaller',
54
  'kanboard' => 'KanboardInstaller',
55
  'kirby' => 'KirbyInstaller',
 
56
  'kodicms' => 'KodiCMSInstaller',
57
  'kohana' => 'KohanaInstaller',
58
  'lms' => 'LanManagementSystemInstaller',
@@ -85,6 +87,7 @@ class Installer extends LibraryInstaller
85
  'phifty' => 'PhiftyInstaller',
86
  'porto' => 'PortoInstaller',
87
  'redaxo' => 'RedaxoInstaller',
 
88
  'reindex' => 'ReIndexInstaller',
89
  'roundcube' => 'RoundcubeInstaller',
90
  'shopware' => 'ShopwareInstaller',
@@ -93,6 +96,7 @@ class Installer extends LibraryInstaller
93
  'smf' => 'SMFInstaller',
94
  'sydes' => 'SyDESInstaller',
95
  'symfony1' => 'Symfony1Installer',
 
96
  'thelia' => 'TheliaInstaller',
97
  'tusk' => 'TuskInstaller',
98
  'typo3-cms' => 'TYPO3CmsInstaller',
35
  'concrete5' => 'Concrete5Installer',
36
  'craft' => 'CraftInstaller',
37
  'croogo' => 'CroogoInstaller',
38
+ 'dframe' => 'DframeInstaller',
39
  'dokuwiki' => 'DokuWikiInstaller',
40
  'dolibarr' => 'DolibarrInstaller',
41
  'decibel' => 'DecibelInstaller',
54
  'joomla' => 'JoomlaInstaller',
55
  'kanboard' => 'KanboardInstaller',
56
  'kirby' => 'KirbyInstaller',
57
+ 'known' => 'KnownInstaller',
58
  'kodicms' => 'KodiCMSInstaller',
59
  'kohana' => 'KohanaInstaller',
60
  'lms' => 'LanManagementSystemInstaller',
87
  'phifty' => 'PhiftyInstaller',
88
  'porto' => 'PortoInstaller',
89
  'redaxo' => 'RedaxoInstaller',
90
+ 'redaxo5' => 'Redaxo5Installer',
91
  'reindex' => 'ReIndexInstaller',
92
  'roundcube' => 'RoundcubeInstaller',
93
  'shopware' => 'ShopwareInstaller',
96
  'smf' => 'SMFInstaller',
97
  'sydes' => 'SyDESInstaller',
98
  'symfony1' => 'Symfony1Installer',
99
+ 'tao' => 'TaoInstaller',
100
  'thelia' => 'TheliaInstaller',
101
  'tusk' => 'TuskInstaller',
102
  'typo3-cms' => 'TYPO3CmsInstaller',
vendor/composer/installers/src/Composer/Installers/KnownInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class KnownInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'IdnoPlugins/{$name}/',
8
+ 'theme' => 'Themes/{$name}/',
9
+ 'console' => 'ConsolePlugins/{$name}/',
10
+ );
11
+ }
vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php CHANGED
@@ -4,12 +4,12 @@ namespace Composer\Installers;
4
  class MicroweberInstaller extends BaseInstaller
5
  {
6
  protected $locations = array(
7
- 'module' => 'userfiles/modules/{$name}/',
8
- 'module-skin' => 'userfiles/modules/{$name}/templates/',
9
- 'template' => 'userfiles/templates/{$name}/',
10
- 'element' => 'userfiles/elements/{$name}/',
11
- 'vendor' => 'vendor/{$name}/',
12
- 'components' => 'components/{$name}/'
13
  );
14
 
15
  /**
@@ -22,89 +22,97 @@ class MicroweberInstaller extends BaseInstaller
22
  */
23
  public function inflectPackageVars($vars)
24
  {
25
- if ($vars['type'] === 'microweber-template') {
26
- return $this->inflectTemplateVars($vars);
27
- }
28
- if ($vars['type'] === 'microweber-templates') {
29
- return $this->inflectTemplatesVars($vars);
30
- }
31
- if ($vars['type'] === 'microweber-core') {
32
- return $this->inflectCoreVars($vars);
33
- }
34
- if ($vars['type'] === 'microweber-adapter') {
35
- return $this->inflectCoreVars($vars);
36
- }
37
- if ($vars['type'] === 'microweber-module') {
38
- return $this->inflectModuleVars($vars);
39
- }
40
- if ($vars['type'] === 'microweber-modules') {
41
- return $this->inflectModulesVars($vars);
42
- }
43
- if ($vars['type'] === 'microweber-skin') {
44
- return $this->inflectSkinVars($vars);
45
- }
46
- if ($vars['type'] === 'microweber-element' or $vars['type'] === 'microweber-elements') {
47
- return $this->inflectElementVars($vars);
 
 
 
 
 
 
 
48
  }
49
 
 
50
  return $vars;
51
  }
52
 
53
  protected function inflectTemplateVars($vars)
54
  {
55
- $vars['name'] = preg_replace('/-template$/', '', $vars['name']);
56
- $vars['name'] = preg_replace('/template-$/', '', $vars['name']);
57
 
58
  return $vars;
59
  }
60
 
61
  protected function inflectTemplatesVars($vars)
62
  {
63
- $vars['name'] = preg_replace('/-templates$/', '', $vars['name']);
64
- $vars['name'] = preg_replace('/templates-$/', '', $vars['name']);
65
 
66
  return $vars;
67
  }
68
 
69
  protected function inflectCoreVars($vars)
70
  {
71
- $vars['name'] = preg_replace('/-providers$/', '', $vars['name']);
72
- $vars['name'] = preg_replace('/-provider$/', '', $vars['name']);
73
- $vars['name'] = preg_replace('/-adapter$/', '', $vars['name']);
74
 
75
  return $vars;
76
  }
77
 
78
  protected function inflectModuleVars($vars)
79
  {
80
- $vars['name'] = preg_replace('/-module$/', '', $vars['name']);
81
- $vars['name'] = preg_replace('/module-$/', '', $vars['name']);
82
 
83
  return $vars;
84
  }
85
 
86
  protected function inflectModulesVars($vars)
87
  {
88
- $vars['name'] = preg_replace('/-modules$/', '', $vars['name']);
89
- $vars['name'] = preg_replace('/modules-$/', '', $vars['name']);
90
 
91
  return $vars;
92
  }
93
 
94
  protected function inflectSkinVars($vars)
95
  {
96
- $vars['name'] = preg_replace('/-skin$/', '', $vars['name']);
97
- $vars['name'] = preg_replace('/skin-$/', '', $vars['name']);
98
 
99
  return $vars;
100
  }
101
 
102
  protected function inflectElementVars($vars)
103
  {
104
- $vars['name'] = preg_replace('/-elements$/', '', $vars['name']);
105
- $vars['name'] = preg_replace('/elements-$/', '', $vars['name']);
106
- $vars['name'] = preg_replace('/-element$/', '', $vars['name']);
107
- $vars['name'] = preg_replace('/element-$/', '', $vars['name']);
108
 
109
  return $vars;
110
  }
4
  class MicroweberInstaller extends BaseInstaller
5
  {
6
  protected $locations = array(
7
+ 'module' => 'userfiles/modules/{$install_item_dir}/',
8
+ 'module-skin' => 'userfiles/modules/{$install_item_dir}/templates/',
9
+ 'template' => 'userfiles/templates/{$install_item_dir}/',
10
+ 'element' => 'userfiles/elements/{$install_item_dir}/',
11
+ 'vendor' => 'vendor/{$install_item_dir}/',
12
+ 'components' => 'components/{$install_item_dir}/'
13
  );
14
 
15
  /**
22
  */
23
  public function inflectPackageVars($vars)
24
  {
25
+
26
+
27
+ if ($this->package->getTargetDir()) {
28
+ $vars['install_item_dir'] = $this->package->getTargetDir();
29
+ } else {
30
+ $vars['install_item_dir'] = $vars['name'];
31
+ if ($vars['type'] === 'microweber-template') {
32
+ return $this->inflectTemplateVars($vars);
33
+ }
34
+ if ($vars['type'] === 'microweber-templates') {
35
+ return $this->inflectTemplatesVars($vars);
36
+ }
37
+ if ($vars['type'] === 'microweber-core') {
38
+ return $this->inflectCoreVars($vars);
39
+ }
40
+ if ($vars['type'] === 'microweber-adapter') {
41
+ return $this->inflectCoreVars($vars);
42
+ }
43
+ if ($vars['type'] === 'microweber-module') {
44
+ return $this->inflectModuleVars($vars);
45
+ }
46
+ if ($vars['type'] === 'microweber-modules') {
47
+ return $this->inflectModulesVars($vars);
48
+ }
49
+ if ($vars['type'] === 'microweber-skin') {
50
+ return $this->inflectSkinVars($vars);
51
+ }
52
+ if ($vars['type'] === 'microweber-element' or $vars['type'] === 'microweber-elements') {
53
+ return $this->inflectElementVars($vars);
54
+ }
55
  }
56
 
57
+
58
  return $vars;
59
  }
60
 
61
  protected function inflectTemplateVars($vars)
62
  {
63
+ $vars['install_item_dir'] = preg_replace('/-template$/', '', $vars['install_item_dir']);
64
+ $vars['install_item_dir'] = preg_replace('/template-$/', '', $vars['install_item_dir']);
65
 
66
  return $vars;
67
  }
68
 
69
  protected function inflectTemplatesVars($vars)
70
  {
71
+ $vars['install_item_dir'] = preg_replace('/-templates$/', '', $vars['install_item_dir']);
72
+ $vars['install_item_dir'] = preg_replace('/templates-$/', '', $vars['install_item_dir']);
73
 
74
  return $vars;
75
  }
76
 
77
  protected function inflectCoreVars($vars)
78
  {
79
+ $vars['install_item_dir'] = preg_replace('/-providers$/', '', $vars['install_item_dir']);
80
+ $vars['install_item_dir'] = preg_replace('/-provider$/', '', $vars['install_item_dir']);
81
+ $vars['install_item_dir'] = preg_replace('/-adapter$/', '', $vars['install_item_dir']);
82
 
83
  return $vars;
84
  }
85
 
86
  protected function inflectModuleVars($vars)
87
  {
88
+ $vars['install_item_dir'] = preg_replace('/-module$/', '', $vars['install_item_dir']);
89
+ $vars['install_item_dir'] = preg_replace('/module-$/', '', $vars['install_item_dir']);
90
 
91
  return $vars;
92
  }
93
 
94
  protected function inflectModulesVars($vars)
95
  {
96
+ $vars['install_item_dir'] = preg_replace('/-modules$/', '', $vars['install_item_dir']);
97
+ $vars['install_item_dir'] = preg_replace('/modules-$/', '', $vars['install_item_dir']);
98
 
99
  return $vars;
100
  }
101
 
102
  protected function inflectSkinVars($vars)
103
  {
104
+ $vars['install_item_dir'] = preg_replace('/-skin$/', '', $vars['install_item_dir']);
105
+ $vars['install_item_dir'] = preg_replace('/skin-$/', '', $vars['install_item_dir']);
106
 
107
  return $vars;
108
  }
109
 
110
  protected function inflectElementVars($vars)
111
  {
112
+ $vars['install_item_dir'] = preg_replace('/-elements$/', '', $vars['install_item_dir']);
113
+ $vars['install_item_dir'] = preg_replace('/elements-$/', '', $vars['install_item_dir']);
114
+ $vars['install_item_dir'] = preg_replace('/-element$/', '', $vars['install_item_dir']);
115
+ $vars['install_item_dir'] = preg_replace('/element-$/', '', $vars['install_item_dir']);
116
 
117
  return $vars;
118
  }
vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php CHANGED
@@ -20,6 +20,7 @@ class MoodleInstaller extends BaseInstaller
20
  'calendartype' => 'calendar/type/{$name}/',
21
  'format' => 'course/format/{$name}/',
22
  'coursereport' => 'course/report/{$name}/',
 
23
  'datafield' => 'mod/data/field/{$name}/',
24
  'datapreset' => 'mod/data/preset/{$name}/',
25
  'editor' => 'lib/editor/{$name}/',
20
  'calendartype' => 'calendar/type/{$name}/',
21
  'format' => 'course/format/{$name}/',
22
  'coursereport' => 'course/report/{$name}/',
23
+ 'customcertelement' => 'mod/customcert/element/{$name}/',
24
  'datafield' => 'mod/data/field/{$name}/',
25
  'datapreset' => 'mod/data/preset/{$name}/',
26
  'editor' => 'lib/editor/{$name}/',
vendor/composer/installers/src/Composer/Installers/Redaxo5Installer.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class Redaxo5Installer extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'addon' => 'redaxo/src/addons/{$name}/',
8
+ 'bestyle-plugin' => 'redaxo/src/addons/be_style/plugins/{$name}/'
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/TaoInstaller.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * An installer to handle TAO extensions.
6
+ */
7
+ class TaoInstaller extends BaseInstaller
8
+ {
9
+ protected $locations = array(
10
+ 'extension' => '{$name}'
11
+ );
12
+ }
vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php CHANGED
@@ -5,6 +5,17 @@ namespace Composer\Installers;
5
  class WHMCSInstaller extends BaseInstaller
6
  {
7
  protected $locations = array(
8
- 'gateway' => 'modules/gateways/{$name}/',
 
 
 
 
 
 
 
 
 
 
 
9
  );
10
  }
5
  class WHMCSInstaller extends BaseInstaller
6
  {
7
  protected $locations = array(
8
+ 'addons' => 'modules/addons/{$vendor}_{$name}/',
9
+ 'fraud' => 'modules/fraud/{$vendor}_{$name}/',
10
+ 'gateways' => 'modules/gateways/{$vendor}_{$name}/',
11
+ 'notifications' => 'modules/notifications/{$vendor}_{$name}/',
12
+ 'registrars' => 'modules/registrars/{$vendor}_{$name}/',
13
+ 'reports' => 'modules/reports/{$vendor}_{$name}/',
14
+ 'security' => 'modules/security/{$vendor}_{$name}/',
15
+ 'servers' => 'modules/servers/{$vendor}_{$name}/',
16
+ 'social' => 'modules/social/{$vendor}_{$name}/',
17
+ 'support' => 'modules/support/{$vendor}_{$name}/',
18
+ 'templates' => 'templates/{$vendor}_{$name}/',
19
+ 'includes' => 'includes/{$vendor}_{$name}/'
20
  );
21
  }
vendor/symfony/polyfill-ctype/composer.json CHANGED
@@ -28,7 +28,7 @@
28
  "minimum-stability": "dev",
29
  "extra": {
30
  "branch-alias": {
31
- "dev-master": "1.11-dev"
32
  }
33
  }
34
  }
28
  "minimum-stability": "dev",
29
  "extra": {
30
  "branch-alias": {
31
+ "dev-master": "1.12-dev"
32
  }
33
  }
34
  }
vendor/twig/twig/.gitignore CHANGED
@@ -3,3 +3,4 @@
3
  /ext/twig/autom4te.cache/
4
  /phpunit.xml
5
  /vendor
 
3
  /ext/twig/autom4te.cache/
4
  /phpunit.xml
5
  /vendor
6
+ .phpunit.result.cache
vendor/twig/twig/.php_cs.dist CHANGED
@@ -4,6 +4,8 @@ return PhpCsFixer\Config::create()
4
  ->setRules([
5
  '@Symfony' => true,
6
  '@Symfony:risky' => true,
 
 
7
  'array_syntax' => ['syntax' => 'short'],
8
  'php_unit_fqcn_annotation' => true,
9
  'no_unreachable_default_argument_value' => false,
4
  ->setRules([
5
  '@Symfony' => true,
6
  '@Symfony:risky' => true,
7
+ '@PHPUnit75Migration:risky' => true,
8
+ 'php_unit_dedicate_assert' => ['target' => '5.6'],
9
  'array_syntax' => ['syntax' => 'short'],
10
  'php_unit_fqcn_annotation' => true,
11
  'no_unreachable_default_argument_value' => false,
vendor/twig/twig/.travis.yml CHANGED
@@ -1,5 +1,7 @@
1
  language: php
2
 
 
 
3
  sudo: false
4
 
5
  cache:
@@ -7,8 +9,11 @@ cache:
7
  - vendor
8
  - $HOME/.composer/cache/files
9
 
 
10
  env:
11
- - TWIG_EXT=no
 
 
12
 
13
  before_install:
14
  - phpenv config-rm xdebug.ini || return 0
@@ -25,9 +30,6 @@ script: ./vendor/bin/simple-phpunit
25
  jobs:
26
  fast_finish: true
27
  include:
28
- - php: 5.4
29
- - php: 5.4
30
- env: TWIG_EXT=yes
31
  - php: 5.5
32
  - php: 5.5
33
  env: TWIG_EXT=yes
1
  language: php
2
 
3
+ dist: trusty
4
+
5
  sudo: false
6
 
7
  cache:
9
  - vendor
10
  - $HOME/.composer/cache/files
11
 
12
+
13
  env:
14
+ global:
15
+ - TWIG_EXT=no
16
+ - SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1
17
 
18
  before_install:
19
  - phpenv config-rm xdebug.ini || return 0
30
  jobs:
31
  fast_finish: true
32
  include:
 
 
 
33
  - php: 5.5
34
  - php: 5.5
35
  env: TWIG_EXT=yes
vendor/twig/twig/CHANGELOG CHANGED
@@ -1,3 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
  * 1.42.1 (2019-06-04)
2
 
3
  * added support for "Twig\Markup" instances in the "in" test (again)
1
+ * 1.42.3 (2019-08-24)
2
+
3
+ * fixed the "split" filter when the delimiter is "0"
4
+ * fixed the "empty" test on Traversable instances
5
+ * fixed cache when opcache is installed but disabled
6
+ * fixed PHP 7.4 compatibility
7
+ * bumped the minimal PHP version to 5.5
8
+
9
+ * 1.42.2 (2019-06-18)
10
+
11
+ * Display partial output (PHP buffer) when an error occurs in debug mode
12
+
13
  * 1.42.1 (2019-06-04)
14
 
15
  * added support for "Twig\Markup" instances in the "in" test (again)
vendor/twig/twig/README.rst CHANGED
@@ -7,6 +7,15 @@ and documentation).
7
  Twig uses a syntax similar to the Django and Jinja template languages which
8
  inspired the Twig runtime environment.
9
 
 
 
 
 
 
 
 
 
 
10
  More Information
11
  ----------------
12
 
7
  Twig uses a syntax similar to the Django and Jinja template languages which
8
  inspired the Twig runtime environment.
9
 
10
+ Sponsors
11
+ --------
12
+
13
+ .. raw:: html
14
+
15
+ <a href="https://blackfire.io/docs/introduction?utm_source=twig&utm_medium=github_readme&utm_campaign=logo">
16
+ <img src="https://static.blackfire.io/assets/intemporals/logo/png/blackfire-io_secondary_horizontal_transparent.png?1" width="255px" alt="Blackfire.io">
17
+ </a>
18
+
19
  More Information
20
  ----------------
21
 
vendor/twig/twig/composer.json CHANGED
@@ -24,12 +24,12 @@
24
  }
25
  ],
26
  "require": {
27
- "php": ">=5.4.0",
28
  "symfony/polyfill-ctype": "^1.8"
29
  },
30
  "require-dev": {
31
- "symfony/phpunit-bridge": "^3.4.19|^4.1.8|^5.0",
32
- "symfony/debug": "^2.7",
33
  "psr/container": "^1.0"
34
  },
35
  "autoload": {
@@ -40,6 +40,11 @@
40
  "Twig\\" : "src/"
41
  }
42
  },
 
 
 
 
 
43
  "extra": {
44
  "branch-alias": {
45
  "dev-master": "1.42-dev"
24
  }
25
  ],
26
  "require": {
27
+ "php": ">=5.5.0",
28
  "symfony/polyfill-ctype": "^1.8"
29
  },
30
  "require-dev": {
31
+ "symfony/phpunit-bridge": "^4.4@dev|^5.0",
32
+ "symfony/debug": "^3.4|^4.2",
33
  "psr/container": "^1.0"
34
  },
35
  "autoload": {
40
  "Twig\\" : "src/"
41
  }
42
  },
43
+ "autoload-dev": {
44
+ "psr-4" : {
45
+ "Twig\\Tests\\" : "tests"
46
+ }
47
+ },
48
  "extra": {
49
  "branch-alias": {
50
  "dev-master": "1.42-dev"
vendor/twig/twig/doc/advanced.rst CHANGED
@@ -851,7 +851,7 @@ This is very convenient but not recommended as it makes template compilation
851
  depend on runtime dependencies even if they are not needed (think for instance
852
  as a dependency that connects to a database engine).
853
 
854
- As of Twig 1.26, you can easily decouple the extension definitions from their
855
  runtime implementations by registering a ``\Twig\RuntimeLoader\RuntimeLoaderInterface``
856
  instance on the environment that knows how to instantiate such runtime classes
857
  (runtime classes must be autoload-able)::
@@ -908,49 +908,6 @@ It is now possible to move the runtime logic to a new
908
  }
909
  }
910
 
911
- Overloading
912
- -----------
913
-
914
- To overload an already defined filter, test, operator, global variable, or
915
- function, re-define it in an extension and register it **as late as
916
- possible** (order matters)::
917
-
918
- class MyCoreExtension extends \Twig\Extension\AbstractExtension
919
- {
920
- public function getFilters()
921
- {
922
- return [
923
- new \Twig\TwigFilter('date', [$this, 'dateFilter']),
924
- ];
925
- }
926
-
927
- public function dateFilter($timestamp, $format = 'F j, Y H:i')
928
- {
929
- // do something different from the built-in date filter
930
- }
931
- }
932
-
933
- $twig = new \Twig\Environment($loader);
934
- $twig->addExtension(new MyCoreExtension());
935
-
936
- Here, we have overloaded the built-in ``date`` filter with a custom one.
937
-
938
- If you do the same on the ``\Twig\Environment`` itself, beware that it takes
939
- precedence over any other registered extensions::
940
-
941
- $twig = new \Twig\Environment($loader);
942
- $twig->addFilter(new \Twig\TwigFilter('date', function ($timestamp, $format = 'F j, Y H:i') {
943
- // do something different from the built-in date filter
944
- }));
945
- // the date filter will come from the above registration, not
946
- // from the registered extension below
947
- $twig->addExtension(new MyCoreExtension());
948
-
949
- .. caution::
950
-
951
- Note that overloading the built-in Twig elements is not recommended as it
952
- might be confusing.
953
-
954
  Testing an Extension
955
  --------------------
956
 
@@ -986,7 +943,7 @@ The ``IntegrationTest.php`` file should look like this::
986
 
987
  public function getFixturesDir()
988
  {
989
- return dirname(__FILE__).'/Fixtures/';
990
  }
991
  }
992
 
@@ -1001,5 +958,5 @@ Testing the node visitors can be complex, so extend your test cases from
1001
  `tests/Twig/Node`_ directory.
1002
 
1003
  .. _`rot13`: https://secure.php.net/manual/en/function.str-rot13.php
1004
- .. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Fixtures
1005
- .. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Node
851
  depend on runtime dependencies even if they are not needed (think for instance
852
  as a dependency that connects to a database engine).
853
 
854
+ As of Twig 1.26, you can decouple the extension definitions from their
855
  runtime implementations by registering a ``\Twig\RuntimeLoader\RuntimeLoaderInterface``
856
  instance on the environment that knows how to instantiate such runtime classes
857
  (runtime classes must be autoload-able)::
908
  }
909
  }
910
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
911
  Testing an Extension
912
  --------------------
913
 
943
 
944
  public function getFixturesDir()
945
  {
946
+ return __DIR__.'/Fixtures/';
947
  }
948
  }
949
 
958
  `tests/Twig/Node`_ directory.
959
 
960
  .. _`rot13`: https://secure.php.net/manual/en/function.str-rot13.php
961
+ .. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/1.x/tests/Fixtures
962
+ .. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/1.x/tests/Node
vendor/twig/twig/doc/advanced_legacy.rst CHANGED
@@ -13,7 +13,7 @@ itself with node visitors.
13
 
14
  .. note::
15
 
16
- The first section of this chapter describes how to extend Twig easily. If
17
  you want to reuse your changes in different projects or if you want to
18
  share them with others, you should then create an extension as described
19
  in the following section.
@@ -140,7 +140,7 @@ callable. For instance, let's say you have the following code in a template:
140
 
141
  When compiling this template to PHP, Twig looks for the PHP callable
142
  associated with the ``lower`` filter. The ``lower`` filter is a built-in Twig
143
- filter, and it is simply mapped to the PHP ``strtolower()`` function. After
144
  compilation, the generated PHP code is roughly equivalent to:
145
 
146
  .. code-block:: html+php
@@ -303,7 +303,7 @@ templates.
303
 
304
  When compiling this template to PHP, Twig looks for the PHP callable
305
  associated with the ``constant`` function. The ``constant`` function is a built-in Twig
306
- function, and it is simply mapped to the PHP ``constant()`` function. After
307
  compilation, the generated PHP code is roughly equivalent to:
308
 
309
  .. code-block:: html+php
@@ -617,8 +617,7 @@ possible::
617
 
618
  .. note::
619
 
620
- Of course, this extension does nothing for now. We will customize it in
621
- the next sections.
622
 
623
  Twig does not care where you save your extension on the filesystem, as all
624
  extensions must be registered explicitly to be available in your templates.
@@ -629,8 +628,8 @@ main ``Environment`` object::
629
  $twig = new \Twig\Environment($loader);
630
  $twig->addExtension(new Project_Twig_Extension());
631
 
632
- Of course, you need to first load the extension file by either using
633
- ``require_once()`` or by using an autoloader (see `spl_autoload_register()`_).
634
 
635
  .. tip::
636
 
@@ -731,7 +730,7 @@ at the cost of a small overhead.
731
  Overriding default Filters
732
  ..........................
733
 
734
- If some default core filters do not suit your needs, you can easily override
735
  them by creating your own extension. Just use the same names as the one you
736
  want to override::
737
 
@@ -834,7 +833,7 @@ Testing an Extension
834
  Functional Tests
835
  ~~~~~~~~~~~~~~~~
836
 
837
- You can create functional tests for extensions simply by creating the
838
  following file structure in your test directory::
839
 
840
  Fixtures/
@@ -863,7 +862,7 @@ The ``IntegrationTest.php`` file should look like this::
863
 
864
  public function getFixturesDir()
865
  {
866
- return dirname(__FILE__).'/Fixtures/';
867
  }
868
  }
869
 
@@ -879,5 +878,5 @@ Testing the node visitors can be complex, so extend your test cases from
879
 
880
  .. _`spl_autoload_register()`: https://secure.php.net/spl_autoload_register
881
  .. _`rot13`: https://secure.php.net/manual/en/function.str-rot13.php
882
- .. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Fixtures
883
- .. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Node
13
 
14
  .. note::
15
 
16
+ The first section of this chapter describes how to extend Twig. If
17
  you want to reuse your changes in different projects or if you want to
18
  share them with others, you should then create an extension as described
19
  in the following section.
140
 
141
  When compiling this template to PHP, Twig looks for the PHP callable
142
  associated with the ``lower`` filter. The ``lower`` filter is a built-in Twig
143
+ filter, and it is mapped directly to the PHP ``strtolower()`` function. After
144
  compilation, the generated PHP code is roughly equivalent to:
145
 
146
  .. code-block:: html+php
303
 
304
  When compiling this template to PHP, Twig looks for the PHP callable
305
  associated with the ``constant`` function. The ``constant`` function is a built-in Twig
306
+ function, and it is mapped directly to the PHP ``constant()`` function. After
307
  compilation, the generated PHP code is roughly equivalent to:
308
 
309
  .. code-block:: html+php
617
 
618
  .. note::
619
 
620
+ This extension does nothing for now. We will customize it in the next sections.
 
621
 
622
  Twig does not care where you save your extension on the filesystem, as all
623
  extensions must be registered explicitly to be available in your templates.
628
  $twig = new \Twig\Environment($loader);
629
  $twig->addExtension(new Project_Twig_Extension());
630
 
631
+ Don't forget to load first the extension file by either using ``require_once()``
632
+ or by using an autoloader (see `spl_autoload_register()`_).
633
 
634
  .. tip::
635
 
730
  Overriding default Filters
731
  ..........................
732
 
733
+ If some default core filters do not suit your needs, you can override
734
  them by creating your own extension. Just use the same names as the one you
735
  want to override::
736
 
833
  Functional Tests
834
  ~~~~~~~~~~~~~~~~
835
 
836
+ You can create functional tests for extensions by creating the
837
  following file structure in your test directory::
838
 
839
  Fixtures/
862
 
863
  public function getFixturesDir()
864
  {
865
+ return __DIR__.'/Fixtures/';
866
  }
867
  }
868
 
878
 
879
  .. _`spl_autoload_register()`: https://secure.php.net/spl_autoload_register
880
  .. _`rot13`: https://secure.php.net/manual/en/function.str-rot13.php
881
+ .. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/1.x/tests/Fixtures
882
+ .. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/1.x/tests/Node
vendor/twig/twig/doc/filters/date.rst CHANGED
@@ -47,7 +47,7 @@ date, use a ternary operator:
47
  {{ post.published_at is empty ? "" : post.published_at|date("m/d/Y") }}
48
 
49
  If no format is provided, Twig will use the default one: ``F j, Y H:i``. This
50
- default can be easily changed by calling the ``setDateFormat()`` method on the
51
  ``core`` extension instance. The first argument is the default format for
52
  dates and the second one is the default format for date intervals:
53
 
47
  {{ post.published_at is empty ? "" : post.published_at|date("m/d/Y") }}
48
 
49
  If no format is provided, Twig will use the default one: ``F j, Y H:i``. This
50
+ default can be changed by calling the ``setDateFormat()`` method on the
51
  ``core`` extension instance. The first argument is the default format for
52
  dates and the second one is the default format for date intervals:
53
 
vendor/twig/twig/doc/filters/date_modify.rst CHANGED
@@ -11,7 +11,7 @@ The ``date_modify`` filter modifies a date with a given modifier string:
11
  {{ post.published_at|date_modify("+1 day")|date("m/d/Y") }}
12
 
13
  The ``date_modify`` filter accepts strings (it must be in a format supported
14
- by the `strtotime`_ function) or `DateTime`_ instances. You can easily combine
15
  it with the :doc:`date<date>` filter for formatting.
16
 
17
  Arguments
11
  {{ post.published_at|date_modify("+1 day")|date("m/d/Y") }}
12
 
13
  The ``date_modify`` filter accepts strings (it must be in a format supported
14
+ by the `strtotime`_ function) or `DateTime`_ instances. You can combine
15
  it with the :doc:`date<date>` filter for formatting.
16
 
17
  Arguments
vendor/twig/twig/doc/filters/map.rst CHANGED
@@ -26,7 +26,7 @@ The arrow function also receives the key as a second argument:
26
  "Alice": "Dupond",
27
  } %}
28
 
29
- {{ people|map((first, last) => "#{first} #{last}")|join(', ') }}
30
  {# outputs Bob Smith, Alice Dupond #}
31
 
32
  Note that the arrow function has access to the current context.
26
  "Alice": "Dupond",
27
  } %}
28
 
29
+ {{ people|map((last, first) => "#{first} #{last}")|join(', ') }}
30
  {# outputs Bob Smith, Alice Dupond #}
31
 
32
  Note that the arrow function has access to the current context.
vendor/twig/twig/doc/filters/number_format.rst CHANGED
@@ -33,7 +33,7 @@ options of:
33
  * ``.`` as the decimal point.
34
  * ``,`` as the thousands separator.
35
 
36
- These defaults can be easily changed through the core extension:
37
 
38
  .. code-block:: php
39
 
33
  * ``.`` as the decimal point.
34
  * ``,`` as the thousands separator.
35
 
36
+ These defaults can be changed through the core extension:
37
 
38
  .. code-block:: php
39
 
vendor/twig/twig/doc/internals.rst CHANGED
@@ -1,7 +1,7 @@
1
  Twig Internals
2
  ==============
3
 
4
- Twig is very extensible and you can easily hack it. Keep in mind that you
5
  should probably try to create an extension before hacking the core, as most
6
  features and enhancements can be handled with extensions. This chapter is also
7
  useful for people who want to understand how Twig works under the hood.
1
  Twig Internals
2
  ==============
3
 
4
+ Twig is very extensible and you can hack it. Keep in mind that you
5
  should probably try to create an extension before hacking the core, as most
6
  features and enhancements can be handled with extensions. This chapter is also
7
  useful for people who want to understand how Twig works under the hood.
vendor/twig/twig/doc/intro.rst CHANGED
@@ -26,7 +26,7 @@ Slim, Yii, Laravel, and Codeigniter — just to name a few.
26
  Prerequisites
27
  -------------
28
 
29
- Twig needs at least **PHP 5.4.0** to run.
30
 
31
  Installation
32
  ------------
26
  Prerequisites
27
  -------------
28
 
29
+ Twig needs at least **PHP 5.5.0** to run.
30
 
31
  Installation
32
  ------------
vendor/twig/twig/doc/recipes.rst CHANGED
@@ -131,7 +131,7 @@ might be tempted to write the following:
131
  {# page.twig in .../templates/mysite #}
132
  {% extends "page.twig" %} {# from .../templates/default #}
133
 
134
- Of course, this will not work as Twig will always load the template from
135
  ``.../templates/mysite``.
136
 
137
  It turns out it is possible to get this to work, by adding a directory right
@@ -361,7 +361,7 @@ To get around this, force Twig to invalidate the bytecode cache::
361
  parent::writeCacheFile($file, $content);
362
 
363
  // Compile cached file into bytecode cache
364
- if (function_exists('opcache_invalidate')) {
365
  opcache_invalidate($file, true);
366
  } elseif (function_exists('apc_compile_file')) {
367
  apc_compile_file($file);
@@ -376,7 +376,7 @@ When attaching a visitor to a ``\Twig\Environment`` instance, Twig uses it to
376
  visit *all* templates it compiles. If you need to keep some state information
377
  around, you probably want to reset it when visiting a new template.
378
 
379
- This can be easily achieved with the following code::
380
 
381
  protected $someTemplateState = [];
382
 
@@ -511,7 +511,7 @@ remove it from the database, and everything else will still work as before.
511
  Loading a Template from a String
512
  --------------------------------
513
 
514
- From a template, you can easily load a template stored in a string via the
515
  ``template_from_string`` function (available as of Twig 1.11 via the
516
  ``\Twig\Extension\StringLoaderExtension`` extension):
517
 
131
  {# page.twig in .../templates/mysite #}
132
  {% extends "page.twig" %} {# from .../templates/default #}
133
 
134
+ However, this will not work as Twig will always load the template from
135
  ``.../templates/mysite``.
136
 
137
  It turns out it is possible to get this to work, by adding a directory right
361
  parent::writeCacheFile($file, $content);
362
 
363
  // Compile cached file into bytecode cache
364
+ if (function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {
365
  opcache_invalidate($file, true);
366
  } elseif (function_exists('apc_compile_file')) {
367
  apc_compile_file($file);
376
  visit *all* templates it compiles. If you need to keep some state information
377
  around, you probably want to reset it when visiting a new template.
378
 
379
+ This can be achieved with the following code::
380
 
381
  protected $someTemplateState = [];
382
 
511
  Loading a Template from a String
512
  --------------------------------
513
 
514
+ From a template, you can load a template stored in a string via the
515
  ``template_from_string`` function (available as of Twig 1.11 via the
516
  ``\Twig\Extension\StringLoaderExtension`` extension):
517
 
vendor/twig/twig/doc/tags/extends.rst CHANGED
@@ -104,7 +104,7 @@ Named Block End-Tags
104
  --------------------
105
 
106
  Twig allows you to put the name of the block after the end tag for better
107
- readability:
108
 
109
  .. code-block:: twig
110
 
@@ -114,8 +114,6 @@ readability:
114
  {% endblock inner_sidebar %}
115
  {% endblock sidebar %}
116
 
117
- Of course, the name after the ``endblock`` word must match the block name.
118
-
119
  Block Nesting and Scope
120
  -----------------------
121
 
104
  --------------------
105
 
106
  Twig allows you to put the name of the block after the end tag for better
107
+ readability (the name after the ``endblock`` word must match the block name):
108
 
109
  .. code-block:: twig
110
 
114
  {% endblock inner_sidebar %}
115
  {% endblock sidebar %}
116
 
 
 
117
  Block Nesting and Scope
118
  -----------------------
119
 
vendor/twig/twig/doc/tags/include.rst CHANGED
@@ -20,7 +20,7 @@ of that file:
20
  template outputs its rendered contents in the current scope; a tag should
21
  not display anything);
22
 
23
- * The rendered template can be more easily stored in a variable when using
24
  the ``include`` function:
25
 
26
  .. code-block:: twig
20
  template outputs its rendered contents in the current scope; a tag should
21
  not display anything);
22
 
23
+ * It's easier to store the rendered template in a variable when using
24
  the ``include`` function:
25
 
26
  .. code-block:: twig
vendor/twig/twig/doc/tags/macro.rst CHANGED
@@ -109,7 +109,7 @@ via the ``from`` tag:
109
 
110
  Importing macros using ``import`` or ``from`` is **local** to the current
111
  file. The imported macros are not available in included templates or child
112
- templates; you need to explicitely re-import macros in each file.
113
 
114
  .. tip::
115
 
@@ -130,12 +130,10 @@ Named Macro End-Tags
130
  --------------------
131
 
132
  Twig allows you to put the name of the macro after the end tag for better
133
- readability:
134
 
135
  .. code-block:: twig
136
 
137
  {% macro input() %}
138
  ...
139
  {% endmacro input %}
140
-
141
- Of course, the name after the ``endmacro`` word must match the macro name.
109
 
110
  Importing macros using ``import`` or ``from`` is **local** to the current
111
  file. The imported macros are not available in included templates or child
112
+ templates; you need to explicitly re-import macros in each file.
113
 
114
  .. tip::
115
 
130
  --------------------
131
 
132
  Twig allows you to put the name of the macro after the end tag for better
133
+ readability (the name after the ``endmacro`` word must match the macro name):
134
 
135
  .. code-block:: twig
136
 
137
  {% macro input() %}
138
  ...
139
  {% endmacro input %}
 
 
vendor/twig/twig/doc/templates.rst CHANGED
@@ -517,7 +517,7 @@ Twig allows expressions everywhere.
517
  ``or``, ``and``, ``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``, ``in``,
518
  ``matches``, ``starts with``, ``ends with``, ``..``, ``+``, ``-``, ``~``,
519
  ``*``, ``/``, ``//``, ``%``, ``is`` (tests), ``**``, ``??``, ``|``
520
- (filters), ``[]``, and ``.``.
521
 
522
  .. code-block:: twig
523
 
517
  ``or``, ``and``, ``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``, ``in``,
518
  ``matches``, ``starts with``, ``ends with``, ``..``, ``+``, ``-``, ``~``,
519
  ``*``, ``/``, ``//``, ``%``, ``is`` (tests), ``**``, ``??``, ``|``
520
+ (filters), ``[]``, and ``.``:
521
 
522
  .. code-block:: twig
523
 
vendor/twig/twig/ext/twig/php_twig.h CHANGED
@@ -15,7 +15,7 @@
15
  #ifndef PHP_TWIG_H
16
  #define PHP_TWIG_H
17
 
18
- #define PHP_TWIG_VERSION "1.42.1"
19
 
20
  #include "php.h"
21
 
15
  #ifndef PHP_TWIG_H
16
  #define PHP_TWIG_H
17
 
18
+ #define PHP_TWIG_VERSION "1.42.3"
19
 
20
  #include "php.h"
21
 
vendor/twig/twig/phpunit.xml.dist CHANGED
@@ -12,7 +12,7 @@
12
  >
13
  <testsuites>
14
  <testsuite name="Twig Test Suite">
15
- <directory>./test/Twig/</directory>
16
  </testsuite>
17
  </testsuites>
18
 
12
  >
13
  <testsuites>
14
  <testsuite name="Twig Test Suite">
15
+ <directory>./tests/</directory>
16
  </testsuite>
17
  </testsuites>
18
 
vendor/twig/twig/src/Cache/FilesystemCache.php CHANGED
@@ -67,8 +67,8 @@ class FilesystemCache implements CacheInterface
67
 
68
  if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) {
69
  // Compile cached file into bytecode cache
70
- if (\function_exists('opcache_invalidate')) {
71
- opcache_invalidate($key, true);
72
  } elseif (\function_exists('apc_compile_file')) {
73
  apc_compile_file($key);
74
  }
67
 
68
  if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) {
69
  // Compile cached file into bytecode cache
70
+ if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {
71
+ @opcache_invalidate($key, true);
72
  } elseif (\function_exists('apc_compile_file')) {
73
  apc_compile_file($key);
74
  }
vendor/twig/twig/src/Environment.php CHANGED
@@ -41,11 +41,11 @@ use Twig\TokenParser\TokenParserInterface;
41
  */
42
  class Environment
43
  {
44
- const VERSION = '1.42.1';
45
- const VERSION_ID = 14201;
46
  const MAJOR_VERSION = 1;
47
  const MINOR_VERSION = 42;
48
- const RELEASE_VERSION = 1;
49
  const EXTRA_VERSION = '';
50
 
51
  protected $charset;
41
  */
42
  class Environment
43
  {
44
+ const VERSION = '1.42.3';
45
+ const VERSION_ID = 14203;
46
  const MAJOR_VERSION = 1;
47
  const MINOR_VERSION = 42;
48
+ const RELEASE_VERSION = 3;
49
  const EXTRA_VERSION = '';
50
 
51
  protected $charset;
vendor/twig/twig/src/Extension/CoreExtension.php CHANGED
@@ -790,7 +790,7 @@ function twig_join_filter($value, $glue = '', $and = null)
790
  */
791
  function twig_split_filter(Environment $env, $value, $delimiter, $limit = null)
792
  {
793
- if (!empty($delimiter)) {
794
  return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit);
795
  }
796
 
@@ -1507,6 +1507,10 @@ function twig_test_empty($value)
1507
  return 0 == \count($value);
1508
  }
1509
 
 
 
 
 
1510
  if (\is_object($value) && method_exists($value, '__toString')) {
1511
  return '' === (string) $value;
1512
  }
790
  */
791
  function twig_split_filter(Environment $env, $value, $delimiter, $limit = null)
792
  {
793
+ if (\strlen($delimiter) > 0) {
794
  return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit);
795
  }
796
 
1507
  return 0 == \count($value);
1508
  }
1509
 
1510
+ if ($value instanceof \Traversable) {
1511
+ return !iterator_count($value);
1512
+ }
1513
+
1514
  if (\is_object($value) && method_exists($value, '__toString')) {
1515
  return '' === (string) $value;
1516
  }
vendor/twig/twig/src/Extension/DebugExtension.php CHANGED
@@ -54,7 +54,7 @@ function twig_var_dump(Environment $env, $context, array $vars = [])
54
  return;
55
  }
56
 
57
- ob_start(function () { return ''; });
58
 
59
  if (!$vars) {
60
  $vars = [];
54
  return;
55
  }
56
 
57
+ ob_start();
58
 
59
  if (!$vars) {
60
  $vars = [];
vendor/twig/twig/src/Loader/FilesystemLoader.php CHANGED
@@ -201,7 +201,6 @@ class FilesystemLoader implements LoaderInterface, ExistsLoaderInterface, Source
201
  *
202
  * @param string $name The template name
203
  *
204
- * @return string|false The template name or false
205
  * @return string|false|null The template name or false/null
206
  */
207
  protected function findTemplate($name)
201
  *
202
  * @param string $name The template name
203
  *
 
204
  * @return string|false|null The template name or false/null
205
  */
206
  protected function findTemplate($name)
vendor/twig/twig/src/Node/MacroNode.php CHANGED
@@ -104,7 +104,13 @@ class MacroNode extends Node
104
  ->outdent()
105
  ->write("]);\n\n")
106
  ->write("\$blocks = [];\n\n")
107
- ->write("ob_start(function () { return ''; });\n")
 
 
 
 
 
 
108
  ->write("try {\n")
109
  ->indent()
110
  ->subcompile($this->getNode('body'))
104
  ->outdent()
105
  ->write("]);\n\n")
106
  ->write("\$blocks = [];\n\n")
107
+ ;
108
+ if ($compiler->getEnvironment()->isDebug()) {
109
+ $compiler->write("ob_start();\n");
110
+ } else {
111
+ $compiler->write("ob_start(function () { return ''; });\n");
112
+ }
113
+ $compiler
114
  ->write("try {\n")
115
  ->indent()
116
  ->subcompile($this->getNode('body'))
vendor/twig/twig/src/Node/SetNode.php CHANGED
@@ -57,8 +57,12 @@ class SetNode extends Node implements NodeCaptureInterface
57
  $compiler->raw(')');
58
  } else {
59
  if ($this->getAttribute('capture')) {
 
 
 
 
 
60
  $compiler
61
- ->write("ob_start(function () { return ''; });\n")
62
  ->subcompile($this->getNode('values'))
63
  ;
64
  }
57
  $compiler->raw(')');
58
  } else {
59
  if ($this->getAttribute('capture')) {
60
+ if ($compiler->getEnvironment()->isDebug()) {
61
+ $compiler->write("ob_start();\n");
62
+ } else {
63
+ $compiler->write("ob_start(function () { return ''; });\n");
64
+ }
65
  $compiler
 
66
  ->subcompile($this->getNode('values'))
67
  ;
68
  }
vendor/twig/twig/src/Node/SpacelessNode.php CHANGED
@@ -31,7 +31,13 @@ class SpacelessNode extends Node
31
  {
32
  $compiler
33
  ->addDebugInfo($this)
34
- ->write("ob_start(function () { return ''; });\n")
 
 
 
 
 
 
35
  ->subcompile($this->getNode('body'))
36
  ->write("echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));\n")
37
  ;
31
  {
32
  $compiler
33
  ->addDebugInfo($this)
34
+ ;
35
+ if ($compiler->getEnvironment()->isDebug()) {
36
+ $compiler->write("ob_start();\n");
37
+ } else {
38
+ $compiler->write("ob_start(function () { return ''; });\n");
39
+ }
40
+ $compiler
41
  ->subcompile($this->getNode('body'))
42
  ->write("echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));\n")
43
  ;
vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php CHANGED
@@ -102,7 +102,7 @@ class SandboxNodeVisitor extends AbstractNodeVisitor
102
  if ($node instanceof ModuleNode) {
103
  $this->inAModule = false;
104
 
105
- $node->setNode('constructor_end', new Node([new CheckSecurityNode($this->filters, $this->tags, $this->functions), $node->getNode('display_start')]));
106
  } elseif ($this->inAModule) {
107
  if ($node instanceof PrintNode || $node instanceof SetNode) {
108
  $this->needsToStringWrap = false;
102
  if ($node instanceof ModuleNode) {
103
  $this->inAModule = false;
104
 
105
+ $node->getNode('constructor_end')->setNode('_security_check', new Node([new CheckSecurityNode($this->filters, $this->tags, $this->functions), $node->getNode('display_start')]));
106
  } elseif ($this->inAModule) {
107
  if ($node instanceof PrintNode || $node instanceof SetNode) {
108
  $this->needsToStringWrap = false;
vendor/twig/twig/src/Template.php CHANGED
@@ -253,7 +253,11 @@ abstract class Template implements \Twig_TemplateInterface
253
  */
254
  public function renderParentBlock($name, array $context, array $blocks = [])
255
  {
256
- ob_start(function () { return ''; });
 
 
 
 
257
  $this->displayParentBlock($name, $context, $blocks);
258
 
259
  return ob_get_clean();
@@ -274,7 +278,11 @@ abstract class Template implements \Twig_TemplateInterface
274
  */
275
  public function renderBlock($name, array $context, array $blocks = [], $useBlocks = true)
276
  {
277
- ob_start(function () { return ''; });
 
 
 
 
278
  $this->displayBlock($name, $context, $blocks, $useBlocks);
279
 
280
  return ob_get_clean();
@@ -417,7 +425,11 @@ abstract class Template implements \Twig_TemplateInterface
417
  public function render(array $context)
418
  {
419
  $level = ob_get_level();
420
- ob_start(function () { return ''; });
 
 
 
 
421
  try {
422
  $this->display($context);
423
  } catch (\Exception $e) {
@@ -525,7 +537,7 @@ abstract class Template implements \Twig_TemplateInterface
525
  if (self::METHOD_CALL !== $type) {
526
  $arrayItem = \is_bool($item) || \is_float($item) ? (int) $item : $item;
527
 
528
- if (((\is_array($object) || $object instanceof \ArrayObject) && (isset($object[$arrayItem]) || \array_key_exists($arrayItem, $object)))
529
  || ($object instanceof \ArrayAccess && isset($object[$arrayItem]))
530
  ) {
531
  if ($isDefinedTest) {
@@ -592,7 +604,7 @@ abstract class Template implements \Twig_TemplateInterface
592
 
593
  // object property
594
  if (self::METHOD_CALL !== $type && !$object instanceof self) { // \Twig\Template does not have public properties, and we don't want to allow access to internal ones
595
- if (isset($object->$item) || \array_key_exists((string) $item, $object)) {
596
  if ($isDefinedTest) {
597
  return true;
598
  }
253
  */
254
  public function renderParentBlock($name, array $context, array $blocks = [])
255
  {
256
+ if ($this->env->isDebug()) {
257
+ ob_start();
258
+ } else {
259
+ ob_start(function () { return ''; });
260
+ }
261
  $this->displayParentBlock($name, $context, $blocks);
262
 
263
  return ob_get_clean();
278
  */
279
  public function renderBlock($name, array $context, array $blocks = [], $useBlocks = true)
280
  {
281
+ if ($this->env->isDebug()) {
282
+ ob_start();
283
+ } else {
284
+ ob_start(function () { return ''; });
285
+ }
286
  $this->displayBlock($name, $context, $blocks, $useBlocks);
287
 
288
  return ob_get_clean();
425
  public function render(array $context)
426
  {
427
  $level = ob_get_level();
428
+ if ($this->env->isDebug()) {
429
+ ob_start();
430
+ } else {
431
+ ob_start(function () { return ''; });
432
+ }
433
  try {
434
  $this->display($context);
435
  } catch (\Exception $e) {
537
  if (self::METHOD_CALL !== $type) {
538
  $arrayItem = \is_bool($item) || \is_float($item) ? (int) $item : $item;
539
 
540
+ if (((\is_array($object) || $object instanceof \ArrayObject) && (isset($object[$arrayItem]) || \array_key_exists($arrayItem, (array) $object)))
541
  || ($object instanceof \ArrayAccess && isset($object[$arrayItem]))
542
  ) {
543
  if ($isDefinedTest) {
604
 
605
  // object property
606
  if (self::METHOD_CALL !== $type && !$object instanceof self) { // \Twig\Template does not have public properties, and we don't want to allow access to internal ones
607
+ if (isset($object->$item) || \array_key_exists((string) $item, (array) $object)) {
608
  if ($isDefinedTest) {
609
  return true;
610
  }
vendor/twig/twig/src/TemplateWrapper.php CHANGED
@@ -96,7 +96,11 @@ final class TemplateWrapper
96
  {
97
  $context = $this->env->mergeGlobals($context);
98
  $level = ob_get_level();
99
- ob_start(function () { return ''; });
 
 
 
 
100
  try {
101
  $this->template->displayBlock($name, $context);
102
  } catch (\Exception $e) {
96
  {
97
  $context = $this->env->mergeGlobals($context);
98
  $level = ob_get_level();
99
+ if ($this->env->isDebug()) {
100
+ ob_start();
101
+ } else {
102
+ ob_start(function () { return ''; });
103
+ }
104
  try {
105
  $this->template->displayBlock($name, $context);
106
  } catch (\Exception $e) {
vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- class Twig_Tests_AutoloaderTest extends \PHPUnit\Framework\TestCase
13
- {
14
- /**
15
- * @group legacy
16
- */
17
- public function testAutoload()
18
- {
19
- $this->assertFalse(class_exists('FooBarFoo'), '->autoload() does not try to load classes that does not begin with Twig');
20
-
21
- $autoloader = new Twig_Autoloader();
22
- $this->assertNull($autoloader->autoload('Foo'), '->autoload() returns false if it is not able to load a class');
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php DELETED
@@ -1,195 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Cache\FilesystemCache;
13
-
14
- require_once \dirname(__DIR__).'/FilesystemHelper.php';
15
-
16
- class Twig_Tests_Cache_FilesystemTest extends \PHPUnit\Framework\TestCase
17
- {
18
- private $classname;
19
- private $directory;
20
- private $cache;
21
-
22
- protected function setUp()
23
- {
24
- $nonce = hash('sha256', uniqid(mt_rand(), true));
25
- $this->classname = '__Twig_Tests_Cache_FilesystemTest_Template_'.$nonce;
26
- $this->directory = sys_get_temp_dir().'/twig-test';
27
- $this->cache = new FilesystemCache($this->directory);
28
- }
29
-
30
- protected function tearDown()
31
- {
32
- if (file_exists($this->directory)) {
33
- Twig_Tests_FilesystemHelper::removeDir($this->directory);
34
- }
35
- }
36
-
37
- public function testLoad()
38
- {
39
- $key = $this->directory.'/cache/cachefile.php';
40
-
41
- $dir = \dirname($key);
42
- @mkdir($dir, 0777, true);
43
- $this->assertTrue(is_dir($dir));
44
- $this->assertFalse(class_exists($this->classname, false));
45
-
46
- $content = $this->generateSource();
47
- file_put_contents($key, $content);
48
-
49
- $this->cache->load($key);
50
-
51
- $this->assertTrue(class_exists($this->classname, false));
52
- }
53
-
54
- public function testLoadMissing()
55
- {
56
- $key = $this->directory.'/cache/cachefile.php';
57
-
58
- $this->assertFalse(class_exists($this->classname, false));
59
-
60
- $this->cache->load($key);
61
-
62
- $this->assertFalse(class_exists($this->classname, false));
63
- }
64
-
65
- public function testWrite()
66
- {
67
- $key = $this->directory.'/cache/cachefile.php';
68
- $content = $this->generateSource();
69
-
70
- $this->assertFileNotExists($key);
71
- $this->assertFileNotExists($this->directory);
72
-
73
- $this->cache->write($key, $content);
74
-
75
- $this->assertFileExists($this->directory);
76
- $this->assertFileExists($key);
77
- $this->assertSame(file_get_contents($key), $content);
78
- }
79
-
80
- /**
81
- * @expectedException \RuntimeException
82
- * @expectedExceptionMessage Unable to create the cache directory
83
- */
84
- public function testWriteFailMkdir()
85
- {
86
- if (\defined('PHP_WINDOWS_VERSION_BUILD')) {
87
- $this->markTestSkipped('Read-only directories not possible on Windows.');
88
- }
89
-
90
- $key = $this->directory.'/cache/cachefile.php';
91
- $content = $this->generateSource();
92
-
93
- $this->assertFileNotExists($key);
94
-
95
- // Create read-only root directory.
96
- @mkdir($this->directory, 0555, true);
97
- $this->assertTrue(is_dir($this->directory));
98
-
99
- $this->cache->write($key, $content);
100
- }
101
-
102
- /**
103
- * @expectedException \RuntimeException
104
- * @expectedExceptionMessage Unable to write in the cache directory
105
- */
106
- public function testWriteFailDirWritable()
107
- {
108
- if (\defined('PHP_WINDOWS_VERSION_BUILD')) {
109
- $this->markTestSkipped('Read-only directories not possible on Windows.');
110
- }
111
-
112
- $key = $this->directory.'/cache/cachefile.php';
113
- $content = $this->generateSource();
114
-
115
- $this->assertFileNotExists($key);
116
-
117
- // Create root directory.
118
- @mkdir($this->directory, 0777, true);
119
- // Create read-only subdirectory.
120
- @mkdir($this->directory.'/cache', 0555);
121
- $this->assertTrue(is_dir($this->directory.'/cache'));
122
-
123
- $this->cache->write($key, $content);
124
- }
125
-
126
- /**
127
- * @expectedException \RuntimeException
128
- * @expectedExceptionMessage Failed to write cache file
129
- */
130
- public function testWriteFailWriteFile()
131
- {
132
- $key = $this->directory.'/cache/cachefile.php';
133
- $content = $this->generateSource();
134
-
135
- $this->assertFileNotExists($key);
136
-
137
- // Create a directory in the place of the cache file.
138
- @mkdir($key, 0777, true);
139
- $this->assertTrue(is_dir($key));
140
-
141
- $this->cache->write($key, $content);
142
- }
143
-
144
- public function testGetTimestamp()
145
- {
146
- $key = $this->directory.'/cache/cachefile.php';
147
-
148
- $dir = \dirname($key);
149
- @mkdir($dir, 0777, true);
150
- $this->assertTrue(is_dir($dir));
151
-
152
- // Create the file with a specific modification time.
153
- touch($key, 1234567890);
154
-
155
- $this->assertSame(1234567890, $this->cache->getTimestamp($key));
156
- }
157
-
158
- public function testGetTimestampMissingFile()
159
- {
160
- $key = $this->directory.'/cache/cachefile.php';
161
- $this->assertSame(0, $this->cache->getTimestamp($key));
162
- }
163
-
164
- /**
165
- * Test file cache is tolerant towards trailing (back)slashes on the configured cache directory.
166
- *
167
- * @dataProvider provideDirectories
168
- */
169
- public function testGenerateKey($expected, $input)
170
- {
171
- $cache = new FilesystemCache($input);
172
- $this->assertRegExp($expected, $cache->generateKey('_test_', \get_class($this)));
173
- }
174
-
175
- public function provideDirectories()
176
- {
177
- $pattern = '#a/b/[a-zA-Z0-9]+/[a-zA-Z0-9]+.php$#';
178
-
179
- return [
180
- [$pattern, 'a/b'],
181
- [$pattern, 'a/b/'],
182
- [$pattern, 'a/b\\'],
183
- [$pattern, 'a/b\\/'],
184
- [$pattern, 'a/b\\//'],
185
- ['#/'.substr($pattern, 1), '/a/b'],
186
- ];
187
- }
188
-
189
- private function generateSource()
190
- {
191
- return strtr('<?php class {{classname}} {}', [
192
- '{{classname}}' => $this->classname,
193
- ]);
194
- }
195
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/CompilerTest.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Compiler;
13
- use Twig\Environment;
14
-
15
- class Twig_Tests_CompilerTest extends \PHPUnit\Framework\TestCase
16
- {
17
- public function testReprNumericValueWithLocale()
18
- {
19
- $compiler = new Compiler(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
20
-
21
- $locale = setlocale(LC_NUMERIC, 0);
22
- if (false === $locale) {
23
- $this->markTestSkipped('Your platform does not support locales.');
24
- }
25
-
26
- $required_locales = ['fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'];
27
- if (false === setlocale(LC_NUMERIC, $required_locales)) {
28
- $this->markTestSkipped('Could not set any of required locales: '.implode(', ', $required_locales));
29
- }
30
-
31
- $this->assertEquals('1.2', $compiler->repr(1.2)->getSource());
32
- $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0)));
33
-
34
- setlocale(LC_NUMERIC, $locale);
35
- }
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php DELETED
@@ -1,42 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\RuntimeLoader\ContainerRuntimeLoader;
13
-
14
- class Twig_Tests_ContainerRuntimeLoaderTest extends \PHPUnit\Framework\TestCase
15
- {
16
- /**
17
- * @requires PHP 5.3
18
- */
19
- public function testLoad()
20
- {
21
- $container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock();
22
- $container->expects($this->once())->method('has')->with('stdClass')->willReturn(true);
23
- $container->expects($this->once())->method('get')->with('stdClass')->willReturn(new \stdClass());
24
-
25
- $loader = new ContainerRuntimeLoader($container);
26
-
27
- $this->assertInstanceOf('stdClass', $loader->load('stdClass'));
28
- }
29
-
30
- /**
31
- * @requires PHP 5.3
32
- */
33
- public function testLoadUnknownRuntimeReturnsNull()
34
- {
35
- $container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock();
36
- $container->expects($this->once())->method('has')->with('Foo');
37
- $container->expects($this->never())->method('get');
38
-
39
- $loader = new ContainerRuntimeLoader($container);
40
- $this->assertNull($loader->load('Foo'));
41
- }
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php DELETED
@@ -1,96 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Extension\ExtensionInterface;
14
-
15
- class CustomExtensionTest extends \PHPUnit\Framework\TestCase
16
- {
17
- /**
18
- * @requires PHP 5.3
19
- * @dataProvider provideInvalidExtensions
20
- */
21
- public function testGetInvalidOperators(ExtensionInterface $extension, $expectedExceptionMessage)
22
- {
23
- if (method_exists($this, 'expectException')) {
24
- $this->expectException('InvalidArgumentException');
25
- $this->expectExceptionMessage($expectedExceptionMessage);
26
- } else {
27
- $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
28
- }
29
-
30
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
31
- $env->addExtension($extension);
32
- $env->getUnaryOperators();
33
- }
34
-
35
- public function provideInvalidExtensions()
36
- {
37
- return [
38
- [new InvalidOperatorExtension(new \stdClass()), '"InvalidOperatorExtension::getOperators()" must return an array with operators, got "stdClass".'],
39
- [new InvalidOperatorExtension([1, 2, 3]), '"InvalidOperatorExtension::getOperators()" must return an array of 2 elements, got 3.'],
40
- ];
41
- }
42
- }
43
-
44
- class InvalidOperatorExtension implements ExtensionInterface
45
- {
46
- private $operators;
47
-
48
- public function __construct($operators)
49
- {
50
- $this->operators = $operators;
51
- }
52
-
53
- public function initRuntime(Environment $environment)
54
- {
55
- }
56
-
57
- public function getTokenParsers()
58
- {
59
- return [];
60
- }
61
-
62
- public function getNodeVisitors()
63
- {
64
- return [];
65
- }
66
-
67
- public function getFilters()
68
- {
69
- return [];
70
- }
71
-
72
- public function getTests()
73
- {
74
- return [];
75
- }
76
-
77
- public function getFunctions()
78
- {
79
- return [];
80
- }
81
-
82
- public function getGlobals()
83
- {
84
- return [];
85
- }
86
-
87
- public function getOperators()
88
- {
89
- return $this->operators;
90
- }
91
-
92
- public function getName()
93
- {
94
- return __CLASS__;
95
- }
96
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php DELETED
@@ -1,677 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Cache\FilesystemCache;
13
- use Twig\Environment;
14
- use Twig\Extension\AbstractExtension;
15
- use Twig\Extension\GlobalsInterface;
16
- use Twig\Extension\InitRuntimeInterface;
17
- use Twig\Loader\ArrayLoader;
18
- use Twig\Loader\LoaderInterface;
19
- use Twig\Loader\SourceContextLoaderInterface;
20
- use Twig\NodeVisitor\NodeVisitorInterface;
21
- use Twig\Source;
22
- use Twig\Token;
23
- use Twig\TokenParser\AbstractTokenParser;
24
- use Twig\TwigFilter;
25
- use Twig\TwigFunction;
26
- use Twig\TwigTest;
27
-
28
- require_once __DIR__.'/FilesystemHelper.php';
29
-
30
- class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase
31
- {
32
- private $deprecations = [];
33
-
34
- /**
35
- * @group legacy
36
- */
37
- public function testLegacyTokenizeSignature()
38
- {
39
- $env = new Environment();
40
- $stream = $env->tokenize('{{ foo }}', 'foo');
41
- $this->assertEquals('{{ foo }}', $stream->getSource());
42
- $this->assertEquals('foo', $stream->getFilename());
43
- }
44
-
45
- /**
46
- * @group legacy
47
- */
48
- public function testLegacyCompileSourceSignature()
49
- {
50
- $loader = new ArrayLoader(['foo' => '{{ foo }}']);
51
- $env = new Environment($loader);
52
- $this->assertContains('getTemplateName', $env->compileSource('{{ foo }}', 'foo'));
53
- }
54
-
55
- /**
56
- * @expectedException \LogicException
57
- * @expectedExceptionMessage You must set a loader first.
58
- * @group legacy
59
- */
60
- public function testRenderNoLoader()
61
- {
62
- $env = new Environment();
63
- $env->render('test');
64
- }
65
-
66
- public function testAutoescapeOption()
67
- {
68
- $loader = new ArrayLoader([
69
- 'html' => '{{ foo }} {{ foo }}',
70
- 'js' => '{{ bar }} {{ bar }}',
71
- ]);
72
-
73
- $twig = new Environment($loader, [
74
- 'debug' => true,
75
- 'cache' => false,
76
- 'autoescape' => [$this, 'escapingStrategyCallback'],
77
- ]);
78
-
79
- $this->assertEquals('foo&lt;br/ &gt; foo&lt;br/ &gt;', $twig->render('html', ['foo' => 'foo<br/ >']));
80
- $this->assertEquals('foo\u003Cbr\/\u0020\u003E foo\u003Cbr\/\u0020\u003E', $twig->render('js', ['bar' => 'foo<br/ >']));
81
- }
82
-
83
- public function escapingStrategyCallback($name)
84
- {
85
- return $name;
86
- }
87
-
88
- public function testGlobals()
89
- {
90
- // to be removed in 2.0
91
- $loader = $this->getMockBuilder('Twig_EnvironmentTestLoaderInterface')->getMock();
92
- //$loader = $this->getMockBuilder(['\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface'])->getMock();
93
- $loader->expects($this->any())->method('getSourceContext')->will($this->returnValue(new Source('', '')));
94
-
95
- // globals can be added after calling getGlobals
96
-
97
- $twig = new Environment($loader);
98
- $twig->addGlobal('foo', 'foo');
99
- $twig->getGlobals();
100
- $twig->addGlobal('foo', 'bar');
101
- $globals = $twig->getGlobals();
102
- $this->assertEquals('bar', $globals['foo']);
103
-
104
- // globals can be modified after a template has been loaded
105
- $twig = new Environment($loader);
106
- $twig->addGlobal('foo', 'foo');
107
- $twig->getGlobals();
108
- $twig->load('index');
109
- $twig->addGlobal('foo', 'bar');
110
- $globals = $twig->getGlobals();
111
- $this->assertEquals('bar', $globals['foo']);
112
-
113
- // globals can be modified after extensions init
114
- $twig = new Environment($loader);
115
- $twig->addGlobal('foo', 'foo');
116
- $twig->getGlobals();
117
- $twig->getFunctions();
118
- $twig->addGlobal('foo', 'bar');
119
- $globals = $twig->getGlobals();
120
- $this->assertEquals('bar', $globals['foo']);
121
-
122
- // globals can be modified after extensions and a template has been loaded
123
- $arrayLoader = new ArrayLoader(['index' => '{{foo}}']);
124
- $twig = new Environment($arrayLoader);
125
- $twig->addGlobal('foo', 'foo');
126
- $twig->getGlobals();
127
- $twig->getFunctions();
128
- $twig->load('index');
129
- $twig->addGlobal('foo', 'bar');
130
- $globals = $twig->getGlobals();
131
- $this->assertEquals('bar', $globals['foo']);
132
-
133
- $twig = new Environment($arrayLoader);
134
- $twig->getGlobals();
135
- $twig->addGlobal('foo', 'bar');
136
- $template = $twig->load('index');
137
- $this->assertEquals('bar', $template->render([]));
138
-
139
- /* to be uncomment in Twig 2.0
140
- // globals cannot be added after a template has been loaded
141
- $twig = new Environment($loader);
142
- $twig->addGlobal('foo', 'foo');
143
- $twig->getGlobals();
144
- $twig->load('index');
145
- try {
146
- $twig->addGlobal('bar', 'bar');
147
- $this->fail();
148
- } catch (\LogicException $e) {
149
- $this->assertFalse(array_key_exists('bar', $twig->getGlobals()));
150
- }
151
-
152
- // globals cannot be added after extensions init
153
- $twig = new Environment($loader);
154
- $twig->addGlobal('foo', 'foo');
155
- $twig->getGlobals();
156
- $twig->getFunctions();
157
- try {
158
- $twig->addGlobal('bar', 'bar');
159
- $this->fail();
160
- } catch (\LogicException $e) {
161
- $this->assertFalse(array_key_exists('bar', $twig->getGlobals()));
162
- }
163
-
164
- // globals cannot be added after extensions and a template has been loaded
165
- $twig = new Environment($loader);
166
- $twig->addGlobal('foo', 'foo');
167
- $twig->getGlobals();
168
- $twig->getFunctions();
169
- $twig->load('index');
170
- try {
171
- $twig->addGlobal('bar', 'bar');
172
- $this->fail();
173
- } catch (\LogicException $e) {
174
- $this->assertFalse(array_key_exists('bar', $twig->getGlobals()));
175
- }
176
-
177
- // test adding globals after a template has been loaded without call to getGlobals
178
- $twig = new Environment($loader);
179
- $twig->load('index');
180
- try {
181
- $twig->addGlobal('bar', 'bar');
182
- $this->fail();
183
- } catch (\LogicException $e) {
184
- $this->assertFalse(array_key_exists('bar', $twig->getGlobals()));
185
- }
186
- */
187
- }
188
-
189
- public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate()
190
- {
191
- $cache = new FilesystemCache($dir = sys_get_temp_dir().'/twig');
192
- $options = ['cache' => $cache, 'auto_reload' => false, 'debug' => false];
193
-
194
- // force compilation
195
- $twig = new Environment($loader = new ArrayLoader(['index' => '{{ foo }}']), $options);
196
-
197
- $key = $cache->generateKey('index', $twig->getTemplateClass('index'));
198
- $cache->write($key, $twig->compileSource(new Source('{{ foo }}', 'index')));
199
-
200
- // check that extensions won't be initialized when rendering a template that is already in the cache
201
- $twig = $this
202
- ->getMockBuilder('\Twig\Environment')
203
- ->setConstructorArgs([$loader, $options])
204
- ->setMethods(['initExtensions'])
205
- ->getMock()
206
- ;
207
-
208
- $twig->expects($this->never())->method('initExtensions');
209
-
210
- // render template
211
- $output = $twig->render('index', ['foo' => 'bar']);
212
- $this->assertEquals('bar', $output);
213
-
214
- Twig_Tests_FilesystemHelper::removeDir($dir);
215
- }
216
-
217
- public function testAutoReloadCacheMiss()
218
- {
219
- $templateName = __FUNCTION__;
220
- $templateContent = __FUNCTION__;
221
-
222
- $cache = $this->getMockBuilder('\Twig\Cache\CacheInterface')->getMock();
223
- $loader = $this->getMockLoader($templateName, $templateContent);
224
- $twig = new Environment($loader, ['cache' => $cache, 'auto_reload' => true, 'debug' => false]);
225
-
226
- // Cache miss: getTimestamp returns 0 and as a result the load() is
227
- // skipped.
228
- $cache->expects($this->once())
229
- ->method('generateKey')
230
- ->will($this->returnValue('key'));
231
- $cache->expects($this->once())
232
- ->method('getTimestamp')
233
- ->will($this->returnValue(0));
234
- $loader->expects($this->never())
235
- ->method('isFresh');
236
- $cache->expects($this->once())
237
- ->method('write');
238
- $cache->expects($this->once())
239
- ->method('load');
240
-
241
- $twig->load($templateName);
242
- }
243
-
244
- public function testAutoReloadCacheHit()
245
- {
246
- $templateName = __FUNCTION__;
247
- $templateContent = __FUNCTION__;
248
-
249
- $cache = $this->getMockBuilder('\Twig\Cache\CacheInterface')->getMock();
250
- $loader = $this->getMockLoader($templateName, $templateContent);
251
- $twig = new Environment($loader, ['cache' => $cache, 'auto_reload' => true, 'debug' => false]);
252
-
253
- $now = time();
254
-
255
- // Cache hit: getTimestamp returns something > extension timestamps and
256
- // the loader returns true for isFresh().
257
- $cache->expects($this->once())
258
- ->method('generateKey')
259
- ->will($this->returnValue('key'));
260
- $cache->expects($this->once())
261
- ->method('getTimestamp')
262
- ->will($this->returnValue($now));
263
- $loader->expects($this->once())
264
- ->method('isFresh')
265
- ->will($this->returnValue(true));
266
- $cache->expects($this->atLeastOnce())
267
- ->method('load');
268
-
269
- $twig->load($templateName);
270
- }
271
-
272
- public function testAutoReloadOutdatedCacheHit()
273
- {
274
- $templateName = __FUNCTION__;
275
- $templateContent = __FUNCTION__;
276
-
277
- $cache = $this->getMockBuilder('\Twig\Cache\CacheInterface')->getMock();
278
- $loader = $this->getMockLoader($templateName, $templateContent);
279
- $twig = new Environment($loader, ['cache' => $cache, 'auto_reload' => true, 'debug' => false]);
280
-
281
- $now = time();
282
-
283
- $cache->expects($this->once())
284
- ->method('generateKey')
285
- ->will($this->returnValue('key'));
286
- $cache->expects($this->once())
287
- ->method('getTimestamp')
288
- ->will($this->returnValue($now));
289
- $loader->expects($this->once())
290
- ->method('isFresh')
291
- ->will($this->returnValue(false));
292
- $cache->expects($this->once())
293
- ->method('write');
294
- $cache->expects($this->once())
295
- ->method('load');
296
-
297
- $twig->load($templateName);
298
- }
299
-
300
- /**
301
- * @group legacy
302
- */
303
- public function testHasGetExtensionWithDynamicName()
304
- {
305
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
306
-
307
- $ext1 = new Twig_Tests_EnvironmentTest_Extension_DynamicWithDeprecatedName('ext1');
308
- $ext2 = new Twig_Tests_EnvironmentTest_Extension_DynamicWithDeprecatedName('ext2');
309
- $twig->addExtension($ext1);
310
- $twig->addExtension($ext2);
311
-
312
- $this->assertTrue($twig->hasExtension('ext1'));
313
- $this->assertTrue($twig->hasExtension('ext2'));
314
-
315
- $this->assertTrue($twig->hasExtension('Twig_Tests_EnvironmentTest_Extension_DynamicWithDeprecatedName'));
316
-
317
- $this->assertSame($ext1, $twig->getExtension('ext1'));
318
- $this->assertSame($ext2, $twig->getExtension('ext2'));
319
- }
320
-
321
- public function testHasGetExtensionByClassName()
322
- {
323
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
324
- $twig->addExtension($ext = new Twig_Tests_EnvironmentTest_Extension());
325
- $this->assertTrue($twig->hasExtension('Twig_Tests_EnvironmentTest_Extension'));
326
- $this->assertTrue($twig->hasExtension('\Twig_Tests_EnvironmentTest_Extension'));
327
-
328
- $this->assertSame($ext, $twig->getExtension('Twig_Tests_EnvironmentTest_Extension'));
329
- $this->assertSame($ext, $twig->getExtension('\Twig_Tests_EnvironmentTest_Extension'));
330
-
331
- $this->assertTrue($twig->hasExtension('Twig\Tests\EnvironmentTest\Extension'));
332
- $this->assertSame($ext, $twig->getExtension('Twig\Tests\EnvironmentTest\Extension'));
333
- }
334
-
335
- public function testAddExtension()
336
- {
337
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
338
- $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension());
339
-
340
- $this->assertArrayHasKey('test', $twig->getTags());
341
- $this->assertArrayHasKey('foo_filter', $twig->getFilters());
342
- $this->assertArrayHasKey('foo_function', $twig->getFunctions());
343
- $this->assertArrayHasKey('foo_test', $twig->getTests());
344
- $this->assertArrayHasKey('foo_unary', $twig->getUnaryOperators());
345
- $this->assertArrayHasKey('foo_binary', $twig->getBinaryOperators());
346
- $this->assertArrayHasKey('foo_global', $twig->getGlobals());
347
- $visitors = $twig->getNodeVisitors();
348
- $found = false;
349
- foreach ($visitors as $visitor) {
350
- if ($visitor instanceof Twig_Tests_EnvironmentTest_NodeVisitor) {
351
- $found = true;
352
- }
353
- }
354
- $this->assertTrue($found);
355
- }
356
-
357
- /**
358
- * @requires PHP 5.3
359
- */
360
- public function testAddExtensionWithDeprecatedGetGlobals()
361
- {
362
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
363
- $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithGlobals());
364
-
365
- $this->deprecations = [];
366
- set_error_handler([$this, 'handleError']);
367
-
368
- $this->assertArrayHasKey('foo_global', $twig->getGlobals());
369
-
370
- $this->assertCount(1, $this->deprecations);
371
- $this->assertContains('Defining the getGlobals() method in the "Twig_Tests_EnvironmentTest_Extension_WithGlobals" extension ', $this->deprecations[0]);
372
-
373
- restore_error_handler();
374
- }
375
-
376
- /**
377
- * @group legacy
378
- */
379
- public function testRemoveExtension()
380
- {
381
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
382
- $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName());
383
- $twig->removeExtension('environment_test');
384
-
385
- $this->assertArrayNotHasKey('test', $twig->getTags());
386
- $this->assertArrayNotHasKey('foo_filter', $twig->getFilters());
387
- $this->assertArrayNotHasKey('foo_function', $twig->getFunctions());
388
- $this->assertArrayNotHasKey('foo_test', $twig->getTests());
389
- $this->assertArrayNotHasKey('foo_unary', $twig->getUnaryOperators());
390
- $this->assertArrayNotHasKey('foo_binary', $twig->getBinaryOperators());
391
- $this->assertArrayNotHasKey('foo_global', $twig->getGlobals());
392
- $this->assertCount(2, $twig->getNodeVisitors());
393
- }
394
-
395
- public function testAddMockExtension()
396
- {
397
- // should be replaced by the following in 2.0 (this current code is just to avoid a dep notice)
398
- // $extension = $this->getMockBuilder('\Twig\Extension\AbstractExtension')->getMock();
399
- $extension = eval(<<<EOF
400
- use Twig\Extension\AbstractExtension;
401
-
402
- class Twig_Tests_EnvironmentTest_ExtensionInEval extends AbstractExtension
403
- {
404
- }
405
- EOF
406
- );
407
- $extension = new Twig_Tests_EnvironmentTest_ExtensionInEval();
408
-
409
- $loader = new ArrayLoader(['page' => 'hey']);
410
-
411
- $twig = new Environment($loader);
412
- $twig->addExtension($extension);
413
-
414
- $this->assertInstanceOf('\Twig\Extension\ExtensionInterface', $twig->getExtension(\get_class($extension)));
415
- $this->assertTrue($twig->isTemplateFresh('page', time()));
416
- }
417
-
418
- public function testInitRuntimeWithAnExtensionUsingInitRuntimeNoDeprecation()
419
- {
420
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
421
- $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime());
422
- $twig->initRuntime();
423
-
424
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
425
- // can be executed without throwing any deprecations
426
- $this->addToAssertionCount(1);
427
- }
428
-
429
- /**
430
- * @requires PHP 5.3
431
- */
432
- public function testInitRuntimeWithAnExtensionUsingInitRuntimeDeprecation()
433
- {
434
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
435
- $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime());
436
-
437
- $this->deprecations = [];
438
- set_error_handler([$this, 'handleError']);
439
-
440
- $twig->initRuntime();
441
-
442
- $this->assertCount(1, $this->deprecations);
443
- $this->assertContains('Defining the initRuntime() method in the "Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime" extension is deprecated since version 1.23.', $this->deprecations[0]);
444
-
445
- restore_error_handler();
446
- }
447
-
448
- public function handleError($type, $msg)
449
- {
450
- if (E_USER_DEPRECATED === $type) {
451
- $this->deprecations[] = $msg;
452
- }
453
- }
454
-
455
- /**
456
- * @requires PHP 5.3
457
- */
458
- public function testOverrideExtension()
459
- {
460
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
461
- $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime());
462
-
463
- $this->deprecations = [];
464
- set_error_handler([$this, 'handleError']);
465
-
466
- $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName());
467
- $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName());
468
-
469
- $this->assertCount(1, $this->deprecations);
470
- $this->assertContains('The possibility to register the same extension twice', $this->deprecations[0]);
471
-
472
- restore_error_handler();
473
- }
474
-
475
- public function testAddRuntimeLoader()
476
- {
477
- $runtimeLoader = $this->getMockBuilder('\Twig\RuntimeLoader\RuntimeLoaderInterface')->getMock();
478
- $runtimeLoader->expects($this->any())->method('load')->will($this->returnValue(new Twig_Tests_EnvironmentTest_Runtime()));
479
-
480
- $loader = new ArrayLoader([
481
- 'func_array' => '{{ from_runtime_array("foo") }}',
482
- 'func_array_default' => '{{ from_runtime_array() }}',
483
- 'func_array_named_args' => '{{ from_runtime_array(name="foo") }}',
484
- 'func_string' => '{{ from_runtime_string("foo") }}',
485
- 'func_string_default' => '{{ from_runtime_string() }}',
486
- 'func_string_named_args' => '{{ from_runtime_string(name="foo") }}',
487
- ]);
488
-
489
- $twig = new Environment($loader);
490
- $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutRuntime());
491
- $twig->addRuntimeLoader($runtimeLoader);
492
-
493
- $this->assertEquals('foo', $twig->render('func_array'));
494
- $this->assertEquals('bar', $twig->render('func_array_default'));
495
- $this->assertEquals('foo', $twig->render('func_array_named_args'));
496
- $this->assertEquals('foo', $twig->render('func_string'));
497
- $this->assertEquals('bar', $twig->render('func_string_default'));
498
- $this->assertEquals('foo', $twig->render('func_string_named_args'));
499
- }
500
-
501
- protected function getMockLoader($templateName, $templateContent)
502
- {
503
- // to be removed in 2.0
504
- $loader = $this->getMockBuilder('Twig_EnvironmentTestLoaderInterface')->getMock();
505
- //$loader = $this->getMockBuilder(['\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface'])->getMock();
506
- $loader->expects($this->any())
507
- ->method('getSourceContext')
508
- ->with($templateName)
509
- ->will($this->returnValue(new Source($templateContent, $templateName)));
510
- $loader->expects($this->any())
511
- ->method('getCacheKey')
512
- ->with($templateName)
513
- ->will($this->returnValue($templateName));
514
-
515
- return $loader;
516
- }
517
- }
518
-
519
- class Twig_Tests_EnvironmentTest_Extension_WithGlobals extends AbstractExtension
520
- {
521
- public function getGlobals()
522
- {
523
- return [
524
- 'foo_global' => 'foo_global',
525
- ];
526
- }
527
- }
528
-
529
- class Twig_Tests_EnvironmentTest_Extension extends AbstractExtension implements GlobalsInterface
530
- {
531
- public function getTokenParsers()
532
- {
533
- return [
534
- new Twig_Tests_EnvironmentTest_TokenParser(),
535
- ];
536
- }
537
-
538
- public function getNodeVisitors()
539
- {
540
- return [
541
- new Twig_Tests_EnvironmentTest_NodeVisitor(),
542
- ];
543
- }
544
-
545
- public function getFilters()
546
- {
547
- return [
548
- new TwigFilter('foo_filter', 'foo_filter'),
549
- ];
550
- }
551
-
552
- public function getTests()
553
- {
554
- return [
555
- new TwigTest('foo_test', 'foo_test'),
556
- ];
557
- }
558
-
559
- public function getFunctions()
560
- {
561
- return [
562
- new TwigFunction('foo_function', 'foo_function'),
563
- ];
564
- }
565
-
566
- public function getOperators()
567
- {
568
- return [
569
- ['foo_unary' => []],
570
- ['foo_binary' => []],
571
- ];
572
- }
573
-
574
- public function getGlobals()
575
- {
576
- return [
577
- 'foo_global' => 'foo_global',
578
- ];
579
- }
580
- }
581
- class_alias('Twig_Tests_EnvironmentTest_Extension', 'Twig\Tests\EnvironmentTest\Extension', false);
582
-
583
- class Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName extends AbstractExtension
584
- {
585
- public function getName()
586
- {
587
- return 'environment_test';
588
- }
589
- }
590
-
591
- class Twig_Tests_EnvironmentTest_Extension_DynamicWithDeprecatedName extends AbstractExtension
592
- {
593
- private $name;
594
-
595
- public function __construct($name)
596
- {
597
- $this->name = $name;
598
- }
599
-
600
- public function getName()
601
- {
602
- return $this->name;
603
- }
604
- }
605
-
606
- class Twig_Tests_EnvironmentTest_TokenParser extends AbstractTokenParser
607
- {
608
- public function parse(Token $token)
609
- {
610
- }
611
-
612
- public function getTag()
613
- {
614
- return 'test';
615
- }
616
- }
617
-
618
- class Twig_Tests_EnvironmentTest_NodeVisitor implements NodeVisitorInterface
619
- {
620
- public function enterNode(Twig_NodeInterface $node, Environment $env)
621
- {
622
- return $node;
623
- }
624
-
625
- public function leaveNode(Twig_NodeInterface $node, Environment $env)
626
- {
627
- return $node;
628
- }
629
-
630
- public function getPriority()
631
- {
632
- return 0;
633
- }
634
- }
635
-
636
- class Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime extends AbstractExtension
637
- {
638
- public function initRuntime(Environment $env)
639
- {
640
- }
641
- }
642
-
643
- class Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime extends AbstractExtension implements InitRuntimeInterface
644
- {
645
- public function initRuntime(Environment $env)
646
- {
647
- }
648
- }
649
-
650
- class Twig_Tests_EnvironmentTest_ExtensionWithoutRuntime extends AbstractExtension
651
- {
652
- public function getFunctions()
653
- {
654
- return [
655
- new TwigFunction('from_runtime_array', ['Twig_Tests_EnvironmentTest_Runtime', 'fromRuntime']),
656
- new TwigFunction('from_runtime_string', 'Twig_Tests_EnvironmentTest_Runtime::fromRuntime'),
657
- ];
658
- }
659
-
660
- public function getName()
661
- {
662
- return 'from_runtime';
663
- }
664
- }
665
-
666
- class Twig_Tests_EnvironmentTest_Runtime
667
- {
668
- public function fromRuntime($name = 'bar')
669
- {
670
- return $name;
671
- }
672
- }
673
-
674
- // to be removed in 2.0
675
- interface Twig_EnvironmentTestLoaderInterface extends LoaderInterface, SourceContextLoaderInterface
676
- {
677
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/ErrorTest.php DELETED
@@ -1,218 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Error\Error;
14
- use Twig\Error\RuntimeError;
15
- use Twig\Loader\ArrayLoader;
16
- use Twig\Loader\FilesystemLoader;
17
- use Twig\Source;
18
-
19
- class Twig_Tests_ErrorTest extends \PHPUnit\Framework\TestCase
20
- {
21
- public function testErrorWithObjectFilename()
22
- {
23
- $error = new Error('foo');
24
- $error->setSourceContext(new Source('', new \SplFileInfo(__FILE__)));
25
-
26
- $this->assertContains('test'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Tests'.DIRECTORY_SEPARATOR.'ErrorTest.php', $error->getMessage());
27
- }
28
-
29
- public function testErrorWithArrayFilename()
30
- {
31
- $error = new Error('foo');
32
- $error->setSourceContext(new Source('', ['foo' => 'bar']));
33
-
34
- $this->assertEquals('foo in {"foo":"bar"}', $error->getMessage());
35
- }
36
-
37
- public function testTwigExceptionGuessWithMissingVarAndArrayLoader()
38
- {
39
- $loader = new ArrayLoader([
40
- 'base.html' => '{% block content %}{% endblock %}',
41
- 'index.html' => <<<EOHTML
42
- {% extends 'base.html' %}
43
- {% block content %}
44
- {{ foo.bar }}
45
- {% endblock %}
46
- {% block foo %}
47
- {{ foo.bar }}
48
- {% endblock %}
49
- EOHTML
50
- ]);
51
- $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]);
52
-
53
- $template = $twig->load('index.html');
54
- try {
55
- $template->render([]);
56
-
57
- $this->fail();
58
- } catch (RuntimeError $e) {
59
- $this->assertEquals('Variable "foo" does not exist in "index.html" at line 3.', $e->getMessage());
60
- $this->assertEquals(3, $e->getTemplateLine());
61
- $this->assertEquals('index.html', $e->getSourceContext()->getName());
62
- }
63
- }
64
-
65
- public function testTwigExceptionGuessWithExceptionAndArrayLoader()
66
- {
67
- $loader = new ArrayLoader([
68
- 'base.html' => '{% block content %}{% endblock %}',
69
- 'index.html' => <<<EOHTML
70
- {% extends 'base.html' %}
71
- {% block content %}
72
- {{ foo.bar }}
73
- {% endblock %}
74
- {% block foo %}
75
- {{ foo.bar }}
76
- {% endblock %}
77
- EOHTML
78
- ]);
79
- $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]);
80
-
81
- $template = $twig->load('index.html');
82
- try {
83
- $template->render(['foo' => new Twig_Tests_ErrorTest_Foo()]);
84
-
85
- $this->fail();
86
- } catch (RuntimeError $e) {
87
- $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index.html" at line 3.', $e->getMessage());
88
- $this->assertEquals(3, $e->getTemplateLine());
89
- $this->assertEquals('index.html', $e->getSourceContext()->getName());
90
- }
91
- }
92
-
93
- public function testTwigExceptionGuessWithMissingVarAndFilesystemLoader()
94
- {
95
- $loader = new FilesystemLoader(__DIR__.'/Fixtures/errors');
96
- $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]);
97
-
98
- $template = $twig->load('index.html');
99
- try {
100
- $template->render([]);
101
-
102
- $this->fail();
103
- } catch (RuntimeError $e) {
104
- $this->assertEquals('Variable "foo" does not exist.', $e->getMessage());
105
- $this->assertEquals(3, $e->getTemplateLine());
106
- $this->assertEquals('index.html', $e->getSourceContext()->getName());
107
- $this->assertEquals(3, $e->getLine());
108
- $this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile());
109
- }
110
- }
111
-
112
- public function testTwigExceptionGuessWithExceptionAndFilesystemLoader()
113
- {
114
- $loader = new FilesystemLoader(__DIR__.'/Fixtures/errors');
115
- $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]);
116
-
117
- $template = $twig->load('index.html');
118
- try {
119
- $template->render(['foo' => new Twig_Tests_ErrorTest_Foo()]);
120
-
121
- $this->fail();
122
- } catch (RuntimeError $e) {
123
- $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...").', $e->getMessage());
124
- $this->assertEquals(3, $e->getTemplateLine());
125
- $this->assertEquals('index.html', $e->getSourceContext()->getName());
126
- $this->assertEquals(3, $e->getLine());
127
- $this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile());
128
- }
129
- }
130
-
131
- /**
132
- * @dataProvider getErroredTemplates
133
- */
134
- public function testTwigExceptionAddsFileAndLine($templates, $name, $line)
135
- {
136
- $loader = new ArrayLoader($templates);
137
- $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]);
138
-
139
- $template = $twig->load('index');
140
-
141
- try {
142
- $template->render([]);
143
-
144
- $this->fail();
145
- } catch (RuntimeError $e) {
146
- $this->assertEquals(sprintf('Variable "foo" does not exist in "%s" at line %d.', $name, $line), $e->getMessage());
147
- $this->assertEquals($line, $e->getTemplateLine());
148
- $this->assertEquals($name, $e->getSourceContext()->getName());
149
- }
150
-
151
- try {
152
- $template->render(['foo' => new Twig_Tests_ErrorTest_Foo()]);
153
-
154
- $this->fail();
155
- } catch (RuntimeError $e) {
156
- $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());
157
- $this->assertEquals($line, $e->getTemplateLine());
158
- $this->assertEquals($name, $e->getSourceContext()->getName());
159
- }
160
- }
161
-
162
- public function getErroredTemplates()
163
- {
164
- return [
165
- // error occurs in a template
166
- [
167
- [
168
- 'index' => "\n\n{{ foo.bar }}\n\n\n{{ 'foo' }}",
169
- ],
170
- 'index', 3,
171
- ],
172
-
173
- // error occurs in an included template
174
- [
175
- [
176
- 'index' => "{% include 'partial' %}",
177
- 'partial' => '{{ foo.bar }}',
178
- ],
179
- 'partial', 1,
180
- ],
181
-
182
- // error occurs in a parent block when called via parent()
183
- [
184
- [
185
- 'index' => "{% extends 'base' %}
186
- {% block content %}
187
- {{ parent() }}
188
- {% endblock %}",
189
- 'base' => '{% block content %}{{ foo.bar }}{% endblock %}',
190
- ],
191
- 'base', 1,
192
- ],
193
-
194
- // error occurs in a block from the child
195
- [
196
- [
197
- 'index' => "{% extends 'base' %}
198
- {% block content %}
199
- {{ foo.bar }}
200
- {% endblock %}
201
- {% block foo %}
202
- {{ foo.bar }}
203
- {% endblock %}",
204
- 'base' => '{% block content %}{% endblock %}',
205
- ],
206
- 'index', 3,
207
- ],
208
- ];
209
- }
210
- }
211
-
212
- class Twig_Tests_ErrorTest_Foo
213
- {
214
- public function bar()
215
- {
216
- throw new \Exception('Runtime error...');
217
- }
218
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php DELETED
@@ -1,387 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Node\Expression\ArrayExpression;
14
- use Twig\Node\Expression\Binary\ConcatBinary;
15
- use Twig\Node\Expression\ConstantExpression;
16
- use Twig\Node\Expression\NameExpression;
17
- use Twig\Parser;
18
- use Twig\Source;
19
-
20
- class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
21
- {
22
- /**
23
- * @expectedException \Twig\Error\SyntaxError
24
- * @dataProvider getFailingTestsForAssignment
25
- */
26
- public function testCanOnlyAssignToNames($template)
27
- {
28
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
29
- $parser = new Parser($env);
30
-
31
- $parser->parse($env->tokenize(new Source($template, 'index')));
32
- }
33
-
34
- public function getFailingTestsForAssignment()
35
- {
36
- return [
37
- ['{% set false = "foo" %}'],
38
- ['{% set FALSE = "foo" %}'],
39
- ['{% set true = "foo" %}'],
40
- ['{% set TRUE = "foo" %}'],
41
- ['{% set none = "foo" %}'],
42
- ['{% set NONE = "foo" %}'],
43
- ['{% set null = "foo" %}'],
44
- ['{% set NULL = "foo" %}'],
45
- ['{% set 3 = "foo" %}'],
46
- ['{% set 1 + 2 = "foo" %}'],
47
- ['{% set "bar" = "foo" %}'],
48
- ['{% set %}{% endset %}'],
49
- ];
50
- }
51
-
52
- /**
53
- * @dataProvider getTestsForArray
54
- */
55
- public function testArrayExpression($template, $expected)
56
- {
57
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
58
- $stream = $env->tokenize($source = new Source($template, ''));
59
- $parser = new Parser($env);
60
- $expected->setSourceContext($source);
61
-
62
- $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr'));
63
- }
64
-
65
- /**
66
- * @expectedException \Twig\Error\SyntaxError
67
- * @dataProvider getFailingTestsForArray
68
- */
69
- public function testArraySyntaxError($template)
70
- {
71
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
72
- $parser = new Parser($env);
73
-
74
- $parser->parse($env->tokenize(new Source($template, 'index')));
75
- }
76
-
77
- public function getFailingTestsForArray()
78
- {
79
- return [
80
- ['{{ [1, "a": "b"] }}'],
81
- ['{{ {"a": "b", 2} }}'],
82
- ];
83
- }
84
-
85
- public function getTestsForArray()
86
- {
87
- return [
88
- // simple array
89
- ['{{ [1, 2] }}', new ArrayExpression([
90
- new ConstantExpression(0, 1),
91
- new ConstantExpression(1, 1),
92
-
93
- new ConstantExpression(1, 1),
94
- new ConstantExpression(2, 1),
95
- ], 1),
96
- ],
97
-
98
- // array with trailing ,
99
- ['{{ [1, 2, ] }}', new ArrayExpression([
100
- new ConstantExpression(0, 1),
101
- new ConstantExpression(1, 1),
102
-
103
- new ConstantExpression(1, 1),
104
- new ConstantExpression(2, 1),
105
- ], 1),
106
- ],
107
-
108
- // simple hash
109
- ['{{ {"a": "b", "b": "c"} }}', new ArrayExpression([
110
- new ConstantExpression('a', 1),
111
- new ConstantExpression('b', 1),
112
-
113
- new ConstantExpression('b', 1),
114
- new ConstantExpression('c', 1),
115
- ], 1),
116
- ],
117
-
118
- // hash with trailing ,
119
- ['{{ {"a": "b", "b": "c", } }}', new ArrayExpression([
120
- new ConstantExpression('a', 1),
121
- new ConstantExpression('b', 1),
122
-
123
- new ConstantExpression('b', 1),
124
- new ConstantExpression('c', 1),
125
- ], 1),
126
- ],
127
-
128
- // hash in an array
129
- ['{{ [1, {"a": "b", "b": "c"}] }}', new ArrayExpression([
130
- new ConstantExpression(0, 1),
131
- new ConstantExpression(1, 1),
132
-
133
- new ConstantExpression(1, 1),
134
- new ArrayExpression([
135
- new ConstantExpression('a', 1),
136
- new ConstantExpression('b', 1),
137
-
138
- new ConstantExpression('b', 1),
139
- new ConstantExpression('c', 1),
140
- ], 1),
141
- ], 1),
142
- ],
143
-
144
- // array in a hash
145
- ['{{ {"a": [1, 2], "b": "c"} }}', new ArrayExpression([
146
- new ConstantExpression('a', 1),
147
- new ArrayExpression([
148
- new ConstantExpression(0, 1),
149
- new ConstantExpression(1, 1),
150
-
151
- new ConstantExpression(1, 1),
152
- new ConstantExpression(2, 1),
153
- ], 1),
154
- new ConstantExpression('b', 1),
155
- new ConstantExpression('c', 1),
156
- ], 1),
157
- ],
158
- ];
159
- }
160
-
161
- /**
162
- * @expectedException \Twig\Error\SyntaxError
163
- */
164
- public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings()
165
- {
166
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]);
167
- $stream = $env->tokenize(new Source('{{ "a" "b" }}', 'index'));
168
- $parser = new Parser($env);
169
-
170
- $parser->parse($stream);
171
- }
172
-
173
- /**
174
- * @dataProvider getTestsForString
175
- */
176
- public function testStringExpression($template, $expected)
177
- {
178
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]);
179
- $stream = $env->tokenize($source = new Source($template, ''));
180
- $parser = new Parser($env);
181
- $expected->setSourceContext($source);
182
-
183
- $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr'));
184
- }
185
-
186
- public function getTestsForString()
187
- {
188
- return [
189
- [
190
- '{{ "foo" }}', new ConstantExpression('foo', 1),
191
- ],
192
- [
193
- '{{ "foo #{bar}" }}', new ConcatBinary(
194
- new ConstantExpression('foo ', 1),
195
- new NameExpression('bar', 1),
196
- 1
197
- ),
198
- ],
199
- [
200
- '{{ "foo #{bar} baz" }}', new ConcatBinary(
201
- new ConcatBinary(
202
- new ConstantExpression('foo ', 1),
203
- new NameExpression('bar', 1),
204
- 1
205
- ),
206
- new ConstantExpression(' baz', 1),
207
- 1
208
- ),
209
- ],
210
-
211
- [
212
- '{{ "foo #{"foo #{bar} baz"} baz" }}', new ConcatBinary(
213
- new ConcatBinary(
214
- new ConstantExpression('foo ', 1),
215
- new ConcatBinary(
216
- new ConcatBinary(
217
- new ConstantExpression('foo ', 1),
218
- new NameExpression('bar', 1),
219
- 1
220
- ),
221
- new ConstantExpression(' baz', 1),
222
- 1
223
- ),
224
- 1
225
- ),
226
- new ConstantExpression(' baz', 1),
227
- 1
228
- ),
229
- ],
230
- ];
231
- }
232
-
233
- /**
234
- * @expectedException \Twig\Error\SyntaxError
235
- */
236
- public function testAttributeCallDoesNotSupportNamedArguments()
237
- {
238
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
239
- $parser = new Parser($env);
240
-
241
- $parser->parse($env->tokenize(new Source('{{ foo.bar(name="Foo") }}', 'index')));
242
- }
243
-
244
- /**
245
- * @expectedException \Twig\Error\SyntaxError
246
- */
247
- public function testMacroCallDoesNotSupportNamedArguments()
248
- {
249
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
250
- $parser = new Parser($env);
251
-
252
- $parser->parse($env->tokenize(new Source('{% from _self import foo %}{% macro foo() %}{% endmacro %}{{ foo(name="Foo") }}', 'index')));
253
- }
254
-
255
- /**
256
- * @expectedException \Twig\Error\SyntaxError
257
- * @expectedExceptionMessage An argument must be a name. Unexpected token "string" of value "a" ("name" expected) in "index" at line 1.
258
- */
259
- public function testMacroDefinitionDoesNotSupportNonNameVariableName()
260
- {
261
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
262
- $parser = new Parser($env);
263
-
264
- $parser->parse($env->tokenize(new Source('{% macro foo("a") %}{% endmacro %}', 'index')));
265
- }
266
-
267
- /**
268
- * @expectedException \Twig\Error\SyntaxError
269
- * @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
270
- * @dataProvider getMacroDefinitionDoesNotSupportNonConstantDefaultValues
271
- */
272
- public function testMacroDefinitionDoesNotSupportNonConstantDefaultValues($template)
273
- {
274
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
275
- $parser = new Parser($env);
276
-
277
- $parser->parse($env->tokenize(new Source($template, 'index')));
278
- }
279
-
280
- public function getMacroDefinitionDoesNotSupportNonConstantDefaultValues()
281
- {
282
- return [
283
- ['{% macro foo(name = "a #{foo} a") %}{% endmacro %}'],
284
- ['{% macro foo(name = [["b", "a #{foo} a"]]) %}{% endmacro %}'],
285
- ];
286
- }
287
-
288
- /**
289
- * @dataProvider getMacroDefinitionSupportsConstantDefaultValues
290
- */
291
- public function testMacroDefinitionSupportsConstantDefaultValues($template)
292
- {
293
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
294
- $parser = new Parser($env);
295
-
296
- $parser->parse($env->tokenize(new Source($template, 'index')));
297
-
298
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
299
- // can be executed without throwing any exceptions
300
- $this->addToAssertionCount(1);
301
- }
302
-
303
- public function getMacroDefinitionSupportsConstantDefaultValues()
304
- {
305
- return [
306
- ['{% macro foo(name = "aa") %}{% endmacro %}'],
307
- ['{% macro foo(name = 12) %}{% endmacro %}'],
308
- ['{% macro foo(name = true) %}{% endmacro %}'],
309
- ['{% macro foo(name = ["a"]) %}{% endmacro %}'],
310
- ['{% macro foo(name = [["a"]]) %}{% endmacro %}'],
311
- ['{% macro foo(name = {a: "a"}) %}{% endmacro %}'],
312
- ['{% macro foo(name = {a: {b: "a"}}) %}{% endmacro %}'],
313
- ];
314
- }
315
-
316
- /**
317
- * @expectedException \Twig\Error\SyntaxError
318
- * @expectedExceptionMessage Unknown "cycl" function. Did you mean "cycle" in "index" at line 1?
319
- */
320
- public function testUnknownFunction()
321
- {
322
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
323
- $parser = new Parser($env);
324
-
325
- $parser->parse($env->tokenize(new Source('{{ cycl() }}', 'index')));
326
- }
327
-
328
- /**
329
- * @expectedException \Twig\Error\SyntaxError
330
- * @expectedExceptionMessage Unknown "foobar" function in "index" at line 1.
331
- */
332
- public function testUnknownFunctionWithoutSuggestions()
333
- {
334
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
335
- $parser = new Parser($env);
336
-
337
- $parser->parse($env->tokenize(new Source('{{ foobar() }}', 'index')));
338
- }
339
-
340
- /**
341
- * @expectedException \Twig\Error\SyntaxError
342
- * @expectedExceptionMessage Unknown "lowe" filter. Did you mean "lower" in "index" at line 1?
343
- */
344
- public function testUnknownFilter()
345
- {
346
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
347
- $parser = new Parser($env);
348
-
349
- $parser->parse($env->tokenize(new Source('{{ 1|lowe }}', 'index')));
350
- }
351
-
352
- /**
353
- * @expectedException \Twig\Error\SyntaxError
354
- * @expectedExceptionMessage Unknown "foobar" filter in "index" at line 1.
355
- */
356
- public function testUnknownFilterWithoutSuggestions()
357
- {
358
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
359
- $parser = new Parser($env);
360
-
361
- $parser->parse($env->tokenize(new Source('{{ 1|foobar }}', 'index')));
362
- }
363
-
364
- /**
365
- * @expectedException \Twig\Error\SyntaxError
366
- * @expectedExceptionMessage Unknown "nul" test. Did you mean "null" in "index" at line 1
367
- */
368
- public function testUnknownTest()
369
- {
370
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
371
- $parser = new Parser($env);
372
- $stream = $env->tokenize(new Source('{{ 1 is nul }}', 'index'));
373
- $parser->parse($stream);
374
- }
375
-
376
- /**
377
- * @expectedException \Twig\Error\SyntaxError
378
- * @expectedExceptionMessage Unknown "foobar" test in "index" at line 1.
379
- */
380
- public function testUnknownTestWithoutSuggestions()
381
- {
382
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
383
- $parser = new Parser($env);
384
-
385
- $parser->parse($env->tokenize(new Source('{{ 1 is foobar }}', 'index')));
386
- }
387
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php DELETED
@@ -1,371 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
-
14
- class Twig_Tests_Extension_CoreTest extends \PHPUnit\Framework\TestCase
15
- {
16
- /**
17
- * @dataProvider getRandomFunctionTestData
18
- */
19
- public function testRandomFunction(array $expectedInArray, $value1, $value2 = null)
20
- {
21
- $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
22
- for ($i = 0; $i < 100; ++$i) {
23
- $this->assertTrue(\in_array(twig_random($env, $value1, $value2), $expectedInArray, true)); // assertContains() would not consider the type
24
- }
25
- }
26
-
27
- public function getRandomFunctionTestData()
28
- {
29
- return [
30
- 'array' => [
31
- ['apple', 'orange', 'citrus'],
32
- ['apple', 'orange', 'citrus'],
33
- ],
34
- 'Traversable' => [
35
- ['apple', 'orange', 'citrus'],
36
- new ArrayObject(['apple', 'orange', 'citrus']),
37
- ],
38
- 'unicode string' => [
39
- ['Ä', '€', 'é'],
40
- 'Ä€é',
41
- ],
42
- 'numeric but string' => [
43
- ['1', '2', '3'],
44
- '123',
45
- ],
46
- 'integer' => [
47
- range(0, 5, 1),
48
- 5,
49
- ],
50
- 'float' => [
51
- range(0, 5, 1),
52
- 5.9,
53
- ],
54
- 'negative' => [
55
- [0, -1, -2],
56
- -2,
57
- ],
58
- 'min max int' => [
59
- range(50, 100),
60
- 50,
61
- 100,
62
- ],
63
- 'min max float' => [
64
- range(-10, 10),
65
- -9.5,
66
- 9.5,
67
- ],
68
- 'min null' => [
69
- range(0, 100),
70
- null,
71
- 100,
72
- ],
73
- ];
74
- }
75
-
76
- public function testRandomFunctionWithoutParameter()
77
- {
78
- $max = mt_getrandmax();
79
-
80
- for ($i = 0; $i < 100; ++$i) {
81
- $val = twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
82
- $this->assertTrue(\is_int($val) && $val >= 0 && $val <= $max);
83
- }
84
- }
85
-
86
- public function testRandomFunctionReturnsAsIs()
87
- {
88
- $this->assertSame('', twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), ''));
89
- $this->assertSame('', twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['charset' => null]), ''));
90
-
91
- $instance = new \stdClass();
92
- $this->assertSame($instance, twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), $instance));
93
- }
94
-
95
- /**
96
- * @expectedException \Twig\Error\RuntimeError
97
- */
98
- public function testRandomFunctionOfEmptyArrayThrowsException()
99
- {
100
- twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), []);
101
- }
102
-
103
- public function testRandomFunctionOnNonUTF8String()
104
- {
105
- if (!\function_exists('iconv') && !\function_exists('mb_convert_encoding')) {
106
- $this->markTestSkipped('needs iconv or mbstring');
107
- }
108
-
109
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
110
- $twig->setCharset('ISO-8859-1');
111
-
112
- $text = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8');
113
- for ($i = 0; $i < 30; ++$i) {
114
- $rand = twig_random($twig, $text);
115
- $this->assertTrue(\in_array(twig_convert_encoding($rand, 'UTF-8', 'ISO-8859-1'), ['Ä', 'é'], true));
116
- }
117
- }
118
-
119
- public function testReverseFilterOnNonUTF8String()
120
- {
121
- if (!\function_exists('iconv') && !\function_exists('mb_convert_encoding')) {
122
- $this->markTestSkipped('needs iconv or mbstring');
123
- }
124
-
125
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
126
- $twig->setCharset('ISO-8859-1');
127
-
128
- $input = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8');
129
- $output = twig_convert_encoding(twig_reverse_filter($twig, $input), 'UTF-8', 'ISO-8859-1');
130
-
131
- $this->assertEquals($output, 'éÄ');
132
- }
133
-
134
- /**
135
- * @dataProvider provideCustomEscaperCases
136
- */
137
- public function testCustomEscaper($expected, $string, $strategy)
138
- {
139
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
140
- $twig->getExtension('\Twig\Extension\CoreExtension')->setEscaper('foo', 'foo_escaper_for_test');
141
-
142
- $this->assertSame($expected, twig_escape_filter($twig, $string, $strategy));
143
- }
144
-
145
- public function provideCustomEscaperCases()
146
- {
147
- return [
148
- ['fooUTF-8', 'foo', 'foo'],
149
- ['UTF-8', null, 'foo'],
150
- ['42UTF-8', 42, 'foo'],
151
- ];
152
- }
153
-
154
- /**
155
- * @expectedException \Twig\Error\RuntimeError
156
- */
157
- public function testUnknownCustomEscaper()
158
- {
159
- twig_escape_filter(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), 'foo', 'bar');
160
- }
161
-
162
- /**
163
- * @dataProvider provideTwigFirstCases
164
- */
165
- public function testTwigFirst($expected, $input)
166
- {
167
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
168
- $this->assertSame($expected, twig_first($twig, $input));
169
- }
170
-
171
- public function provideTwigFirstCases()
172
- {
173
- $i = [1 => 'a', 2 => 'b', 3 => 'c'];
174
-
175
- return [
176
- ['a', 'abc'],
177
- [1, [1, 2, 3]],
178
- ['', null],
179
- ['', ''],
180
- ['a', new CoreTestIterator($i, array_keys($i), true, 3)],
181
- ];
182
- }
183
-
184
- /**
185
- * @dataProvider provideTwigLastCases
186
- */
187
- public function testTwigLast($expected, $input)
188
- {
189
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
190
- $this->assertSame($expected, twig_last($twig, $input));
191
- }
192
-
193
- public function provideTwigLastCases()
194
- {
195
- $i = [1 => 'a', 2 => 'b', 3 => 'c'];
196
-
197
- return [
198
- ['c', 'abc'],
199
- [3, [1, 2, 3]],
200
- ['', null],
201
- ['', ''],
202
- ['c', new CoreTestIterator($i, array_keys($i), true)],
203
- ];
204
- }
205
-
206
- /**
207
- * @dataProvider provideArrayKeyCases
208
- */
209
- public function testArrayKeysFilter(array $expected, $input)
210
- {
211
- $this->assertSame($expected, twig_get_array_keys_filter($input));
212
- }
213
-
214
- public function provideArrayKeyCases()
215
- {
216
- $array = ['a' => 'a1', 'b' => 'b1', 'c' => 'c1'];
217
- $keys = array_keys($array);
218
-
219
- return [
220
- [$keys, $array],
221
- [$keys, new CoreTestIterator($array, $keys)],
222
- [$keys, new CoreTestIteratorAggregate($array, $keys)],
223
- [$keys, new CoreTestIteratorAggregateAggregate($array, $keys)],
224
- [[], null],
225
- [['a'], new \SimpleXMLElement('<xml><a></a></xml>')],
226
- ];
227
- }
228
-
229
- /**
230
- * @dataProvider provideInFilterCases
231
- */
232
- public function testInFilter($expected, $value, $compare)
233
- {
234
- $this->assertSame($expected, twig_in_filter($value, $compare));
235
- }
236
-
237
- public function provideInFilterCases()
238
- {
239
- $array = [1, 2, 'a' => 3, 5, 6, 7];
240
- $keys = array_keys($array);
241
-
242
- return [
243
- [true, 1, $array],
244
- [true, '3', $array],
245
- [true, '3', 'abc3def'],
246
- [true, 1, new CoreTestIterator($array, $keys, true, 1)],
247
- [true, '3', new CoreTestIterator($array, $keys, true, 3)],
248
- [true, '3', new CoreTestIteratorAggregateAggregate($array, $keys, true, 3)],
249
- [false, 4, $array],
250
- [false, 4, new CoreTestIterator($array, $keys, true)],
251
- [false, 4, new CoreTestIteratorAggregateAggregate($array, $keys, true)],
252
- [false, 1, 1],
253
- [true, 'b', new \SimpleXMLElement('<xml><a>b</a></xml>')],
254
- ];
255
- }
256
-
257
- /**
258
- * @dataProvider provideSliceFilterCases
259
- */
260
- public function testSliceFilter($expected, $input, $start, $length = null, $preserveKeys = false)
261
- {
262
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
263
- $this->assertSame($expected, twig_slice($twig, $input, $start, $length, $preserveKeys));
264
- }
265
-
266
- public function provideSliceFilterCases()
267
- {
268
- $i = ['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4];
269
- $keys = array_keys($i);
270
-
271
- return [
272
- [['a' => 1], $i, 0, 1, true],
273
- [['a' => 1], $i, 0, 1, false],
274
- [['b' => 2, 'c' => 3], $i, 1, 2],
275
- [[1], [1, 2, 3, 4], 0, 1],
276
- [[2, 3], [1, 2, 3, 4], 1, 2],
277
- [[2, 3], new CoreTestIterator($i, $keys, true), 1, 2],
278
- [['c' => 3, 'd' => 4], new CoreTestIteratorAggregate($i, $keys, true), 2, null, true],
279
- [$i, new CoreTestIterator($i, $keys, true), 0, \count($keys) + 10, true],
280
- [[], new CoreTestIterator($i, $keys, true), \count($keys) + 10],
281
- ['de', 'abcdef', 3, 2],
282
- [[], new \SimpleXMLElement('<items><item>1</item><item>2</item></items>'), 3],
283
- [[], new \ArrayIterator([1, 2]), 3],
284
- ];
285
- }
286
- }
287
-
288
- function foo_escaper_for_test(Environment $env, $string, $charset)
289
- {
290
- return $string.$charset;
291
- }
292
-
293
- final class CoreTestIteratorAggregate implements \IteratorAggregate
294
- {
295
- private $iterator;
296
-
297
- public function __construct(array $array, array $keys, $allowAccess = false, $maxPosition = false)
298
- {
299
- $this->iterator = new CoreTestIterator($array, $keys, $allowAccess, $maxPosition);
300
- }
301
-
302
- public function getIterator()
303
- {
304
- return $this->iterator;
305
- }
306
- }
307
-
308
- final class CoreTestIteratorAggregateAggregate implements \IteratorAggregate
309
- {
310
- private $iterator;
311
-
312
- public function __construct(array $array, array $keys, $allowValueAccess = false, $maxPosition = false)
313
- {
314
- $this->iterator = new CoreTestIteratorAggregate($array, $keys, $allowValueAccess, $maxPosition);
315
- }
316
-
317
- public function getIterator()
318
- {
319
- return $this->iterator;
320
- }
321
- }
322
-
323
- final class CoreTestIterator implements Iterator
324
- {
325
- private $position;
326
- private $array;
327
- private $arrayKeys;
328
- private $allowValueAccess;
329
- private $maxPosition;
330
-
331
- public function __construct(array $values, array $keys, $allowValueAccess = false, $maxPosition = false)
332
- {
333
- $this->array = $values;
334
- $this->arrayKeys = $keys;
335
- $this->position = 0;
336
- $this->allowValueAccess = $allowValueAccess;
337
- $this->maxPosition = false === $maxPosition ? \count($values) + 1 : $maxPosition;
338
- }
339
-
340
- public function rewind()
341
- {
342
- $this->position = 0;
343
- }
344
-
345
- public function current()
346
- {
347
- if ($this->allowValueAccess) {
348
- return $this->array[$this->key()];
349
- }
350
-
351
- throw new \LogicException('Code should only use the keys, not the values provided by iterator.');
352
- }
353
-
354
- public function key()
355
- {
356
- return $this->arrayKeys[$this->position];
357
- }
358
-
359
- public function next()
360
- {
361
- ++$this->position;
362
- if ($this->position === $this->maxPosition) {
363
- throw new \LogicException(sprintf('Code should not iterate beyond %d.', $this->maxPosition));
364
- }
365
- }
366
-
367
- public function valid()
368
- {
369
- return isset($this->arrayKeys[$this->position]);
370
- }
371
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php DELETED
@@ -1,364 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Extension\SandboxExtension;
14
- use Twig\Loader\ArrayLoader;
15
- use Twig\Sandbox\SecurityError;
16
- use Twig\Sandbox\SecurityPolicy;
17
-
18
- class Twig_Tests_Extension_SandboxTest extends \PHPUnit\Framework\TestCase
19
- {
20
- protected static $params;
21
- protected static $templates;
22
-
23
- protected function setUp()
24
- {
25
- self::$params = [
26
- 'name' => 'Fabien',
27
- 'obj' => new FooObject(),
28
- 'arr' => ['obj' => new FooObject()],
29
- ];
30
-
31
- self::$templates = [
32
- '1_basic1' => '{{ obj.foo }}',
33
- '1_basic2' => '{{ name|upper }}',
34
- '1_basic3' => '{% if name %}foo{% endif %}',
35
- '1_basic4' => '{{ obj.bar }}',
36
- '1_basic5' => '{{ obj }}',
37
- '1_basic7' => '{{ cycle(["foo","bar"], 1) }}',
38
- '1_basic8' => '{{ obj.getfoobar }}{{ obj.getFooBar }}',
39
- '1_basic9' => '{{ obj.foobar }}{{ obj.fooBar }}',
40
- '1_basic' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}',
41
- '1_layout' => '{% block content %}{% endblock %}',
42
- '1_child' => "{% extends \"1_layout\" %}\n{% block content %}\n{{ \"a\"|json_encode }}\n{% endblock %}",
43
- '1_include' => '{{ include("1_basic1", sandboxed=true) }}',
44
- '1_range_operator' => '{{ (1..2)[0] }}',
45
- ];
46
- }
47
-
48
- /**
49
- * @expectedException \Twig\Sandbox\SecurityError
50
- * @expectedExceptionMessage Filter "json_encode" is not allowed in "1_child" at line 3.
51
- */
52
- public function testSandboxWithInheritance()
53
- {
54
- $twig = $this->getEnvironment(true, [], self::$templates, ['block']);
55
- $twig->load('1_child')->render([]);
56
- }
57
-
58
- public function testSandboxGloballySet()
59
- {
60
- $twig = $this->getEnvironment(false, [], self::$templates);
61
- $this->assertEquals('FOO', $twig->load('1_basic')->render(self::$params), 'Sandbox does nothing if it is disabled globally');
62
- }
63
-
64
- public function testSandboxUnallowedMethodAccessor()
65
- {
66
- $twig = $this->getEnvironment(true, [], self::$templates);
67
- try {
68
- $twig->load('1_basic1')->render(self::$params);
69
- $this->fail('Sandbox throws a SecurityError exception if an unallowed method is called');
70
- } catch (SecurityError $e) {
71
- $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError');
72
- $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class');
73
- $this->assertEquals('foo', $e->getMethodName(), 'Exception should be raised on the "foo" method');
74
- }
75
- }
76
-
77
- public function testSandboxUnallowedFilter()
78
- {
79
- $twig = $this->getEnvironment(true, [], self::$templates);
80
- try {
81
- $twig->load('1_basic2')->render(self::$params);
82
- $this->fail('Sandbox throws a SecurityError exception if an unallowed filter is called');
83
- } catch (SecurityError $e) {
84
- $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedFilterError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFilterError');
85
- $this->assertEquals('upper', $e->getFilterName(), 'Exception should be raised on the "upper" filter');
86
- }
87
- }
88
-
89
- public function testSandboxUnallowedTag()
90
- {
91
- $twig = $this->getEnvironment(true, [], self::$templates);
92
- try {
93
- $twig->load('1_basic3')->render(self::$params);
94
- $this->fail('Sandbox throws a SecurityError exception if an unallowed tag is used in the template');
95
- } catch (SecurityError $e) {
96
- $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedTagError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedTagError');
97
- $this->assertEquals('if', $e->getTagName(), 'Exception should be raised on the "if" tag');
98
- }
99
- }
100
-
101
- public function testSandboxUnallowedProperty()
102
- {
103
- $twig = $this->getEnvironment(true, [], self::$templates);
104
- try {
105
- $twig->load('1_basic4')->render(self::$params);
106
- $this->fail('Sandbox throws a SecurityError exception if an unallowed property is called in the template');
107
- } catch (SecurityError $e) {
108
- $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedPropertyError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedPropertyError');
109
- $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class');
110
- $this->assertEquals('bar', $e->getPropertyName(), 'Exception should be raised on the "bar" property');
111
- }
112
- }
113
-
114
- /**
115
- * @dataProvider getSandboxUnallowedToStringTests
116
- */
117
- public function testSandboxUnallowedToString($template)
118
- {
119
- $twig = $this->getEnvironment(true, [], ['index' => $template], [], ['upper'], ['FooObject' => 'getAnotherFooObject'], [], ['random']);
120
- try {
121
- $twig->load('index')->render(self::$params);
122
- $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template');
123
- } catch (SecurityError $e) {
124
- $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError');
125
- $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class');
126
- $this->assertEquals('__tostring', $e->getMethodName(), 'Exception should be raised on the "__toString" method');
127
- }
128
- }
129
-
130
- public function getSandboxUnallowedToStringTests()
131
- {
132
- return [
133
- 'simple' => ['{{ obj }}'],
134
- 'object_from_array' => ['{{ arr.obj }}'],
135
- 'object_chain' => ['{{ obj.anotherFooObject }}'],
136
- 'filter' => ['{{ obj|upper }}'],
137
- 'filter_from_array' => ['{{ arr.obj|upper }}'],
138
- 'function' => ['{{ random(obj) }}'],
139
- 'function_from_array' => ['{{ random(arr.obj) }}'],
140
- 'function_and_filter' => ['{{ random(obj|upper) }}'],
141
- 'function_and_filter_from_array' => ['{{ random(arr.obj|upper) }}'],
142
- 'object_chain_and_filter' => ['{{ obj.anotherFooObject|upper }}'],
143
- 'object_chain_and_function' => ['{{ random(obj.anotherFooObject) }}'],
144
- 'concat' => ['{{ obj ~ "" }}'],
145
- 'concat_again' => ['{{ "" ~ obj }}'],
146
- ];
147
- }
148
-
149
- /**
150
- * @dataProvider getSandboxAllowedToStringTests
151
- */
152
- public function testSandboxAllowedToString($template, $output)
153
- {
154
- $twig = $this->getEnvironment(true, [], ['index' => $template], ['set'], [], ['FooObject' => ['foo', 'getAnotherFooObject']]);
155
- $this->assertEquals($output, $twig->load('index')->render(self::$params));
156
- }
157
-
158
- public function getSandboxAllowedToStringTests()
159
- {
160
- return [
161
- 'constant_test' => ['{{ obj is constant("PHP_INT_MAX") }}', ''],
162
- 'set_object' => ['{% set a = obj.anotherFooObject %}{{ a.foo }}', 'foo'],
163
- 'is_defined' => ['{{ obj.anotherFooObject is defined }}', '1'],
164
- 'is_null' => ['{{ obj is null }}', ''],
165
- 'is_sameas' => ['{{ obj is same as(obj) }}', '1'],
166
- 'is_sameas_from_array' => ['{{ arr.obj is same as(arr.obj) }}', '1'],
167
- 'is_sameas_from_another_method' => ['{{ obj.anotherFooObject is same as(obj.anotherFooObject) }}', ''],
168
- ];
169
- }
170
-
171
- public function testSandboxAllowMethodToString()
172
- {
173
- $twig = $this->getEnvironment(true, [], self::$templates, [], [], ['FooObject' => '__toString']);
174
- FooObject::reset();
175
- $this->assertEquals('foo', $twig->load('1_basic5')->render(self::$params), 'Sandbox allow some methods');
176
- $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once');
177
- }
178
-
179
- public function testSandboxAllowMethodToStringDisabled()
180
- {
181
- $twig = $this->getEnvironment(false, [], self::$templates);
182
- FooObject::reset();
183
- $this->assertEquals('foo', $twig->load('1_basic5')->render(self::$params), 'Sandbox allows __toString when sandbox disabled');
184
- $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once');
185
- }
186
-
187
- public function testSandboxUnallowedFunction()
188
- {
189
- $twig = $this->getEnvironment(true, [], self::$templates);
190
- try {
191
- $twig->load('1_basic7')->render(self::$params);
192
- $this->fail('Sandbox throws a SecurityError exception if an unallowed function is called in the template');
193
- } catch (SecurityError $e) {
194
- $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedFunctionError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFunctionError');
195
- $this->assertEquals('cycle', $e->getFunctionName(), 'Exception should be raised on the "cycle" function');
196
- }
197
- }
198
-
199
- public function testSandboxUnallowedRangeOperator()
200
- {
201
- $twig = $this->getEnvironment(true, [], self::$templates);
202
- try {
203
- $twig->load('1_range_operator')->render(self::$params);
204
- $this->fail('Sandbox throws a SecurityError exception if the unallowed range operator is called');
205
- } catch (SecurityError $e) {
206
- $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedFunctionError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFunctionError');
207
- $this->assertEquals('range', $e->getFunctionName(), 'Exception should be raised on the "range" function');
208
- }
209
- }
210
-
211
- public function testSandboxAllowMethodFoo()
212
- {
213
- $twig = $this->getEnvironment(true, [], self::$templates, [], [], ['FooObject' => 'foo']);
214
- FooObject::reset();
215
- $this->assertEquals('foo', $twig->load('1_basic1')->render(self::$params), 'Sandbox allow some methods');
216
- $this->assertEquals(1, FooObject::$called['foo'], 'Sandbox only calls method once');
217
- }
218
-
219
- public function testSandboxAllowFilter()
220
- {
221
- $twig = $this->getEnvironment(true, [], self::$templates, [], ['upper']);
222
- $this->assertEquals('FABIEN', $twig->load('1_basic2')->render(self::$params), 'Sandbox allow some filters');
223
- }
224
-
225
- public function testSandboxAllowTag()
226
- {
227
- $twig = $this->getEnvironment(true, [], self::$templates, ['if']);
228
- $this->assertEquals('foo', $twig->load('1_basic3')->render(self::$params), 'Sandbox allow some tags');
229
- }
230
-
231
- public function testSandboxAllowProperty()
232
- {
233
- $twig = $this->getEnvironment(true, [], self::$templates, [], [], [], ['FooObject' => 'bar']);
234
- $this->assertEquals('bar', $twig->load('1_basic4')->render(self::$params), 'Sandbox allow some properties');
235
- }
236
-
237
- public function testSandboxAllowFunction()
238
- {
239
- $twig = $this->getEnvironment(true, [], self::$templates, [], [], [], [], ['cycle']);
240
- $this->assertEquals('bar', $twig->load('1_basic7')->render(self::$params), 'Sandbox allow some functions');
241
- }
242
-
243
- public function testSandboxAllowRangeOperator()
244
- {
245
- $twig = $this->getEnvironment(true, [], self::$templates, [], [], [], [], ['range']);
246
- $this->assertEquals('1', $twig->load('1_range_operator')->render(self::$params), 'Sandbox allow the range operator');
247
- }
248
-
249
- public function testSandboxAllowFunctionsCaseInsensitive()
250
- {
251
- foreach (['getfoobar', 'getFoobar', 'getFooBar'] as $name) {
252
- $twig = $this->getEnvironment(true, [], self::$templates, [], [], ['FooObject' => $name]);
253
- FooObject::reset();
254
- $this->assertEquals('foobarfoobar', $twig->load('1_basic8')->render(self::$params), 'Sandbox allow methods in a case-insensitive way');
255
- $this->assertEquals(2, FooObject::$called['getFooBar'], 'Sandbox only calls method once');
256
-
257
- $this->assertEquals('foobarfoobar', $twig->load('1_basic9')->render(self::$params), 'Sandbox allow methods via shortcut names (ie. without get/set)');
258
- }
259
- }
260
-
261
- public function testSandboxLocallySetForAnInclude()
262
- {
263
- self::$templates = [
264
- '2_basic' => '{{ obj.foo }}{% include "2_included" %}{{ obj.foo }}',
265
- '2_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}',
266
- ];
267
-
268
- $twig = $this->getEnvironment(false, [], self::$templates);
269
- $this->assertEquals('fooFOOfoo', $twig->load('2_basic')->render(self::$params), 'Sandbox does nothing if disabled globally and sandboxed not used for the include');
270
-
271
- self::$templates = [
272
- '3_basic' => '{{ obj.foo }}{% sandbox %}{% include "3_included" %}{% endsandbox %}{{ obj.foo }}',
273
- '3_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}',
274
- ];
275
-
276
- $twig = $this->getEnvironment(true, [], self::$templates);
277
- try {
278
- $twig->load('3_basic')->render(self::$params);
279
- $this->fail('Sandbox throws a SecurityError exception when the included file is sandboxed');
280
- } catch (SecurityError $e) {
281
- $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedTagError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedTagError');
282
- $this->assertEquals('sandbox', $e->getTagName());
283
- }
284
- }
285
-
286
- public function testMacrosInASandbox()
287
- {
288
- $twig = $this->getEnvironment(true, ['autoescape' => 'html'], ['index' => <<<EOF
289
- {%- import _self as macros %}
290
-
291
- {%- macro test(text) %}<p>{{ text }}</p>{% endmacro %}
292
-
293
- {{- macros.test('username') }}
294
- EOF
295
- ], ['macro', 'import'], ['escape']);
296
-
297
- $this->assertEquals('<p>username</p>', $twig->load('index')->render([]));
298
- }
299
-
300
- public function testSandboxDisabledAfterIncludeFunctionError()
301
- {
302
- $twig = $this->getEnvironment(false, [], self::$templates);
303
-
304
- $e = null;
305
- try {
306
- $twig->load('1_include')->render(self::$params);
307
- } catch (\Throwable $e) {
308
- } catch (\Exception $e) {
309
- }
310
- if (null === $e) {
311
- $this->fail('An exception should be thrown for this test to be valid.');
312
- }
313
-
314
- $this->assertFalse($twig->getExtension('\Twig\Extension\SandboxExtension')->isSandboxed(), 'Sandboxed include() function call should not leave Sandbox enabled when an error occurs.');
315
- }
316
-
317
- protected function getEnvironment($sandboxed, $options, $templates, $tags = [], $filters = [], $methods = [], $properties = [], $functions = [])
318
- {
319
- $loader = new ArrayLoader($templates);
320
- $twig = new Environment($loader, array_merge(['debug' => true, 'cache' => false, 'autoescape' => false], $options));
321
- $policy = new SecurityPolicy($tags, $filters, $methods, $properties, $functions);
322
- $twig->addExtension(new SandboxExtension($policy, $sandboxed));
323
-
324
- return $twig;
325
- }
326
- }
327
-
328
- class FooObject
329
- {
330
- public static $called = ['__toString' => 0, 'foo' => 0, 'getFooBar' => 0];
331
-
332
- public $bar = 'bar';
333
-
334
- public static function reset()
335
- {
336
- self::$called = ['__toString' => 0, 'foo' => 0, 'getFooBar' => 0];
337
- }
338
-
339
- public function __toString()
340
- {
341
- ++self::$called['__toString'];
342
-
343
- return 'foo';
344
- }
345
-
346
- public function foo()
347
- {
348
- ++self::$called['foo'];
349
-
350
- return 'foo';
351
- }
352
-
353
- public function getFooBar()
354
- {
355
- ++self::$called['getFooBar'];
356
-
357
- return 'foobar';
358
- }
359
-
360
- public function getAnotherFooObject()
361
- {
362
- return new self();
363
- }
364
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\RuntimeLoader\FactoryRuntimeLoader;
13
-
14
- class Twig_Tests_FactoryRuntimeLoaderTest extends \PHPUnit\Framework\TestCase
15
- {
16
- public function testLoad()
17
- {
18
- $loader = new FactoryRuntimeLoader(['stdClass' => 'getRuntime']);
19
-
20
- $this->assertInstanceOf('stdClass', $loader->load('stdClass'));
21
- }
22
-
23
- public function testLoadReturnsNullForUnmappedRuntime()
24
- {
25
- $loader = new FactoryRuntimeLoader();
26
-
27
- $this->assertNull($loader->load('stdClass'));
28
- }
29
- }
30
-
31
- function getRuntime()
32
- {
33
- return new \stdClass();
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/FileCachingTest.php DELETED
@@ -1,66 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Loader\ArrayLoader;
14
-
15
- require_once __DIR__.'/FilesystemHelper.php';
16
-
17
- class Twig_Tests_FileCachingTest extends \PHPUnit\Framework\TestCase
18
- {
19
- private $env;
20
- private $tmpDir;
21
-
22
- protected function setUp()
23
- {
24
- $this->tmpDir = sys_get_temp_dir().'/TwigTests';
25
- if (!file_exists($this->tmpDir)) {
26
- @mkdir($this->tmpDir, 0777, true);
27
- }
28
-
29
- if (!is_writable($this->tmpDir)) {
30
- $this->markTestSkipped(sprintf('Unable to run the tests as "%s" is not writable.', $this->tmpDir));
31
- }
32
-
33
- $this->env = new Environment(new ArrayLoader(['index' => 'index', 'index2' => 'index2']), ['cache' => $this->tmpDir]);
34
- }
35
-
36
- protected function tearDown()
37
- {
38
- Twig_Tests_FilesystemHelper::removeDir($this->tmpDir);
39
- }
40
-
41
- /**
42
- * @group legacy
43
- */
44
- public function testWritingCacheFiles()
45
- {
46
- $name = 'index';
47
- $this->env->load($name);
48
- $cacheFileName = $this->env->getCacheFilename($name);
49
-
50
- $this->assertFileExists($cacheFileName, 'Cache file does not exist.');
51
- }
52
-
53
- /**
54
- * @group legacy
55
- */
56
- public function testClearingCacheFiles()
57
- {
58
- $name = 'index2';
59
- $this->env->load($name);
60
- $cacheFileName = $this->env->getCacheFilename($name);
61
-
62
- $this->assertFileExists($cacheFileName, 'Cache file does not exist.');
63
- $this->env->clearCacheFiles();
64
- $this->assertFileNotExists($cacheFileName, 'Cache file was not cleared.');
65
- }
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php DELETED
@@ -1,53 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\FileExtensionEscapingStrategy;
13
-
14
- class Twig_Tests_FileExtensionEscapingStrategyTest extends \PHPUnit\Framework\TestCase
15
- {
16
- /**
17
- * @dataProvider getGuessData
18
- */
19
- public function testGuess($strategy, $filename)
20
- {
21
- $this->assertSame($strategy, FileExtensionEscapingStrategy::guess($filename));
22
- }
23
-
24
- public function getGuessData()
25
- {
26
- return [
27
- // default
28
- ['html', 'foo.html'],
29
- ['html', 'foo.html.twig'],
30
- ['html', 'foo'],
31
- ['html', 'foo.bar.twig'],
32
- ['html', 'foo.txt/foo'],
33
- ['html', 'foo.txt/foo.js/'],
34
-
35
- // css
36
- ['css', 'foo.css'],
37
- ['css', 'foo.css.twig'],
38
- ['css', 'foo.twig.css'],
39
- ['css', 'foo.js.css'],
40
- ['css', 'foo.js.css.twig'],
41
-
42
- // js
43
- ['js', 'foo.js'],
44
- ['js', 'foo.js.twig'],
45
- ['js', 'foo.txt/foo.js'],
46
- ['js', 'foo.txt.twig/foo.js'],
47
-
48
- // txt
49
- [false, 'foo.txt'],
50
- [false, 'foo.txt.twig'],
51
- ];
52
- }
53
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- class Twig_Tests_FilesystemHelper
13
- {
14
- public static function removeDir($dir)
15
- {
16
- $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir, PHP_VERSION_ID < 50300 ? 0 : \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST);
17
- foreach ($iterator as $filename => $fileInfo) {
18
- if ($iterator->isDot()) {
19
- continue;
20
- }
21
-
22
- if ($fileInfo->isDir()) {
23
- rmdir($filename);
24
- } else {
25
- unlink($filename);
26
- }
27
- }
28
- rmdir($dir);
29
- }
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test DELETED
@@ -1,28 +0,0 @@
1
- --TEST--
2
- Twig supports method calls
3
- --TEMPLATE--
4
- {{ items.foo.foo }}
5
- {{ items.foo.getFoo() }}
6
- {{ items.foo.bar }}
7
- {{ items.foo['bar'] }}
8
- {{ items.foo.bar('a', 43) }}
9
- {{ items.foo.bar(foo) }}
10
- {{ items.foo.self.foo() }}
11
- {{ items.foo.is }}
12
- {{ items.foo.in }}
13
- {{ items.foo.not }}
14
- --DATA--
15
- return ['foo' => 'bar', 'items' => ['foo' => new TwigTestFoo(), 'bar' => 'foo']]
16
- --CONFIG--
17
- return ['strict_variables' => false]
18
- --EXPECT--
19
- foo
20
- foo
21
- bar
22
-
23
- bar_a-43
24
- bar_bar
25
- foo
26
- is
27
- in
28
- not
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test DELETED
@@ -1,150 +0,0 @@
1
- --TEST--
2
- "default" filter
3
- --TEMPLATE--
4
- Variable:
5
- {{ definedVar |default('default') is same as('default') ? 'ko' : 'ok' }}
6
- {{ zeroVar |default('default') is same as('default') ? 'ko' : 'ok' }}
7
- {{ emptyVar |default('default') is same as('default') ? 'ok' : 'ko' }}
8
- {{ nullVar |default('default') is same as('default') ? 'ok' : 'ko' }}
9
- {{ undefinedVar |default('default') is same as('default') ? 'ok' : 'ko' }}
10
- Array access:
11
- {{ nested.definedVar |default('default') is same as('default') ? 'ko' : 'ok' }}
12
- {{ nested['definedVar'] |default('default') is same as('default') ? 'ko' : 'ok' }}
13
- {{ nested.zeroVar |default('default') is same as('default') ? 'ko' : 'ok' }}
14
- {{ nested.emptyVar |default('default') is same as('default') ? 'ok' : 'ko' }}
15
- {{ nested.nullVar |default('default') is same as('default') ? 'ok' : 'ko' }}
16
- {{ nested.undefinedVar |default('default') is same as('default') ? 'ok' : 'ko' }}
17
- {{ nested['undefinedVar'] |default('default') is same as('default') ? 'ok' : 'ko' }}
18
- {{ undefinedVar.foo |default('default') is same as('default') ? 'ok' : 'ko' }}
19
- Plain values:
20
- {{ 'defined' |default('default') is same as('default') ? 'ko' : 'ok' }}
21
- {{ 0 |default('default') is same as('default') ? 'ko' : 'ok' }}
22
- {{ '' |default('default') is same as('default') ? 'ok' : 'ko' }}
23
- {{ null |default('default') is same as('default') ? 'ok' : 'ko' }}
24
- Precedence:
25
- {{ 'o' ~ nullVar |default('k') }}
26
- {{ 'o' ~ nested.nullVar |default('k') }}
27
- Object methods:
28
- {{ object.foo |default('default') is same as('default') ? 'ko' : 'ok' }}
29
- {{ object.undefinedMethod |default('default') is same as('default') ? 'ok' : 'ko' }}
30
- {{ object.getFoo() |default('default') is same as('default') ? 'ko' : 'ok' }}
31
- {{ object.getFoo('a') |default('default') is same as('default') ? 'ko' : 'ok' }}
32
- {{ object.undefinedMethod() |default('default') is same as('default') ? 'ok' : 'ko' }}
33
- {{ object.undefinedMethod('a') |default('default') is same as('default') ? 'ok' : 'ko' }}
34
- Deep nested:
35
- {{ nested.undefinedVar.foo.bar |default('default') is same as('default') ? 'ok' : 'ko' }}
36
- {{ nested.definedArray.0 |default('default') is same as('default') ? 'ko' : 'ok' }}
37
- {{ nested['definedArray'][0] |default('default') is same as('default') ? 'ko' : 'ok' }}
38
- {{ object.self.foo |default('default') is same as('default') ? 'ko' : 'ok' }}
39
- {{ object.self.undefinedMethod |default('default') is same as('default') ? 'ok' : 'ko' }}
40
- {{ object.undefinedMethod.self |default('default') is same as('default') ? 'ok' : 'ko' }}
41
- --DATA--
42
- return [
43
- 'definedVar' => 'defined',
44
- 'zeroVar' => 0,
45
- 'emptyVar' => '',
46
- 'nullVar' => null,
47
- 'nested' => [
48
- 'definedVar' => 'defined',
49
- 'zeroVar' => 0,
50
- 'emptyVar' => '',
51
- 'nullVar' => null,
52
- 'definedArray' => [0],
53
- ],
54
- 'object' => new TwigTestFoo(),
55
- ]
56
- --CONFIG--
57
- return ['strict_variables' => false]
58
- --EXPECT--
59
- Variable:
60
- ok
61
- ok
62
- ok
63
- ok
64
- ok
65
- Array access:
66
- ok
67
- ok
68
- ok
69
- ok
70
- ok
71
- ok
72
- ok
73
- ok
74
- Plain values:
75
- ok
76
- ok
77
- ok
78
- ok
79
- Precedence:
80
- ok
81
- ok
82
- Object methods:
83
- ok
84
- ok
85
- ok
86
- ok
87
- ok
88
- ok
89
- Deep nested:
90
- ok
91
- ok
92
- ok
93
- ok
94
- ok
95
- ok
96
- --DATA--
97
- return [
98
- 'definedVar' => 'defined',
99
- 'zeroVar' => 0,
100
- 'emptyVar' => '',
101
- 'nullVar' => null,
102
- 'nested' => [
103
- 'definedVar' => 'defined',
104
- 'zeroVar' => 0,
105
- 'emptyVar' => '',
106
- 'nullVar' => null,
107
- 'definedArray' => [0],
108
- ],
109
- 'object' => new TwigTestFoo(),
110
- ]
111
- --CONFIG--
112
- return ['strict_variables' => true]
113
- --EXPECT--
114
- Variable:
115
- ok
116
- ok
117
- ok
118
- ok
119
- ok
120
- Array access:
121
- ok
122
- ok
123
- ok
124
- ok
125
- ok
126
- ok
127
- ok
128
- ok
129
- Plain values:
130
- ok
131
- ok
132
- ok
133
- ok
134
- Precedence:
135
- ok
136
- ok
137
- Object methods:
138
- ok
139
- ok
140
- ok
141
- ok
142
- ok
143
- ok
144
- Deep nested:
145
- ok
146
- ok
147
- ok
148
- ok
149
- ok
150
- ok
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Fixtures/filters/filter.test DELETED
@@ -1,46 +0,0 @@
1
- --TEST--
2
- "filter" filter
3
- --TEMPLATE--
4
- {% set offset = 3 %}
5
-
6
- {% for k, v in [1, 5, 3, 4, 5]|filter((v) => v > offset) -%}
7
- {{ k }} = {{ v }}
8
- {% endfor %}
9
-
10
- {% for k, v in {a: 1, b: 2, c: 5, d: 8}|filter(v => v > offset) -%}
11
- {{ k }} = {{ v }}
12
- {% endfor %}
13
-
14
- {% for k, v in [1, 5, 3, 4, 5]|filter(v => v > offset) -%}
15
- {{ k }} = {{ v }}
16
- {% endfor %}
17
-
18
- {% for k, v in it|filter((v) => v > offset) -%}
19
- {{ k }} = {{ v }}
20
- {% endfor %}
21
-
22
- {% for k, v in ita|filter(v => v > offset) -%}
23
- {{ k }} = {{ v }}
24
- {% endfor %}
25
- --DATA--
26
- return [
27
- 'it' => new \ArrayIterator(['a' => 1, 'b' => 2, 'c' => 5, 'd' => 8]),
28
- 'ita' => new IteratorAggregateStub(['a' => 1, 'b' => 2, 'c' => 5, 'd' => 8]),
29
- ]
30
- --EXPECT--
31
- 1 = 5
32
- 3 = 4
33
- 4 = 5
34
-
35
- c = 5
36
- d = 8
37
-
38
- 1 = 5
39
- 3 = 4
40
- 4 = 5
41
-
42
- c = 5
43
- d = 8
44
-
45
- c = 5
46
- d = 8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test DELETED
@@ -1,38 +0,0 @@
1
- --TEST--
2
- "join" filter
3
- --TEMPLATE--
4
- {{ ["foo", "bar"]|join(', ') }}
5
- {{ foo|join(', ') }}
6
- {{ bar|join(', ') }}
7
-
8
- {{ ["foo", "bar"]|join(', ', ' and ') }}
9
- {{ foo|join(', ', ' and ') }}
10
- {{ bar|join(', ', ' and ') }}
11
- {{ ["one", "two", "three"]|join(', ', ' and ') }}
12
- {{ ["a", "b", "c"]|join('','-') }}
13
- {{ ["a", "b", "c"]|join('-','-') }}
14
- {{ ["a", "b", "c"]|join('-','') }}
15
- {{ ["hello"]|join('|','-') }}
16
-
17
- {{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join }}
18
- {{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join(',') }}
19
- {{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join(',','-') }}
20
- --DATA--
21
- return ['foo' => new TwigTestFoo(), 'bar' => new \ArrayObject([3, 4])]
22
- --EXPECT--
23
- foo, bar
24
- 1, 2
25
- 3, 4
26
-
27
- foo and bar
28
- 1 and 2
29
- 3 and 4
30
- one, two and three
31
- ab-c
32
- a-b-c
33
- a-bc
34
- hello
35
-
36
- wxyz
37
- w,x,y,z
38
- w,x,y-z
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test DELETED
@@ -1,40 +0,0 @@
1
- --TEST--
2
- "length" filter
3
- --TEMPLATE--
4
- {{ array|length }}
5
- {{ string|length }}
6
- {{ number|length }}
7
- {{ to_string_able|length }}
8
- {{ countable|length }}
9
- {{ iterator_aggregate|length }}
10
- {{ null|length }}
11
- {{ magic|length }}
12
- {{ non_countable|length }}
13
- {{ simple_xml_element|length }}
14
- {{ iterator|length }}
15
- --DATA--
16
- return [
17
- 'array' => [1, 4],
18
- 'string' => 'foo',
19
- 'number' => 1000,
20
- 'to_string_able' => new ToStringStub('foobar'),
21
- 'countable' => new CountableStub(42), /* also asserts we do *not* call __toString() */
22
- 'iterator_aggregate' => new IteratorAggregateStub(['a', 'b', 'c']), /* also asserts we do *not* call __toString() */
23
- 'null' => null,
24
- 'magic' => new MagicCallStub(), /* used to assert we do *not* call __call */
25
- 'non_countable' => new \StdClass(),
26
- 'simple_xml_element' => new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><doc><elem/><elem/></doc>'),
27
- 'iterator' => new \SimpleIteratorForTesting()
28
- ]
29
- --EXPECT--
30
- 2
31
- 3
32
- 4
33
- 6
34
- 42
35
- 3
36
- 0
37
- 1
38
- 1
39
- 2
40
- 7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test DELETED
@@ -1,20 +0,0 @@
1
- --TEST--
2
- "split" filter
3
- --TEMPLATE--
4
- {{ "one,two,three,four,five"|split(',')|join('-') }}
5
- {{ foo|split(',')|join('-') }}
6
- {{ foo|split(',', 3)|join('-') }}
7
- {{ baz|split('')|join('-') }}
8
- {{ baz|split('', 1)|join('-') }}
9
- {{ baz|split('', 2)|join('-') }}
10
- {{ foo|split(',', -2)|join('-') }}
11
- --DATA--
12
- return ['foo' => "one,two,three,four,five", 'baz' => '12345',]
13
- --EXPECT--
14
- one-two-three-four-five
15
- one-two-three-four-five
16
- one-two-three,four,five
17
- 1-2-3-4-5
18
- 1-2-3-4-5
19
- 12-34-5
20
- one-two-three
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test DELETED
@@ -1,18 +0,0 @@
1
- --TEST--
2
- "attribute" function
3
- --TEMPLATE--
4
- {{ attribute(obj, method) }}
5
- {{ attribute(array, item) }}
6
- {{ attribute(obj, "bar", ["a", "b"]) }}
7
- {{ attribute(obj, "bar", arguments) }}
8
- {{ attribute(obj, method) is defined ? 'ok' : 'ko' }}
9
- {{ attribute(obj, nonmethod) is defined ? 'ok' : 'ko' }}
10
- --DATA--
11
- return ['obj' => new TwigTestFoo(), 'method' => 'foo', 'array' => ['foo' => 'bar'], 'item' => 'foo', 'nonmethod' => 'xxx', 'arguments' => ['a', 'b']]
12
- --EXPECT--
13
- foo
14
- bar
15
- bar_a-b
16
- bar_a-b
17
- ok
18
- ko
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test DELETED
@@ -1,14 +0,0 @@
1
- --TEST--
2
- "const" test
3
- --TEMPLATE--
4
- {{ 8 is constant('E_NOTICE') ? 'ok' : 'no' }}
5
- {{ 'bar' is constant('TwigTestFoo::BAR_NAME') ? 'ok' : 'no' }}
6
- {{ value is constant('TwigTestFoo::BAR_NAME') ? 'ok' : 'no' }}
7
- {{ 2 is constant('ARRAY_AS_PROPS', object) ? 'ok' : 'no' }}
8
- --DATA--
9
- return ['value' => 'bar', 'object' => new \ArrayObject(['hi'])]
10
- --EXPECT--
11
- ok
12
- ok
13
- ok
14
- ok
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test DELETED
@@ -1,129 +0,0 @@
1
- --TEST--
2
- "defined" test
3
- --TEMPLATE--
4
- {{ definedVar is defined ? 'ok' : 'ko' }}
5
- {{ definedVar is not defined ? 'ko' : 'ok' }}
6
- {{ undefinedVar is defined ? 'ko' : 'ok' }}
7
- {{ undefinedVar is not defined ? 'ok' : 'ko' }}
8
- {{ zeroVar is defined ? 'ok' : 'ko' }}
9
- {{ nullVar is defined ? 'ok' : 'ko' }}
10
- {{ nested.definedVar is defined ? 'ok' : 'ko' }}
11
- {{ nested['definedVar'] is defined ? 'ok' : 'ko' }}
12
- {{ nested.definedVar is not defined ? 'ko' : 'ok' }}
13
- {{ nested.undefinedVar is defined ? 'ko' : 'ok' }}
14
- {{ nested['undefinedVar'] is defined ? 'ko' : 'ok' }}
15
- {{ nested.undefinedVar is not defined ? 'ok' : 'ko' }}
16
- {{ nested.zeroVar is defined ? 'ok' : 'ko' }}
17
- {{ nested.nullVar is defined ? 'ok' : 'ko' }}
18
- {{ nested.definedArray.0 is defined ? 'ok' : 'ko' }}
19
- {{ nested['definedArray'][0] is defined ? 'ok' : 'ko' }}
20
- {{ object.foo is defined ? 'ok' : 'ko' }}
21
- {{ object.undefinedMethod is defined ? 'ko' : 'ok' }}
22
- {{ object.getFoo() is defined ? 'ok' : 'ko' }}
23
- {{ object.getFoo('a') is defined ? 'ok' : 'ko' }}
24
- {{ object.undefinedMethod() is defined ? 'ko' : 'ok' }}
25
- {{ object.undefinedMethod('a') is defined ? 'ko' : 'ok' }}
26
- {{ object.self.foo is defined ? 'ok' : 'ko' }}
27
- {{ object.self.undefinedMethod is defined ? 'ko' : 'ok' }}
28
- {{ object.undefinedMethod.self is defined ? 'ko' : 'ok' }}
29
- {{ 0 is defined ? 'ok' : 'ko' }}
30
- {{ "foo" is defined ? 'ok' : 'ko' }}
31
- {{ true is defined ? 'ok' : 'ko' }}
32
- {{ false is defined ? 'ok' : 'ko' }}
33
- {{ null is defined ? 'ok' : 'ko' }}
34
- {{ [1, 2] is defined ? 'ok' : 'ko' }}
35
- {{ { foo: "bar" } is defined ? 'ok' : 'ko' }}
36
- --DATA--
37
- return [
38
- 'definedVar' => 'defined',
39
- 'zeroVar' => 0,
40
- 'nullVar' => null,
41
- 'nested' => [
42
- 'definedVar' => 'defined',
43
- 'zeroVar' => 0,
44
- 'nullVar' => null,
45
- 'definedArray' => [0],
46
- ],
47
- 'object' => new TwigTestFoo(),
48
- ]
49
- --EXPECT--
50
- ok
51
- ok
52
- ok
53
- ok
54
- ok
55
- ok
56
- ok
57
- ok
58
- ok
59
- ok
60
- ok
61
- ok
62
- ok
63
- ok
64
- ok
65
- ok
66
- ok
67
- ok
68
- ok
69
- ok
70
- ok
71
- ok
72
- ok
73
- ok
74
- ok
75
- ok
76
- ok
77
- ok
78
- ok
79
- ok
80
- ok
81
- ok
82
- --DATA--
83
- return [
84
- 'definedVar' => 'defined',
85
- 'zeroVar' => 0,
86
- 'nullVar' => null,
87
- 'nested' => [
88
- 'definedVar' => 'defined',
89
- 'zeroVar' => 0,
90
- 'nullVar' => null,
91
- 'definedArray' => [0],
92
- ],
93
- 'object' => new TwigTestFoo(),
94
- ]
95
- --CONFIG--
96
- return ['strict_variables' => false]
97
- --EXPECT--
98
- ok
99
- ok
100
- ok
101
- ok
102
- ok
103
- ok
104
- ok
105
- ok
106
- ok
107
- ok
108
- ok
109
- ok
110
- ok
111
- ok
112
- ok
113
- ok
114
- ok
115
- ok
116
- ok
117
- ok
118
- ok
119
- ok
120
- ok
121
- ok
122
- ok
123
- ok
124
- ok
125
- ok
126
- ok
127
- ok
128
- ok
129
- ok
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test DELETED
@@ -1,42 +0,0 @@
1
- --TEST--
2
- "empty" test
3
- --TEMPLATE--
4
- {{ string_empty is empty ? 'ok' : 'ko' }}
5
- {{ string_zero is empty ? 'ko' : 'ok' }}
6
- {{ value_null is empty ? 'ok' : 'ko' }}
7
- {{ value_false is empty ? 'ok' : 'ko' }}
8
- {{ value_int_zero is empty ? 'ko' : 'ok' }}
9
- {{ array_empty is empty ? 'ok' : 'ko' }}
10
- {{ array_not_empty is empty ? 'ko' : 'ok' }}
11
- {{ magically_callable is empty ? 'ko' : 'ok' }}
12
- {{ countable_empty is empty ? 'ok' : 'ko' }}
13
- {{ countable_not_empty is empty ? 'ko' : 'ok' }}
14
- {{ tostring_empty is empty ? 'ok' : 'ko' }}
15
- {{ tostring_not_empty is empty ? 'ko' : 'ok' }}
16
- {{ markup_empty is empty ? 'ok' : 'ko' }}
17
- {{ markup_not_empty is empty ? 'ko' : 'ok' }}
18
- --DATA--
19
- return [
20
- 'string_empty' => '', 'string_zero' => '0',
21
- 'value_null' => null, 'value_false' => false, 'value_int_zero' => 0,
22
- 'array_empty' => [], 'array_not_empty' => [1, 2],
23
- 'magically_callable' => new MagicCallStub(),
24
- 'countable_empty' => new CountableStub([]), 'countable_not_empty' => new CountableStub([1, 2]),
25
- 'tostring_empty' => new ToStringStub(''), 'tostring_not_empty' => new ToStringStub('0' /* edge case of using "0" as the string */),
26
- 'markup_empty' => new \Twig\Markup('', 'UTF-8'), 'markup_not_empty' => new \Twig\Markup('test', 'UTF-8'),
27
- ]
28
- --EXPECT--
29
- ok
30
- ok
31
- ok
32
- ok
33
- ok
34
- ok
35
- ok
36
- ok
37
- ok
38
- ok
39
- ok
40
- ok
41
- ok
42
- ok
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test DELETED
@@ -1,19 +0,0 @@
1
- --TEST--
2
- Twig supports the in operator when using objects
3
- --TEMPLATE--
4
- {% if object in object_list %}
5
- TRUE
6
- {% endif %}
7
- --DATA--
8
- $foo = new TwigTestFoo();
9
- $foo1 = new TwigTestFoo();
10
-
11
- $foo->position = $foo1;
12
- $foo1->position = $foo;
13
-
14
- return [
15
- 'object' => $foo,
16
- 'object_list' => [$foo1, $foo],
17
- ]
18
- --EXPECT--
19
- TRUE
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/IntegrationTest.php DELETED
@@ -1,384 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Extension\AbstractExtension;
13
- use Twig\Extension\DebugExtension;
14
- use Twig\Extension\SandboxExtension;
15
- use Twig\Extension\StringLoaderExtension;
16
- use Twig\Node\Expression\ConstantExpression;
17
- use Twig\Node\PrintNode;
18
- use Twig\Sandbox\SecurityPolicy;
19
- use Twig\Test\IntegrationTestCase;
20
- use Twig\Token;
21
- use Twig\TokenParser\AbstractTokenParser;
22
- use Twig\TwigFilter;
23
- use Twig\TwigFunction;
24
- use Twig\TwigTest;
25
-
26
- // This function is defined to check that escaping strategies
27
- // like html works even if a function with the same name is defined.
28
- function html()
29
- {
30
- return 'foo';
31
- }
32
-
33
- class Twig_Tests_IntegrationTest extends IntegrationTestCase
34
- {
35
- public function getExtensions()
36
- {
37
- $policy = new SecurityPolicy([], [], [], [], ['dump']);
38
-
39
- return [
40
- new DebugExtension(),
41
- new SandboxExtension($policy, false),
42
- new StringLoaderExtension(),
43
- new TwigTestExtension(),
44
- ];
45
- }
46
-
47
- public function getFixturesDir()
48
- {
49
- return __DIR__.'/Fixtures/';
50
- }
51
- }
52
-
53
- function test_foo($value = 'foo')
54
- {
55
- return $value;
56
- }
57
-
58
- class TwigTestFoo implements Iterator
59
- {
60
- const BAR_NAME = 'bar';
61
-
62
- public $position = 0;
63
- public $array = [1, 2];
64
-
65
- public function bar($param1 = null, $param2 = null)
66
- {
67
- return 'bar'.($param1 ? '_'.$param1 : '').($param2 ? '-'.$param2 : '');
68
- }
69
-
70
- public function getFoo()
71
- {
72
- return 'foo';
73
- }
74
-
75
- public function getSelf()
76
- {
77
- return $this;
78
- }
79
-
80
- public function is()
81
- {
82
- return 'is';
83
- }
84
-
85
- public function in()
86
- {
87
- return 'in';
88
- }
89
-
90
- public function not()
91
- {
92
- return 'not';
93
- }
94
-
95
- public function strToLower($value)
96
- {
97
- return strtolower($value);
98
- }
99
-
100
- public function rewind()
101
- {
102
- $this->position = 0;
103
- }
104
-
105
- public function current()
106
- {
107
- return $this->array[$this->position];
108
- }
109
-
110
- public function key()
111
- {
112
- return 'a';
113
- }
114
-
115
- public function next()
116
- {
117
- ++$this->position;
118
- }
119
-
120
- public function valid()
121
- {
122
- return isset($this->array[$this->position]);
123
- }
124
- }
125
-
126
- class TwigTestTokenParser_§ extends AbstractTokenParser
127
- {
128
- public function parse(Token $token)
129
- {
130
- $this->parser->getStream()->expect(Token::BLOCK_END_TYPE);
131
-
132
- return new PrintNode(new ConstantExpression('§', -1), -1);
133
- }
134
-
135
- public function getTag()
136
- {
137
- return '§';
138
- }
139
- }
140
-
141
- class TwigTestExtension extends AbstractExtension
142
- {
143
- public function getTokenParsers()
144
- {
145
- return [
146
- new TwigTestTokenParser_§(),
147
- ];
148
- }
149
-
150
- public function getFilters()
151
- {
152
- return [
153
- new TwigFilter('§', [$this, '§Filter']),
154
- new TwigFilter('escape_and_nl2br', [$this, 'escape_and_nl2br'], ['needs_environment' => true, 'is_safe' => ['html']]),
155
- new TwigFilter('nl2br', [$this, 'nl2br'], ['pre_escape' => 'html', 'is_safe' => ['html']]),
156
- new TwigFilter('escape_something', [$this, 'escape_something'], ['is_safe' => ['something']]),
157
- new TwigFilter('preserves_safety', [$this, 'preserves_safety'], ['preserves_safety' => ['html']]),
158
- new TwigFilter('static_call_string', 'TwigTestExtension::staticCall'),
159
- new TwigFilter('static_call_array', ['TwigTestExtension', 'staticCall']),
160
- new TwigFilter('magic_call', [$this, 'magicCall']),
161
- new TwigFilter('magic_call_string', 'TwigTestExtension::magicStaticCall'),
162
- new TwigFilter('magic_call_array', ['TwigTestExtension', 'magicStaticCall']),
163
- new TwigFilter('*_path', [$this, 'dynamic_path']),
164
- new TwigFilter('*_foo_*_bar', [$this, 'dynamic_foo']),
165
- ];
166
- }
167
-
168
- public function getFunctions()
169
- {
170
- return [
171
- new TwigFunction('§', [$this, '§Function']),
172
- new TwigFunction('safe_br', [$this, 'br'], ['is_safe' => ['html']]),
173
- new TwigFunction('unsafe_br', [$this, 'br']),
174
- new TwigFunction('static_call_string', 'TwigTestExtension::staticCall'),
175
- new TwigFunction('static_call_array', ['TwigTestExtension', 'staticCall']),
176
- new TwigFunction('*_path', [$this, 'dynamic_path']),
177
- new TwigFunction('*_foo_*_bar', [$this, 'dynamic_foo']),
178
- ];
179
- }
180
-
181
- public function getTests()
182
- {
183
- return [
184
- new TwigTest('multi word', [$this, 'is_multi_word']),
185
- new TwigTest('test_*', [$this, 'dynamic_test']),
186
- ];
187
- }
188
-
189
- public function §Filter($value)
190
- {
191
- return "§{$value}§";
192
- }
193
-
194
- public function §Function($value)
195
- {
196
- return "§{$value}§";
197
- }
198
-
199
- /**
200
- * nl2br which also escapes, for testing escaper filters.
201
- */
202
- public function escape_and_nl2br($env, $value, $sep = '<br />')
203
- {
204
- return $this->nl2br(twig_escape_filter($env, $value, 'html'), $sep);
205
- }
206
-
207
- /**
208
- * nl2br only, for testing filters with pre_escape.
209
- */
210
- public function nl2br($value, $sep = '<br />')
211
- {
212
- // not secure if $value contains html tags (not only entities)
213
- // don't use
214
- return str_replace("\n", "$sep\n", $value);
215
- }
216
-
217
- public function dynamic_path($element, $item)
218
- {
219
- return $element.'/'.$item;
220
- }
221
-
222
- public function dynamic_foo($foo, $bar, $item)
223
- {
224
- return $foo.'/'.$bar.'/'.$item;
225
- }
226
-
227
- public function dynamic_test($element, $item)
228
- {
229
- return $element === $item;
230
- }
231
-
232
- public function escape_something($value)
233
- {
234
- return strtoupper($value);
235
- }
236
-
237
- public function preserves_safety($value)
238
- {
239
- return strtoupper($value);
240
- }
241
-
242
- public static function staticCall($value)
243
- {
244
- return "*$value*";
245
- }
246
-
247
- public function br()
248
- {
249
- return '<br />';
250
- }
251
-
252
- public function is_multi_word($value)
253
- {
254
- return false !== strpos($value, ' ');
255
- }
256
-
257
- public function __call($method, $arguments)
258
- {
259
- if ('magicCall' !== $method) {
260
- throw new \BadMethodCallException('Unexpected call to __call');
261
- }
262
-
263
- return 'magic_'.$arguments[0];
264
- }
265
-
266
- public static function __callStatic($method, $arguments)
267
- {
268
- if ('magicStaticCall' !== $method) {
269
- throw new \BadMethodCallException('Unexpected call to __callStatic');
270
- }
271
-
272
- return 'static_magic_'.$arguments[0];
273
- }
274
- }
275
-
276
- /**
277
- * This class is used in tests for the "length" filter and "empty" test. It asserts that __call is not
278
- * used to convert such objects to strings.
279
- */
280
- class MagicCallStub
281
- {
282
- public function __call($name, $args)
283
- {
284
- throw new \Exception('__call shall not be called');
285
- }
286
- }
287
-
288
- class ToStringStub
289
- {
290
- /**
291
- * @var string
292
- */
293
- private $string;
294
-
295
- public function __construct($string)
296
- {
297
- $this->string = $string;
298
- }
299
-
300
- public function __toString()
301
- {
302
- return $this->string;
303
- }
304
- }
305
-
306
- /**
307
- * This class is used in tests for the length filter and empty test to show
308
- * that when \Countable is implemented, it is preferred over the __toString()
309
- * method.
310
- */
311
- class CountableStub implements \Countable
312
- {
313
- private $count;
314
-
315
- public function __construct($count)
316
- {
317
- $this->count = $count;
318
- }
319
-
320
- public function count()
321
- {
322
- return $this->count;
323
- }
324
-
325
- public function __toString()
326
- {
327
- throw new \Exception('__toString shall not be called on \Countables');
328
- }
329
- }
330
-
331
- /**
332
- * This class is used in tests for the length filter.
333
- */
334
- class IteratorAggregateStub implements \IteratorAggregate
335
- {
336
- private $data;
337
-
338
- public function __construct(array $data)
339
- {
340
- $this->data = $data;
341
- }
342
-
343
- public function getIterator()
344
- {
345
- return new \ArrayIterator($this->data);
346
- }
347
- }
348
-
349
- class SimpleIteratorForTesting implements Iterator
350
- {
351
- private $data = [1, 2, 3, 4, 5, 6, 7];
352
- private $key = 0;
353
-
354
- public function current()
355
- {
356
- return $this->key;
357
- }
358
-
359
- public function next()
360
- {
361
- ++$this->key;
362
- }
363
-
364
- public function key()
365
- {
366
- return $this->key;
367
- }
368
-
369
- public function valid()
370
- {
371
- return isset($this->data[$this->key]);
372
- }
373
-
374
- public function rewind()
375
- {
376
- $this->key = 0;
377
- }
378
-
379
- public function __toString()
380
- {
381
- // for testing, make sure string length returned is not the same as the `iterator_count`
382
- return str_repeat('X', iterator_count($this) + 10);
383
- }
384
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Extension\AbstractExtension;
13
- use Twig\Test\IntegrationTestCase;
14
-
15
- class Twig_Tests_LegacyIntegrationTest extends IntegrationTestCase
16
- {
17
- public function getExtensions()
18
- {
19
- return [
20
- new LegacyTwigTestExtension(),
21
- ];
22
- }
23
-
24
- public function getFixturesDir()
25
- {
26
- return __DIR__.'/LegacyFixtures/';
27
- }
28
-
29
- public function getTests($name, $legacyTests = false)
30
- {
31
- if (!$legacyTests) {
32
- return [['', '', '', [], '', []]];
33
- }
34
-
35
- return parent::getTests($name, true);
36
- }
37
- }
38
-
39
- class LegacyTwigTestExtension extends AbstractExtension
40
- {
41
- public function getTests()
42
- {
43
- return [
44
- 'multi word' => new Twig_Test_Method($this, 'is_multi_word'),
45
- ];
46
- }
47
-
48
- public function is_multi_word($value)
49
- {
50
- return false !== strpos($value, ' ');
51
- }
52
-
53
- public function getName()
54
- {
55
- return 'legacy_integration_test';
56
- }
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/LexerTest.php DELETED
@@ -1,379 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Lexer;
14
- use Twig\Source;
15
- use Twig\Token;
16
-
17
- class Twig_Tests_LexerTest extends \PHPUnit\Framework\TestCase
18
- {
19
- /**
20
- * @group legacy
21
- */
22
- public function testLegacyConstructorSignature()
23
- {
24
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
25
- $stream = $lexer->tokenize('{{ foo }}', 'foo');
26
- $this->assertEquals('foo', $stream->getFilename());
27
- $this->assertEquals('{{ foo }}', $stream->getSource());
28
- }
29
-
30
- public function testNameLabelForTag()
31
- {
32
- $template = '{% § %}';
33
-
34
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
35
- $stream = $lexer->tokenize(new Source($template, 'index'));
36
-
37
- $stream->expect(Token::BLOCK_START_TYPE);
38
- $this->assertSame('§', $stream->expect(Token::NAME_TYPE)->getValue());
39
- }
40
-
41
- public function testNameLabelForFunction()
42
- {
43
- $template = '{{ §() }}';
44
-
45
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
46
- $stream = $lexer->tokenize(new Source($template, 'index'));
47
-
48
- $stream->expect(Token::VAR_START_TYPE);
49
- $this->assertSame('§', $stream->expect(Token::NAME_TYPE)->getValue());
50
- }
51
-
52
- public function testBracketsNesting()
53
- {
54
- $template = '{{ {"a":{"b":"c"}} }}';
55
-
56
- $this->assertEquals(2, $this->countToken($template, Token::PUNCTUATION_TYPE, '{'));
57
- $this->assertEquals(2, $this->countToken($template, Token::PUNCTUATION_TYPE, '}'));
58
- }
59
-
60
- protected function countToken($template, $type, $value = null)
61
- {
62
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
63
- $stream = $lexer->tokenize(new Source($template, 'index'));
64
-
65
- $count = 0;
66
- while (!$stream->isEOF()) {
67
- $token = $stream->next();
68
- if ($type === $token->getType()) {
69
- if (null === $value || $value === $token->getValue()) {
70
- ++$count;
71
- }
72
- }
73
- }
74
-
75
- return $count;
76
- }
77
-
78
- public function testLineDirective()
79
- {
80
- $template = "foo\n"
81
- ."bar\n"
82
- ."{% line 10 %}\n"
83
- ."{{\n"
84
- ."baz\n"
85
- ."}}\n";
86
-
87
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
88
- $stream = $lexer->tokenize(new Source($template, 'index'));
89
-
90
- // foo\nbar\n
91
- $this->assertSame(1, $stream->expect(Token::TEXT_TYPE)->getLine());
92
- // \n (after {% line %})
93
- $this->assertSame(10, $stream->expect(Token::TEXT_TYPE)->getLine());
94
- // {{
95
- $this->assertSame(11, $stream->expect(Token::VAR_START_TYPE)->getLine());
96
- // baz
97
- $this->assertSame(12, $stream->expect(Token::NAME_TYPE)->getLine());
98
- }
99
-
100
- public function testLineDirectiveInline()
101
- {
102
- $template = "foo\n"
103
- ."bar{% line 10 %}{{\n"
104
- ."baz\n"
105
- ."}}\n";
106
-
107
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
108
- $stream = $lexer->tokenize(new Source($template, 'index'));
109
-
110
- // foo\nbar
111
- $this->assertSame(1, $stream->expect(Token::TEXT_TYPE)->getLine());
112
- // {{
113
- $this->assertSame(10, $stream->expect(Token::VAR_START_TYPE)->getLine());
114
- // baz
115
- $this->assertSame(11, $stream->expect(Token::NAME_TYPE)->getLine());
116
- }
117
-
118
- public function testLongComments()
119
- {
120
- $template = '{# '.str_repeat('*', 100000).' #}';
121
-
122
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
123
- $lexer->tokenize(new Source($template, 'index'));
124
-
125
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
126
- // can be executed without throwing any exceptions
127
- $this->addToAssertionCount(1);
128
- }
129
-
130
- public function testLongVerbatim()
131
- {
132
- $template = '{% verbatim %}'.str_repeat('*', 100000).'{% endverbatim %}';
133
-
134
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
135
- $lexer->tokenize(new Source($template, 'index'));
136
-
137
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
138
- // can be executed without throwing any exceptions
139
- $this->addToAssertionCount(1);
140
- }
141
-
142
- public function testLongVar()
143
- {
144
- $template = '{{ '.str_repeat('x', 100000).' }}';
145
-
146
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
147
- $lexer->tokenize(new Source($template, 'index'));
148
-
149
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
150
- // can be executed without throwing any exceptions
151
- $this->addToAssertionCount(1);
152
- }
153
-
154
- public function testLongBlock()
155
- {
156
- $template = '{% '.str_repeat('x', 100000).' %}';
157
-
158
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
159
- $lexer->tokenize(new Source($template, 'index'));
160
-
161
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
162
- // can be executed without throwing any exceptions
163
- $this->addToAssertionCount(1);
164
- }
165
-
166
- public function testBigNumbers()
167
- {
168
- $template = '{{ 922337203685477580700 }}';
169
-
170
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
171
- $stream = $lexer->tokenize(new Source($template, 'index'));
172
- $stream->next();
173
- $node = $stream->next();
174
- $this->assertEquals('922337203685477580700', $node->getValue());
175
- }
176
-
177
- public function testStringWithEscapedDelimiter()
178
- {
179
- $tests = [
180
- "{{ 'foo \' bar' }}" => 'foo \' bar',
181
- '{{ "foo \" bar" }}' => 'foo " bar',
182
- ];
183
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
184
- foreach ($tests as $template => $expected) {
185
- $stream = $lexer->tokenize(new Source($template, 'index'));
186
- $stream->expect(Token::VAR_START_TYPE);
187
- $stream->expect(Token::STRING_TYPE, $expected);
188
-
189
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
190
- // can be executed without throwing any exceptions
191
- $this->addToAssertionCount(1);
192
- }
193
- }
194
-
195
- public function testStringWithInterpolation()
196
- {
197
- $template = 'foo {{ "bar #{ baz + 1 }" }}';
198
-
199
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
200
- $stream = $lexer->tokenize(new Source($template, 'index'));
201
- $stream->expect(Token::TEXT_TYPE, 'foo ');
202
- $stream->expect(Token::VAR_START_TYPE);
203
- $stream->expect(Token::STRING_TYPE, 'bar ');
204
- $stream->expect(Token::INTERPOLATION_START_TYPE);
205
- $stream->expect(Token::NAME_TYPE, 'baz');
206
- $stream->expect(Token::OPERATOR_TYPE, '+');
207
- $stream->expect(Token::NUMBER_TYPE, '1');
208
- $stream->expect(Token::INTERPOLATION_END_TYPE);
209
- $stream->expect(Token::VAR_END_TYPE);
210
-
211
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
212
- // can be executed without throwing any exceptions
213
- $this->addToAssertionCount(1);
214
- }
215
-
216
- public function testStringWithEscapedInterpolation()
217
- {
218
- $template = '{{ "bar \#{baz+1}" }}';
219
-
220
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
221
- $stream = $lexer->tokenize(new Source($template, 'index'));
222
- $stream->expect(Token::VAR_START_TYPE);
223
- $stream->expect(Token::STRING_TYPE, 'bar #{baz+1}');
224
- $stream->expect(Token::VAR_END_TYPE);
225
-
226
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
227
- // can be executed without throwing any exceptions
228
- $this->addToAssertionCount(1);
229
- }
230
-
231
- public function testStringWithHash()
232
- {
233
- $template = '{{ "bar # baz" }}';
234
-
235
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
236
- $stream = $lexer->tokenize(new Source($template, 'index'));
237
- $stream->expect(Token::VAR_START_TYPE);
238
- $stream->expect(Token::STRING_TYPE, 'bar # baz');
239
- $stream->expect(Token::VAR_END_TYPE);
240
-
241
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
242
- // can be executed without throwing any exceptions
243
- $this->addToAssertionCount(1);
244
- }
245
-
246
- /**
247
- * @expectedException \Twig\Error\SyntaxError
248
- * @expectedExceptionMessage Unclosed """
249
- */
250
- public function testStringWithUnterminatedInterpolation()
251
- {
252
- $template = '{{ "bar #{x" }}';
253
-
254
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
255
- $lexer->tokenize(new Source($template, 'index'));
256
- }
257
-
258
- public function testStringWithNestedInterpolations()
259
- {
260
- $template = '{{ "bar #{ "foo#{bar}" }" }}';
261
-
262
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
263
- $stream = $lexer->tokenize(new Source($template, 'index'));
264
- $stream->expect(Token::VAR_START_TYPE);
265
- $stream->expect(Token::STRING_TYPE, 'bar ');
266
- $stream->expect(Token::INTERPOLATION_START_TYPE);
267
- $stream->expect(Token::STRING_TYPE, 'foo');
268
- $stream->expect(Token::INTERPOLATION_START_TYPE);
269
- $stream->expect(Token::NAME_TYPE, 'bar');
270
- $stream->expect(Token::INTERPOLATION_END_TYPE);
271
- $stream->expect(Token::INTERPOLATION_END_TYPE);
272
- $stream->expect(Token::VAR_END_TYPE);
273
-
274
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
275
- // can be executed without throwing any exceptions
276
- $this->addToAssertionCount(1);
277
- }
278
-
279
- public function testStringWithNestedInterpolationsInBlock()
280
- {
281
- $template = '{% foo "bar #{ "foo#{bar}" }" %}';
282
-
283
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
284
- $stream = $lexer->tokenize(new Source($template, 'index'));
285
- $stream->expect(Token::BLOCK_START_TYPE);
286
- $stream->expect(Token::NAME_TYPE, 'foo');
287
- $stream->expect(Token::STRING_TYPE, 'bar ');
288
- $stream->expect(Token::INTERPOLATION_START_TYPE);
289
- $stream->expect(Token::STRING_TYPE, 'foo');
290
- $stream->expect(Token::INTERPOLATION_START_TYPE);
291
- $stream->expect(Token::NAME_TYPE, 'bar');
292
- $stream->expect(Token::INTERPOLATION_END_TYPE);
293
- $stream->expect(Token::INTERPOLATION_END_TYPE);
294
- $stream->expect(Token::BLOCK_END_TYPE);
295
-
296
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
297
- // can be executed without throwing any exceptions
298
- $this->addToAssertionCount(1);
299
- }
300
-
301
- public function testOperatorEndingWithALetterAtTheEndOfALine()
302
- {
303
- $template = "{{ 1 and\n0}}";
304
-
305
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
306
- $stream = $lexer->tokenize(new Source($template, 'index'));
307
- $stream->expect(Token::VAR_START_TYPE);
308
- $stream->expect(Token::NUMBER_TYPE, 1);
309
- $stream->expect(Token::OPERATOR_TYPE, 'and');
310
-
311
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
312
- // can be executed without throwing any exceptions
313
- $this->addToAssertionCount(1);
314
- }
315
-
316
- /**
317
- * @expectedException \Twig\Error\SyntaxError
318
- * @expectedExceptionMessage Unclosed "variable" in "index" at line 3
319
- */
320
- public function testUnterminatedVariable()
321
- {
322
- $template = '
323
-
324
- {{
325
-
326
- bar
327
-
328
-
329
- ';
330
-
331
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
332
- $lexer->tokenize(new Source($template, 'index'));
333
- }
334
-
335
- /**
336
- * @expectedException \Twig\Error\SyntaxError
337
- * @expectedExceptionMessage Unclosed "block" in "index" at line 3
338
- */
339
- public function testUnterminatedBlock()
340
- {
341
- $template = '
342
-
343
- {%
344
-
345
- bar
346
-
347
-
348
- ';
349
-
350
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
351
- $lexer->tokenize(new Source($template, 'index'));
352
- }
353
-
354
- public function testOverridingSyntax()
355
- {
356
- $template = '[# comment #]{# variable #}/# if true #/true/# endif #/';
357
- $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), [
358
- 'tag_comment' => ['[#', '#]'],
359
- 'tag_block' => ['/#', '#/'],
360
- 'tag_variable' => ['{#', '#}'],
361
- ]);
362
- $stream = $lexer->tokenize(new Source($template, 'index'));
363
- $stream->expect(Token::VAR_START_TYPE);
364
- $stream->expect(Token::NAME_TYPE, 'variable');
365
- $stream->expect(Token::VAR_END_TYPE);
366
- $stream->expect(Token::BLOCK_START_TYPE);
367
- $stream->expect(Token::NAME_TYPE, 'if');
368
- $stream->expect(Token::NAME_TYPE, 'true');
369
- $stream->expect(Token::BLOCK_END_TYPE);
370
- $stream->expect(Token::TEXT_TYPE, 'true');
371
- $stream->expect(Token::BLOCK_START_TYPE);
372
- $stream->expect(Token::NAME_TYPE, 'endif');
373
- $stream->expect(Token::BLOCK_END_TYPE);
374
-
375
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
376
- // can be executed without throwing any exceptions
377
- $this->addToAssertionCount(1);
378
- }
379
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php DELETED
@@ -1,139 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Loader\ArrayLoader;
13
-
14
- class Twig_Tests_Loader_ArrayTest extends \PHPUnit\Framework\TestCase
15
- {
16
- /**
17
- * @group legacy
18
- */
19
- public function testGetSource()
20
- {
21
- $loader = new ArrayLoader(['foo' => 'bar']);
22
-
23
- $this->assertEquals('bar', $loader->getSource('foo'));
24
- }
25
-
26
- /**
27
- * @group legacy
28
- * @expectedException \Twig\Error\LoaderError
29
- */
30
- public function testGetSourceWhenTemplateDoesNotExist()
31
- {
32
- $loader = new ArrayLoader([]);
33
-
34
- $loader->getSource('foo');
35
- }
36
-
37
- /**
38
- * @expectedException \Twig\Error\LoaderError
39
- */
40
- public function testGetSourceContextWhenTemplateDoesNotExist()
41
- {
42
- $loader = new ArrayLoader([]);
43
-
44
- $loader->getSourceContext('foo');
45
- }
46
-
47
- public function testGetCacheKey()
48
- {
49
- $loader = new ArrayLoader(['foo' => 'bar']);
50
-
51
- $this->assertEquals('foo:bar', $loader->getCacheKey('foo'));
52
- }
53
-
54
- public function testGetCacheKeyWhenTemplateHasDuplicateContent()
55
- {
56
- $loader = new ArrayLoader([
57
- 'foo' => 'bar',
58
- 'baz' => 'bar',
59
- ]);
60
-
61
- $this->assertEquals('foo:bar', $loader->getCacheKey('foo'));
62
- $this->assertEquals('baz:bar', $loader->getCacheKey('baz'));
63
- }
64
-
65
- public function testGetCacheKeyIsProtectedFromEdgeCollisions()
66
- {
67
- $loader = new ArrayLoader([
68
- 'foo__' => 'bar',
69
- 'foo' => '__bar',
70
- ]);
71
-
72
- $this->assertEquals('foo__:bar', $loader->getCacheKey('foo__'));
73
- $this->assertEquals('foo:__bar', $loader->getCacheKey('foo'));
74
- }
75
-
76
- /**
77
- * @expectedException \Twig\Error\LoaderError
78
- */
79
- public function testGetCacheKeyWhenTemplateDoesNotExist()
80
- {
81
- $loader = new ArrayLoader([]);
82
-
83
- $loader->getCacheKey('foo');
84
- }
85
-
86
- public function testSetTemplate()
87
- {
88
- $loader = new ArrayLoader([]);
89
- $loader->setTemplate('foo', 'bar');
90
-
91
- $this->assertEquals('bar', $loader->getSourceContext('foo')->getCode());
92
- }
93
-
94
- public function testIsFresh()
95
- {
96
- $loader = new ArrayLoader(['foo' => 'bar']);
97
- $this->assertTrue($loader->isFresh('foo', time()));
98
- }
99
-
100
- /**
101
- * @expectedException \Twig\Error\LoaderError
102
- */
103
- public function testIsFreshWhenTemplateDoesNotExist()
104
- {
105
- $loader = new ArrayLoader([]);
106
-
107
- $loader->isFresh('foo', time());
108
- }
109
-
110
- public function testTemplateReference()
111
- {
112
- $name = new Twig_Test_Loader_TemplateReference('foo');
113
- $loader = new ArrayLoader(['foo' => 'bar']);
114
-
115
- $loader->getCacheKey($name);
116
- $loader->getSourceContext($name);
117
- $loader->isFresh($name, time());
118
- $loader->setTemplate($name, 'foo:bar');
119
-
120
- // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
121
- // can be executed without crashing PHP
122
- $this->addToAssertionCount(1);
123
- }
124
- }
125
-
126
- class Twig_Test_Loader_TemplateReference
127
- {
128
- private $name;
129
-
130
- public function __construct($name)
131
- {
132
- $this->name = $name;
133
- }
134
-
135
- public function __toString()
136
- {
137
- return $this->name;
138
- }
139
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php DELETED
@@ -1,132 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Loader\ArrayLoader;
13
- use Twig\Loader\ChainLoader;
14
- use Twig\Loader\ExistsLoaderInterface;
15
- use Twig\Loader\FilesystemLoader;
16
- use Twig\Loader\LoaderInterface;
17
- use Twig\Loader\SourceContextLoaderInterface;
18
- use Twig\Source;
19
-
20
- class Twig_Tests_Loader_ChainTest extends \PHPUnit\Framework\TestCase
21
- {
22
- /**
23
- * @group legacy
24
- */
25
- public function testGetSource()
26
- {
27
- $loader = new ChainLoader([
28
- new ArrayLoader(['foo' => 'bar']),
29
- new ArrayLoader(['foo' => 'foobar', 'bar' => 'foo']),
30
- ]);
31
-
32
- $this->assertEquals('bar', $loader->getSource('foo'));
33
- $this->assertEquals('foo', $loader->getSource('bar'));
34
- }
35
-
36
- public function testGetSourceContext()
37
- {
38
- $path = __DIR__.'/../Fixtures';
39
- $loader = new ChainLoader([
40
- new ArrayLoader(['foo' => 'bar']),
41
- new ArrayLoader(['errors/index.html' => 'baz']),
42
- new FilesystemLoader([$path]),
43
- ]);
44
-
45
- $this->assertEquals('foo', $loader->getSourceContext('foo')->getName());
46
- $this->assertSame('', $loader->getSourceContext('foo')->getPath());
47
-
48
- $this->assertEquals('errors/index.html', $loader->getSourceContext('errors/index.html')->getName());
49
- $this->assertSame('', $loader->getSourceContext('errors/index.html')->getPath());
50
- $this->assertEquals('baz', $loader->getSourceContext('errors/index.html')->getCode());
51
-
52
- $this->assertEquals('errors/base.html', $loader->getSourceContext('errors/base.html')->getName());
53
- $this->assertEquals(realpath($path.'/errors/base.html'), realpath($loader->getSourceContext('errors/base.html')->getPath()));
54
- $this->assertNotEquals('baz', $loader->getSourceContext('errors/base.html')->getCode());
55
- }
56
-
57
- /**
58
- * @expectedException \Twig\Error\LoaderError
59
- */
60
- public function testGetSourceContextWhenTemplateDoesNotExist()
61
- {
62
- $loader = new ChainLoader([]);
63
-
64
- $loader->getSourceContext('foo');
65
- }
66
-
67
- /**
68
- * @group legacy
69
- * @expectedException \Twig\Error\LoaderError
70
- */
71
- public function testGetSourceWhenTemplateDoesNotExist()
72
- {
73
- $loader = new ChainLoader([]);
74
-
75
- $loader->getSource('foo');
76
- }
77
-
78
- public function testGetCacheKey()
79
- {
80
- $loader = new ChainLoader([
81
- new ArrayLoader(['foo' => 'bar']),
82
- new ArrayLoader(['foo' => 'foobar', 'bar' => 'foo']),
83
- ]);
84
-
85
- $this->assertEquals('foo:bar', $loader->getCacheKey('foo'));
86
- $this->assertEquals('bar:foo', $loader->getCacheKey('bar'));
87
- }
88
-
89
- /**
90
- * @expectedException \Twig\Error\LoaderError
91
- */
92
- public function testGetCacheKeyWhenTemplateDoesNotExist()
93
- {
94
- $loader = new ChainLoader([]);
95
-
96
- $loader->getCacheKey('foo');
97
- }
98
-
99
- public function testAddLoader()
100
- {
101
- $loader = new ChainLoader();
102
- $loader->addLoader(new ArrayLoader(['foo' => 'bar']));
103
-
104
- $this->assertEquals('bar', $loader->getSourceContext('foo')->getCode());
105
- }
106
-
107
- public function testExists()
108
- {
109
- $loader1 = $this->getMockBuilder('Twig_ChainTestLoaderWithExistsInterface')->getMock();
110
- $loader1->expects($this->once())->method('exists')->will($this->returnValue(false));
111
- $loader1->expects($this->never())->method('getSourceContext');
112
-
113
- // can be removed in 2.0
114
- $loader2 = $this->getMockBuilder('Twig_ChainTestLoaderInterface')->getMock();
115
- //$loader2 = $this->getMockBuilder(['\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface'])->getMock();
116
- $loader2->expects($this->once())->method('getSourceContext')->will($this->returnValue(new Source('content', 'index')));
117
-
118
- $loader = new ChainLoader();
119
- $loader->addLoader($loader1);
120
- $loader->addLoader($loader2);
121
-
122
- $this->assertTrue($loader->exists('foo'));
123
- }
124
- }
125
-
126
- interface Twig_ChainTestLoaderInterface extends LoaderInterface, SourceContextLoaderInterface
127
- {
128
- }
129
-
130
- interface Twig_ChainTestLoaderWithExistsInterface extends LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface
131
- {
132
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php DELETED
@@ -1,245 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Error\LoaderError;
14
- use Twig\Loader\FilesystemLoader;
15
-
16
- class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase
17
- {
18
- public function testGetSourceContext()
19
- {
20
- $path = __DIR__.'/../Fixtures';
21
- $loader = new FilesystemLoader([$path]);
22
- $this->assertEquals('errors/index.html', $loader->getSourceContext('errors/index.html')->getName());
23
- $this->assertEquals(realpath($path.'/errors/index.html'), realpath($loader->getSourceContext('errors/index.html')->getPath()));
24
- }
25
-
26
- /**
27
- * @dataProvider getSecurityTests
28
- */
29
- public function testSecurity($template)
30
- {
31
- $loader = new FilesystemLoader([__DIR__.'/../Fixtures']);
32
-
33
- try {
34
- $loader->getCacheKey($template);
35
- $this->fail();
36
- } catch (LoaderError $e) {
37
- $this->assertNotContains('Unable to find template', $e->getMessage());
38
- }
39
- }
40
-
41
- public function getSecurityTests()
42
- {
43
- return [
44
- ["AutoloaderTest\0.php"],
45
- ['..\\AutoloaderTest.php'],
46
- ['..\\\\\\AutoloaderTest.php'],
47
- ['../AutoloaderTest.php'],
48
- ['..////AutoloaderTest.php'],
49
- ['./../AutoloaderTest.php'],
50
- ['.\\..\\AutoloaderTest.php'],
51
- ['././././././../AutoloaderTest.php'],
52
- ['.\\./.\\./.\\./../AutoloaderTest.php'],
53
- ['foo/../../AutoloaderTest.php'],
54
- ['foo\\..\\..\\AutoloaderTest.php'],
55
- ['foo/../bar/../../AutoloaderTest.php'],
56
- ['foo/bar/../../../AutoloaderTest.php'],
57
- ['filters/../../AutoloaderTest.php'],
58
- ['filters//..//..//AutoloaderTest.php'],
59
- ['filters\\..\\..\\AutoloaderTest.php'],
60
- ['filters\\\\..\\\\..\\\\AutoloaderTest.php'],
61
- ['filters\\//../\\/\\..\\AutoloaderTest.php'],
62
- ['/../AutoloaderTest.php'],
63
- ];
64
- }
65
-
66
- /**
67
- * @dataProvider getBasePaths
68
- */
69
- public function testPaths($basePath, $cacheKey, $rootPath)
70
- {
71
- $loader = new FilesystemLoader([$basePath.'/normal', $basePath.'/normal_bis'], $rootPath);
72
- $loader->setPaths([$basePath.'/named', $basePath.'/named_bis'], 'named');
73
- $loader->addPath($basePath.'/named_ter', 'named');
74
- $loader->addPath($basePath.'/normal_ter');
75
- $loader->prependPath($basePath.'/normal_final');
76
- $loader->prependPath($basePath.'/named/../named_quater', 'named');
77
- $loader->prependPath($basePath.'/named_final', 'named');
78
-
79
- $this->assertEquals([
80
- $basePath.'/normal_final',
81
- $basePath.'/normal',
82
- $basePath.'/normal_bis',
83
- $basePath.'/normal_ter',
84
- ], $loader->getPaths());
85
- $this->assertEquals([
86
- $basePath.'/named_final',
87
- $basePath.'/named/../named_quater',
88
- $basePath.'/named',
89
- $basePath.'/named_bis',
90
- $basePath.'/named_ter',
91
- ], $loader->getPaths('named'));
92
-
93
- // do not use realpath here as it would make the test unuseful
94
- $this->assertEquals($cacheKey, str_replace('\\', '/', $loader->getCacheKey('@named/named_absolute.html')));
95
- $this->assertEquals("path (final)\n", $loader->getSourceContext('index.html')->getCode());
96
- $this->assertEquals("path (final)\n", $loader->getSourceContext('@__main__/index.html')->getCode());
97
- $this->assertEquals("named path (final)\n", $loader->getSourceContext('@named/index.html')->getCode());
98
- }
99
-
100
- public function getBasePaths()
101
- {
102
- return [
103
- [
104
- __DIR__.'/Fixtures',
105
- 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html',
106
- null,
107
- ],
108
- [
109
- __DIR__.'/Fixtures/../Fixtures',
110
- 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html',
111
- null,
112
- ],
113
- [
114
- 'test/Twig/Tests/Loader/Fixtures',
115
- 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html',
116
- getcwd(),
117
- ],
118
- [
119
- 'Fixtures',
120
- 'Fixtures/named_quater/named_absolute.html',
121
- getcwd().'/test/Twig/Tests/Loader',
122
- ],
123
- [
124
- 'Fixtures',
125
- 'Fixtures/named_quater/named_absolute.html',
126
- getcwd().'/test/../test/Twig/Tests/Loader',
127
- ],
128
- ];
129
- }
130
-
131
- public function testEmptyConstructor()
132
- {
133
- $loader = new FilesystemLoader();
134
- $this->assertEquals([], $loader->getPaths());
135
- }
136
-
137
- public function testGetNamespaces()
138
- {
139
- $loader = new FilesystemLoader(sys_get_temp_dir());
140
- $this->assertEquals([FilesystemLoader::MAIN_NAMESPACE], $loader->getNamespaces());
141
-
142
- $loader->addPath(sys_get_temp_dir(), 'named');
143
- $this->assertEquals([FilesystemLoader::MAIN_NAMESPACE, 'named'], $loader->getNamespaces());
144
- }
145
-
146
- public function testFindTemplateExceptionNamespace()
147
- {
148
- $basePath = __DIR__.'/Fixtures';
149
-
150
- $loader = new FilesystemLoader([$basePath.'/normal']);
151
- $loader->addPath($basePath.'/named', 'named');
152
-
153
- try {
154
- $loader->getSourceContext('@named/nowhere.html');
155
- } catch (\Exception $e) {
156
- $this->assertInstanceOf('\Twig\Error\LoaderError', $e);
157
- $this->assertContains('Unable to find template "@named/nowhere.html"', $e->getMessage());
158
- }
159
- }
160
-
161
- public function testFindTemplateWithCache()
162
- {
163
- $basePath = __DIR__.'/Fixtures';
164
-
165
- $loader = new FilesystemLoader([$basePath.'/normal']);
166
- $loader->addPath($basePath.'/named', 'named');
167
-
168
- // prime the cache for index.html in the named namespace
169
- $namedSource = $loader->getSourceContext('@named/index.html')->getCode();
170
- $this->assertEquals("named path\n", $namedSource);
171
-
172
- // get index.html from the main namespace
173
- $this->assertEquals("path\n", $loader->getSourceContext('index.html')->getCode());
174
- }
175
-
176
- public function testLoadTemplateAndRenderBlockWithCache()
177
- {
178
- $loader = new FilesystemLoader([]);
179
- $loader->addPath(__DIR__.'/Fixtures/themes/theme2');
180
- $loader->addPath(__DIR__.'/Fixtures/themes/theme1');
181
- $loader->addPath(__DIR__.'/Fixtures/themes/theme1', 'default_theme');
182
-
183
- $twig = new Environment($loader);
184
-
185
- $template = $twig->load('blocks.html.twig');
186
- $this->assertSame('block from theme 1', $template->renderBlock('b1', []));
187
-
188
- $template = $twig->load('blocks.html.twig');
189
- $this->assertSame('block from theme 2', $template->renderBlock('b2', []));
190
- }
191
-
192
- public function getArrayInheritanceTests()
193
- {
194
- return [
195
- 'valid array inheritance' => ['array_inheritance_valid_parent.html.twig'],
196
- 'array inheritance with null first template' => ['array_inheritance_null_parent.html.twig'],
197
- 'array inheritance with empty first template' => ['array_inheritance_empty_parent.html.twig'],
198
- 'array inheritance with non-existent first template' => ['array_inheritance_nonexistent_parent.html.twig'],
199
- ];
200
- }
201
-
202
- /**
203
- * @dataProvider getArrayInheritanceTests
204
- *
205
- * @param $templateName string Template name with array inheritance
206
- */
207
- public function testArrayInheritance($templateName)
208
- {
209
- $loader = new FilesystemLoader([]);
210
- $loader->addPath(__DIR__.'/Fixtures/inheritance');
211
-
212
- $twig = new Environment($loader);
213
-
214
- $template = $twig->load($templateName);
215
- $this->assertSame('VALID Child', $template->renderBlock('body', []));
216
- }
217
-
218
- /**
219
- * @requires PHP 5.3
220
- */
221
- public function testLoadTemplateFromPhar()
222
- {
223
- $loader = new FilesystemLoader([]);
224
- // phar-sample.phar was created with the following script:
225
- // $f = new Phar('phar-test.phar');
226
- // $f->addFromString('hello.twig', 'hello from phar');
227
- $loader->addPath('phar://'.__DIR__.'/Fixtures/phar/phar-sample.phar');
228
- $this->assertSame('hello from phar', $loader->getSourceContext('hello.twig')->getCode());
229
- }
230
-
231
- public function testTemplateExistsAlwaysReturnsBool()
232
- {
233
- $loader = new FilesystemLoader([]);
234
- $this->assertFalse($loader->exists("foo\0.twig"));
235
- $this->assertFalse($loader->exists('../foo.twig'));
236
- $this->assertFalse($loader->exists('@foo'));
237
- $this->assertFalse($loader->exists('foo'));
238
- $this->assertFalse($loader->exists('@foo/bar.twig'));
239
-
240
- $loader->addPath(__DIR__.'/Fixtures/normal');
241
- $this->assertTrue($loader->exists('index.html'));
242
- $loader->addPath(__DIR__.'/Fixtures/normal', 'foo');
243
- $this->assertTrue($loader->exists('@foo/index.html'));
244
- }
245
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php DELETED
@@ -1,39 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Loader\ArrayLoader;
14
-
15
- class Twig_Tests_NativeExtensionTest extends \PHPUnit\Framework\TestCase
16
- {
17
- /**
18
- * @requires PHP 5.3
19
- */
20
- public function testGetProperties()
21
- {
22
- if (PHP_VERSION_ID >= 70000) {
23
- $this->markTestSkipped('Extension is not available on PHP 7+');
24
- }
25
-
26
- $twig = new Environment(new ArrayLoader(['index' => '{{ d1.date }}{{ d2.date }}']), [
27
- 'debug' => true,
28
- 'cache' => false,
29
- 'autoescape' => false,
30
- ]);
31
-
32
- $d1 = new \DateTime();
33
- $d2 = new \DateTime();
34
- $output = $twig->render('index', compact('d1', 'd2'));
35
-
36
- // If it fails, PHP will crash.
37
- $this->assertEquals($output, $d1->date.$d2->date);
38
- }
39
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\AutoEscapeNode;
13
- use Twig\Node\Node;
14
- use Twig\Node\TextNode;
15
- use Twig\Test\NodeTestCase;
16
-
17
- class Twig_Tests_Node_AutoEscapeTest extends NodeTestCase
18
- {
19
- public function testConstructor()
20
- {
21
- $body = new Node([new TextNode('foo', 1)]);
22
- $node = new AutoEscapeNode(true, $body, 1);
23
-
24
- $this->assertEquals($body, $node->getNode('body'));
25
- $this->assertTrue($node->getAttribute('value'));
26
- }
27
-
28
- public function getTests()
29
- {
30
- $body = new Node([new TextNode('foo', 1)]);
31
- $node = new AutoEscapeNode(true, $body, 1);
32
-
33
- return [
34
- [$node, "// line 1\necho \"foo\";"],
35
- ];
36
- }
37
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\BlockReferenceNode;
13
- use Twig\Test\NodeTestCase;
14
-
15
- class Twig_Tests_Node_BlockReferenceTest extends NodeTestCase
16
- {
17
- public function testConstructor()
18
- {
19
- $node = new BlockReferenceNode('foo', 1);
20
-
21
- $this->assertEquals('foo', $node->getAttribute('name'));
22
- }
23
-
24
- public function getTests()
25
- {
26
- return [
27
- [new BlockReferenceNode('foo', 1), <<<EOF
28
- // line 1
29
- \$this->displayBlock('foo', \$context, \$blocks);
30
- EOF
31
- ],
32
- ];
33
- }
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\BlockNode;
13
- use Twig\Node\TextNode;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_BlockTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $body = new TextNode('foo', 1);
21
- $node = new BlockNode('foo', $body, 1);
22
-
23
- $this->assertEquals($body, $node->getNode('body'));
24
- $this->assertEquals('foo', $node->getAttribute('name'));
25
- }
26
-
27
- public function getTests()
28
- {
29
- $body = new TextNode('foo', 1);
30
- $node = new BlockNode('foo', $body, 1);
31
-
32
- return [
33
- [$node, <<<EOF
34
- // line 1
35
- public function block_foo(\$context, array \$blocks = [])
36
- {
37
- echo "foo";
38
- }
39
- EOF
40
- ],
41
- ];
42
- }
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/DeprecatedTest.php DELETED
@@ -1,80 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Node\DeprecatedNode;
14
- use Twig\Node\Expression\ConstantExpression;
15
- use Twig\Node\Expression\FunctionExpression;
16
- use Twig\Node\IfNode;
17
- use Twig\Node\Node;
18
- use Twig\Test\NodeTestCase;
19
- use Twig\TwigFunction;
20
-
21
- class Twig_Tests_Node_DeprecatedTest extends NodeTestCase
22
- {
23
- public function testConstructor()
24
- {
25
- $expr = new ConstantExpression('foo', 1);
26
- $node = new DeprecatedNode($expr, 1);
27
-
28
- $this->assertEquals($expr, $node->getNode('expr'));
29
- }
30
-
31
- public function getTests()
32
- {
33
- $tests = [];
34
-
35
- $expr = new ConstantExpression('This section is deprecated', 1);
36
- $node = new DeprecatedNode($expr, 1, 'deprecated');
37
- $node->setTemplateName('foo.twig');
38
-
39
- $tests[] = [$node, <<<EOF
40
- // line 1
41
- @trigger_error("This section is deprecated"." (\"foo.twig\" at line 1).", E_USER_DEPRECATED);
42
- EOF
43
- ];
44
-
45
- $t = new Node([
46
- new ConstantExpression(true, 1),
47
- new DeprecatedNode($expr, 2, 'deprecated'),
48
- ], [], 1);
49
- $node = new IfNode($t, null, 1);
50
- $node->setTemplateName('foo.twig');
51
-
52
- $tests[] = [$node, <<<EOF
53
- // line 1
54
- if (true) {
55
- // line 2
56
- @trigger_error("This section is deprecated"." (\"foo.twig\" at line 2).", E_USER_DEPRECATED);
57
- }
58
- EOF
59
- ];
60
-
61
- $environment = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
62
- $environment->addFunction(new TwigFunction('foo', 'foo', []));
63
-
64
- $expr = new FunctionExpression('foo', new Node(), 1);
65
- $node = new DeprecatedNode($expr, 1, 'deprecated');
66
- $node->setTemplateName('foo.twig');
67
-
68
- $compiler = $this->getCompiler($environment);
69
- $varName = $compiler->getVarName();
70
-
71
- $tests[] = [$node, <<<EOF
72
- // line 1
73
- \$$varName = foo();
74
- @trigger_error(\$$varName." (\"foo.twig\" at line 1).", E_USER_DEPRECATED);
75
- EOF
76
- , $environment];
77
-
78
- return $tests;
79
- }
80
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/DoTest.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\DoNode;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_DoTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $expr = new ConstantExpression('foo', 1);
21
- $node = new DoNode($expr, 1);
22
-
23
- $this->assertEquals($expr, $node->getNode('expr'));
24
- }
25
-
26
- public function getTests()
27
- {
28
- $tests = [];
29
-
30
- $expr = new ConstantExpression('foo', 1);
31
- $node = new DoNode($expr, 1);
32
- $tests[] = [$node, "// line 1\n\"foo\";"];
33
-
34
- return $tests;
35
- }
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\ArrayExpression;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_ArrayTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $elements = [new ConstantExpression('foo', 1), $foo = new ConstantExpression('bar', 1)];
21
- $node = new ArrayExpression($elements, 1);
22
-
23
- $this->assertEquals($foo, $node->getNode(1));
24
- }
25
-
26
- public function getTests()
27
- {
28
- $elements = [
29
- new ConstantExpression('foo', 1),
30
- new ConstantExpression('bar', 1),
31
-
32
- new ConstantExpression('bar', 1),
33
- new ConstantExpression('foo', 1),
34
- ];
35
- $node = new ArrayExpression($elements, 1);
36
-
37
- return [
38
- [$node, '["foo" => "bar", "bar" => "foo"]'],
39
- ];
40
- }
41
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\AssignNameExpression;
13
- use Twig\Test\NodeTestCase;
14
-
15
- class Twig_Tests_Node_Expression_AssignNameTest extends NodeTestCase
16
- {
17
- public function testConstructor()
18
- {
19
- $node = new AssignNameExpression('foo', 1);
20
-
21
- $this->assertEquals('foo', $node->getAttribute('name'));
22
- }
23
-
24
- public function getTests()
25
- {
26
- $node = new AssignNameExpression('foo', 1);
27
-
28
- return [
29
- [$node, '$context["foo"]'],
30
- ];
31
- }
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\Binary\AddBinary;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_Binary_AddTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $left = new ConstantExpression(1, 1);
21
- $right = new ConstantExpression(2, 1);
22
- $node = new AddBinary($left, $right, 1);
23
-
24
- $this->assertEquals($left, $node->getNode('left'));
25
- $this->assertEquals($right, $node->getNode('right'));
26
- }
27
-
28
- public function getTests()
29
- {
30
- $left = new ConstantExpression(1, 1);
31
- $right = new ConstantExpression(2, 1);
32
- $node = new AddBinary($left, $right, 1);
33
-
34
- return [
35
- [$node, '(1 + 2)'],
36
- ];
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\Binary\AndBinary;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_Binary_AndTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $left = new ConstantExpression(1, 1);
21
- $right = new ConstantExpression(2, 1);
22
- $node = new AndBinary($left, $right, 1);
23
-
24
- $this->assertEquals($left, $node->getNode('left'));
25
- $this->assertEquals($right, $node->getNode('right'));
26
- }
27
-
28
- public function getTests()
29
- {
30
- $left = new ConstantExpression(1, 1);
31
- $right = new ConstantExpression(2, 1);
32
- $node = new AndBinary($left, $right, 1);
33
-
34
- return [
35
- [$node, '(1 && 2)'],
36
- ];
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\Binary\ConcatBinary;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_Binary_ConcatTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $left = new ConstantExpression(1, 1);
21
- $right = new ConstantExpression(2, 1);
22
- $node = new ConcatBinary($left, $right, 1);
23
-
24
- $this->assertEquals($left, $node->getNode('left'));
25
- $this->assertEquals($right, $node->getNode('right'));
26
- }
27
-
28
- public function getTests()
29
- {
30
- $left = new ConstantExpression(1, 1);
31
- $right = new ConstantExpression(2, 1);
32
- $node = new ConcatBinary($left, $right, 1);
33
-
34
- return [
35
- [$node, '(1 . 2)'],
36
- ];
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\Binary\DivBinary;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_Binary_DivTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $left = new ConstantExpression(1, 1);
21
- $right = new ConstantExpression(2, 1);
22
- $node = new DivBinary($left, $right, 1);
23
-
24
- $this->assertEquals($left, $node->getNode('left'));
25
- $this->assertEquals($right, $node->getNode('right'));
26
- }
27
-
28
- public function getTests()
29
- {
30
- $left = new ConstantExpression(1, 1);
31
- $right = new ConstantExpression(2, 1);
32
- $node = new DivBinary($left, $right, 1);
33
-
34
- return [
35
- [$node, '(1 / 2)'],
36
- ];
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\Binary\FloorDivBinary;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_Binary_FloorDivTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $left = new ConstantExpression(1, 1);
21
- $right = new ConstantExpression(2, 1);
22
- $node = new FloorDivBinary($left, $right, 1);
23
-
24
- $this->assertEquals($left, $node->getNode('left'));
25
- $this->assertEquals($right, $node->getNode('right'));
26
- }
27
-
28
- public function getTests()
29
- {
30
- $left = new ConstantExpression(1, 1);
31
- $right = new ConstantExpression(2, 1);
32
- $node = new FloorDivBinary($left, $right, 1);
33
-
34
- return [
35
- [$node, '(int) floor((1 / 2))'],
36
- ];
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\Binary\ModBinary;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_Binary_ModTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $left = new ConstantExpression(1, 1);
21
- $right = new ConstantExpression(2, 1);
22
- $node = new ModBinary($left, $right, 1);
23
-
24
- $this->assertEquals($left, $node->getNode('left'));
25
- $this->assertEquals($right, $node->getNode('right'));
26
- }
27
-
28
- public function getTests()
29
- {
30
- $left = new ConstantExpression(1, 1);
31
- $right = new ConstantExpression(2, 1);
32
- $node = new ModBinary($left, $right, 1);
33
-
34
- return [
35
- [$node, '(1 % 2)'],
36
- ];
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\Binary\MulBinary;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_Binary_MulTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $left = new ConstantExpression(1, 1);
21
- $right = new ConstantExpression(2, 1);
22
- $node = new MulBinary($left, $right, 1);
23
-
24
- $this->assertEquals($left, $node->getNode('left'));
25
- $this->assertEquals($right, $node->getNode('right'));
26
- }
27
-
28
- public function getTests()
29
- {
30
- $left = new ConstantExpression(1, 1);
31
- $right = new ConstantExpression(2, 1);
32
- $node = new MulBinary($left, $right, 1);
33
-
34
- return [
35
- [$node, '(1 * 2)'],
36
- ];
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\Binary\OrBinary;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_Binary_OrTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $left = new ConstantExpression(1, 1);
21
- $right = new ConstantExpression(2, 1);
22
- $node = new OrBinary($left, $right, 1);
23
-
24
- $this->assertEquals($left, $node->getNode('left'));
25
- $this->assertEquals($right, $node->getNode('right'));
26
- }
27
-
28
- public function getTests()
29
- {
30
- $left = new ConstantExpression(1, 1);
31
- $right = new ConstantExpression(2, 1);
32
- $node = new OrBinary($left, $right, 1);
33
-
34
- return [
35
- [$node, '(1 || 2)'],
36
- ];
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\Binary\SubBinary;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_Binary_SubTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $left = new ConstantExpression(1, 1);
21
- $right = new ConstantExpression(2, 1);
22
- $node = new SubBinary($left, $right, 1);
23
-
24
- $this->assertEquals($left, $node->getNode('left'));
25
- $this->assertEquals($right, $node->getNode('right'));
26
- }
27
-
28
- public function getTests()
29
- {
30
- $left = new ConstantExpression(1, 1);
31
- $right = new ConstantExpression(2, 1);
32
- $node = new SubBinary($left, $right, 1);
33
-
34
- return [
35
- [$node, '(1 - 2)'],
36
- ];
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php DELETED
@@ -1,145 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\CallExpression;
13
-
14
- class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase
15
- {
16
- public function testGetArguments()
17
- {
18
- $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
19
- $this->assertEquals(['U', null], $node->getArguments('date', ['format' => 'U', 'timestamp' => null]));
20
- }
21
-
22
- /**
23
- * @expectedException \Twig\Error\SyntaxError
24
- * @expectedExceptionMessage Positional arguments cannot be used after named arguments for function "date".
25
- */
26
- public function testGetArgumentsWhenPositionalArgumentsAfterNamedArguments()
27
- {
28
- $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
29
- $node->getArguments('date', ['timestamp' => 123456, 'Y-m-d']);
30
- }
31
-
32
- /**
33
- * @expectedException \Twig\Error\SyntaxError
34
- * @expectedExceptionMessage Argument "format" is defined twice for function "date".
35
- */
36
- public function testGetArgumentsWhenArgumentIsDefinedTwice()
37
- {
38
- $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
39
- $node->getArguments('date', ['Y-m-d', 'format' => 'U']);
40
- }
41
-
42
- /**
43
- * @expectedException \Twig\Error\SyntaxError
44
- * @expectedExceptionMessage Unknown argument "unknown" for function "date(format, timestamp)".
45
- */
46
- public function testGetArgumentsWithWrongNamedArgumentName()
47
- {
48
- $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
49
- $node->getArguments('date', ['Y-m-d', 'timestamp' => null, 'unknown' => '']);
50
- }
51
-
52
- /**
53
- * @expectedException \Twig\Error\SyntaxError
54
- * @expectedExceptionMessage Unknown arguments "unknown1", "unknown2" for function "date(format, timestamp)".
55
- */
56
- public function testGetArgumentsWithWrongNamedArgumentNames()
57
- {
58
- $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
59
- $node->getArguments('date', ['Y-m-d', 'timestamp' => null, 'unknown1' => '', 'unknown2' => '']);
60
- }
61
-
62
- /**
63
- * @expectedException \Twig\Error\SyntaxError
64
- * @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".
65
- */
66
- public function testResolveArgumentsWithMissingValueForOptionalArgument()
67
- {
68
- $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'substr_compare']);
69
- $node->getArguments('substr_compare', ['abcd', 'bc', 'offset' => 1, 'case_sensitivity' => true]);
70
- }
71
-
72
- public function testResolveArgumentsOnlyNecessaryArgumentsForCustomFunction()
73
- {
74
- $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'custom_function']);
75
-
76
- $this->assertEquals(['arg1'], $node->getArguments([$this, 'customFunction'], ['arg1' => 'arg1']));
77
- }
78
-
79
- public function testGetArgumentsForStaticMethod()
80
- {
81
- $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'custom_static_function']);
82
- $this->assertEquals(['arg1'], $node->getArguments(__CLASS__.'::customStaticFunction', ['arg1' => 'arg1']));
83
- }
84
-
85
- /**
86
- * @expectedException \LogicException
87
- * @expectedExceptionMessage The last parameter of "Twig_Tests_Node_Expression_CallTest::customFunctionWithArbitraryArguments" for function "foo" must be an array with default value, eg. "array $arg = []".
88
- */
89
- public function testResolveArgumentsWithMissingParameterForArbitraryArguments()
90
- {
91
- $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]);
92
- $node->getArguments([$this, 'customFunctionWithArbitraryArguments'], []);
93
- }
94
-
95
- public static function customStaticFunction($arg1, $arg2 = 'default', $arg3 = [])
96
- {
97
- }
98
-
99
- public function customFunction($arg1, $arg2 = 'default', $arg3 = [])
100
- {
101
- }
102
-
103
- public function customFunctionWithArbitraryArguments()
104
- {
105
- }
106
-
107
- /**
108
- * @expectedException \LogicException
109
- * @expectedExceptionMessageRegExp #^The last parameter of "custom_Twig_Tests_Node_Expression_CallTest_function" for function "foo" must be an array with default value, eg\. "array \$arg \= \[\]"\.$#
110
- */
111
- public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnFunction()
112
- {
113
- $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]);
114
- $node->getArguments('custom_Twig_Tests_Node_Expression_CallTest_function', []);
115
- }
116
-
117
- /**
118
- * @expectedException \LogicException
119
- * @expectedExceptionMessageRegExp #^The last parameter of "CallableTestClass\:\:__invoke" for function "foo" must be an array with default value, eg\. "array \$arg \= \[\]"\.$#
120
- */
121
- public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnObject()
122
- {
123
- $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]);
124
- $node->getArguments(new CallableTestClass(), []);
125
- }
126
- }
127
-
128
- class Twig_Tests_Node_Expression_Call extends CallExpression
129
- {
130
- public function getArguments($callable, $arguments)
131
- {
132
- return parent::getArguments($callable, $arguments);
133
- }
134
- }
135
-
136
- class CallableTestClass
137
- {
138
- public function __invoke($required)
139
- {
140
- }
141
- }
142
-
143
- function custom_Twig_Tests_Node_Expression_CallTest_function($required)
144
- {
145
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php DELETED
@@ -1,42 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\ConditionalExpression;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_ConditionalTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $expr1 = new ConstantExpression(1, 1);
21
- $expr2 = new ConstantExpression(2, 1);
22
- $expr3 = new ConstantExpression(3, 1);
23
- $node = new ConditionalExpression($expr1, $expr2, $expr3, 1);
24
-
25
- $this->assertEquals($expr1, $node->getNode('expr1'));
26
- $this->assertEquals($expr2, $node->getNode('expr2'));
27
- $this->assertEquals($expr3, $node->getNode('expr3'));
28
- }
29
-
30
- public function getTests()
31
- {
32
- $tests = [];
33
-
34
- $expr1 = new ConstantExpression(1, 1);
35
- $expr2 = new ConstantExpression(2, 1);
36
- $expr3 = new ConstantExpression(3, 1);
37
- $node = new ConditionalExpression($expr1, $expr2, $expr3, 1);
38
- $tests[] = [$node, '((1) ? (2) : (3))'];
39
-
40
- return $tests;
41
- }
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\ConstantExpression;
13
- use Twig\Test\NodeTestCase;
14
-
15
- class Twig_Tests_Node_Expression_ConstantTest extends NodeTestCase
16
- {
17
- public function testConstructor()
18
- {
19
- $node = new ConstantExpression('foo', 1);
20
-
21
- $this->assertEquals('foo', $node->getAttribute('value'));
22
- }
23
-
24
- public function getTests()
25
- {
26
- $tests = [];
27
-
28
- $node = new ConstantExpression('foo', 1);
29
- $tests[] = [$node, '"foo"'];
30
-
31
- return $tests;
32
- }
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php DELETED
@@ -1,161 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Node\Expression\FilterExpression;
15
- use Twig\Node\Node;
16
- use Twig\Test\NodeTestCase;
17
- use Twig\TwigFilter;
18
-
19
- class Twig_Tests_Node_Expression_FilterTest extends NodeTestCase
20
- {
21
- public function testConstructor()
22
- {
23
- $expr = new ConstantExpression('foo', 1);
24
- $name = new ConstantExpression('upper', 1);
25
- $args = new Node();
26
- $node = new FilterExpression($expr, $name, $args, 1);
27
-
28
- $this->assertEquals($expr, $node->getNode('node'));
29
- $this->assertEquals($name, $node->getNode('filter'));
30
- $this->assertEquals($args, $node->getNode('arguments'));
31
- }
32
-
33
- public function getTests()
34
- {
35
- $environment = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
36
- $environment->addFilter(new TwigFilter('bar', 'bar', ['needs_environment' => true]));
37
- $environment->addFilter(new TwigFilter('barbar', 'twig_tests_filter_barbar', ['needs_context' => true, 'is_variadic' => true]));
38
-
39
- $tests = [];
40
-
41
- $expr = new ConstantExpression('foo', 1);
42
- $node = $this->createFilter($expr, 'upper');
43
- $node = $this->createFilter($node, 'number_format', [new ConstantExpression(2, 1), new ConstantExpression('.', 1), new ConstantExpression(',', 1)]);
44
-
45
- if (\function_exists('mb_get_info')) {
46
- $tests[] = [$node, 'twig_number_format_filter($this->env, twig_upper_filter($this->env, "foo"), 2, ".", ",")'];
47
- } else {
48
- $tests[] = [$node, 'twig_number_format_filter($this->env, strtoupper("foo"), 2, ".", ",")'];
49
- }
50
-
51
- // named arguments
52
- $date = new ConstantExpression(0, 1);
53
- $node = $this->createFilter($date, 'date', [
54
- 'timezone' => new ConstantExpression('America/Chicago', 1),
55
- 'format' => new ConstantExpression('d/m/Y H:i:s P', 1),
56
- ]);
57
- $tests[] = [$node, 'twig_date_format_filter($this->env, 0, "d/m/Y H:i:s P", "America/Chicago")'];
58
-
59
- // skip an optional argument
60
- $date = new ConstantExpression(0, 1);
61
- $node = $this->createFilter($date, 'date', [
62
- 'timezone' => new ConstantExpression('America/Chicago', 1),
63
- ]);
64
- $tests[] = [$node, 'twig_date_format_filter($this->env, 0, null, "America/Chicago")'];
65
-
66
- // underscores vs camelCase for named arguments
67
- $string = new ConstantExpression('abc', 1);
68
- $node = $this->createFilter($string, 'reverse', [
69
- 'preserve_keys' => new ConstantExpression(true, 1),
70
- ]);
71
- $tests[] = [$node, 'twig_reverse_filter($this->env, "abc", true)'];
72
- $node = $this->createFilter($string, 'reverse', [
73
- 'preserveKeys' => new ConstantExpression(true, 1),
74
- ]);
75
- $tests[] = [$node, 'twig_reverse_filter($this->env, "abc", true)'];
76
-
77
- // filter as an anonymous function
78
- if (PHP_VERSION_ID >= 50300) {
79
- $node = $this->createFilter(new ConstantExpression('foo', 1), 'anonymous');
80
- $tests[] = [$node, 'call_user_func_array($this->env->getFilter(\'anonymous\')->getCallable(), ["foo"])'];
81
- }
82
-
83
- // needs environment
84
- $node = $this->createFilter($string, 'bar');
85
- $tests[] = [$node, 'bar($this->env, "abc")', $environment];
86
-
87
- $node = $this->createFilter($string, 'bar', [new ConstantExpression('bar', 1)]);
88
- $tests[] = [$node, 'bar($this->env, "abc", "bar")', $environment];
89
-
90
- // arbitrary named arguments
91
- $node = $this->createFilter($string, 'barbar');
92
- $tests[] = [$node, 'twig_tests_filter_barbar($context, "abc")', $environment];
93
-
94
- $node = $this->createFilter($string, 'barbar', ['foo' => new ConstantExpression('bar', 1)]);
95
- $tests[] = [$node, 'twig_tests_filter_barbar($context, "abc", null, null, ["foo" => "bar"])', $environment];
96
-
97
- $node = $this->createFilter($string, 'barbar', ['arg2' => new ConstantExpression('bar', 1)]);
98
- $tests[] = [$node, 'twig_tests_filter_barbar($context, "abc", null, "bar")', $environment];
99
-
100
- $node = $this->createFilter($string, 'barbar', [
101
- new ConstantExpression('1', 1),
102
- new ConstantExpression('2', 1),
103
- new ConstantExpression('3', 1),
104
- 'foo' => new ConstantExpression('bar', 1),
105
- ]);
106
- $tests[] = [$node, 'twig_tests_filter_barbar($context, "abc", "1", "2", [0 => "3", "foo" => "bar"])', $environment];
107
-
108
- return $tests;
109
- }
110
-
111
- /**
112
- * @expectedException \Twig\Error\SyntaxError
113
- * @expectedExceptionMessage Unknown argument "foobar" for filter "date(format, timezone)" at line 1.
114
- */
115
- public function testCompileWithWrongNamedArgumentName()
116
- {
117
- $date = new ConstantExpression(0, 1);
118
- $node = $this->createFilter($date, 'date', [
119
- 'foobar' => new ConstantExpression('America/Chicago', 1),
120
- ]);
121
-
122
- $compiler = $this->getCompiler();
123
- $compiler->compile($node);
124
- }
125
-
126
- /**
127
- * @expectedException \Twig\Error\SyntaxError
128
- * @expectedExceptionMessage Value for argument "from" is required for filter "replace" at line 1.
129
- */
130
- public function testCompileWithMissingNamedArgument()
131
- {
132
- $value = new ConstantExpression(0, 1);
133
- $node = $this->createFilter($value, 'replace', [
134
- 'to' => new ConstantExpression('foo', 1),
135
- ]);
136
-
137
- $compiler = $this->getCompiler();
138
- $compiler->compile($node);
139
- }
140
-
141
- protected function createFilter($node, $name, array $arguments = [])
142
- {
143
- $name = new ConstantExpression($name, 1);
144
- $arguments = new Node($arguments);
145
-
146
- return new FilterExpression($node, $name, $arguments, 1);
147
- }
148
-
149
- protected function getEnvironment()
150
- {
151
- if (PHP_VERSION_ID >= 50300) {
152
- return include 'PHP53/FilterInclude.php';
153
- }
154
-
155
- return parent::getEnvironment();
156
- }
157
- }
158
-
159
- function twig_tests_filter_barbar($context, $string, $arg1 = null, $arg2 = null, array $args = [])
160
- {
161
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php DELETED
@@ -1,117 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Node\Expression\FunctionExpression;
15
- use Twig\Node\Node;
16
- use Twig\Test\NodeTestCase;
17
- use Twig\TwigFunction;
18
-
19
- class Twig_Tests_Node_Expression_FunctionTest extends NodeTestCase
20
- {
21
- public function testConstructor()
22
- {
23
- $name = 'function';
24
- $args = new Node();
25
- $node = new FunctionExpression($name, $args, 1);
26
-
27
- $this->assertEquals($name, $node->getAttribute('name'));
28
- $this->assertEquals($args, $node->getNode('arguments'));
29
- }
30
-
31
- public function getTests()
32
- {
33
- $environment = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
34
- $environment->addFunction(new TwigFunction('foo', 'foo', []));
35
- $environment->addFunction(new TwigFunction('bar', 'bar', ['needs_environment' => true]));
36
- $environment->addFunction(new TwigFunction('foofoo', 'foofoo', ['needs_context' => true]));
37
- $environment->addFunction(new TwigFunction('foobar', 'foobar', ['needs_environment' => true, 'needs_context' => true]));
38
- $environment->addFunction(new TwigFunction('barbar', 'twig_tests_function_barbar', ['is_variadic' => true]));
39
-
40
- $tests = [];
41
-
42
- $node = $this->createFunction('foo');
43
- $tests[] = [$node, 'foo()', $environment];
44
-
45
- $node = $this->createFunction('foo', [new ConstantExpression('bar', 1), new ConstantExpression('foobar', 1)]);
46
- $tests[] = [$node, 'foo("bar", "foobar")', $environment];
47
-
48
- $node = $this->createFunction('bar');
49
- $tests[] = [$node, 'bar($this->env)', $environment];
50
-
51
- $node = $this->createFunction('bar', [new ConstantExpression('bar', 1)]);
52
- $tests[] = [$node, 'bar($this->env, "bar")', $environment];
53
-
54
- $node = $this->createFunction('foofoo');
55
- $tests[] = [$node, 'foofoo($context)', $environment];
56
-
57
- $node = $this->createFunction('foofoo', [new ConstantExpression('bar', 1)]);
58
- $tests[] = [$node, 'foofoo($context, "bar")', $environment];
59
-
60
- $node = $this->createFunction('foobar');
61
- $tests[] = [$node, 'foobar($this->env, $context)', $environment];
62
-
63
- $node = $this->createFunction('foobar', [new ConstantExpression('bar', 1)]);
64
- $tests[] = [$node, 'foobar($this->env, $context, "bar")', $environment];
65
-
66
- // named arguments
67
- $node = $this->createFunction('date', [
68
- 'timezone' => new ConstantExpression('America/Chicago', 1),
69
- 'date' => new ConstantExpression(0, 1),
70
- ]);
71
- $tests[] = [$node, 'twig_date_converter($this->env, 0, "America/Chicago")'];
72
-
73
- // arbitrary named arguments
74
- $node = $this->createFunction('barbar');
75
- $tests[] = [$node, 'twig_tests_function_barbar()', $environment];
76
-
77
- $node = $this->createFunction('barbar', ['foo' => new ConstantExpression('bar', 1)]);
78
- $tests[] = [$node, 'twig_tests_function_barbar(null, null, ["foo" => "bar"])', $environment];
79
-
80
- $node = $this->createFunction('barbar', ['arg2' => new ConstantExpression('bar', 1)]);
81
- $tests[] = [$node, 'twig_tests_function_barbar(null, "bar")', $environment];
82
-
83
- $node = $this->createFunction('barbar', [
84
- new ConstantExpression('1', 1),
85
- new ConstantExpression('2', 1),
86
- new ConstantExpression('3', 1),
87
- 'foo' => new ConstantExpression('bar', 1),
88
- ]);
89
- $tests[] = [$node, 'twig_tests_function_barbar("1", "2", [0 => "3", "foo" => "bar"])', $environment];
90
-
91
- // function as an anonymous function
92
- if (PHP_VERSION_ID >= 50300) {
93
- $node = $this->createFunction('anonymous', [new ConstantExpression('foo', 1)]);
94
- $tests[] = [$node, 'call_user_func_array($this->env->getFunction(\'anonymous\')->getCallable(), ["foo"])'];
95
- }
96
-
97
- return $tests;
98
- }
99
-
100
- protected function createFunction($name, array $arguments = [])
101
- {
102
- return new FunctionExpression($name, new Node($arguments), 1);
103
- }
104
-
105
- protected function getEnvironment()
106
- {
107
- if (PHP_VERSION_ID >= 50300) {
108
- return include 'PHP53/FunctionInclude.php';
109
- }
110
-
111
- return parent::getEnvironment();
112
- }
113
- }
114
-
115
- function twig_tests_function_barbar($arg1 = null, $arg2 = null, array $args = [])
116
- {
117
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\ArrayExpression;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Node\Expression\GetAttrExpression;
15
- use Twig\Node\Expression\NameExpression;
16
- use Twig\Template;
17
- use Twig\Test\NodeTestCase;
18
-
19
- class Twig_Tests_Node_Expression_GetAttrTest extends NodeTestCase
20
- {
21
- public function testConstructor()
22
- {
23
- $expr = new NameExpression('foo', 1);
24
- $attr = new ConstantExpression('bar', 1);
25
- $args = new ArrayExpression([], 1);
26
- $args->addElement(new NameExpression('foo', 1));
27
- $args->addElement(new ConstantExpression('bar', 1));
28
- $node = new GetAttrExpression($expr, $attr, $args, Template::ARRAY_CALL, 1);
29
-
30
- $this->assertEquals($expr, $node->getNode('node'));
31
- $this->assertEquals($attr, $node->getNode('attribute'));
32
- $this->assertEquals($args, $node->getNode('arguments'));
33
- $this->assertEquals(Template::ARRAY_CALL, $node->getAttribute('type'));
34
- }
35
-
36
- public function getTests()
37
- {
38
- $tests = [];
39
-
40
- $expr = new NameExpression('foo', 1);
41
- $attr = new ConstantExpression('bar', 1);
42
- $args = new ArrayExpression([], 1);
43
- $node = new GetAttrExpression($expr, $attr, $args, Template::ANY_CALL, 1);
44
- $tests[] = [$node, sprintf('%s%s, "bar", [])', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))];
45
-
46
- $node = new GetAttrExpression($expr, $attr, $args, Template::ARRAY_CALL, 1);
47
- $tests[] = [$node, sprintf('%s%s, "bar", [], "array")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))];
48
-
49
- $args = new ArrayExpression([], 1);
50
- $args->addElement(new NameExpression('foo', 1));
51
- $args->addElement(new ConstantExpression('bar', 1));
52
- $node = new GetAttrExpression($expr, $attr, $args, Template::METHOD_CALL, 1);
53
- $tests[] = [$node, sprintf('%s%s, "bar", [0 => %s, 1 => "bar"], "method")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1), $this->getVariableGetter('foo'))];
54
-
55
- return $tests;
56
- }
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Node\Expression\NameExpression;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_NameTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $node = new NameExpression('foo', 1);
21
-
22
- $this->assertEquals('foo', $node->getAttribute('name'));
23
- }
24
-
25
- public function getTests()
26
- {
27
- $node = new NameExpression('foo', 1);
28
- $context = new NameExpression('_context', 1);
29
-
30
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true]);
31
- $env1 = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => false]);
32
-
33
- if (PHP_VERSION_ID >= 70000) {
34
- $output = '($context["foo"] ?? $this->getContext($context, "foo"))';
35
- } elseif (PHP_VERSION_ID >= 50400) {
36
- $output = '(isset($context["foo"]) ? $context["foo"] : $this->getContext($context, "foo"))';
37
- } else {
38
- $output = '$this->getContext($context, "foo")';
39
- }
40
-
41
- return [
42
- [$node, "// line 1\n".$output, $env],
43
- [$node, $this->getVariableGetter('foo', 1), $env1],
44
- [$context, "// line 1\n\$context"],
45
- ];
46
- }
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\ConstantExpression;
13
- use Twig\Node\Expression\NameExpression;
14
- use Twig\Node\Expression\NullCoalesceExpression;
15
- use Twig\Test\NodeTestCase;
16
-
17
- class Twig_Tests_Node_Expression_NullCoalesceTest extends NodeTestCase
18
- {
19
- public function getTests()
20
- {
21
- $tests = [];
22
-
23
- $left = new NameExpression('foo', 1);
24
- $right = new ConstantExpression(2, 1);
25
- $node = new NullCoalesceExpression($left, $right, 1);
26
- if (PHP_VERSION_ID >= 70000) {
27
- $tests[] = [$node, "((// line 1\n\$context[\"foo\"]) ?? (2))"];
28
- } elseif (PHP_VERSION_ID >= 50400) {
29
- $tests[] = [$node, "(((// line 1\n(isset(\$context[\"foo\"]) || array_key_exists(\"foo\", \$context)) && !(null === (isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)))) ? ((isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)) : (2))"];
30
- } else {
31
- $tests[] = [$node, "(((// line 1\n(isset(\$context[\"foo\"]) || array_key_exists(\"foo\", \$context)) && !(null === \$this->getContext(\$context, \"foo\")))) ? (\$this->getContext(\$context, \"foo\")) : (2))"];
32
- }
33
-
34
- return $tests;
35
- }
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
- $env = new \Twig\Environment(new \Twig\Loader\ArrayLoader([]));
4
- $env->addFilter(new \Twig\TwigFilter('anonymous', function () {}));
5
-
6
- return $env;
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
- $env = new \Twig\Environment(new \Twig\Loader\ArrayLoader([]));
4
- $env->addFunction(new \Twig\TwigFunction('anonymous', function () {}));
5
-
6
- return $env;
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
- $env = new \Twig\Environment(new \Twig\Loader\ArrayLoader([]));
4
- $env->addTest(new \Twig\TwigTest('anonymous', function () {}));
5
-
6
- return $env;
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\ParentExpression;
13
- use Twig\Test\NodeTestCase;
14
-
15
- class Twig_Tests_Node_Expression_ParentTest extends NodeTestCase
16
- {
17
- public function testConstructor()
18
- {
19
- $node = new ParentExpression('foo', 1);
20
-
21
- $this->assertEquals('foo', $node->getAttribute('name'));
22
- }
23
-
24
- public function getTests()
25
- {
26
- $tests = [];
27
- $tests[] = [new ParentExpression('foo', 1), '$this->renderParentBlock("foo", $context, $blocks)'];
28
-
29
- return $tests;
30
- }
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php DELETED
@@ -1,90 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Node\Expression\Test\NullTest;
15
- use Twig\Node\Expression\TestExpression;
16
- use Twig\Node\Node;
17
- use Twig\Test\NodeTestCase;
18
- use Twig\TwigTest;
19
-
20
- class Twig_Tests_Node_Expression_TestTest extends NodeTestCase
21
- {
22
- public function testConstructor()
23
- {
24
- $expr = new ConstantExpression('foo', 1);
25
- $name = new ConstantExpression('null', 1);
26
- $args = new Node();
27
- $node = new TestExpression($expr, $name, $args, 1);
28
-
29
- $this->assertEquals($expr, $node->getNode('node'));
30
- $this->assertEquals($args, $node->getNode('arguments'));
31
- $this->assertEquals($name, $node->getAttribute('name'));
32
- }
33
-
34
- public function getTests()
35
- {
36
- $environment = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
37
- $environment->addTest(new TwigTest('barbar', 'twig_tests_test_barbar', ['is_variadic' => true, 'need_context' => true]));
38
-
39
- $tests = [];
40
-
41
- $expr = new ConstantExpression('foo', 1);
42
- $node = new NullTest($expr, 'null', new Node([]), 1);
43
- $tests[] = [$node, '(null === "foo")'];
44
-
45
- // test as an anonymous function
46
- if (PHP_VERSION_ID >= 50300) {
47
- $node = $this->createTest(new ConstantExpression('foo', 1), 'anonymous', [new ConstantExpression('foo', 1)]);
48
- $tests[] = [$node, 'call_user_func_array($this->env->getTest(\'anonymous\')->getCallable(), ["foo", "foo"])'];
49
- }
50
-
51
- // arbitrary named arguments
52
- $string = new ConstantExpression('abc', 1);
53
- $node = $this->createTest($string, 'barbar');
54
- $tests[] = [$node, 'twig_tests_test_barbar("abc")', $environment];
55
-
56
- $node = $this->createTest($string, 'barbar', ['foo' => new ConstantExpression('bar', 1)]);
57
- $tests[] = [$node, 'twig_tests_test_barbar("abc", null, null, ["foo" => "bar"])', $environment];
58
-
59
- $node = $this->createTest($string, 'barbar', ['arg2' => new ConstantExpression('bar', 1)]);
60
- $tests[] = [$node, 'twig_tests_test_barbar("abc", null, "bar")', $environment];
61
-
62
- $node = $this->createTest($string, 'barbar', [
63
- new ConstantExpression('1', 1),
64
- new ConstantExpression('2', 1),
65
- new ConstantExpression('3', 1),
66
- 'foo' => new ConstantExpression('bar', 1),
67
- ]);
68
- $tests[] = [$node, 'twig_tests_test_barbar("abc", "1", "2", [0 => "3", "foo" => "bar"])', $environment];
69
-
70
- return $tests;
71
- }
72
-
73
- protected function createTest($node, $name, array $arguments = [])
74
- {
75
- return new TestExpression($node, $name, new Node($arguments), 1);
76
- }
77
-
78
- protected function getEnvironment()
79
- {
80
- if (PHP_VERSION_ID >= 50300) {
81
- return include 'PHP53/TestInclude.php';
82
- }
83
-
84
- return parent::getEnvironment();
85
- }
86
- }
87
-
88
- function twig_tests_test_barbar($string, $arg1 = null, $arg2 = null, array $args = [])
89
- {
90
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\ConstantExpression;
13
- use Twig\Node\Expression\Unary\NegUnary;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_Unary_NegTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $expr = new ConstantExpression(1, 1);
21
- $node = new NegUnary($expr, 1);
22
-
23
- $this->assertEquals($expr, $node->getNode('node'));
24
- }
25
-
26
- public function getTests()
27
- {
28
- $node = new ConstantExpression(1, 1);
29
- $node = new NegUnary($node, 1);
30
-
31
- return [
32
- [$node, '-1'],
33
- [new NegUnary($node, 1), '- -1'],
34
- ];
35
- }
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php DELETED
@@ -1,35 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\ConstantExpression;
13
- use Twig\Node\Expression\Unary\NotUnary;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_Unary_NotTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $expr = new ConstantExpression(1, 1);
21
- $node = new NotUnary($expr, 1);
22
-
23
- $this->assertEquals($expr, $node->getNode('node'));
24
- }
25
-
26
- public function getTests()
27
- {
28
- $node = new ConstantExpression(1, 1);
29
- $node = new NotUnary($node, 1);
30
-
31
- return [
32
- [$node, '!1'],
33
- ];
34
- }
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php DELETED
@@ -1,35 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\ConstantExpression;
13
- use Twig\Node\Expression\Unary\PosUnary;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_Expression_Unary_PosTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $expr = new ConstantExpression(1, 1);
21
- $node = new PosUnary($expr, 1);
22
-
23
- $this->assertEquals($expr, $node->getNode('node'));
24
- }
25
-
26
- public function getTests()
27
- {
28
- $node = new ConstantExpression(1, 1);
29
- $node = new PosUnary($node, 1);
30
-
31
- return [
32
- [$node, '+1'],
33
- ];
34
- }
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/ForTest.php DELETED
@@ -1,199 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\AssignNameExpression;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Node\Expression\NameExpression;
15
- use Twig\Node\ForNode;
16
- use Twig\Node\Node;
17
- use Twig\Node\PrintNode;
18
- use Twig\Test\NodeTestCase;
19
-
20
- class Twig_Tests_Node_ForTest extends NodeTestCase
21
- {
22
- public function testConstructor()
23
- {
24
- $keyTarget = new AssignNameExpression('key', 1);
25
- $valueTarget = new AssignNameExpression('item', 1);
26
- $seq = new NameExpression('items', 1);
27
- $ifexpr = new ConstantExpression(true, 1);
28
- $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1);
29
- $else = null;
30
- $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
31
- $node->setAttribute('with_loop', false);
32
-
33
- $this->assertEquals($keyTarget, $node->getNode('key_target'));
34
- $this->assertEquals($valueTarget, $node->getNode('value_target'));
35
- $this->assertEquals($seq, $node->getNode('seq'));
36
- $this->assertTrue($node->getAttribute('ifexpr'));
37
- $this->assertInstanceOf('\Twig\Node\IfNode', $node->getNode('body'));
38
- $this->assertEquals($body, $node->getNode('body')->getNode('tests')->getNode(1)->getNode(0));
39
- $this->assertFalse($node->hasNode('else'));
40
-
41
- $else = new PrintNode(new NameExpression('foo', 1), 1);
42
- $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
43
- $node->setAttribute('with_loop', false);
44
- $this->assertEquals($else, $node->getNode('else'));
45
- }
46
-
47
- public function getTests()
48
- {
49
- $tests = [];
50
-
51
- $keyTarget = new AssignNameExpression('key', 1);
52
- $valueTarget = new AssignNameExpression('item', 1);
53
- $seq = new NameExpression('items', 1);
54
- $ifexpr = null;
55
- $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1);
56
- $else = null;
57
- $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
58
- $node->setAttribute('with_loop', false);
59
-
60
- $tests[] = [$node, <<<EOF
61
- // line 1
62
- \$context['_parent'] = \$context;
63
- \$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('items')});
64
- foreach (\$context['_seq'] as \$context["key"] => \$context["item"]) {
65
- echo {$this->getVariableGetter('foo')};
66
- }
67
- \$_parent = \$context['_parent'];
68
- unset(\$context['_seq'], \$context['_iterated'], \$context['key'], \$context['item'], \$context['_parent'], \$context['loop']);
69
- \$context = array_intersect_key(\$context, \$_parent) + \$_parent;
70
- EOF
71
- ];
72
-
73
- $keyTarget = new AssignNameExpression('k', 1);
74
- $valueTarget = new AssignNameExpression('v', 1);
75
- $seq = new NameExpression('values', 1);
76
- $ifexpr = null;
77
- $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1);
78
- $else = null;
79
- $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
80
- $node->setAttribute('with_loop', true);
81
-
82
- $tests[] = [$node, <<<EOF
83
- // line 1
84
- \$context['_parent'] = \$context;
85
- \$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('values')});
86
- \$context['loop'] = [
87
- 'parent' => \$context['_parent'],
88
- 'index0' => 0,
89
- 'index' => 1,
90
- 'first' => true,
91
- ];
92
- if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof \Countable)) {
93
- \$length = count(\$context['_seq']);
94
- \$context['loop']['revindex0'] = \$length - 1;
95
- \$context['loop']['revindex'] = \$length;
96
- \$context['loop']['length'] = \$length;
97
- \$context['loop']['last'] = 1 === \$length;
98
- }
99
- foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) {
100
- echo {$this->getVariableGetter('foo')};
101
- ++\$context['loop']['index0'];
102
- ++\$context['loop']['index'];
103
- \$context['loop']['first'] = false;
104
- if (isset(\$context['loop']['length'])) {
105
- --\$context['loop']['revindex0'];
106
- --\$context['loop']['revindex'];
107
- \$context['loop']['last'] = 0 === \$context['loop']['revindex0'];
108
- }
109
- }
110
- \$_parent = \$context['_parent'];
111
- unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']);
112
- \$context = array_intersect_key(\$context, \$_parent) + \$_parent;
113
- EOF
114
- ];
115
-
116
- $keyTarget = new AssignNameExpression('k', 1);
117
- $valueTarget = new AssignNameExpression('v', 1);
118
- $seq = new NameExpression('values', 1);
119
- $ifexpr = new ConstantExpression(true, 1);
120
- $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1);
121
- $else = null;
122
- $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
123
- $node->setAttribute('with_loop', true);
124
-
125
- $tests[] = [$node, <<<EOF
126
- // line 1
127
- \$context['_parent'] = \$context;
128
- \$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('values')});
129
- \$context['loop'] = [
130
- 'parent' => \$context['_parent'],
131
- 'index0' => 0,
132
- 'index' => 1,
133
- 'first' => true,
134
- ];
135
- foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) {
136
- if (true) {
137
- echo {$this->getVariableGetter('foo')};
138
- ++\$context['loop']['index0'];
139
- ++\$context['loop']['index'];
140
- \$context['loop']['first'] = false;
141
- }
142
- }
143
- \$_parent = \$context['_parent'];
144
- unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']);
145
- \$context = array_intersect_key(\$context, \$_parent) + \$_parent;
146
- EOF
147
- ];
148
-
149
- $keyTarget = new AssignNameExpression('k', 1);
150
- $valueTarget = new AssignNameExpression('v', 1);
151
- $seq = new NameExpression('values', 1);
152
- $ifexpr = null;
153
- $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1);
154
- $else = new PrintNode(new NameExpression('foo', 1), 1);
155
- $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
156
- $node->setAttribute('with_loop', true);
157
-
158
- $tests[] = [$node, <<<EOF
159
- // line 1
160
- \$context['_parent'] = \$context;
161
- \$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('values')});
162
- \$context['_iterated'] = false;
163
- \$context['loop'] = [
164
- 'parent' => \$context['_parent'],
165
- 'index0' => 0,
166
- 'index' => 1,
167
- 'first' => true,
168
- ];
169
- if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof \Countable)) {
170
- \$length = count(\$context['_seq']);
171
- \$context['loop']['revindex0'] = \$length - 1;
172
- \$context['loop']['revindex'] = \$length;
173
- \$context['loop']['length'] = \$length;
174
- \$context['loop']['last'] = 1 === \$length;
175
- }
176
- foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) {
177
- echo {$this->getVariableGetter('foo')};
178
- \$context['_iterated'] = true;
179
- ++\$context['loop']['index0'];
180
- ++\$context['loop']['index'];
181
- \$context['loop']['first'] = false;
182
- if (isset(\$context['loop']['length'])) {
183
- --\$context['loop']['revindex0'];
184
- --\$context['loop']['revindex'];
185
- \$context['loop']['last'] = 0 === \$context['loop']['revindex0'];
186
- }
187
- }
188
- if (!\$context['_iterated']) {
189
- echo {$this->getVariableGetter('foo')};
190
- }
191
- \$_parent = \$context['_parent'];
192
- unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']);
193
- \$context = array_intersect_key(\$context, \$_parent) + \$_parent;
194
- EOF
195
- ];
196
-
197
- return $tests;
198
- }
199
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/IfTest.php DELETED
@@ -1,95 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\ConstantExpression;
13
- use Twig\Node\Expression\NameExpression;
14
- use Twig\Node\IfNode;
15
- use Twig\Node\Node;
16
- use Twig\Node\PrintNode;
17
- use Twig\Test\NodeTestCase;
18
-
19
- class Twig_Tests_Node_IfTest extends NodeTestCase
20
- {
21
- public function testConstructor()
22
- {
23
- $t = new Node([
24
- new ConstantExpression(true, 1),
25
- new PrintNode(new NameExpression('foo', 1), 1),
26
- ], [], 1);
27
- $else = null;
28
- $node = new IfNode($t, $else, 1);
29
-
30
- $this->assertEquals($t, $node->getNode('tests'));
31
- $this->assertFalse($node->hasNode('else'));
32
-
33
- $else = new PrintNode(new NameExpression('bar', 1), 1);
34
- $node = new IfNode($t, $else, 1);
35
- $this->assertEquals($else, $node->getNode('else'));
36
- }
37
-
38
- public function getTests()
39
- {
40
- $tests = [];
41
-
42
- $t = new Node([
43
- new ConstantExpression(true, 1),
44
- new PrintNode(new NameExpression('foo', 1), 1),
45
- ], [], 1);
46
- $else = null;
47
- $node = new IfNode($t, $else, 1);
48
-
49
- $tests[] = [$node, <<<EOF
50
- // line 1
51
- if (true) {
52
- echo {$this->getVariableGetter('foo')};
53
- }
54
- EOF
55
- ];
56
-
57
- $t = new Node([
58
- new ConstantExpression(true, 1),
59
- new PrintNode(new NameExpression('foo', 1), 1),
60
- new ConstantExpression(false, 1),
61
- new PrintNode(new NameExpression('bar', 1), 1),
62
- ], [], 1);
63
- $else = null;
64
- $node = new IfNode($t, $else, 1);
65
-
66
- $tests[] = [$node, <<<EOF
67
- // line 1
68
- if (true) {
69
- echo {$this->getVariableGetter('foo')};
70
- } elseif (false) {
71
- echo {$this->getVariableGetter('bar')};
72
- }
73
- EOF
74
- ];
75
-
76
- $t = new Node([
77
- new ConstantExpression(true, 1),
78
- new PrintNode(new NameExpression('foo', 1), 1),
79
- ], [], 1);
80
- $else = new PrintNode(new NameExpression('bar', 1), 1);
81
- $node = new IfNode($t, $else, 1);
82
-
83
- $tests[] = [$node, <<<EOF
84
- // line 1
85
- if (true) {
86
- echo {$this->getVariableGetter('foo')};
87
- } else {
88
- echo {$this->getVariableGetter('bar')};
89
- }
90
- EOF
91
- ];
92
-
93
- return $tests;
94
- }
95
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\AssignNameExpression;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Node\ImportNode;
15
- use Twig\Test\NodeTestCase;
16
-
17
- class Twig_Tests_Node_ImportTest extends NodeTestCase
18
- {
19
- public function testConstructor()
20
- {
21
- $macro = new ConstantExpression('foo.twig', 1);
22
- $var = new AssignNameExpression('macro', 1);
23
- $node = new ImportNode($macro, $var, 1);
24
-
25
- $this->assertEquals($macro, $node->getNode('expr'));
26
- $this->assertEquals($var, $node->getNode('var'));
27
- }
28
-
29
- public function getTests()
30
- {
31
- $tests = [];
32
-
33
- $macro = new ConstantExpression('foo.twig', 1);
34
- $var = new AssignNameExpression('macro', 1);
35
- $node = new ImportNode($macro, $var, 1);
36
-
37
- $tests[] = [$node, <<<EOF
38
- // line 1
39
- \$context["macro"] = \$this->loadTemplate("foo.twig", null, 1)->unwrap();
40
- EOF
41
- ];
42
-
43
- return $tests;
44
- }
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php DELETED
@@ -1,93 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\ArrayExpression;
13
- use Twig\Node\Expression\ConditionalExpression;
14
- use Twig\Node\Expression\ConstantExpression;
15
- use Twig\Node\IncludeNode;
16
- use Twig\Test\NodeTestCase;
17
-
18
- class Twig_Tests_Node_IncludeTest extends NodeTestCase
19
- {
20
- public function testConstructor()
21
- {
22
- $expr = new ConstantExpression('foo.twig', 1);
23
- $node = new IncludeNode($expr, null, false, false, 1);
24
-
25
- $this->assertFalse($node->hasNode('variables'));
26
- $this->assertEquals($expr, $node->getNode('expr'));
27
- $this->assertFalse($node->getAttribute('only'));
28
-
29
- $vars = new ArrayExpression([new ConstantExpression('foo', 1), new ConstantExpression(true, 1)], 1);
30
- $node = new IncludeNode($expr, $vars, true, false, 1);
31
- $this->assertEquals($vars, $node->getNode('variables'));
32
- $this->assertTrue($node->getAttribute('only'));
33
- }
34
-
35
- public function getTests()
36
- {
37
- $tests = [];
38
-
39
- $expr = new ConstantExpression('foo.twig', 1);
40
- $node = new IncludeNode($expr, null, false, false, 1);
41
- $tests[] = [$node, <<<EOF
42
- // line 1
43
- \$this->loadTemplate("foo.twig", null, 1)->display(\$context);
44
- EOF
45
- ];
46
-
47
- $expr = new ConditionalExpression(
48
- new ConstantExpression(true, 1),
49
- new ConstantExpression('foo', 1),
50
- new ConstantExpression('foo', 1),
51
- 0
52
- );
53
- $node = new IncludeNode($expr, null, false, false, 1);
54
- $tests[] = [$node, <<<EOF
55
- // line 1
56
- \$this->loadTemplate(((true) ? ("foo") : ("foo")), null, 1)->display(\$context);
57
- EOF
58
- ];
59
-
60
- $expr = new ConstantExpression('foo.twig', 1);
61
- $vars = new ArrayExpression([new ConstantExpression('foo', 1), new ConstantExpression(true, 1)], 1);
62
- $node = new IncludeNode($expr, $vars, false, false, 1);
63
- $tests[] = [$node, <<<EOF
64
- // line 1
65
- \$this->loadTemplate("foo.twig", null, 1)->display(twig_array_merge(\$context, ["foo" => true]));
66
- EOF
67
- ];
68
-
69
- $node = new IncludeNode($expr, $vars, true, false, 1);
70
- $tests[] = [$node, <<<EOF
71
- // line 1
72
- \$this->loadTemplate("foo.twig", null, 1)->display(twig_to_array(["foo" => true]));
73
- EOF
74
- ];
75
-
76
- $node = new IncludeNode($expr, $vars, true, true, 1);
77
- $tests[] = [$node, <<<EOF
78
- // line 1
79
- \$__internal_%s = null;
80
- try {
81
- \$__internal_%s = \$this->loadTemplate("foo.twig", null, 1);
82
- } catch (LoaderError \$e) {
83
- // ignore missing template
84
- }
85
- if (\$__internal_%s) {
86
- \$__internal_%s->display(twig_to_array(["foo" => true]));
87
- }
88
- EOF
89
- , null, true];
90
-
91
- return $tests;
92
- }
93
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php DELETED
@@ -1,81 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\ConstantExpression;
13
- use Twig\Node\Expression\NameExpression;
14
- use Twig\Node\MacroNode;
15
- use Twig\Node\Node;
16
- use Twig\Node\TextNode;
17
- use Twig\Test\NodeTestCase;
18
-
19
- class Twig_Tests_Node_MacroTest extends NodeTestCase
20
- {
21
- public function testConstructor()
22
- {
23
- $body = new TextNode('foo', 1);
24
- $arguments = new Node([new NameExpression('foo', 1)], [], 1);
25
- $node = new MacroNode('foo', $body, $arguments, 1);
26
-
27
- $this->assertEquals($body, $node->getNode('body'));
28
- $this->assertEquals($arguments, $node->getNode('arguments'));
29
- $this->assertEquals('foo', $node->getAttribute('name'));
30
- }
31
-
32
- public function getTests()
33
- {
34
- $body = new TextNode('foo', 1);
35
- $arguments = new Node([
36
- 'foo' => new ConstantExpression(null, 1),
37
- 'bar' => new ConstantExpression('Foo', 1),
38
- ], [], 1);
39
- $node = new MacroNode('foo', $body, $arguments, 1);
40
-
41
- if (PHP_VERSION_ID >= 50600) {
42
- $declaration = ', ...$__varargs__';
43
- $varargs = '$__varargs__';
44
- } else {
45
- $declaration = '';
46
- $varargs = 'func_num_args() > 2 ? array_slice(func_get_args(), 2) : []';
47
- }
48
-
49
- return [
50
- [$node, <<<EOF
51
- // line 1
52
- public function getfoo(\$__foo__ = null, \$__bar__ = "Foo"$declaration)
53
- {
54
- \$context = \$this->env->mergeGlobals([
55
- "foo" => \$__foo__,
56
- "bar" => \$__bar__,
57
- "varargs" => $varargs,
58
- ]);
59
-
60
- \$blocks = [];
61
-
62
- ob_start(function () { return ''; });
63
- try {
64
- echo "foo";
65
- } catch (\Exception \$e) {
66
- ob_end_clean();
67
-
68
- throw \$e;
69
- } catch (\Throwable \$e) {
70
- ob_end_clean();
71
-
72
- throw \$e;
73
- }
74
-
75
- return ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset());
76
- }
77
- EOF
78
- ],
79
- ];
80
- }
81
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php DELETED
@@ -1,268 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Node\Expression\AssignNameExpression;
14
- use Twig\Node\Expression\ConditionalExpression;
15
- use Twig\Node\Expression\ConstantExpression;
16
- use Twig\Node\ImportNode;
17
- use Twig\Node\ModuleNode;
18
- use Twig\Node\Node;
19
- use Twig\Node\SetNode;
20
- use Twig\Node\TextNode;
21
- use Twig\Source;
22
- use Twig\Test\NodeTestCase;
23
-
24
- class Twig_Tests_Node_ModuleTest extends NodeTestCase
25
- {
26
- public function testConstructor()
27
- {
28
- $body = new TextNode('foo', 1);
29
- $parent = new ConstantExpression('layout.twig', 1);
30
- $blocks = new Node();
31
- $macros = new Node();
32
- $traits = new Node();
33
- $source = new Source('{{ foo }}', 'foo.twig');
34
- $node = new ModuleNode($body, $parent, $blocks, $macros, $traits, new Node([]), $source);
35
-
36
- $this->assertEquals($body, $node->getNode('body'));
37
- $this->assertEquals($blocks, $node->getNode('blocks'));
38
- $this->assertEquals($macros, $node->getNode('macros'));
39
- $this->assertEquals($parent, $node->getNode('parent'));
40
- $this->assertEquals($source->getName(), $node->getTemplateName());
41
- }
42
-
43
- public function getTests()
44
- {
45
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
46
-
47
- $tests = [];
48
-
49
- $body = new TextNode('foo', 1);
50
- $extends = null;
51
- $blocks = new Node();
52
- $macros = new Node();
53
- $traits = new Node();
54
- $source = new Source('{{ foo }}', 'foo.twig');
55
-
56
- $node = new ModuleNode($body, $extends, $blocks, $macros, $traits, new Node([]), $source);
57
- $tests[] = [$node, <<<EOF
58
- <?php
59
-
60
- use Twig\Environment;
61
- use Twig\Error\LoaderError;
62
- use Twig\Error\RuntimeError;
63
- use Twig\Markup;
64
- use Twig\Sandbox\SecurityError;
65
- use Twig\Sandbox\SecurityNotAllowedTagError;
66
- use Twig\Sandbox\SecurityNotAllowedFilterError;
67
- use Twig\Sandbox\SecurityNotAllowedFunctionError;
68
- use Twig\Source;
69
- use Twig\Template;
70
-
71
- /* foo.twig */
72
- class __TwigTemplate_%x extends \Twig\Template
73
- {
74
- public function __construct(Environment \$env)
75
- {
76
- parent::__construct(\$env);
77
-
78
- \$this->parent = false;
79
-
80
- \$this->blocks = [
81
- ];
82
- }
83
-
84
- protected function doDisplay(array \$context, array \$blocks = [])
85
- {
86
- // line 1
87
- echo "foo";
88
- }
89
-
90
- public function getTemplateName()
91
- {
92
- return "foo.twig";
93
- }
94
-
95
- public function getDebugInfo()
96
- {
97
- return array ( 30 => 1,);
98
- }
99
-
100
- /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
101
- public function getSource()
102
- {
103
- @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);
104
-
105
- return \$this->getSourceContext()->getCode();
106
- }
107
-
108
- public function getSourceContext()
109
- {
110
- return new Source("", "foo.twig", "");
111
- }
112
- }
113
- EOF
114
- , $twig, true];
115
-
116
- $import = new ImportNode(new ConstantExpression('foo.twig', 1), new AssignNameExpression('macro', 1), 2);
117
-
118
- $body = new Node([$import]);
119
- $extends = new ConstantExpression('layout.twig', 1);
120
-
121
- $node = new ModuleNode($body, $extends, $blocks, $macros, $traits, new Node([]), $source);
122
- $tests[] = [$node, <<<EOF
123
- <?php
124
-
125
- use Twig\Environment;
126
- use Twig\Error\LoaderError;
127
- use Twig\Error\RuntimeError;
128
- use Twig\Markup;
129
- use Twig\Sandbox\SecurityError;
130
- use Twig\Sandbox\SecurityNotAllowedTagError;
131
- use Twig\Sandbox\SecurityNotAllowedFilterError;
132
- use Twig\Sandbox\SecurityNotAllowedFunctionError;
133
- use Twig\Source;
134
- use Twig\Template;
135
-
136
- /* foo.twig */
137
- class __TwigTemplate_%x extends \Twig\Template
138
- {
139
- public function __construct(Environment \$env)
140
- {
141
- parent::__construct(\$env);
142
-
143
- \$this->blocks = [
144
- ];
145
- }
146
-
147
- protected function doGetParent(array \$context)
148
- {
149
- // line 1
150
- return "layout.twig";
151
- }
152
-
153
- protected function doDisplay(array \$context, array \$blocks = [])
154
- {
155
- // line 2
156
- \$context["macro"] = \$this->loadTemplate("foo.twig", "foo.twig", 2)->unwrap();
157
- // line 1
158
- \$this->parent = \$this->loadTemplate("layout.twig", "foo.twig", 1);
159
- \$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks));
160
- }
161
-
162
- public function getTemplateName()
163
- {
164
- return "foo.twig";
165
- }
166
-
167
- public function isTraitable()
168
- {
169
- return false;
170
- }
171
-
172
- public function getDebugInfo()
173
- {
174
- return array ( 36 => 1, 34 => 2, 28 => 1,);
175
- }
176
-
177
- /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
178
- public function getSource()
179
- {
180
- @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);
181
-
182
- return \$this->getSourceContext()->getCode();
183
- }
184
-
185
- public function getSourceContext()
186
- {
187
- return new Source("", "foo.twig", "");
188
- }
189
- }
190
- EOF
191
- , $twig, true];
192
-
193
- $set = new SetNode(false, new Node([new AssignNameExpression('foo', 4)]), new Node([new ConstantExpression('foo', 4)]), 4);
194
- $body = new Node([$set]);
195
- $extends = new ConditionalExpression(
196
- new ConstantExpression(true, 2),
197
- new ConstantExpression('foo', 2),
198
- new ConstantExpression('foo', 2),
199
- 2
200
- );
201
-
202
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['debug' => true]);
203
- $node = new ModuleNode($body, $extends, $blocks, $macros, $traits, new Node([]), $source);
204
- $tests[] = [$node, <<<EOF
205
- <?php
206
-
207
- use Twig\Environment;
208
- use Twig\Error\LoaderError;
209
- use Twig\Error\RuntimeError;
210
- use Twig\Markup;
211
- use Twig\Sandbox\SecurityError;
212
- use Twig\Sandbox\SecurityNotAllowedTagError;
213
- use Twig\Sandbox\SecurityNotAllowedFilterError;
214
- use Twig\Sandbox\SecurityNotAllowedFunctionError;
215
- use Twig\Source;
216
- use Twig\Template;
217
-
218
- /* foo.twig */
219
- class __TwigTemplate_%x extends \Twig\Template
220
- {
221
- protected function doGetParent(array \$context)
222
- {
223
- // line 2
224
- return \$this->loadTemplate(((true) ? ("foo") : ("foo")), "foo.twig", 2);
225
- }
226
-
227
- protected function doDisplay(array \$context, array \$blocks = [])
228
- {
229
- // line 4
230
- \$context["foo"] = "foo";
231
- // line 2
232
- \$this->getParent(\$context)->display(\$context, array_merge(\$this->blocks, \$blocks));
233
- }
234
-
235
- public function getTemplateName()
236
- {
237
- return "foo.twig";
238
- }
239
-
240
- public function isTraitable()
241
- {
242
- return false;
243
- }
244
-
245
- public function getDebugInfo()
246
- {
247
- return array ( 28 => 2, 26 => 4, 20 => 2,);
248
- }
249
-
250
- /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
251
- public function getSource()
252
- {
253
- @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);
254
-
255
- return \$this->getSourceContext()->getCode();
256
- }
257
-
258
- public function getSourceContext()
259
- {
260
- return new Source("{{ foo }}", "foo.twig", "");
261
- }
262
- }
263
- EOF
264
- , $twig, true];
265
-
266
- return $tests;
267
- }
268
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\ConstantExpression;
13
- use Twig\Node\PrintNode;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_PrintTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $expr = new ConstantExpression('foo', 1);
21
- $node = new PrintNode($expr, 1);
22
-
23
- $this->assertEquals($expr, $node->getNode('expr'));
24
- }
25
-
26
- public function getTests()
27
- {
28
- $tests = [];
29
- $tests[] = [new PrintNode(new ConstantExpression('foo', 1), 1), "// line 1\necho \"foo\";"];
30
-
31
- return $tests;
32
- }
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\SandboxNode;
13
- use Twig\Node\TextNode;
14
- use Twig\Test\NodeTestCase;
15
-
16
- class Twig_Tests_Node_SandboxTest extends NodeTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- $body = new TextNode('foo', 1);
21
- $node = new SandboxNode($body, 1);
22
-
23
- $this->assertEquals($body, $node->getNode('body'));
24
- }
25
-
26
- public function getTests()
27
- {
28
- $tests = [];
29
-
30
- $body = new TextNode('foo', 1);
31
- $node = new SandboxNode($body, 1);
32
-
33
- $tests[] = [$node, <<<EOF
34
- // line 1
35
- if (!\$alreadySandboxed = \$this->sandbox->isSandboxed()) {
36
- \$this->sandbox->enableSandbox();
37
- }
38
- echo "foo";
39
- if (!\$alreadySandboxed) {
40
- \$this->sandbox->disableSandbox();
41
- }
42
- EOF
43
- ];
44
-
45
- return $tests;
46
- }
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/SetTest.php DELETED
@@ -1,78 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Expression\AssignNameExpression;
13
- use Twig\Node\Expression\ConstantExpression;
14
- use Twig\Node\Expression\NameExpression;
15
- use Twig\Node\Node;
16
- use Twig\Node\PrintNode;
17
- use Twig\Node\SetNode;
18
- use Twig\Node\TextNode;
19
- use Twig\Test\NodeTestCase;
20
-
21
- class Twig_Tests_Node_SetTest extends NodeTestCase
22
- {
23
- public function testConstructor()
24
- {
25
- $names = new Node([new AssignNameExpression('foo', 1)], [], 1);
26
- $values = new Node([new ConstantExpression('foo', 1)], [], 1);
27
- $node = new SetNode(false, $names, $values, 1);
28
-
29
- $this->assertEquals($names, $node->getNode('names'));
30
- $this->assertEquals($values, $node->getNode('values'));
31
- $this->assertFalse($node->getAttribute('capture'));
32
- }
33
-
34
- public function getTests()
35
- {
36
- $tests = [];
37
-
38
- $names = new Node([new AssignNameExpression('foo', 1)], [], 1);
39
- $values = new Node([new ConstantExpression('foo', 1)], [], 1);
40
- $node = new SetNode(false, $names, $values, 1);
41
- $tests[] = [$node, <<<EOF
42
- // line 1
43
- \$context["foo"] = "foo";
44
- EOF
45
- ];
46
-
47
- $names = new Node([new AssignNameExpression('foo', 1)], [], 1);
48
- $values = new Node([new PrintNode(new ConstantExpression('foo', 1), 1)], [], 1);
49
- $node = new SetNode(true, $names, $values, 1);
50
- $tests[] = [$node, <<<EOF
51
- // line 1
52
- ob_start(function () { return ''; });
53
- echo "foo";
54
- \$context["foo"] = ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset());
55
- EOF
56
- ];
57
-
58
- $names = new Node([new AssignNameExpression('foo', 1)], [], 1);
59
- $values = new TextNode('foo', 1);
60
- $node = new SetNode(true, $names, $values, 1);
61
- $tests[] = [$node, <<<EOF
62
- // line 1
63
- \$context["foo"] = ('' === \$tmp = "foo") ? '' : new Markup(\$tmp, \$this->env->getCharset());
64
- EOF
65
- ];
66
-
67
- $names = new Node([new AssignNameExpression('foo', 1), new AssignNameExpression('bar', 1)], [], 1);
68
- $values = new Node([new ConstantExpression('foo', 1), new NameExpression('bar', 1)], [], 1);
69
- $node = new SetNode(false, $names, $values, 1);
70
- $tests[] = [$node, <<<EOF
71
- // line 1
72
- list(\$context["foo"], \$context["bar"]) = ["foo", {$this->getVariableGetter('bar')}];
73
- EOF
74
- ];
75
-
76
- return $tests;
77
- }
78
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php DELETED
@@ -1,42 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\Node;
13
- use Twig\Node\SpacelessNode;
14
- use Twig\Node\TextNode;
15
- use Twig\Test\NodeTestCase;
16
-
17
- class Twig_Tests_Node_SpacelessTest extends NodeTestCase
18
- {
19
- public function testConstructor()
20
- {
21
- $body = new Node([new TextNode('<div> <div> foo </div> </div>', 1)]);
22
- $node = new SpacelessNode($body, 1);
23
-
24
- $this->assertEquals($body, $node->getNode('body'));
25
- }
26
-
27
- public function getTests()
28
- {
29
- $body = new Node([new TextNode('<div> <div> foo </div> </div>', 1)]);
30
- $node = new SpacelessNode($body, 1);
31
-
32
- return [
33
- [$node, <<<EOF
34
- // line 1
35
- ob_start(function () { return ''; });
36
- echo "<div> <div> foo </div> </div>";
37
- echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));
38
- EOF
39
- ],
40
- ];
41
- }
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Node/TextTest.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Node\TextNode;
13
- use Twig\Test\NodeTestCase;
14
-
15
- class Twig_Tests_Node_TextTest extends NodeTestCase
16
- {
17
- public function testConstructor()
18
- {
19
- $node = new TextNode('foo', 1);
20
-
21
- $this->assertEquals('foo', $node->getAttribute('data'));
22
- }
23
-
24
- public function getTests()
25
- {
26
- $tests = [];
27
- $tests[] = [new TextNode('foo', 1), "// line 1\necho \"foo\";"];
28
-
29
- return $tests;
30
- }
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/NodeTraverserTest.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Node\Node;
14
- use Twig\NodeTraverser;
15
- use Twig\NodeVisitor\NodeVisitorInterface;
16
-
17
- class Twig_Tests_NodeTraverserTest extends \PHPUnit\Framework\TestCase
18
- {
19
- /**
20
- * @group legacy
21
- */
22
- public function testNodeIsNullWhenTraversing()
23
- {
24
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
25
- $traverser = new NodeTraverser($env, [new IdentityVisitor()]);
26
- $n = new Node([new Node([]), null, new Node([])]);
27
- $this->assertCount(3, $traverser->traverse($n));
28
- }
29
- }
30
-
31
- class IdentityVisitor implements NodeVisitorInterface
32
- {
33
- public function enterNode(\Twig_NodeInterface $node, Environment $env)
34
- {
35
- return $node;
36
- }
37
-
38
- public function leaveNode(\Twig_NodeInterface $node, Environment $env)
39
- {
40
- return $node;
41
- }
42
-
43
- public function getPriority()
44
- {
45
- return 0;
46
- }
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php DELETED
@@ -1,129 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Node\ForNode;
14
- use Twig\Source;
15
-
16
- class Twig_Tests_NodeVisitor_OptimizerTest extends \PHPUnit\Framework\TestCase
17
- {
18
- public function testRenderBlockOptimizer()
19
- {
20
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
21
-
22
- $stream = $env->parse($env->tokenize(new Source('{{ block("foo") }}', 'index')));
23
-
24
- $node = $stream->getNode('body')->getNode(0);
25
-
26
- $this->assertInstanceOf('\Twig\Node\Expression\BlockReferenceExpression', $node);
27
- $this->assertTrue($node->getAttribute('output'));
28
- }
29
-
30
- public function testRenderParentBlockOptimizer()
31
- {
32
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
33
-
34
- $stream = $env->parse($env->tokenize(new Source('{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}', 'index')));
35
-
36
- $node = $stream->getNode('blocks')->getNode('content')->getNode(0)->getNode('body');
37
-
38
- $this->assertInstanceOf('\Twig\Node\Expression\ParentExpression', $node);
39
- $this->assertTrue($node->getAttribute('output'));
40
- }
41
-
42
- public function testRenderVariableBlockOptimizer()
43
- {
44
- if (PHP_VERSION_ID >= 50400) {
45
- $this->markTestSkipped('not needed on PHP >= 5.4');
46
- }
47
-
48
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]);
49
- $stream = $env->parse($env->tokenize(new Source('{{ block(name|lower) }}', 'index')));
50
-
51
- $node = $stream->getNode('body')->getNode(0)->getNode(1);
52
-
53
- $this->assertInstanceOf('\Twig\Node\Expression\BlockReferenceExpression', $node);
54
- $this->assertTrue($node->getAttribute('output'));
55
- }
56
-
57
- /**
58
- * @dataProvider getTestsForForOptimizer
59
- */
60
- public function testForOptimizer($template, $expected)
61
- {
62
- $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false]);
63
-
64
- $stream = $env->parse($env->tokenize(new Source($template, 'index')));
65
-
66
- foreach ($expected as $target => $withLoop) {
67
- $this->assertTrue($this->checkForConfiguration($stream, $target, $withLoop), sprintf('variable %s is %soptimized', $target, $withLoop ? 'not ' : ''));
68
- }
69
- }
70
-
71
- public function getTestsForForOptimizer()
72
- {
73
- return [
74
- ['{% for i in foo %}{% endfor %}', ['i' => false]],
75
-
76
- ['{% for i in foo %}{{ loop.index }}{% endfor %}', ['i' => true]],
77
-
78
- ['{% for i in foo %}{% for j in foo %}{% endfor %}{% endfor %}', ['i' => false, 'j' => false]],
79
-
80
- ['{% for i in foo %}{% include "foo" %}{% endfor %}', ['i' => true]],
81
-
82
- ['{% for i in foo %}{% include "foo" only %}{% endfor %}', ['i' => false]],
83
-
84
- ['{% for i in foo %}{% include "foo" with { "foo": "bar" } only %}{% endfor %}', ['i' => false]],
85
-
86
- ['{% for i in foo %}{% include "foo" with { "foo": loop.index } only %}{% endfor %}', ['i' => true]],
87
-
88
- ['{% for i in foo %}{% for j in foo %}{{ loop.index }}{% endfor %}{% endfor %}', ['i' => false, 'j' => true]],
89
-
90
- ['{% for i in foo %}{% for j in foo %}{{ loop.parent.loop.index }}{% endfor %}{% endfor %}', ['i' => true, 'j' => true]],
91
-
92
- ['{% for i in foo %}{% set l = loop %}{% for j in foo %}{{ l.index }}{% endfor %}{% endfor %}', ['i' => true, 'j' => false]],
93
-
94
- ['{% for i in foo %}{% for j in foo %}{{ foo.parent.loop.index }}{% endfor %}{% endfor %}', ['i' => false, 'j' => false]],
95
-
96
- ['{% for i in foo %}{% for j in foo %}{{ loop["parent"].loop.index }}{% endfor %}{% endfor %}', ['i' => true, 'j' => true]],
97
-
98
- ['{% for i in foo %}{{ include("foo") }}{% endfor %}', ['i' => true]],
99
-
100
- ['{% for i in foo %}{{ include("foo", with_context = false) }}{% endfor %}', ['i' => false]],
101
-
102
- ['{% for i in foo %}{{ include("foo", with_context = true) }}{% endfor %}', ['i' => true]],
103
-
104
- ['{% for i in foo %}{{ include("foo", { "foo": "bar" }, with_context = false) }}{% endfor %}', ['i' => false]],
105
-
106
- ['{% for i in foo %}{{ include("foo", { "foo": loop.index }, with_context = false) }}{% endfor %}', ['i' => true]],
107
- ];
108
- }
109
-
110
- public function checkForConfiguration(Twig_NodeInterface $node = null, $target, $withLoop)
111
- {
112
- if (null === $node) {
113
- return;
114
- }
115
-
116
- foreach ($node as $n) {
117
- if ($n instanceof ForNode) {
118
- if ($target === $n->getNode('value_target')->getAttribute('name')) {
119
- return $withLoop == $n->getAttribute('with_loop');
120
- }
121
- }
122
-
123
- $ret = $this->checkForConfiguration($n, $target, $withLoop);
124
- if (null !== $ret) {
125
- return $ret;
126
- }
127
- }
128
- }
129
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/ParserTest.php DELETED
@@ -1,217 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Node\Node;
14
- use Twig\Node\SetNode;
15
- use Twig\Node\TextNode;
16
- use Twig\Parser;
17
- use Twig\Source;
18
- use Twig\Token;
19
- use Twig\TokenParser\AbstractTokenParser;
20
- use Twig\TokenStream;
21
-
22
- class Twig_Tests_ParserTest extends \PHPUnit\Framework\TestCase
23
- {
24
- /**
25
- * @expectedException \Twig\Error\SyntaxError
26
- */
27
- public function testSetMacroThrowsExceptionOnReservedMethods()
28
- {
29
- $parser = $this->getParser();
30
- $parser->setMacro('parent', $this->getMockBuilder('\Twig\Node\MacroNode')->disableOriginalConstructor()->getMock());
31
- }
32
-
33
- /**
34
- * @expectedException \Twig\Error\SyntaxError
35
- * @expectedExceptionMessage Unknown "foo" tag. Did you mean "for" at line 1?
36
- */
37
- public function testUnknownTag()
38
- {
39
- $stream = new TokenStream([
40
- new Token(Token::BLOCK_START_TYPE, '', 1),
41
- new Token(Token::NAME_TYPE, 'foo', 1),
42
- new Token(Token::BLOCK_END_TYPE, '', 1),
43
- new Token(Token::EOF_TYPE, '', 1),
44
- ]);
45
- $parser = new Parser(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
46
- $parser->parse($stream);
47
- }
48
-
49
- /**
50
- * @expectedException \Twig\Error\SyntaxError
51
- * @expectedExceptionMessage Unknown "foobar" tag at line 1.
52
- */
53
- public function testUnknownTagWithoutSuggestions()
54
- {
55
- $stream = new TokenStream([
56
- new Token(Token::BLOCK_START_TYPE, '', 1),
57
- new Token(Token::NAME_TYPE, 'foobar', 1),
58
- new Token(Token::BLOCK_END_TYPE, '', 1),
59
- new Token(Token::EOF_TYPE, '', 1),
60
- ]);
61
- $parser = new Parser(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
62
- $parser->parse($stream);
63
- }
64
-
65
- /**
66
- * @dataProvider getFilterBodyNodesData
67
- */
68
- public function testFilterBodyNodes($input, $expected)
69
- {
70
- $parser = $this->getParser();
71
-
72
- $this->assertEquals($expected, $parser->filterBodyNodes($input));
73
- }
74
-
75
- public function getFilterBodyNodesData()
76
- {
77
- return [
78
- [
79
- new Node([new TextNode(' ', 1)]),
80
- new Node([]),
81
- ],
82
- [
83
- $input = new Node([new SetNode(false, new Node(), new Node(), 1)]),
84
- $input,
85
- ],
86
- [
87
- $input = new Node([new SetNode(true, new Node(), new Node([new Node([new TextNode('foo', 1)])]), 1)]),
88
- $input,
89
- ],
90
- ];
91
- }
92
-
93
- /**
94
- * @dataProvider getFilterBodyNodesDataThrowsException
95
- * @expectedException \Twig\Error\SyntaxError
96
- */
97
- public function testFilterBodyNodesThrowsException($input)
98
- {
99
- $parser = $this->getParser();
100
-
101
- $parser->filterBodyNodes($input);
102
- }
103
-
104
- public function getFilterBodyNodesDataThrowsException()
105
- {
106
- return [
107
- [new TextNode('foo', 1)],
108
- [new Node([new Node([new TextNode('foo', 1)])])],
109
- ];
110
- }
111
-
112
- /**
113
- * @dataProvider getFilterBodyNodesWithBOMData
114
- */
115
- public function testFilterBodyNodesWithBOM($emptyNode)
116
- {
117
- $this->assertNull($this->getParser()->filterBodyNodes(new TextNode(\chr(0xEF).\chr(0xBB).\chr(0xBF).$emptyNode, 1)));
118
- }
119
-
120
- public function getFilterBodyNodesWithBOMData()
121
- {
122
- return [
123
- [' '],
124
- ["\t"],
125
- ["\n"],
126
- ["\n\t\n "],
127
- ];
128
- }
129
-
130
- public function testParseIsReentrant()
131
- {
132
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), [
133
- 'autoescape' => false,
134
- 'optimizations' => 0,
135
- ]);
136
- $twig->addTokenParser(new TestTokenParser());
137
-
138
- $parser = new Parser($twig);
139
-
140
- $parser->parse(new TokenStream([
141
- new Token(Token::BLOCK_START_TYPE, '', 1),
142
- new Token(Token::NAME_TYPE, 'test', 1),
143
- new Token(Token::BLOCK_END_TYPE, '', 1),
144
- new Token(Token::VAR_START_TYPE, '', 1),
145
- new Token(Token::NAME_TYPE, 'foo', 1),
146
- new Token(Token::VAR_END_TYPE, '', 1),
147
- new Token(Token::EOF_TYPE, '', 1),
148
- ]));
149
-
150
- $this->assertNull($parser->getParent());
151
- }
152
-
153
- public function testGetVarName()
154
- {
155
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), [
156
- 'autoescape' => false,
157
- 'optimizations' => 0,
158
- ]);
159
-
160
- $twig->parse($twig->tokenize(new Source(<<<EOF
161
- {% from _self import foo %}
162
-
163
- {% macro foo() %}
164
- {{ foo }}
165
- {% endmacro %}
166
- EOF
167
- , 'index')));
168
-
169
- // The getVarName() must not depend on the template loaders,
170
- // If this test does not throw any exception, that's good.
171
- // see https://github.com/symfony/symfony/issues/4218
172
- $this->addToAssertionCount(1);
173
- }
174
-
175
- protected function getParser()
176
- {
177
- $parser = new TestParser(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
178
- $parser->setParent(new Node());
179
- $parser->stream = new TokenStream([]);
180
-
181
- return $parser;
182
- }
183
- }
184
-
185
- class TestParser extends Parser
186
- {
187
- public $stream;
188
-
189
- public function filterBodyNodes(Twig_NodeInterface $node)
190
- {
191
- return parent::filterBodyNodes($node);
192
- }
193
- }
194
-
195
- class TestTokenParser extends AbstractTokenParser
196
- {
197
- public function parse(Token $token)
198
- {
199
- // simulate the parsing of another template right in the middle of the parsing of the current template
200
- $this->parser->parse(new TokenStream([
201
- new Token(Token::BLOCK_START_TYPE, '', 1),
202
- new Token(Token::NAME_TYPE, 'extends', 1),
203
- new Token(Token::STRING_TYPE, 'base', 1),
204
- new Token(Token::BLOCK_END_TYPE, '', 1),
205
- new Token(Token::EOF_TYPE, '', 1),
206
- ]));
207
-
208
- $this->parser->getStream()->expect(Token::BLOCK_END_TYPE);
209
-
210
- return new Node([]);
211
- }
212
-
213
- public function getTag()
214
- {
215
- return 'test';
216
- }
217
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php DELETED
@@ -1,105 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Profiler\Profile;
13
-
14
- abstract class Twig_Tests_Profiler_Dumper_AbstractTest extends \PHPUnit\Framework\TestCase
15
- {
16
- protected function getProfile()
17
- {
18
- $profile = new Profile('main');
19
- $subProfiles = [
20
- $this->getIndexProfile(
21
- [
22
- $this->getEmbeddedBlockProfile(),
23
- $this->getEmbeddedTemplateProfile(
24
- [
25
- $this->getIncludedTemplateProfile(),
26
- ]
27
- ),
28
- $this->getMacroProfile(),
29
- $this->getEmbeddedTemplateProfile(
30
- [
31
- $this->getIncludedTemplateProfile(),
32
- ]
33
- ),
34
- ]
35
- ),
36
- ];
37
-
38
- $p = new \ReflectionProperty($profile, 'profiles');
39
- $p->setAccessible(true);
40
- $p->setValue($profile, $subProfiles);
41
-
42
- return $profile;
43
- }
44
-
45
- private function getIndexProfile(array $subProfiles = [])
46
- {
47
- return $this->generateProfile('main', 1, 'template', 'index.twig', $subProfiles);
48
- }
49
-
50
- private function getEmbeddedBlockProfile(array $subProfiles = [])
51
- {
52
- return $this->generateProfile('body', 0.0001, 'block', 'embedded.twig', $subProfiles);
53
- }
54
-
55
- private function getEmbeddedTemplateProfile(array $subProfiles = [])
56
- {
57
- return $this->generateProfile('main', 0.0001, 'template', 'embedded.twig', $subProfiles);
58
- }
59
-
60
- private function getIncludedTemplateProfile(array $subProfiles = [])
61
- {
62
- return $this->generateProfile('main', 0.0001, 'template', 'included.twig', $subProfiles);
63
- }
64
-
65
- private function getMacroProfile(array $subProfiles = [])
66
- {
67
- return $this->generateProfile('foo', 0.0001, 'macro', 'index.twig', $subProfiles);
68
- }
69
-
70
- /**
71
- * @param string $name
72
- * @param float $duration
73
- * @param bool $isTemplate
74
- * @param string $type
75
- * @param string $templateName
76
- * @param array $subProfiles
77
- *
78
- * @return Profile
79
- */
80
- private function generateProfile($name, $duration, $type, $templateName, array $subProfiles = [])
81
- {
82
- $profile = new Profile($templateName, $type, $name);
83
-
84
- $p = new \ReflectionProperty($profile, 'profiles');
85
- $p->setAccessible(true);
86
- $p->setValue($profile, $subProfiles);
87
-
88
- $starts = new \ReflectionProperty($profile, 'starts');
89
- $starts->setAccessible(true);
90
- $starts->setValue($profile, [
91
- 'wt' => 0,
92
- 'mu' => 0,
93
- 'pmu' => 0,
94
- ]);
95
- $ends = new \ReflectionProperty($profile, 'ends');
96
- $ends->setAccessible(true);
97
- $ends->setValue($profile, [
98
- 'wt' => $duration,
99
- 'mu' => 0,
100
- 'pmu' => 0,
101
- ]);
102
-
103
- return $profile;
104
- }
105
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Profiler\Dumper\BlackfireDumper;
13
-
14
- class Twig_Tests_Profiler_Dumper_BlackfireTest extends Twig_Tests_Profiler_Dumper_AbstractTest
15
- {
16
- public function testDump()
17
- {
18
- $dumper = new BlackfireDumper();
19
-
20
- $this->assertStringMatchesFormat(<<<EOF
21
- file-format: BlackfireProbe
22
- cost-dimensions: wt mu pmu
23
- request-start: %d.%d
24
-
25
- main()//1 %d %d %d
26
- main()==>index.twig//1 %d %d %d
27
- index.twig==>embedded.twig::block(body)//1 %d %d 0
28
- index.twig==>embedded.twig//2 %d %d %d
29
- embedded.twig==>included.twig//2 %d %d %d
30
- index.twig==>index.twig::macro(foo)//1 %d %d %d
31
- EOF
32
- , $dumper->dump($this->getProfile()));
33
- }
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Profiler\Dumper\HtmlDumper;
13
-
14
- class Twig_Tests_Profiler_Dumper_HtmlTest extends Twig_Tests_Profiler_Dumper_AbstractTest
15
- {
16
- public function testDump()
17
- {
18
- $dumper = new HtmlDumper();
19
- $this->assertStringMatchesFormat(<<<EOF
20
- <pre>main <span style="color: #d44">%d.%dms/%d%</span>
21
- â”” <span style="background-color: #ffd">index.twig</span> <span style="color: #d44">%d.%dms/%d%</span>
22
- â”” embedded.twig::block(<span style="background-color: #dfd">body</span>)
23
- â”” <span style="background-color: #ffd">embedded.twig</span>
24
- │ └ <span style="background-color: #ffd">included.twig</span>
25
- â”” index.twig::macro(<span style="background-color: #ddf">foo</span>)
26
- â”” <span style="background-color: #ffd">embedded.twig</span>
27
- â”” <span style="background-color: #ffd">included.twig</span>
28
- </pre>
29
- EOF
30
- , $dumper->dump($this->getProfile()));
31
- }
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Profiler\Dumper\TextDumper;
13
-
14
- class Twig_Tests_Profiler_Dumper_TextTest extends Twig_Tests_Profiler_Dumper_AbstractTest
15
- {
16
- public function testDump()
17
- {
18
- $dumper = new TextDumper();
19
- $this->assertStringMatchesFormat(<<<EOF
20
- main %d.%dms/%d%
21
- â”” index.twig %d.%dms/%d%
22
- â”” embedded.twig::block(body)
23
- â”” embedded.twig
24
- │ └ included.twig
25
- â”” index.twig::macro(foo)
26
- â”” embedded.twig
27
- â”” included.twig
28
-
29
- EOF
30
- , $dumper->dump($this->getProfile()));
31
- }
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php DELETED
@@ -1,112 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Profiler\Profile;
13
-
14
- class Twig_Tests_Profiler_ProfileTest extends \PHPUnit\Framework\TestCase
15
- {
16
- public function testConstructor()
17
- {
18
- $profile = new Profile('template', 'type', 'name');
19
-
20
- $this->assertEquals('template', $profile->getTemplate());
21
- $this->assertEquals('type', $profile->getType());
22
- $this->assertEquals('name', $profile->getName());
23
- }
24
-
25
- public function testIsRoot()
26
- {
27
- $profile = new Profile('template', Profile::ROOT);
28
- $this->assertTrue($profile->isRoot());
29
-
30
- $profile = new Profile('template', Profile::TEMPLATE);
31
- $this->assertFalse($profile->isRoot());
32
- }
33
-
34
- public function testIsTemplate()
35
- {
36
- $profile = new Profile('template', Profile::TEMPLATE);
37
- $this->assertTrue($profile->isTemplate());
38
-
39
- $profile = new Profile('template', Profile::ROOT);
40
- $this->assertFalse($profile->isTemplate());
41
- }
42
-
43
- public function testIsBlock()
44
- {
45
- $profile = new Profile('template', Profile::BLOCK);
46
- $this->assertTrue($profile->isBlock());
47
-
48
- $profile = new Profile('template', Profile::ROOT);
49
- $this->assertFalse($profile->isBlock());
50
- }
51
-
52
- public function testIsMacro()
53
- {
54
- $profile = new Profile('template', Profile::MACRO);
55
- $this->assertTrue($profile->isMacro());
56
-
57
- $profile = new Profile('template', Profile::ROOT);
58
- $this->assertFalse($profile->isMacro());
59
- }
60
-
61
- public function testGetAddProfile()
62
- {
63
- $profile = new Profile();
64
- $profile->addProfile($a = new Profile());
65
- $profile->addProfile($b = new Profile());
66
-
67
- $this->assertSame([$a, $b], $profile->getProfiles());
68
- $this->assertSame([$a, $b], iterator_to_array($profile));
69
- }
70
-
71
- public function testGetDuration()
72
- {
73
- $profile = new Profile();
74
- usleep(1);
75
- $profile->leave();
76
-
77
- $this->assertTrue($profile->getDuration() > 0, sprintf('Expected duration > 0, got: %f', $profile->getDuration()));
78
- }
79
-
80
- public function testSerialize()
81
- {
82
- $profile = new Profile('template', 'type', 'name');
83
- $profile1 = new Profile('template1', 'type1', 'name1');
84
- $profile->addProfile($profile1);
85
- $profile->leave();
86
- $profile1->leave();
87
-
88
- $profile2 = unserialize(serialize($profile));
89
- $profiles = $profile->getProfiles();
90
- $this->assertCount(1, $profiles);
91
- $profile3 = $profiles[0];
92
-
93
- $this->assertEquals($profile->getTemplate(), $profile2->getTemplate());
94
- $this->assertEquals($profile->getType(), $profile2->getType());
95
- $this->assertEquals($profile->getName(), $profile2->getName());
96
- $this->assertEquals($profile->getDuration(), $profile2->getDuration());
97
-
98
- $this->assertEquals($profile1->getTemplate(), $profile3->getTemplate());
99
- $this->assertEquals($profile1->getType(), $profile3->getType());
100
- $this->assertEquals($profile1->getName(), $profile3->getName());
101
- }
102
-
103
- public function testReset()
104
- {
105
- $profile = new Profile();
106
- usleep(1);
107
- $profile->leave();
108
- $profile->reset();
109
-
110
- $this->assertEquals(0, $profile->getDuration());
111
- }
112
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/TemplateTest.php DELETED
@@ -1,812 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Error\RuntimeError;
14
- use Twig\Extension\SandboxExtension;
15
- use Twig\Loader\ArrayLoader;
16
- use Twig\Loader\LoaderInterface;
17
- use Twig\Loader\SourceContextLoaderInterface;
18
- use Twig\Node\Expression\GetAttrExpression;
19
- use Twig\NodeVisitor\NodeVisitorInterface;
20
- use Twig\Sandbox\SecurityError;
21
- use Twig\Sandbox\SecurityPolicy;
22
- use Twig\Template;
23
-
24
- class Twig_Tests_TemplateTest extends \PHPUnit\Framework\TestCase
25
- {
26
- /**
27
- * @expectedException \LogicException
28
- */
29
- public function testDisplayBlocksAcceptTemplateOnlyAsBlocks()
30
- {
31
- $template = $this->getMockForAbstractClass('\Twig\Template', [], '', false);
32
- $template->displayBlock('foo', [], ['foo' => [new \stdClass(), 'foo']]);
33
- }
34
-
35
- /**
36
- * @dataProvider getAttributeExceptions
37
- */
38
- public function testGetAttributeExceptions($template, $message)
39
- {
40
- $templates = ['index' => $template];
41
- $env = new Environment(new ArrayLoader($templates), ['strict_variables' => true]);
42
- $template = $env->load('index');
43
-
44
- $context = [
45
- 'string' => 'foo',
46
- 'null' => null,
47
- 'empty_array' => [],
48
- 'array' => ['foo' => 'foo'],
49
- 'array_access' => new Twig_TemplateArrayAccessObject(),
50
- 'magic_exception' => new Twig_TemplateMagicPropertyObjectWithException(),
51
- 'object' => new \stdClass(),
52
- ];
53
-
54
- try {
55
- $template->render($context);
56
- $this->fail('Accessing an invalid attribute should throw an exception.');
57
- } catch (RuntimeError $e) {
58
- $this->assertSame(sprintf($message, 'index'), $e->getMessage());
59
- }
60
- }
61
-
62
- public function getAttributeExceptions()
63
- {
64
- return [
65
- ['{{ string["a"] }}', 'Impossible to access a key ("a") on a string variable ("foo") in "%s" at line 1.'],
66
- ['{{ null["a"] }}', 'Impossible to access a key ("a") on a null variable in "%s" at line 1.'],
67
- ['{{ empty_array["a"] }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'],
68
- ['{{ array["a"] }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'],
69
- ['{{ array_access["a"] }}', 'Key "a" in object with ArrayAccess of class "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1.'],
70
- ['{{ string.a }}', 'Impossible to access an attribute ("a") on a string variable ("foo") in "%s" at line 1.'],
71
- ['{{ string.a() }}', 'Impossible to invoke a method ("a") on a string variable ("foo") in "%s" at line 1.'],
72
- ['{{ null.a }}', 'Impossible to access an attribute ("a") on a null variable in "%s" at line 1.'],
73
- ['{{ null.a() }}', 'Impossible to invoke a method ("a") on a null variable in "%s" at line 1.'],
74
- ['{{ array.a() }}', 'Impossible to invoke a method ("a") on an array in "%s" at line 1.'],
75
- ['{{ empty_array.a }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'],
76
- ['{{ array.a }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'],
77
- ['{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1.'],
78
- ['{{ array_access.a }}', 'Neither the property "a" nor one of the methods "a()", "geta()"/"isa()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.'],
79
- ['{% from _self import foo %}{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ foo(array_access) }}', 'Neither the property "missing_method" nor one of the methods "missing_method()", "getmissing_method()"/"ismissing_method()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.'],
80
- ['{{ 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.'],
81
- ['{{ 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.'],
82
- ];
83
- }
84
-
85
- /**
86
- * @dataProvider getGetAttributeWithSandbox
87
- */
88
- public function testGetAttributeWithSandbox($object, $item, $allowed)
89
- {
90
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
91
- $policy = new SecurityPolicy([], [], [/*method*/], [/*prop*/], []);
92
- $twig->addExtension(new SandboxExtension($policy, !$allowed));
93
- $template = new Twig_TemplateTest($twig);
94
-
95
- try {
96
- $template->getAttribute($object, $item, [], 'any');
97
-
98
- if (!$allowed) {
99
- $this->fail();
100
- } else {
101
- $this->addToAssertionCount(1);
102
- }
103
- } catch (SecurityError $e) {
104
- if ($allowed) {
105
- $this->fail();
106
- } else {
107
- $this->addToAssertionCount(1);
108
- }
109
-
110
- $this->assertContains('is not allowed', $e->getMessage());
111
- }
112
- }
113
-
114
- public function getGetAttributeWithSandbox()
115
- {
116
- return [
117
- [new Twig_TemplatePropertyObject(), 'defined', false],
118
- [new Twig_TemplatePropertyObject(), 'defined', true],
119
- [new Twig_TemplateMethodObject(), 'defined', false],
120
- [new Twig_TemplateMethodObject(), 'defined', true],
121
- ];
122
- }
123
-
124
- /**
125
- * @group legacy
126
- */
127
- public function testGetAttributeWithTemplateAsObject()
128
- {
129
- // to be removed in 2.0
130
- $twig = new Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock());
131
- //$twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface')->getMock());
132
-
133
- $template = new Twig_TemplateTest($twig, 'index.twig');
134
- $template1 = new Twig_TemplateTest($twig, 'index1.twig');
135
-
136
- $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'string'));
137
- $this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
138
-
139
- $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'true'));
140
- $this->assertEquals('1', $template->getAttribute($template1, 'true'));
141
-
142
- $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'zero'));
143
- $this->assertEquals('0', $template->getAttribute($template1, 'zero'));
144
-
145
- $this->assertNotInstanceof('\Twig\Markup', $template->getAttribute($template1, 'empty'));
146
- $this->assertSame('', $template->getAttribute($template1, 'empty'));
147
-
148
- $this->assertFalse($template->getAttribute($template1, 'env', [], Template::ANY_CALL, true));
149
- $this->assertFalse($template->getAttribute($template1, 'environment', [], Template::ANY_CALL, true));
150
- $this->assertFalse($template->getAttribute($template1, 'getEnvironment', [], Template::METHOD_CALL, true));
151
- $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', [], Template::METHOD_CALL, true));
152
- }
153
-
154
- /**
155
- * @group legacy
156
- * @expectedDeprecation Calling "string" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
157
- * @expectedDeprecation Calling "string" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
158
- * @expectedDeprecation Calling "true" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
159
- * @expectedDeprecation Calling "true" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
160
- * @expectedDeprecation Calling "zero" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
161
- * @expectedDeprecation Calling "zero" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
162
- * @expectedDeprecation Calling "empty" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
163
- * @expectedDeprecation Calling "empty" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
164
- * @expectedDeprecation Calling "renderBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name") instead).
165
- * @expectedDeprecation Calling "displayBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name") instead).
166
- * @expectedDeprecation Calling "hasBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use "block("name") is defined" instead).
167
- * @expectedDeprecation Calling "render" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index.twig") instead).
168
- * @expectedDeprecation Calling "display" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index.twig") instead).
169
- * @expectedDeprecation Calling "renderBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name", template) instead).
170
- * @expectedDeprecation Calling "displayBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name", template) instead).
171
- * @expectedDeprecation Calling "hasBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use "block("name", template) is defined" instead).
172
- * @expectedDeprecation Calling "render" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index1.twig") instead).
173
- * @expectedDeprecation Calling "display" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index1.twig") instead).
174
- */
175
- public function testGetAttributeWithTemplateAsObjectForDeprecations()
176
- {
177
- // to be removed in 2.0
178
- $twig = new Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock());
179
- //$twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface')->getMock());
180
-
181
- $template = new Twig_TemplateTest($twig, 'index.twig');
182
- $template1 = new Twig_TemplateTest($twig, 'index1.twig');
183
-
184
- $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'string'));
185
- $this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
186
-
187
- $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'true'));
188
- $this->assertEquals('1', $template->getAttribute($template1, 'true'));
189
-
190
- $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'zero'));
191
- $this->assertEquals('0', $template->getAttribute($template1, 'zero'));
192
-
193
- $this->assertNotInstanceof('\Twig\Markup', $template->getAttribute($template1, 'empty'));
194
- $this->assertSame('', $template->getAttribute($template1, 'empty'));
195
-
196
- $blocks = ['name' => [$template1, 'block_name']];
197
-
198
- // trigger some deprecation notice messages to check them with @expectedDeprecation
199
- $template->getAttribute($template, 'renderBlock', ['name', [], $blocks]);
200
- $template->getAttribute($template, 'displayBlock', ['name', [], $blocks]);
201
- $template->getAttribute($template, 'hasBlock', ['name', []]);
202
- $template->getAttribute($template, 'render', [[]]);
203
- $template->getAttribute($template, 'display', [[]]);
204
-
205
- $template->getAttribute($template1, 'renderBlock', ['name', [], $blocks]);
206
- $template->getAttribute($template1, 'displayBlock', ['name', [], $blocks]);
207
- $template->getAttribute($template1, 'hasBlock', ['name', []]);
208
- $template->getAttribute($template1, 'render', [[]]);
209
- $template->getAttribute($template1, 'display', [[]]);
210
-
211
- $this->assertFalse($template->getAttribute($template1, 'env', [], Template::ANY_CALL, true));
212
- $this->assertFalse($template->getAttribute($template1, 'environment', [], Template::ANY_CALL, true));
213
- $this->assertFalse($template->getAttribute($template1, 'getEnvironment', [], Template::METHOD_CALL, true));
214
- $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', [], Template::METHOD_CALL, true));
215
- }
216
-
217
- /**
218
- * @group legacy
219
- * @expectedDeprecation Silent display of undefined block "unknown" in template "index.twig" is deprecated since version 1.29 and will throw an exception in 2.0. Use the "block('unknown') is defined" expression to test for block existence.
220
- * @expectedDeprecation Silent display of undefined block "unknown" in template "index.twig" is deprecated since version 1.29 and will throw an exception in 2.0. Use the "block('unknown') is defined" expression to test for block existence.
221
- */
222
- public function testRenderBlockWithUndefinedBlock()
223
- {
224
- $twig = new Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock());
225
-
226
- $template = new Twig_TemplateTest($twig, 'index.twig');
227
- $template->renderBlock('unknown', []);
228
- $template->displayBlock('unknown', []);
229
- }
230
-
231
- public function testGetAttributeOnArrayWithConfusableKey()
232
- {
233
- $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
234
-
235
- $array = ['Zero', 'One', -1 => 'MinusOne', '' => 'EmptyString', '1.5' => 'FloatButString', '01' => 'IntegerButStringWithLeadingZeros'];
236
-
237
- $this->assertSame('Zero', $array[false]);
238
- $this->assertSame('One', $array[true]);
239
- $this->assertSame('One', $array[1.5]);
240
- $this->assertSame('One', $array['1']);
241
- $this->assertSame('MinusOne', $array[-1.5]);
242
- $this->assertSame('FloatButString', $array['1.5']);
243
- $this->assertSame('IntegerButStringWithLeadingZeros', $array['01']);
244
- $this->assertSame('EmptyString', $array[null]);
245
-
246
- $this->assertSame('Zero', $template->getAttribute($array, false), 'false is treated as 0 when accessing an array (equals PHP behavior)');
247
- $this->assertSame('One', $template->getAttribute($array, true), 'true is treated as 1 when accessing an array (equals PHP behavior)');
248
- $this->assertSame('One', $template->getAttribute($array, 1.5), 'float is casted to int when accessing an array (equals PHP behavior)');
249
- $this->assertSame('One', $template->getAttribute($array, '1'), '"1" is treated as integer 1 when accessing an array (equals PHP behavior)');
250
- $this->assertSame('MinusOne', $template->getAttribute($array, -1.5), 'negative float is casted to int when accessing an array (equals PHP behavior)');
251
- $this->assertSame('FloatButString', $template->getAttribute($array, '1.5'), '"1.5" is treated as-is when accessing an array (equals PHP behavior)');
252
- $this->assertSame('IntegerButStringWithLeadingZeros', $template->getAttribute($array, '01'), '"01" is treated as-is when accessing an array (equals PHP behavior)');
253
- $this->assertSame('EmptyString', $template->getAttribute($array, null), 'null is treated as "" when accessing an array (equals PHP behavior)');
254
- }
255
-
256
- /**
257
- * @dataProvider getGetAttributeTests
258
- */
259
- public function testGetAttribute($defined, $value, $object, $item, $arguments, $type)
260
- {
261
- $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
262
-
263
- $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
264
- }
265
-
266
- /**
267
- * @dataProvider getGetAttributeTests
268
- */
269
- public function testGetAttributeStrict($defined, $value, $object, $item, $arguments, $type, $exceptionMessage = null)
270
- {
271
- $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true]));
272
-
273
- if ($defined) {
274
- $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
275
- } else {
276
- if (method_exists($this, 'expectException')) {
277
- $this->expectException('\Twig\Error\RuntimeError');
278
- if (null !== $exceptionMessage) {
279
- $this->expectExceptionMessage($exceptionMessage);
280
- }
281
- } else {
282
- $this->setExpectedException('\Twig\Error\RuntimeError', $exceptionMessage);
283
- }
284
- $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
285
- }
286
- }
287
-
288
- /**
289
- * @dataProvider getGetAttributeTests
290
- */
291
- public function testGetAttributeDefined($defined, $value, $object, $item, $arguments, $type)
292
- {
293
- $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
294
-
295
- $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true));
296
- }
297
-
298
- /**
299
- * @dataProvider getGetAttributeTests
300
- */
301
- public function testGetAttributeDefinedStrict($defined, $value, $object, $item, $arguments, $type)
302
- {
303
- $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true]));
304
-
305
- $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true));
306
- }
307
-
308
- public function testGetAttributeCallExceptions()
309
- {
310
- $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()));
311
-
312
- $object = new Twig_TemplateMagicMethodExceptionObject();
313
-
314
- $this->assertNull($template->getAttribute($object, 'foo'));
315
- }
316
-
317
- public function getGetAttributeTests()
318
- {
319
- $array = [
320
- 'defined' => 'defined',
321
- 'zero' => 0,
322
- 'null' => null,
323
- '1' => 1,
324
- 'bar' => true,
325
- 'baz' => 'baz',
326
- '09' => '09',
327
- '+4' => '+4',
328
- ];
329
-
330
- $objectArray = new Twig_TemplateArrayAccessObject();
331
- $arrayObject = new \ArrayObject($array);
332
- $stdObject = (object) $array;
333
- $magicPropertyObject = new Twig_TemplateMagicPropertyObject();
334
- $propertyObject = new Twig_TemplatePropertyObject();
335
- $propertyObject1 = new Twig_TemplatePropertyObjectAndIterator();
336
- $propertyObject2 = new Twig_TemplatePropertyObjectAndArrayAccess();
337
- $propertyObject3 = new Twig_TemplatePropertyObjectDefinedWithUndefinedValue();
338
- $methodObject = new Twig_TemplateMethodObject();
339
- $magicMethodObject = new Twig_TemplateMagicMethodObject();
340
-
341
- $anyType = Template::ANY_CALL;
342
- $methodType = Template::METHOD_CALL;
343
- $arrayType = Template::ARRAY_CALL;
344
-
345
- $basicTests = [
346
- // array(defined, value, property to fetch)
347
- [true, 'defined', 'defined'],
348
- [false, null, 'undefined'],
349
- [false, null, 'protected'],
350
- [true, 0, 'zero'],
351
- [true, 1, 1],
352
- [true, 1, 1.0],
353
- [true, null, 'null'],
354
- [true, true, 'bar'],
355
- [true, 'baz', 'baz'],
356
- [true, '09', '09'],
357
- [true, '+4', '+4'],
358
- ];
359
- $testObjects = [
360
- // array(object, type of fetch)
361
- [$array, $arrayType],
362
- [$objectArray, $arrayType],
363
- [$arrayObject, $anyType],
364
- [$stdObject, $anyType],
365
- [$magicPropertyObject, $anyType],
366
- [$methodObject, $methodType],
367
- [$methodObject, $anyType],
368
- [$propertyObject, $anyType],
369
- [$propertyObject1, $anyType],
370
- [$propertyObject2, $anyType],
371
- ];
372
-
373
- $tests = [];
374
- foreach ($testObjects as $testObject) {
375
- foreach ($basicTests as $test) {
376
- // properties cannot be numbers
377
- if (($testObject[0] instanceof \stdClass || $testObject[0] instanceof Twig_TemplatePropertyObject) && is_numeric($test[2])) {
378
- continue;
379
- }
380
-
381
- if ('+4' === $test[2] && $methodObject === $testObject[0]) {
382
- continue;
383
- }
384
-
385
- $tests[] = [$test[0], $test[1], $testObject[0], $test[2], [], $testObject[1]];
386
- }
387
- }
388
-
389
- // additional properties tests
390
- $tests = array_merge($tests, [
391
- [true, null, $propertyObject3, 'foo', [], $anyType],
392
- ]);
393
-
394
- // additional method tests
395
- $tests = array_merge($tests, [
396
- [true, 'defined', $methodObject, 'defined', [], $methodType],
397
- [true, 'defined', $methodObject, 'DEFINED', [], $methodType],
398
- [true, 'defined', $methodObject, 'getDefined', [], $methodType],
399
- [true, 'defined', $methodObject, 'GETDEFINED', [], $methodType],
400
- [true, 'static', $methodObject, 'static', [], $methodType],
401
- [true, 'static', $methodObject, 'getStatic', [], $methodType],
402
-
403
- [true, '__call_undefined', $magicMethodObject, 'undefined', [], $methodType],
404
- [true, '__call_UNDEFINED', $magicMethodObject, 'UNDEFINED', [], $methodType],
405
- ]);
406
-
407
- // add the same tests for the any type
408
- foreach ($tests as $test) {
409
- if ($anyType !== $test[5]) {
410
- $test[5] = $anyType;
411
- $tests[] = $test;
412
- }
413
- }
414
-
415
- $methodAndPropObject = new Twig_TemplateMethodAndPropObject();
416
-
417
- // additional method tests
418
- $tests = array_merge($tests, [
419
- [true, 'a', $methodAndPropObject, 'a', [], $anyType],
420
- [true, 'a', $methodAndPropObject, 'a', [], $methodType],
421
- [false, null, $methodAndPropObject, 'a', [], $arrayType],
422
-
423
- [true, 'b_prop', $methodAndPropObject, 'b', [], $anyType],
424
- [true, 'b', $methodAndPropObject, 'B', [], $anyType],
425
- [true, 'b', $methodAndPropObject, 'b', [], $methodType],
426
- [true, 'b', $methodAndPropObject, 'B', [], $methodType],
427
- [false, null, $methodAndPropObject, 'b', [], $arrayType],
428
-
429
- [false, null, $methodAndPropObject, 'c', [], $anyType],
430
- [false, null, $methodAndPropObject, 'c', [], $methodType],
431
- [false, null, $methodAndPropObject, 'c', [], $arrayType],
432
- ]);
433
-
434
- $arrayAccess = new Twig_TemplateArrayAccess();
435
- $tests = array_merge($tests, [
436
- [true, ['foo' => 'bar'], $arrayAccess, 'vars', [], $anyType],
437
- ]);
438
-
439
- // tests when input is not an array or object
440
- $tests = array_merge($tests, [
441
- [false, null, 42, 'a', [], $anyType, 'Impossible to access an attribute ("a") on a integer variable ("42") in "index.twig".'],
442
- [false, null, 'string', 'a', [], $anyType, 'Impossible to access an attribute ("a") on a string variable ("string") in "index.twig".'],
443
- [false, null, [], 'a', [], $anyType, 'Key "a" does not exist as the array is empty in "index.twig".'],
444
- ]);
445
-
446
- return $tests;
447
- }
448
-
449
- /**
450
- * @expectedException \Twig\Error\RuntimeError
451
- */
452
- public function testGetIsMethods()
453
- {
454
- $getIsObject = new Twig_TemplateGetIsMethods();
455
- $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true]));
456
- // first time should not create a cache for "get"
457
- $this->assertNull($template->getAttribute($getIsObject, 'get'));
458
- // 0 should be in the method cache now, so this should fail
459
- $this->assertNull($template->getAttribute($getIsObject, 0));
460
- }
461
- }
462
-
463
- class Twig_TemplateTest extends Template
464
- {
465
- private $name;
466
-
467
- public function __construct(Environment $env, $name = 'index.twig')
468
- {
469
- parent::__construct($env);
470
- self::$cache = [];
471
- $this->name = $name;
472
- }
473
-
474
- public function getZero()
475
- {
476
- return 0;
477
- }
478
-
479
- public function getEmpty()
480
- {
481
- return '';
482
- }
483
-
484
- public function getString()
485
- {
486
- return 'some_string';
487
- }
488
-
489
- public function getTrue()
490
- {
491
- return true;
492
- }
493
-
494
- public function getTemplateName()
495
- {
496
- return $this->name;
497
- }
498
-
499
- public function getDebugInfo()
500
- {
501
- return [];
502
- }
503
-
504
- protected function doGetParent(array $context)
505
- {
506
- return false;
507
- }
508
-
509
- protected function doDisplay(array $context, array $blocks = [])
510
- {
511
- }
512
-
513
- public function getAttribute($object, $item, array $arguments = [], $type = Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false)
514
- {
515
- if (\function_exists('twig_template_get_attributes')) {
516
- return twig_template_get_attributes($this, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);
517
- } else {
518
- return parent::getAttribute($object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);
519
- }
520
- }
521
-
522
- public function block_name($context, array $blocks = [])
523
- {
524
- }
525
- }
526
-
527
- class Twig_TemplateArrayAccessObject implements \ArrayAccess
528
- {
529
- protected $protected = 'protected';
530
-
531
- public $attributes = [
532
- 'defined' => 'defined',
533
- 'zero' => 0,
534
- 'null' => null,
535
- '1' => 1,
536
- 'bar' => true,
537
- 'baz' => 'baz',
538
- '09' => '09',
539
- '+4' => '+4',
540
- ];
541
-
542
- public function offsetExists($name)
543
- {
544
- return \array_key_exists($name, $this->attributes);
545
- }
546
-
547
- public function offsetGet($name)
548
- {
549
- return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null;
550
- }
551
-
552
- public function offsetSet($name, $value)
553
- {
554
- }
555
-
556
- public function offsetUnset($name)
557
- {
558
- }
559
- }
560
-
561
- class Twig_TemplateMagicPropertyObject
562
- {
563
- public $defined = 'defined';
564
-
565
- public $attributes = [
566
- 'zero' => 0,
567
- 'null' => null,
568
- '1' => 1,
569
- 'bar' => true,
570
- 'baz' => 'baz',
571
- '09' => '09',
572
- '+4' => '+4',
573
- ];
574
-
575
- protected $protected = 'protected';
576
-
577
- public function __isset($name)
578
- {
579
- return \array_key_exists($name, $this->attributes);
580
- }
581
-
582
- public function __get($name)
583
- {
584
- return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null;
585
- }
586
- }
587
-
588
- class Twig_TemplateMagicPropertyObjectWithException
589
- {
590
- public function __isset($key)
591
- {
592
- throw new \Exception('Hey! Don\'t try to isset me!');
593
- }
594
- }
595
-
596
- class Twig_TemplatePropertyObject
597
- {
598
- public $defined = 'defined';
599
- public $zero = 0;
600
- public $null = null;
601
- public $bar = true;
602
- public $baz = 'baz';
603
-
604
- protected $protected = 'protected';
605
- }
606
-
607
- class Twig_TemplatePropertyObjectAndIterator extends Twig_TemplatePropertyObject implements \IteratorAggregate
608
- {
609
- public function getIterator()
610
- {
611
- return new \ArrayIterator(['foo', 'bar']);
612
- }
613
- }
614
-
615
- class Twig_TemplatePropertyObjectAndArrayAccess extends Twig_TemplatePropertyObject implements \ArrayAccess
616
- {
617
- private $data = [
618
- 'defined' => 'defined',
619
- 'zero' => 0,
620
- 'null' => null,
621
- 'bar' => true,
622
- 'foo' => true,
623
- 'baz' => 'baz',
624
- 'baf' => 'baf',
625
- ];
626
-
627
- public function offsetExists($offset)
628
- {
629
- return \array_key_exists($offset, $this->data);
630
- }
631
-
632
- public function offsetGet($offset)
633
- {
634
- return $this->offsetExists($offset) ? $this->data[$offset] : 'n/a';
635
- }
636
-
637
- public function offsetSet($offset, $value)
638
- {
639
- }
640
-
641
- public function offsetUnset($offset)
642
- {
643
- }
644
- }
645
-
646
- class Twig_TemplatePropertyObjectDefinedWithUndefinedValue
647
- {
648
- public $foo;
649
-
650
- public function __construct()
651
- {
652
- $this->foo = @$notExist;
653
- }
654
- }
655
-
656
- class Twig_TemplateMethodObject
657
- {
658
- public function getDefined()
659
- {
660
- return 'defined';
661
- }
662
-
663
- public function get1()
664
- {
665
- return 1;
666
- }
667
-
668
- public function get09()
669
- {
670
- return '09';
671
- }
672
-
673
- public function getZero()
674
- {
675
- return 0;
676
- }
677
-
678
- public function getNull()
679
- {
680
- }
681
-
682
- public function isBar()
683
- {
684
- return true;
685
- }
686
-
687
- public function isBaz()
688
- {
689
- return 'should never be returned';
690
- }
691
-
692
- public function getBaz()
693
- {
694
- return 'baz';
695
- }
696
-
697
- protected function getProtected()
698
- {
699
- return 'protected';
700
- }
701
-
702
- public static function getStatic()
703
- {
704
- return 'static';
705
- }
706
- }
707
-
708
- class Twig_TemplateGetIsMethods
709
- {
710
- public function get()
711
- {
712
- }
713
-
714
- public function is()
715
- {
716
- }
717
- }
718
-
719
- class Twig_TemplateMethodAndPropObject
720
- {
721
- private $a = 'a_prop';
722
-
723
- public function getA()
724
- {
725
- return 'a';
726
- }
727
-
728
- public $b = 'b_prop';
729
-
730
- public function getB()
731
- {
732
- return 'b';
733
- }
734
-
735
- private $c = 'c_prop';
736
-
737
- private function getC()
738
- {
739
- return 'c';
740
- }
741
- }
742
-
743
- class Twig_TemplateArrayAccess implements \ArrayAccess
744
- {
745
- public $vars = [
746
- 'foo' => 'bar',
747
- ];
748
- private $children = [];
749
-
750
- public function offsetExists($offset)
751
- {
752
- return \array_key_exists($offset, $this->children);
753
- }
754
-
755
- public function offsetGet($offset)
756
- {
757
- return $this->children[$offset];
758
- }
759
-
760
- public function offsetSet($offset, $value)
761
- {
762
- $this->children[$offset] = $value;
763
- }
764
-
765
- public function offsetUnset($offset)
766
- {
767
- unset($this->children[$offset]);
768
- }
769
- }
770
-
771
- class Twig_TemplateMagicMethodObject
772
- {
773
- public function __call($method, $arguments)
774
- {
775
- return '__call_'.$method;
776
- }
777
- }
778
-
779
- class Twig_TemplateMagicMethodExceptionObject
780
- {
781
- public function __call($method, $arguments)
782
- {
783
- throw new \BadMethodCallException(sprintf('Unknown method "%s".', $method));
784
- }
785
- }
786
-
787
- class CExtDisablingNodeVisitor implements NodeVisitorInterface
788
- {
789
- public function enterNode(Twig_NodeInterface $node, Environment $env)
790
- {
791
- if ($node instanceof GetAttrExpression) {
792
- $node->setAttribute('disable_c_ext', true);
793
- }
794
-
795
- return $node;
796
- }
797
-
798
- public function leaveNode(Twig_NodeInterface $node, Environment $env)
799
- {
800
- return $node;
801
- }
802
-
803
- public function getPriority()
804
- {
805
- return 0;
806
- }
807
- }
808
-
809
- // to be removed in 2.0
810
- interface Twig_TemplateTestLoaderInterface extends LoaderInterface, SourceContextLoaderInterface
811
- {
812
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php DELETED
@@ -1,68 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\Loader\ArrayLoader;
14
-
15
- class Twig_Tests_TemplateWrapperTest extends \PHPUnit\Framework\TestCase
16
- {
17
- public function testHasGetBlocks()
18
- {
19
- $twig = new Environment(new ArrayLoader([
20
- 'index' => '{% block foo %}{% endblock %}',
21
- 'index_with_use' => '{% use "imported" %}{% block foo %}{% endblock %}',
22
- 'index_with_extends' => '{% extends "extended" %}{% block foo %}{% endblock %}',
23
- 'imported' => '{% block imported %}{% endblock %}',
24
- 'extended' => '{% block extended %}{% endblock %}',
25
- ]));
26
-
27
- $wrapper = $twig->load('index');
28
- $this->assertTrue($wrapper->hasBlock('foo'));
29
- $this->assertFalse($wrapper->hasBlock('bar'));
30
- $this->assertEquals(['foo'], $wrapper->getBlockNames());
31
-
32
- $wrapper = $twig->load('index_with_use');
33
- $this->assertTrue($wrapper->hasBlock('foo'));
34
- $this->assertTrue($wrapper->hasBlock('imported'));
35
- $this->assertEquals(['imported', 'foo'], $wrapper->getBlockNames());
36
-
37
- $wrapper = $twig->load('index_with_extends');
38
- $this->assertTrue($wrapper->hasBlock('foo'));
39
- $this->assertTrue($wrapper->hasBlock('extended'));
40
- $this->assertEquals(['foo', 'extended'], $wrapper->getBlockNames());
41
- }
42
-
43
- public function testRenderBlock()
44
- {
45
- $twig = new Environment(new ArrayLoader([
46
- 'index' => '{% block foo %}{{ foo }}{{ bar }}{% endblock %}',
47
- ]));
48
- $twig->addGlobal('bar', 'BAR');
49
-
50
- $wrapper = $twig->load('index');
51
- $this->assertEquals('FOOBAR', $wrapper->renderBlock('foo', ['foo' => 'FOO']));
52
- }
53
-
54
- public function testDisplayBlock()
55
- {
56
- $twig = new Environment(new ArrayLoader([
57
- 'index' => '{% block foo %}{{ foo }}{{ bar }}{% endblock %}',
58
- ]));
59
- $twig->addGlobal('bar', 'BAR');
60
-
61
- $wrapper = $twig->load('index');
62
-
63
- ob_start();
64
- $wrapper->displayBlock('foo', ['foo' => 'FOO']);
65
-
66
- $this->assertEquals('FOOBAR', ob_get_clean());
67
- }
68
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php DELETED
@@ -1,85 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Token;
13
- use Twig\TokenStream;
14
-
15
- class Twig_Tests_TokenStreamTest extends \PHPUnit\Framework\TestCase
16
- {
17
- protected static $tokens;
18
-
19
- protected function setUp()
20
- {
21
- self::$tokens = [
22
- new Token(Token::TEXT_TYPE, 1, 1),
23
- new Token(Token::TEXT_TYPE, 2, 1),
24
- new Token(Token::TEXT_TYPE, 3, 1),
25
- new Token(Token::TEXT_TYPE, 4, 1),
26
- new Token(Token::TEXT_TYPE, 5, 1),
27
- new Token(Token::TEXT_TYPE, 6, 1),
28
- new Token(Token::TEXT_TYPE, 7, 1),
29
- new Token(Token::EOF_TYPE, 0, 1),
30
- ];
31
- }
32
-
33
- /**
34
- * @group legacy
35
- */
36
- public function testLegacyConstructorSignature()
37
- {
38
- $stream = new TokenStream([], 'foo', '{{ foo }}');
39
- $this->assertEquals('foo', $stream->getFilename());
40
- $this->assertEquals('{{ foo }}', $stream->getSource());
41
- $this->assertEquals('foo', $stream->getSourceContext()->getName());
42
- $this->assertEquals('{{ foo }}', $stream->getSourceContext()->getCode());
43
- }
44
-
45
- public function testNext()
46
- {
47
- $stream = new TokenStream(self::$tokens);
48
- $repr = [];
49
- while (!$stream->isEOF()) {
50
- $token = $stream->next();
51
-
52
- $repr[] = $token->getValue();
53
- }
54
- $this->assertEquals('1, 2, 3, 4, 5, 6, 7', implode(', ', $repr), '->next() advances the pointer and returns the current token');
55
- }
56
-
57
- /**
58
- * @expectedException \Twig\Error\SyntaxError
59
- * @expectedExceptionMessage Unexpected end of template
60
- */
61
- public function testEndOfTemplateNext()
62
- {
63
- $stream = new TokenStream([
64
- new Token(Token::BLOCK_START_TYPE, 1, 1),
65
- ]);
66
- while (!$stream->isEOF()) {
67
- $stream->next();
68
- }
69
- }
70
-
71
- /**
72
- * @expectedException \Twig\Error\SyntaxError
73
- * @expectedExceptionMessage Unexpected end of template
74
- */
75
- public function testEndOfTemplateLook()
76
- {
77
- $stream = new TokenStream([
78
- new Token(Token::BLOCK_START_TYPE, 1, 1),
79
- ]);
80
- while (!$stream->isEOF()) {
81
- $stream->look();
82
- $stream->next();
83
- }
84
- }
85
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Twig.
5
- *
6
- * (c) Fabien Potencier
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Twig\Environment;
13
- use Twig\TwigFunction;
14
- use Twig\Util\DeprecationCollector;
15
-
16
- class Twig_Tests_Util_DeprecationCollectorTest extends \PHPUnit\Framework\TestCase
17
- {
18
- /**
19
- * @requires PHP 5.3
20
- */
21
- public function testCollect()
22
- {
23
- $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
24
- $twig->addFunction(new TwigFunction('deprec', [$this, 'deprec'], ['deprecated' => true]));
25
-
26
- $collector = new DeprecationCollector($twig);
27
- $deprecations = $collector->collect(new Twig_Tests_Util_Iterator());
28
-
29
- $this->assertEquals(['Twig Function "deprec" is deprecated in deprec.twig at line 1.'], $deprecations);
30
- }
31
-
32
- public function deprec()
33
- {
34
- }
35
- }
36
-
37
- class Twig_Tests_Util_Iterator implements \IteratorAggregate
38
- {
39
- public function getIterator()
40
- {
41
- return new \ArrayIterator([
42
- 'ok.twig' => '{{ foo }}',
43
- 'deprec.twig' => '{{ deprec("foo") }}',
44
- ]);
45
- }
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/test/Twig/Tests/escapingTest.php DELETED
@@ -1,325 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * This class is adapted from code coming from Zend Framework.
5
- *
6
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (https://www.zend.com)
7
- * @license https://framework.zend.com/license/new-bsd New BSD License
8
- */
9
- class Twig_Test_EscapingTest extends \PHPUnit\Framework\TestCase
10
- {
11
- /**
12
- * All character encodings supported by htmlspecialchars().
13
- */
14
- protected $htmlSpecialChars = [
15
- '\'' => '&#039;',
16
- '"' => '&quot;',
17
- '<' => '&lt;',
18
- '>' => '&gt;',
19
- '&' => '&amp;',
20
- ];
21
-
22
- protected $htmlAttrSpecialChars = [
23
- '\'' => '&#x27;',
24
- /* Characters beyond ASCII value 255 to unicode escape */
25
- 'Ä€' => '&#x0100;',
26
- '😀' => '&#x1F600;',
27
- /* Immune chars excluded */
28
- ',' => ',',
29
- '.' => '.',
30
- '-' => '-',
31
- '_' => '_',
32
- /* Basic alnums excluded */
33
- 'a' => 'a',
34
- 'A' => 'A',
35
- 'z' => 'z',
36
- 'Z' => 'Z',
37
- '0' => '0',
38
- '9' => '9',
39
- /* Basic control characters and null */
40
- "\r" => '&#x0D;',
41
- "\n" => '&#x0A;',
42
- "\t" => '&#x09;',
43
- "\0" => '&#xFFFD;', // should use Unicode replacement char
44
- /* Encode chars as named entities where possible */
45
- '<' => '&lt;',
46
- '>' => '&gt;',
47
- '&' => '&amp;',
48
- '"' => '&quot;',
49
- /* Encode spaces for quoteless attribute protection */
50
- ' ' => '&#x20;',
51
- ];
52
-
53
- protected $jsSpecialChars = [
54
- /* HTML special chars - escape without exception to hex */
55
- '<' => '\\u003C',
56
- '>' => '\\u003E',
57
- '\'' => '\\u0027',
58
- '"' => '\\u0022',
59
- '&' => '\\u0026',
60
- '/' => '\\/',
61
- /* Characters beyond ASCII value 255 to unicode escape */
62
- 'Ä€' => '\\u0100',
63
- '😀' => '\\uD83D\\uDE00',
64
- /* Immune chars excluded */
65
- ',' => ',',
66
- '.' => '.',
67
- '_' => '_',
68
- /* Basic alnums excluded */
69
- 'a' => 'a',
70
- 'A' => 'A',
71
- 'z' => 'z',
72
- 'Z' => 'Z',
73
- '0' => '0',
74
- '9' => '9',
75
- /* Basic control characters and null */
76
- "\r" => '\r',
77
- "\n" => '\n',
78
- "\x08" => '\b',
79
- "\t" => '\t',
80
- "\x0C" => '\f',
81
- "\0" => '\\u0000',
82
- /* Encode spaces for quoteless attribute protection */
83
- ' ' => '\\u0020',
84
- ];
85
-
86
- protected $urlSpecialChars = [
87
- /* HTML special chars - escape without exception to percent encoding */
88
- '<' => '%3C',
89
- '>' => '%3E',
90
- '\'' => '%27',
91
- '"' => '%22',
92
- '&' => '%26',
93
- /* Characters beyond ASCII value 255 to hex sequence */
94
- 'Ä€' => '%C4%80',
95
- /* Punctuation and unreserved check */
96
- ',' => '%2C',
97
- '.' => '.',
98
- '_' => '_',
99
- '-' => '-',
100
- ':' => '%3A',
101
- ';' => '%3B',
102
- '!' => '%21',
103
- /* Basic alnums excluded */
104
- 'a' => 'a',
105
- 'A' => 'A',
106
- 'z' => 'z',
107
- 'Z' => 'Z',
108
- '0' => '0',
109
- '9' => '9',
110
- /* Basic control characters and null */
111
- "\r" => '%0D',
112
- "\n" => '%0A',
113
- "\t" => '%09',
114
- "\0" => '%00',
115
- /* PHP quirks from the past */
116
- ' ' => '%20',
117
- '~' => '~',
118
- '+' => '%2B',
119
- ];
120
-
121
- protected $cssSpecialChars = [
122
- /* HTML special chars - escape without exception to hex */
123
- '<' => '\\3C ',
124
- '>' => '\\3E ',
125
- '\'' => '\\27 ',
126
- '"' => '\\22 ',
127
- '&' => '\\26 ',
128
- /* Characters beyond ASCII value 255 to unicode escape */
129
- 'Ä€' => '\\100 ',
130
- /* Immune chars excluded */
131
- ',' => '\\2C ',
132
- '.' => '\\2E ',
133
- '_' => '\\5F ',
134
- /* Basic alnums excluded */
135
- 'a' => 'a',
136
- 'A' => 'A',
137
- 'z' => 'z',
138
- 'Z' => 'Z',
139
- '0' => '0',
140
- '9' => '9',
141
- /* Basic control characters and null */
142
- "\r" => '\\D ',
143
- "\n" => '\\A ',
144
- "\t" => '\\9 ',
145
- "\0" => '\\0 ',
146
- /* Encode spaces for quoteless attribute protection */
147
- ' ' => '\\20 ',
148
- ];
149
-
150
- protected $env;
151
-
152
- protected function setUp()
153
- {
154
- $this->env = new \Twig\Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
155
- }
156
-
157
- public function testHtmlEscapingConvertsSpecialChars()
158
- {
159
- foreach ($this->htmlSpecialChars as $key => $value) {
160
- $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html'), 'Failed to escape: '.$key);
161
- }
162
- }
163
-
164
- public function testHtmlAttributeEscapingConvertsSpecialChars()
165
- {
166
- foreach ($this->htmlAttrSpecialChars as $key => $value) {
167
- $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html_attr'), 'Failed to escape: '.$key);
168
- }
169
- }
170
-
171
- public function testJavascriptEscapingConvertsSpecialChars()
172
- {
173
- foreach ($this->jsSpecialChars as $key => $value) {
174
- $this->assertEquals($value, twig_escape_filter($this->env, $key, 'js'), 'Failed to escape: '.$key);
175
- }
176
- }
177
-
178
- public function testJavascriptEscapingReturnsStringIfZeroLength()
179
- {
180
- $this->assertEquals('', twig_escape_filter($this->env, '', 'js'));
181
- }
182
-
183
- public function testJavascriptEscapingReturnsStringIfContainsOnlyDigits()
184
- {
185
- $this->assertEquals('123', twig_escape_filter($this->env, '123', 'js'));
186
- }
187
-
188
- public function testCssEscapingConvertsSpecialChars()
189
- {
190
- foreach ($this->cssSpecialChars as $key => $value) {
191
- $this->assertEquals($value, twig_escape_filter($this->env, $key, 'css'), 'Failed to escape: '.$key);
192
- }
193
- }
194
-
195
- public function testCssEscapingReturnsStringIfZeroLength()
196
- {
197
- $this->assertEquals('', twig_escape_filter($this->env, '', 'css'));
198
- }
199
-
200
- public function testCssEscapingReturnsStringIfContainsOnlyDigits()
201
- {
202
- $this->assertEquals('123', twig_escape_filter($this->env, '123', 'css'));
203
- }
204
-
205
- public function testUrlEscapingConvertsSpecialChars()
206
- {
207
- foreach ($this->urlSpecialChars as $key => $value) {
208
- $this->assertEquals($value, twig_escape_filter($this->env, $key, 'url'), 'Failed to escape: '.$key);
209
- }
210
- }
211
-
212
- /**
213
- * Range tests to confirm escaped range of characters is within OWASP recommendation.
214
- */
215
-
216
- /**
217
- * Only testing the first few 2 ranges on this prot. function as that's all these
218
- * other range tests require.
219
- */
220
- public function testUnicodeCodepointConversionToUtf8()
221
- {
222
- $expected = ' ~Þ™';
223
- $codepoints = [0x20, 0x7e, 0x799];
224
- $result = '';
225
- foreach ($codepoints as $value) {
226
- $result .= $this->codepointToUtf8($value);
227
- }
228
- $this->assertEquals($expected, $result);
229
- }
230
-
231
- /**
232
- * Convert a Unicode Codepoint to a literal UTF-8 character.
233
- *
234
- * @param int $codepoint Unicode codepoint in hex notation
235
- *
236
- * @return string UTF-8 literal string
237
- */
238
- protected function codepointToUtf8($codepoint)
239
- {
240
- if ($codepoint < 0x80) {
241
- return \chr($codepoint);
242
- }
243
- if ($codepoint < 0x800) {
244
- return \chr($codepoint >> 6 & 0x3f | 0xc0)
245
- .\chr($codepoint & 0x3f | 0x80);
246
- }
247
- if ($codepoint < 0x10000) {
248
- return \chr($codepoint >> 12 & 0x0f | 0xe0)
249
- .\chr($codepoint >> 6 & 0x3f | 0x80)
250
- .\chr($codepoint & 0x3f | 0x80);
251
- }
252
- if ($codepoint < 0x110000) {
253
- return \chr($codepoint >> 18 & 0x07 | 0xf0)
254
- .\chr($codepoint >> 12 & 0x3f | 0x80)
255
- .\chr($codepoint >> 6 & 0x3f | 0x80)
256
- .\chr($codepoint & 0x3f | 0x80);
257
- }
258
- throw new \Exception('Codepoint requested outside of Unicode range.');
259
- }
260
-
261
- public function testJavascriptEscapingEscapesOwaspRecommendedRanges()
262
- {
263
- $immune = [',', '.', '_']; // Exceptions to escaping ranges
264
- for ($chr = 0; $chr < 0xFF; ++$chr) {
265
- if ($chr >= 0x30 && $chr <= 0x39
266
- || $chr >= 0x41 && $chr <= 0x5A
267
- || $chr >= 0x61 && $chr <= 0x7A) {
268
- $literal = $this->codepointToUtf8($chr);
269
- $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js'));
270
- } else {
271
- $literal = $this->codepointToUtf8($chr);
272
- if (\in_array($literal, $immune)) {
273
- $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js'));
274
- } else {
275
- $this->assertNotEquals(
276
- $literal,
277
- twig_escape_filter($this->env, $literal, 'js'),
278
- "$literal should be escaped!");
279
- }
280
- }
281
- }
282
- }
283
-
284
- public function testHtmlAttributeEscapingEscapesOwaspRecommendedRanges()
285
- {
286
- $immune = [',', '.', '-', '_']; // Exceptions to escaping ranges
287
- for ($chr = 0; $chr < 0xFF; ++$chr) {
288
- if ($chr >= 0x30 && $chr <= 0x39
289
- || $chr >= 0x41 && $chr <= 0x5A
290
- || $chr >= 0x61 && $chr <= 0x7A) {
291
- $literal = $this->codepointToUtf8($chr);
292
- $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr'));
293
- } else {
294
- $literal = $this->codepointToUtf8($chr);
295
- if (\in_array($literal, $immune)) {
296
- $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr'));
297
- } else {
298
- $this->assertNotEquals(
299
- $literal,
300
- twig_escape_filter($this->env, $literal, 'html_attr'),
301
- "$literal should be escaped!");
302
- }
303
- }
304
- }
305
- }
306
-
307
- public function testCssEscapingEscapesOwaspRecommendedRanges()
308
- {
309
- // CSS has no exceptions to escaping ranges
310
- for ($chr = 0; $chr < 0xFF; ++$chr) {
311
- if ($chr >= 0x30 && $chr <= 0x39
312
- || $chr >= 0x41 && $chr <= 0x5A
313
- || $chr >= 0x61 && $chr <= 0x7A) {
314
- $literal = $this->codepointToUtf8($chr);
315
- $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'css'));
316
- } else {
317
- $literal = $this->codepointToUtf8($chr);
318
- $this->assertNotEquals(
319
- $literal,
320
- twig_escape_filter($this->env, $literal, 'css'),
321
- "$literal should be escaped!");
322
- }
323
- }
324
- }
325
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/twig/twig/tests/AutoloaderTest.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ class AutoloaderTest extends \PHPUnit\Framework\TestCase
15
+ {
16
+ /**
17
+ * @group legacy
18
+ */
19
+ public function testAutoload()
20
+ {
21
+ $this->assertFalse(class_exists('FooBarFoo'), '->autoload() does not try to load classes that does not begin with Twig');
22
+
23
+ $autoloader = new \Twig_Autoloader();
24
+ $this->assertNull($autoloader->autoload('Foo'), '->autoload() returns false if it is not able to load a class');
25
+ }
26
+ }
vendor/twig/twig/tests/Cache/FilesystemTest.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Cache;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Cache\FilesystemCache;
15
+ use Twig\Tests\FilesystemHelper;
16
+
17
+ class FilesystemTest extends \PHPUnit\Framework\TestCase
18
+ {
19
+ private $classname;
20
+ private $directory;
21
+ private $cache;
22
+
23
+ protected function setUp()
24
+ {
25
+ $nonce = hash('sha256', uniqid(mt_rand(), true));
26
+ $this->classname = '__Twig_Tests_Cache_FilesystemTest_Template_'.$nonce;
27
+ $this->directory = sys_get_temp_dir().'/twig-test';
28
+ $this->cache = new FilesystemCache($this->directory);
29
+ }
30
+
31
+ protected function tearDown()
32
+ {
33
+ if (file_exists($this->directory)) {
34
+ FilesystemHelper::removeDir($this->directory);
35
+ }
36
+ }
37
+
38
+ public function testLoad()
39
+ {
40
+ $key = $this->directory.'/cache/cachefile.php';
41
+
42
+ $dir = \dirname($key);
43
+ @mkdir($dir, 0777, true);
44
+ $this->assertDirectoryExists($dir);
45
+ $this->assertFalse(class_exists($this->classname, false));
46
+
47
+ $content = $this->generateSource();
48
+ file_put_contents($key, $content);
49
+
50
+ $this->cache->load($key);
51
+
52
+ $this->assertTrue(class_exists($this->classname, false));
53
+ }
54
+
55
+ public function testLoadMissing()
56
+ {
57
+ $key = $this->directory.'/cache/cachefile.php';
58
+
59
+ $this->assertFalse(class_exists($this->classname, false));
60
+
61
+ $this->cache->load($key);
62
+
63
+ $this->assertFalse(class_exists($this->classname, false));
64
+ }
65
+
66
+ public function testWrite()
67
+ {
68
+ $key = $this->directory.'/cache/cachefile.php';
69
+ $content = $this->generateSource();
70
+
71
+ $this->assertFileNotExists($key);
72
+ $this->assertFileNotExists($this->directory);
73
+
74
+ $this->cache->write($key, $content);
75
+
76
+ $this->assertFileExists($this->directory);
77
+ $this->assertFileExists($key);
78
+ $this->assertSame(file_get_contents($key), $content);
79
+ }
80
+
81
+ public function testWriteFailMkdir()
82
+ {
83
+ $this->expectException('\RuntimeException');
84
+ $this->expectExceptionMessage('Unable to create the cache directory');
85
+
86
+ if (\defined('PHP_WINDOWS_VERSION_BUILD')) {
87
+ $this->markTestSkipped('Read-only directories not possible on Windows.');
88
+ }
89
+
90
+ $key = $this->directory.'/cache/cachefile.php';
91
+ $content = $this->generateSource();
92
+
93
+ $this->assertFileNotExists($key);
94
+
95
+ // Create read-only root directory.
96
+ @mkdir($this->directory, 0555, true);
97
+ $this->assertDirectoryExists($this->directory);
98
+
99
+ $this->cache->write($key, $content);
100
+ }
101
+
102
+ public function testWriteFailDirWritable()
103
+ {
104
+ $this->expectException('\RuntimeException');
105
+ $this->expectExceptionMessage('Unable to write in the cache directory');
106
+
107
+ if (\defined('PHP_WINDOWS_VERSION_BUILD')) {
108
+ $this->markTestSkipped('Read-only directories not possible on Windows.');
109
+ }
110
+
111
+ $key = $this->directory.'/cache/cachefile.php';
112
+ $content = $this->generateSource();
113
+
114
+ $this->assertFileNotExists($key);
115
+
116
+ // Create root directory.
117
+ @mkdir($this->directory, 0777, true);
118
+ // Create read-only subdirectory.
119
+ @mkdir($this->directory.'/cache', 0555);
120
+ $this->assertDirectoryExists($this->directory.'/cache');
121
+
122
+ $this->cache->write($key, $content);
123
+ }
124
+
125
+ public function testWriteFailWriteFile()
126
+ {
127
+ $this->expectException('\RuntimeException');
128
+ $this->expectExceptionMessage('Failed to write cache file');
129
+
130
+ $key = $this->directory.'/cache/cachefile.php';
131
+ $content = $this->generateSource();
132
+
133
+ $this->assertFileNotExists($key);
134
+
135
+ // Create a directory in the place of the cache file.
136
+ @mkdir($key, 0777, true);
137
+ $this->assertDirectoryExists($key);
138
+
139
+ $this->cache->write($key, $content);
140
+ }
141
+
142
+ public function testGetTimestamp()
143
+ {
144
+ $key = $this->directory.'/cache/cachefile.php';
145
+
146
+ $dir = \dirname($key);
147
+ @mkdir($dir, 0777, true);
148
+ $this->assertDirectoryExists($dir);
149
+
150
+ // Create the file with a specific modification time.
151
+ touch($key, 1234567890);
152
+
153
+ $this->assertSame(1234567890, $this->cache->getTimestamp($key));
154
+ }
155
+
156
+ public function testGetTimestampMissingFile()
157
+ {
158
+ $key = $this->directory.'/cache/cachefile.php';
159
+ $this->assertSame(0, $this->cache->getTimestamp($key));
160
+ }
161
+
162
+ /**
163
+ * Test file cache is tolerant towards trailing (back)slashes on the configured cache directory.
164
+ *
165
+ * @dataProvider provideDirectories
166
+ */
167
+ public function testGenerateKey($expected, $input)
168
+ {
169
+ $cache = new FilesystemCache($input);
170
+ $this->assertRegExp($expected, $cache->generateKey('_test_', \get_class($this)));
171
+ }
172
+
173
+ public function provideDirectories()
174
+ {
175
+ $pattern = '#a/b/[a-zA-Z0-9]+/[a-zA-Z0-9]+.php$#';
176
+
177
+ return [
178
+ [$pattern, 'a/b'],
179
+ [$pattern, 'a/b/'],
180
+ [$pattern, 'a/b\\'],
181
+ [$pattern, 'a/b\\/'],
182
+ [$pattern, 'a/b\\//'],
183
+ ['#/'.substr($pattern, 1), '/a/b'],
184
+ ];
185
+ }
186
+
187
+ private function generateSource()
188
+ {
189
+ return strtr('<?php class {{classname}} {}', [
190
+ '{{classname}}' => $this->classname,
191
+ ]);
192
+ }
193
+ }
vendor/twig/twig/tests/CompilerTest.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Compiler;
15
+ use Twig\Environment;
16
+
17
+ class CompilerTest extends \PHPUnit\Framework\TestCase
18
+ {
19
+ public function testReprNumericValueWithLocale()
20
+ {
21
+ $compiler = new Compiler(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
22
+
23
+ $locale = setlocale(LC_NUMERIC, 0);
24
+ if (false === $locale) {
25
+ $this->markTestSkipped('Your platform does not support locales.');
26
+ }
27
+
28
+ $required_locales = ['fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'];
29
+ if (false === setlocale(LC_NUMERIC, $required_locales)) {
30
+ $this->markTestSkipped('Could not set any of required locales: '.implode(', ', $required_locales));
31
+ }
32
+
33
+ $this->assertEquals('1.2', $compiler->repr(1.2)->getSource());
34
+ $this->assertStringContainsString('fr', strtolower(setlocale(LC_NUMERIC, 0)));
35
+
36
+ setlocale(LC_NUMERIC, $locale);
37
+ }
38
+ }
vendor/twig/twig/tests/ContainerRuntimeLoaderTest.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\RuntimeLoader\ContainerRuntimeLoader;
15
+
16
+ class ContainerRuntimeLoaderTest extends \PHPUnit\Framework\TestCase
17
+ {
18
+ /**
19
+ * @requires PHP 5.3
20
+ */
21
+ public function testLoad()
22
+ {
23
+ $container = $this->createMock('Psr\Container\ContainerInterface');
24
+ $container->expects($this->once())->method('has')->with('stdClass')->willReturn(true);
25
+ $container->expects($this->once())->method('get')->with('stdClass')->willReturn(new \stdClass());
26
+
27
+ $loader = new ContainerRuntimeLoader($container);
28
+
29
+ $this->assertInstanceOf('stdClass', $loader->load('stdClass'));
30
+ }
31
+
32
+ /**
33
+ * @requires PHP 5.3
34
+ */
35
+ public function testLoadUnknownRuntimeReturnsNull()
36
+ {
37
+ $container = $this->createMock('Psr\Container\ContainerInterface');
38
+ $container->expects($this->once())->method('has')->with('Foo');
39
+ $container->expects($this->never())->method('get');
40
+
41
+ $loader = new ContainerRuntimeLoader($container);
42
+ $this->assertNull($loader->load('Foo'));
43
+ }
44
+ }
vendor/twig/twig/tests/CustomExtensionTest.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Extension\ExtensionInterface;
16
+
17
+ class CustomExtensionTest extends \PHPUnit\Framework\TestCase
18
+ {
19
+ /**
20
+ * @requires PHP 5.3
21
+ * @dataProvider provideInvalidExtensions
22
+ */
23
+ public function testGetInvalidOperators(ExtensionInterface $extension, $expectedExceptionMessage)
24
+ {
25
+ $this->expectException('InvalidArgumentException');
26
+ $this->expectExceptionMessage($expectedExceptionMessage);
27
+
28
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
29
+ $env->addExtension($extension);
30
+ $env->getUnaryOperators();
31
+ }
32
+
33
+ public function provideInvalidExtensions()
34
+ {
35
+ return [
36
+ [new InvalidOperatorExtension(new \stdClass()), '"Twig\Tests\InvalidOperatorExtension::getOperators()" must return an array with operators, got "stdClass".'],
37
+ [new InvalidOperatorExtension([1, 2, 3]), '"Twig\Tests\InvalidOperatorExtension::getOperators()" must return an array of 2 elements, got 3.'],
38
+ ];
39
+ }
40
+ }
41
+
42
+ class InvalidOperatorExtension implements ExtensionInterface
43
+ {
44
+ private $operators;
45
+
46
+ public function __construct($operators)
47
+ {
48
+ $this->operators = $operators;
49
+ }
50
+
51
+ public function initRuntime(Environment $environment)
52
+ {
53
+ }
54
+
55
+ public function getTokenParsers()
56
+ {
57
+ return [];
58
+ }
59
+
60
+ public function getNodeVisitors()
61
+ {
62
+ return [];
63
+ }
64
+
65
+ public function getFilters()
66
+ {
67
+ return [];
68
+ }
69
+
70
+ public function getTests()
71
+ {
72
+ return [];
73
+ }
74
+
75
+ public function getFunctions()
76
+ {
77
+ return [];
78
+ }
79
+
80
+ public function getGlobals()
81
+ {
82
+ return [];
83
+ }
84
+
85
+ public function getOperators()
86
+ {
87
+ return $this->operators;
88
+ }
89
+
90
+ public function getName()
91
+ {
92
+ return __CLASS__;
93
+ }
94
+ }
vendor/twig/twig/tests/EnvironmentTest.php ADDED
@@ -0,0 +1,678 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Cache\FilesystemCache;
15
+ use Twig\Environment;
16
+ use Twig\Extension\AbstractExtension;
17
+ use Twig\Extension\GlobalsInterface;
18
+ use Twig\Extension\InitRuntimeInterface;
19
+ use Twig\Loader\ArrayLoader;
20
+ use Twig\Loader\LoaderInterface;
21
+ use Twig\Loader\SourceContextLoaderInterface;
22
+ use Twig\NodeVisitor\NodeVisitorInterface;
23
+ use Twig\Source;
24
+ use Twig\Token;
25
+ use Twig\TokenParser\AbstractTokenParser;
26
+ use Twig\TwigFilter;
27
+ use Twig\TwigFunction;
28
+ use Twig\TwigTest;
29
+
30
+ class EnvironmentTest extends \PHPUnit\Framework\TestCase
31
+ {
32
+ private $deprecations = [];
33
+
34
+ /**
35
+ * @group legacy
36
+ */
37
+ public function testLegacyTokenizeSignature()
38
+ {
39
+ $env = new Environment();
40
+ $stream = $env->tokenize('{{ foo }}', 'foo');
41
+ $this->assertEquals('{{ foo }}', $stream->getSource());
42
+ $this->assertEquals('foo', $stream->getFilename());
43
+ }
44
+
45
+ /**
46
+ * @group legacy
47
+ */
48
+ public function testLegacyCompileSourceSignature()
49
+ {
50
+ $loader = new ArrayLoader(['foo' => '{{ foo }}']);
51
+ $env = new Environment($loader);
52
+ $this->assertStringContainsString('getTemplateName', $env->compileSource('{{ foo }}', 'foo'));
53
+ }
54
+
55
+ /**
56
+ * @group legacy
57
+ */
58
+ public function testRenderNoLoader()
59
+ {
60
+ $this->expectException('\LogicException');
61
+ $this->expectExceptionMessage('You must set a loader first.');
62
+
63
+ $env = new Environment();
64
+ $env->render('test');
65
+ }
66
+
67
+ public function testAutoescapeOption()
68
+ {
69
+ $loader = new ArrayLoader([
70
+ 'html' => '{{ foo }} {{ foo }}',
71
+ 'js' => '{{ bar }} {{ bar }}',
72
+ ]);
73
+
74
+ $twig = new Environment($loader, [
75
+ 'debug' => true,
76
+ 'cache' => false,
77
+ 'autoescape' => [$this, 'escapingStrategyCallback'],
78
+ ]);
79
+
80
+ $this->assertEquals('foo&lt;br/ &gt; foo&lt;br/ &gt;', $twig->render('html', ['foo' => 'foo<br/ >']));
81
+ $this->assertEquals('foo\u003Cbr\/\u0020\u003E foo\u003Cbr\/\u0020\u003E', $twig->render('js', ['bar' => 'foo<br/ >']));
82
+ }
83
+
84
+ public function escapingStrategyCallback($name)
85
+ {
86
+ return $name;
87
+ }
88
+
89
+ public function testGlobals()
90
+ {
91
+ // to be removed in 2.0
92
+ $loader = $this->createMock('\Twig\Tests\EnvironmentTestLoaderInterface');
93
+ //$loader = $this->createMock(['\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface']);
94
+ $loader->expects($this->any())->method('getSourceContext')->willReturn(new Source('', ''));
95
+
96
+ // globals can be added after calling getGlobals
97
+
98
+ $twig = new Environment($loader);
99
+ $twig->addGlobal('foo', 'foo');
100
+ $twig->getGlobals();
101
+ $twig->addGlobal('foo', 'bar');
102
+ $globals = $twig->getGlobals();
103
+ $this->assertEquals('bar', $globals['foo']);
104
+
105
+ // globals can be modified after a template has been loaded
106
+ $twig = new Environment($loader);
107
+ $twig->addGlobal('foo', 'foo');
108
+ $twig->getGlobals();
109
+ $twig->load('index');
110
+ $twig->addGlobal('foo', 'bar');
111
+ $globals = $twig->getGlobals();
112
+ $this->assertEquals('bar', $globals['foo']);
113
+
114
+ // globals can be modified after extensions init
115
+ $twig = new Environment($loader);
116
+ $twig->addGlobal('foo', 'foo');
117
+ $twig->getGlobals();
118
+ $twig->getFunctions();
119
+ $twig->addGlobal('foo', 'bar');
120
+ $globals = $twig->getGlobals();
121
+ $this->assertEquals('bar', $globals['foo']);
122
+
123
+ // globals can be modified after extensions and a template has been loaded
124
+ $arrayLoader = new ArrayLoader(['index' => '{{foo}}']);
125
+ $twig = new Environment($arrayLoader);
126
+ $twig->addGlobal('foo', 'foo');
127
+ $twig->getGlobals();
128
+ $twig->getFunctions();
129
+ $twig->load('index');
130
+ $twig->addGlobal('foo', 'bar');
131
+ $globals = $twig->getGlobals();
132
+ $this->assertEquals('bar', $globals['foo']);
133
+
134
+ $twig = new Environment($arrayLoader);
135
+ $twig->getGlobals();
136
+ $twig->addGlobal('foo', 'bar');
137
+ $template = $twig->load('index');
138
+ $this->assertEquals('bar', $template->render([]));
139
+
140
+ /* to be uncomment in Twig 2.0
141
+ // globals cannot be added after a template has been loaded
142
+ $twig = new Environment($loader);
143
+ $twig->addGlobal('foo', 'foo');
144
+ $twig->getGlobals();
145
+ $twig->load('index');
146
+ try {
147
+ $twig->addGlobal('bar', 'bar');
148
+ $this->fail();
149
+ } catch (\LogicException $e) {
150
+ $this->assertFalse(array_key_exists('bar', $twig->getGlobals()));
151
+ }
152
+
153
+ // globals cannot be added after extensions init
154
+ $twig = new Environment($loader);
155
+ $twig->addGlobal('foo', 'foo');
156
+ $twig->getGlobals();
157
+ $twig->getFunctions();
158
+ try {
159
+ $twig->addGlobal('bar', 'bar');
160
+ $this->fail();
161
+ } catch (\LogicException $e) {
162
+ $this->assertFalse(array_key_exists('bar', $twig->getGlobals()));
163
+ }
164
+
165
+ // globals cannot be added after extensions and a template has been loaded
166
+ $twig = new Environment($loader);
167
+ $twig->addGlobal('foo', 'foo');
168
+ $twig->getGlobals();
169
+ $twig->getFunctions();
170
+ $twig->load('index');
171
+ try {
172
+ $twig->addGlobal('bar', 'bar');
173
+ $this->fail();
174
+ } catch (\LogicException $e) {
175
+ $this->assertFalse(array_key_exists('bar', $twig->getGlobals()));
176
+ }
177
+
178
+ // test adding globals after a template has been loaded without call to getGlobals
179
+ $twig = new Environment($loader);
180
+ $twig->load('index');
181
+ try {
182
+ $twig->addGlobal('bar', 'bar');
183
+ $this->fail();
184
+ } catch (\LogicException $e) {
185
+ $this->assertFalse(array_key_exists('bar', $twig->getGlobals()));
186
+ }
187
+ */
188
+ }
189
+
190
+ public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate()
191
+ {
192
+ $cache = new FilesystemCache($dir = sys_get_temp_dir().'/twig');
193
+ $options = ['cache' => $cache, 'auto_reload' => false, 'debug' => false];
194
+
195
+ // force compilation
196
+ $twig = new Environment($loader = new ArrayLoader(['index' => '{{ foo }}']), $options);
197
+
198
+ $key = $cache->generateKey('index', $twig->getTemplateClass('index'));
199
+ $cache->write($key, $twig->compileSource(new Source('{{ foo }}', 'index')));
200
+
201
+ // check that extensions won't be initialized when rendering a template that is already in the cache
202
+ $twig = $this
203
+ ->getMockBuilder('\Twig\Environment')
204
+ ->setConstructorArgs([$loader, $options])
205
+ ->setMethods(['initExtensions'])
206
+ ->getMock()
207
+ ;
208
+
209
+ $twig->expects($this->never())->method('initExtensions');
210
+
211
+ // render template
212
+ $output = $twig->render('index', ['foo' => 'bar']);
213
+ $this->assertEquals('bar', $output);
214
+
215
+ FilesystemHelper::removeDir($dir);
216
+ }
217
+
218
+ public function testAutoReloadCacheMiss()
219
+ {
220
+ $templateName = __FUNCTION__;
221
+ $templateContent = __FUNCTION__;
222
+
223
+ $cache = $this->createMock('\Twig\Cache\CacheInterface');
224
+ $loader = $this->getMockLoader($templateName, $templateContent);
225
+ $twig = new Environment($loader, ['cache' => $cache, 'auto_reload' => true, 'debug' => false]);
226
+
227
+ // Cache miss: getTimestamp returns 0 and as a result the load() is
228
+ // skipped.
229
+ $cache->expects($this->once())
230
+ ->method('generateKey')
231
+ ->willReturn('key');
232
+ $cache->expects($this->once())
233
+ ->method('getTimestamp')
234
+ ->willReturn(0);
235
+ $loader->expects($this->never())
236
+ ->method('isFresh');
237
+ $cache->expects($this->once())
238
+ ->method('write');
239
+ $cache->expects($this->once())
240
+ ->method('load');
241
+
242
+ $twig->load($templateName);
243
+ }
244
+
245
+ public function testAutoReloadCacheHit()
246
+ {
247
+ $templateName = __FUNCTION__;
248
+ $templateContent = __FUNCTION__;
249
+
250
+ $cache = $this->createMock('\Twig\Cache\CacheInterface');
251
+ $loader = $this->getMockLoader($templateName, $templateContent);
252
+ $twig = new Environment($loader, ['cache' => $cache, 'auto_reload' => true, 'debug' => false]);
253
+
254
+ $now = time();
255
+
256
+ // Cache hit: getTimestamp returns something > extension timestamps and
257
+ // the loader returns true for isFresh().
258
+ $cache->expects($this->once())
259
+ ->method('generateKey')
260
+ ->willReturn('key');
261
+ $cache->expects($this->once())
262
+ ->method('getTimestamp')
263
+ ->willReturn($now);
264
+ $loader->expects($this->once())
265
+ ->method('isFresh')
266
+ ->willReturn(true);
267
+ $cache->expects($this->atLeastOnce())
268
+ ->method('load');
269
+
270
+ $twig->load($templateName);
271
+ }
272
+
273
+ public function testAutoReloadOutdatedCacheHit()
274
+ {
275
+ $templateName = __FUNCTION__;
276
+ $templateContent = __FUNCTION__;
277
+
278
+ $cache = $this->createMock('\Twig\Cache\CacheInterface');
279
+ $loader = $this->getMockLoader($templateName, $templateContent);
280
+ $twig = new Environment($loader, ['cache' => $cache, 'auto_reload' => true, 'debug' => false]);
281
+
282
+ $now = time();
283
+
284
+ $cache->expects($this->once())
285
+ ->method('generateKey')
286
+ ->willReturn('key');
287
+ $cache->expects($this->once())
288
+ ->method('getTimestamp')
289
+ ->willReturn($now);
290
+ $loader->expects($this->once())
291
+ ->method('isFresh')
292
+ ->willReturn(false);
293
+ $cache->expects($this->once())
294
+ ->method('write');
295
+ $cache->expects($this->once())
296
+ ->method('load');
297
+
298
+ $twig->load($templateName);
299
+ }
300
+
301
+ /**
302
+ * @group legacy
303
+ */
304
+ public function testHasGetExtensionWithDynamicName()
305
+ {
306
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
307
+
308
+ $ext1 = new EnvironmentTest_Extension_DynamicWithDeprecatedName('ext1');
309
+ $ext2 = new EnvironmentTest_Extension_DynamicWithDeprecatedName('ext2');
310
+ $twig->addExtension($ext1);
311
+ $twig->addExtension($ext2);
312
+
313
+ $this->assertTrue($twig->hasExtension('ext1'));
314
+ $this->assertTrue($twig->hasExtension('ext2'));
315
+
316
+ $this->assertTrue($twig->hasExtension('Twig\Tests\EnvironmentTest_Extension_DynamicWithDeprecatedName'));
317
+
318
+ $this->assertSame($ext1, $twig->getExtension('ext1'));
319
+ $this->assertSame($ext2, $twig->getExtension('ext2'));
320
+ }
321
+
322
+ public function testHasGetExtensionByClassName()
323
+ {
324
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
325
+ $twig->addExtension($ext = new EnvironmentTest_Extension());
326
+ $this->assertTrue($twig->hasExtension('Twig\Tests\EnvironmentTest_Extension'));
327
+ $this->assertTrue($twig->hasExtension('\Twig\Tests\EnvironmentTest_Extension'));
328
+
329
+ $this->assertSame($ext, $twig->getExtension('Twig\Tests\EnvironmentTest_Extension'));
330
+ $this->assertSame($ext, $twig->getExtension('\Twig\Tests\EnvironmentTest_Extension'));
331
+
332
+ $this->assertTrue($twig->hasExtension('Twig\Tests\EnvironmentTest\Extension'));
333
+ $this->assertSame($ext, $twig->getExtension('Twig\Tests\EnvironmentTest\Extension'));
334
+ }
335
+
336
+ public function testAddExtension()
337
+ {
338
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
339
+ $twig->addExtension(new EnvironmentTest_Extension());
340
+
341
+ $this->assertArrayHasKey('test', $twig->getTags());
342
+ $this->assertArrayHasKey('foo_filter', $twig->getFilters());
343
+ $this->assertArrayHasKey('foo_function', $twig->getFunctions());
344
+ $this->assertArrayHasKey('foo_test', $twig->getTests());
345
+ $this->assertArrayHasKey('foo_unary', $twig->getUnaryOperators());
346
+ $this->assertArrayHasKey('foo_binary', $twig->getBinaryOperators());
347
+ $this->assertArrayHasKey('foo_global', $twig->getGlobals());
348
+ $visitors = $twig->getNodeVisitors();
349
+ $found = false;
350
+ foreach ($visitors as $visitor) {
351
+ if ($visitor instanceof EnvironmentTest_NodeVisitor) {
352
+ $found = true;
353
+ }
354
+ }
355
+ $this->assertTrue($found);
356
+ }
357
+
358
+ /**
359
+ * @requires PHP 5.3
360
+ */
361
+ public function testAddExtensionWithDeprecatedGetGlobals()
362
+ {
363
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
364
+ $twig->addExtension(new EnvironmentTest_Extension_WithGlobals());
365
+
366
+ $this->deprecations = [];
367
+ set_error_handler([$this, 'handleError']);
368
+
369
+ $this->assertArrayHasKey('foo_global', $twig->getGlobals());
370
+
371
+ $this->assertCount(1, $this->deprecations);
372
+ $this->assertStringContainsString('Defining the getGlobals() method in the "Twig\Tests\EnvironmentTest_Extension_WithGlobals" extension ', $this->deprecations[0]);
373
+
374
+ restore_error_handler();
375
+ }
376
+
377
+ /**
378
+ * @group legacy
379
+ */
380
+ public function testRemoveExtension()
381
+ {
382
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
383
+ $twig->addExtension(new EnvironmentTest_Extension_WithDeprecatedName());
384
+ $twig->removeExtension('environment_test');
385
+
386
+ $this->assertArrayNotHasKey('test', $twig->getTags());
387
+ $this->assertArrayNotHasKey('foo_filter', $twig->getFilters());
388
+ $this->assertArrayNotHasKey('foo_function', $twig->getFunctions());
389
+ $this->assertArrayNotHasKey('foo_test', $twig->getTests());
390
+ $this->assertArrayNotHasKey('foo_unary', $twig->getUnaryOperators());
391
+ $this->assertArrayNotHasKey('foo_binary', $twig->getBinaryOperators());
392
+ $this->assertArrayNotHasKey('foo_global', $twig->getGlobals());
393
+ $this->assertCount(2, $twig->getNodeVisitors());
394
+ }
395
+
396
+ public function testAddMockExtension()
397
+ {
398
+ // should be replaced by the following in 2.0 (this current code is just to avoid a dep notice)
399
+ // $extension = $this->createMock('\Twig\Extension\AbstractExtension');
400
+ $extension = eval(<<<EOF
401
+ use Twig\Extension\AbstractExtension;
402
+
403
+ class EnvironmentTest_ExtensionInEval extends AbstractExtension
404
+ {
405
+ }
406
+ EOF
407
+ );
408
+ $extension = new \EnvironmentTest_ExtensionInEval();
409
+
410
+ $loader = new ArrayLoader(['page' => 'hey']);
411
+
412
+ $twig = new Environment($loader);
413
+ $twig->addExtension($extension);
414
+
415
+ $this->assertInstanceOf('\Twig\Extension\ExtensionInterface', $twig->getExtension(\get_class($extension)));
416
+ $this->assertTrue($twig->isTemplateFresh('page', time()));
417
+ }
418
+
419
+ public function testInitRuntimeWithAnExtensionUsingInitRuntimeNoDeprecation()
420
+ {
421
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
422
+ $twig->addExtension(new EnvironmentTest_ExtensionWithoutDeprecationInitRuntime());
423
+ $twig->initRuntime();
424
+
425
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
426
+ // can be executed without throwing any deprecations
427
+ $this->addToAssertionCount(1);
428
+ }
429
+
430
+ /**
431
+ * @requires PHP 5.3
432
+ */
433
+ public function testInitRuntimeWithAnExtensionUsingInitRuntimeDeprecation()
434
+ {
435
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
436
+ $twig->addExtension(new EnvironmentTest_ExtensionWithDeprecationInitRuntime());
437
+
438
+ $this->deprecations = [];
439
+ set_error_handler([$this, 'handleError']);
440
+
441
+ $twig->initRuntime();
442
+
443
+ $this->assertCount(1, $this->deprecations);
444
+ $this->assertStringContainsString('Defining the initRuntime() method in the "Twig\Tests\EnvironmentTest_ExtensionWithDeprecationInitRuntime" extension is deprecated since version 1.23.', $this->deprecations[0]);
445
+
446
+ restore_error_handler();
447
+ }
448
+
449
+ public function handleError($type, $msg)
450
+ {
451
+ if (E_USER_DEPRECATED === $type) {
452
+ $this->deprecations[] = $msg;
453
+ }
454
+ }
455
+
456
+ /**
457
+ * @requires PHP 5.3
458
+ */
459
+ public function testOverrideExtension()
460
+ {
461
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
462
+ $twig->addExtension(new EnvironmentTest_ExtensionWithDeprecationInitRuntime());
463
+
464
+ $this->deprecations = [];
465
+ set_error_handler([$this, 'handleError']);
466
+
467
+ $twig->addExtension(new EnvironmentTest_Extension_WithDeprecatedName());
468
+ $twig->addExtension(new EnvironmentTest_Extension_WithDeprecatedName());
469
+
470
+ $this->assertCount(1, $this->deprecations);
471
+ $this->assertStringContainsString('The possibility to register the same extension twice', $this->deprecations[0]);
472
+
473
+ restore_error_handler();
474
+ }
475
+
476
+ public function testAddRuntimeLoader()
477
+ {
478
+ $runtimeLoader = $this->createMock('\Twig\RuntimeLoader\RuntimeLoaderInterface');
479
+ $runtimeLoader->expects($this->any())->method('load')->willReturn(new EnvironmentTest_Runtime());
480
+
481
+ $loader = new ArrayLoader([
482
+ 'func_array' => '{{ from_runtime_array("foo") }}',
483
+ 'func_array_default' => '{{ from_runtime_array() }}',
484
+ 'func_array_named_args' => '{{ from_runtime_array(name="foo") }}',
485
+ 'func_string' => '{{ from_runtime_string("foo") }}',
486
+ 'func_string_default' => '{{ from_runtime_string() }}',
487
+ 'func_string_named_args' => '{{ from_runtime_string(name="foo") }}',
488
+ ]);
489
+
490
+ $twig = new Environment($loader);
491
+ $twig->addExtension(new EnvironmentTest_ExtensionWithoutRuntime());
492
+ $twig->addRuntimeLoader($runtimeLoader);
493
+
494
+ $this->assertEquals('foo', $twig->render('func_array'));
495
+ $this->assertEquals('bar', $twig->render('func_array_default'));
496
+ $this->assertEquals('foo', $twig->render('func_array_named_args'));
497
+ $this->assertEquals('foo', $twig->render('func_string'));
498
+ $this->assertEquals('bar', $twig->render('func_string_default'));
499
+ $this->assertEquals('foo', $twig->render('func_string_named_args'));
500
+ }
501
+
502
+ protected function getMockLoader($templateName, $templateContent)
503
+ {
504
+ // to be removed in 2.0
505
+ $loader = $this->createMock('Twig\Tests\EnvironmentTestLoaderInterface');
506
+ //$loader = $this->createMock(['\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface']);
507
+ $loader->expects($this->any())
508
+ ->method('getSourceContext')
509
+ ->with($templateName)
510
+ ->willReturn(new Source($templateContent, $templateName));
511
+ $loader->expects($this->any())
512
+ ->method('getCacheKey')
513
+ ->with($templateName)
514
+ ->willReturn($templateName);
515
+
516
+ return $loader;
517
+ }
518
+ }
519
+
520
+ class EnvironmentTest_Extension_WithGlobals extends AbstractExtension
521
+ {
522
+ public function getGlobals()
523
+ {
524
+ return [
525
+ 'foo_global' => 'foo_global',
526
+ ];
527
+ }
528
+ }
529
+
530
+ class EnvironmentTest_Extension extends AbstractExtension implements GlobalsInterface
531
+ {
532
+ public function getTokenParsers()
533
+ {
534
+ return [
535
+ new EnvironmentTest_TokenParser(),
536
+ ];
537
+ }
538
+
539
+ public function getNodeVisitors()
540
+ {
541
+ return [
542
+ new EnvironmentTest_NodeVisitor(),
543
+ ];
544
+ }
545
+
546
+ public function getFilters()
547
+ {
548
+ return [
549
+ new TwigFilter('foo_filter', 'foo_filter'),
550
+ ];
551
+ }
552
+
553
+ public function getTests()
554
+ {
555
+ return [
556
+ new TwigTest('foo_test', 'foo_test'),
557
+ ];
558
+ }
559
+
560
+ public function getFunctions()
561
+ {
562
+ return [
563
+ new TwigFunction('foo_function', 'foo_function'),
564
+ ];
565
+ }
566
+
567
+ public function getOperators()
568
+ {
569
+ return [
570
+ ['foo_unary' => []],
571
+ ['foo_binary' => []],
572
+ ];
573
+ }
574
+
575
+ public function getGlobals()
576
+ {
577
+ return [
578
+ 'foo_global' => 'foo_global',
579
+ ];
580
+ }
581
+ }
582
+ class_alias('\Twig\Tests\EnvironmentTest_Extension', 'Twig\Tests\EnvironmentTest\Extension', false);
583
+
584
+ class EnvironmentTest_Extension_WithDeprecatedName extends AbstractExtension
585
+ {
586
+ public function getName()
587
+ {
588
+ return 'environment_test';
589
+ }
590
+ }
591
+
592
+ class EnvironmentTest_Extension_DynamicWithDeprecatedName extends AbstractExtension
593
+ {
594
+ private $name;
595
+
596
+ public function __construct($name)
597
+ {
598
+ $this->name = $name;
599
+ }
600
+
601
+ public function getName()
602
+ {
603
+ return $this->name;
604
+ }
605
+ }
606
+
607
+ class EnvironmentTest_TokenParser extends AbstractTokenParser
608
+ {
609
+ public function parse(Token $token)
610
+ {
611
+ }
612
+
613
+ public function getTag()
614
+ {
615
+ return 'test';
616
+ }
617
+ }
618
+
619
+ class EnvironmentTest_NodeVisitor implements NodeVisitorInterface
620
+ {
621
+ public function enterNode(\Twig_NodeInterface $node, Environment $env)
622
+ {
623
+ return $node;
624
+ }
625
+
626
+ public function leaveNode(\Twig_NodeInterface $node, Environment $env)
627
+ {
628
+ return $node;
629
+ }
630
+
631
+ public function getPriority()
632
+ {
633
+ return 0;
634
+ }
635
+ }
636
+
637
+ class EnvironmentTest_ExtensionWithDeprecationInitRuntime extends AbstractExtension
638
+ {
639
+ public function initRuntime(Environment $env)
640
+ {
641
+ }
642
+ }
643
+
644
+ class EnvironmentTest_ExtensionWithoutDeprecationInitRuntime extends AbstractExtension implements InitRuntimeInterface
645
+ {
646
+ public function initRuntime(Environment $env)
647
+ {
648
+ }
649
+ }
650
+
651
+ class EnvironmentTest_ExtensionWithoutRuntime extends AbstractExtension
652
+ {
653
+ public function getFunctions()
654
+ {
655
+ return [
656
+ new TwigFunction('from_runtime_array', ['Twig\Tests\EnvironmentTest_Runtime', 'fromRuntime']),
657
+ new TwigFunction('from_runtime_string', 'Twig\Tests\EnvironmentTest_Runtime::fromRuntime'),
658
+ ];
659
+ }
660
+
661
+ public function getName()
662
+ {
663
+ return 'from_runtime';
664
+ }
665
+ }
666
+
667
+ class EnvironmentTest_Runtime
668
+ {
669
+ public function fromRuntime($name = 'bar')
670
+ {
671
+ return $name;
672
+ }
673
+ }
674
+
675
+ // to be removed in 2.0
676
+ interface EnvironmentTestLoaderInterface extends LoaderInterface, SourceContextLoaderInterface
677
+ {
678
+ }
vendor/twig/twig/tests/ErrorTest.php ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Error\Error;
16
+ use Twig\Error\RuntimeError;
17
+ use Twig\Loader\ArrayLoader;
18
+ use Twig\Loader\FilesystemLoader;
19
+ use Twig\Source;
20
+
21
+ class ErrorTest extends \PHPUnit\Framework\TestCase
22
+ {
23
+ public function testErrorWithObjectFilename()
24
+ {
25
+ $error = new Error('foo');
26
+ $error->setSourceContext(new Source('', new \SplFileInfo(__FILE__)));
27
+
28
+ $this->assertStringContainsString('tests'.\DIRECTORY_SEPARATOR.'ErrorTest.php', $error->getMessage());
29
+ }
30
+
31
+ public function testErrorWithArrayFilename()
32
+ {
33
+ $error = new Error('foo');
34
+ $error->setSourceContext(new Source('', ['foo' => 'bar']));
35
+
36
+ $this->assertEquals('foo in {"foo":"bar"}', $error->getMessage());
37
+ }
38
+
39
+ public function testTwigExceptionGuessWithMissingVarAndArrayLoader()
40
+ {
41
+ $loader = new ArrayLoader([
42
+ 'base.html' => '{% block content %}{% endblock %}',
43
+ 'index.html' => <<<EOHTML
44
+ {% extends 'base.html' %}
45
+ {% block content %}
46
+ {{ foo.bar }}
47
+ {% endblock %}
48
+ {% block foo %}
49
+ {{ foo.bar }}
50
+ {% endblock %}
51
+ EOHTML
52
+ ]);
53
+ $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]);
54
+
55
+ $template = $twig->load('index.html');
56
+ try {
57
+ $template->render([]);
58
+
59
+ $this->fail();
60
+ } catch (RuntimeError $e) {
61
+ $this->assertEquals('Variable "foo" does not exist in "index.html" at line 3.', $e->getMessage());
62
+ $this->assertEquals(3, $e->getTemplateLine());
63
+ $this->assertEquals('index.html', $e->getSourceContext()->getName());
64
+ }
65
+ }
66
+
67
+ public function testTwigExceptionGuessWithExceptionAndArrayLoader()
68
+ {
69
+ $loader = new ArrayLoader([
70
+ 'base.html' => '{% block content %}{% endblock %}',
71
+ 'index.html' => <<<EOHTML
72
+ {% extends 'base.html' %}
73
+ {% block content %}
74
+ {{ foo.bar }}
75
+ {% endblock %}
76
+ {% block foo %}
77
+ {{ foo.bar }}
78
+ {% endblock %}
79
+ EOHTML
80
+ ]);
81
+ $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]);
82
+
83
+ $template = $twig->load('index.html');
84
+ try {
85
+ $template->render(['foo' => new ErrorTest_Foo()]);
86
+
87
+ $this->fail();
88
+ } catch (RuntimeError $e) {
89
+ $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index.html" at line 3.', $e->getMessage());
90
+ $this->assertEquals(3, $e->getTemplateLine());
91
+ $this->assertEquals('index.html', $e->getSourceContext()->getName());
92
+ }
93
+ }
94
+
95
+ public function testTwigExceptionGuessWithMissingVarAndFilesystemLoader()
96
+ {
97
+ $loader = new FilesystemLoader(__DIR__.'/Fixtures/errors');
98
+ $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]);
99
+
100
+ $template = $twig->load('index.html');
101
+ try {
102
+ $template->render([]);
103
+
104
+ $this->fail();
105
+ } catch (RuntimeError $e) {
106
+ $this->assertEquals('Variable "foo" does not exist.', $e->getMessage());
107
+ $this->assertEquals(3, $e->getTemplateLine());
108
+ $this->assertEquals('index.html', $e->getSourceContext()->getName());
109
+ $this->assertEquals(3, $e->getLine());
110
+ $this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', \DIRECTORY_SEPARATOR), $e->getFile());
111
+ }
112
+ }
113
+
114
+ public function testTwigExceptionGuessWithExceptionAndFilesystemLoader()
115
+ {
116
+ $loader = new FilesystemLoader(__DIR__.'/Fixtures/errors');
117
+ $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]);
118
+
119
+ $template = $twig->load('index.html');
120
+ try {
121
+ $template->render(['foo' => new ErrorTest_Foo()]);
122
+
123
+ $this->fail();
124
+ } catch (RuntimeError $e) {
125
+ $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...").', $e->getMessage());
126
+ $this->assertEquals(3, $e->getTemplateLine());
127
+ $this->assertEquals('index.html', $e->getSourceContext()->getName());
128
+ $this->assertEquals(3, $e->getLine());
129
+ $this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', \DIRECTORY_SEPARATOR), $e->getFile());
130
+ }
131
+ }
132
+
133
+ /**
134
+ * @dataProvider getErroredTemplates
135
+ */
136
+ public function testTwigExceptionAddsFileAndLine($templates, $name, $line)
137
+ {
138
+ $loader = new ArrayLoader($templates);
139
+ $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]);
140
+
141
+ $template = $twig->load('index');
142
+
143
+ try {
144
+ $template->render([]);
145
+
146
+ $this->fail();
147
+ } catch (RuntimeError $e) {
148
+ $this->assertEquals(sprintf('Variable "foo" does not exist in "%s" at line %d.', $name, $line), $e->getMessage());
149
+ $this->assertEquals($line, $e->getTemplateLine());
150
+ $this->assertEquals($name, $e->getSourceContext()->getName());
151
+ }
152
+
153
+ try {
154
+ $template->render(['foo' => new ErrorTest_Foo()]);
155
+
156
+ $this->fail();
157
+ } catch (RuntimeError $e) {
158
+ $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());
159
+ $this->assertEquals($line, $e->getTemplateLine());
160
+ $this->assertEquals($name, $e->getSourceContext()->getName());
161
+ }
162
+ }
163
+
164
+ public function getErroredTemplates()
165
+ {
166
+ return [
167
+ // error occurs in a template
168
+ [
169
+ [
170
+ 'index' => "\n\n{{ foo.bar }}\n\n\n{{ 'foo' }}",
171
+ ],
172
+ 'index', 3,
173
+ ],
174
+
175
+ // error occurs in an included template
176
+ [
177
+ [
178
+ 'index' => "{% include 'partial' %}",
179
+ 'partial' => '{{ foo.bar }}',
180
+ ],
181
+ 'partial', 1,
182
+ ],
183
+
184
+ // error occurs in a parent block when called via parent()
185
+ [
186
+ [
187
+ 'index' => "{% extends 'base' %}
188
+ {% block content %}
189
+ {{ parent() }}
190
+ {% endblock %}",
191
+ 'base' => '{% block content %}{{ foo.bar }}{% endblock %}',
192
+ ],
193
+ 'base', 1,
194
+ ],
195
+
196
+ // error occurs in a block from the child
197
+ [
198
+ [
199
+ 'index' => "{% extends 'base' %}
200
+ {% block content %}
201
+ {{ foo.bar }}
202
+ {% endblock %}
203
+ {% block foo %}
204
+ {{ foo.bar }}
205
+ {% endblock %}",
206
+ 'base' => '{% block content %}{% endblock %}',
207
+ ],
208
+ 'index', 3,
209
+ ],
210
+ ];
211
+ }
212
+
213
+ public function testTwigLeakOutputInDebugMode()
214
+ {
215
+ $output = exec(sprintf('%s %s debug', \PHP_BINARY, escapeshellarg(__DIR__.'/Fixtures/errors/leak-output.php')));
216
+
217
+ $this->assertSame('Hello OOPS', $output);
218
+ }
219
+
220
+ public function testDoesNotTwigLeakOutput()
221
+ {
222
+ $output = exec(sprintf('%s %s', \PHP_BINARY, escapeshellarg(__DIR__.'/Fixtures/errors/leak-output.php')));
223
+
224
+ $this->assertSame('', $output);
225
+ }
226
+ }
227
+
228
+ class ErrorTest_Foo
229
+ {
230
+ public function bar()
231
+ {
232
+ throw new \Exception('Runtime error...');
233
+ }
234
+ }
vendor/twig/twig/tests/ExpressionParserTest.php ADDED
@@ -0,0 +1,382 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Node\Expression\ArrayExpression;
16
+ use Twig\Node\Expression\Binary\ConcatBinary;
17
+ use Twig\Node\Expression\ConstantExpression;
18
+ use Twig\Node\Expression\NameExpression;
19
+ use Twig\Parser;
20
+ use Twig\Source;
21
+
22
+ class ExpressionParserTest extends \PHPUnit\Framework\TestCase
23
+ {
24
+ /**
25
+ * @dataProvider getFailingTestsForAssignment
26
+ */
27
+ public function testCanOnlyAssignToNames($template)
28
+ {
29
+ $this->expectException('\Twig\Error\SyntaxError');
30
+
31
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
32
+ $parser = new Parser($env);
33
+
34
+ $parser->parse($env->tokenize(new Source($template, 'index')));
35
+ }
36
+
37
+ public function getFailingTestsForAssignment()
38
+ {
39
+ return [
40
+ ['{% set false = "foo" %}'],
41
+ ['{% set FALSE = "foo" %}'],
42
+ ['{% set true = "foo" %}'],
43
+ ['{% set TRUE = "foo" %}'],
44
+ ['{% set none = "foo" %}'],
45
+ ['{% set NONE = "foo" %}'],
46
+ ['{% set null = "foo" %}'],
47
+ ['{% set NULL = "foo" %}'],
48
+ ['{% set 3 = "foo" %}'],
49
+ ['{% set 1 + 2 = "foo" %}'],
50
+ ['{% set "bar" = "foo" %}'],
51
+ ['{% set %}{% endset %}'],
52
+ ];
53
+ }
54
+
55
+ /**
56
+ * @dataProvider getTestsForArray
57
+ */
58
+ public function testArrayExpression($template, $expected)
59
+ {
60
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
61
+ $stream = $env->tokenize($source = new Source($template, ''));
62
+ $parser = new Parser($env);
63
+ $expected->setSourceContext($source);
64
+
65
+ $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr'));
66
+ }
67
+
68
+ /**
69
+ * @dataProvider getFailingTestsForArray
70
+ */
71
+ public function testArraySyntaxError($template)
72
+ {
73
+ $this->expectException('\Twig\Error\SyntaxError');
74
+
75
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
76
+ $parser = new Parser($env);
77
+
78
+ $parser->parse($env->tokenize(new Source($template, 'index')));
79
+ }
80
+
81
+ public function getFailingTestsForArray()
82
+ {
83
+ return [
84
+ ['{{ [1, "a": "b"] }}'],
85
+ ['{{ {"a": "b", 2} }}'],
86
+ ];
87
+ }
88
+
89
+ public function getTestsForArray()
90
+ {
91
+ return [
92
+ // simple array
93
+ ['{{ [1, 2] }}', new ArrayExpression([
94
+ new ConstantExpression(0, 1),
95
+ new ConstantExpression(1, 1),
96
+
97
+ new ConstantExpression(1, 1),
98
+ new ConstantExpression(2, 1),
99
+ ], 1),
100
+ ],
101
+
102
+ // array with trailing ,
103
+ ['{{ [1, 2, ] }}', new ArrayExpression([
104
+ new ConstantExpression(0, 1),
105
+ new ConstantExpression(1, 1),
106
+
107
+ new ConstantExpression(1, 1),
108
+ new ConstantExpression(2, 1),
109
+ ], 1),
110
+ ],
111
+
112
+ // simple hash
113
+ ['{{ {"a": "b", "b": "c"} }}', new ArrayExpression([
114
+ new ConstantExpression('a', 1),
115
+ new ConstantExpression('b', 1),
116
+
117
+ new ConstantExpression('b', 1),
118
+ new ConstantExpression('c', 1),
119
+ ], 1),
120
+ ],
121
+
122
+ // hash with trailing ,
123
+ ['{{ {"a": "b", "b": "c", } }}', new ArrayExpression([
124
+ new ConstantExpression('a', 1),
125
+ new ConstantExpression('b', 1),
126
+
127
+ new ConstantExpression('b', 1),
128
+ new ConstantExpression('c', 1),
129
+ ], 1),
130
+ ],
131
+
132
+ // hash in an array
133
+ ['{{ [1, {"a": "b", "b": "c"}] }}', new ArrayExpression([
134
+ new ConstantExpression(0, 1),
135
+ new ConstantExpression(1, 1),
136
+
137
+ new ConstantExpression(1, 1),
138
+ new ArrayExpression([
139
+ new ConstantExpression('a', 1),
140
+ new ConstantExpression('b', 1),
141
+
142
+ new ConstantExpression('b', 1),
143
+ new ConstantExpression('c', 1),
144
+ ], 1),
145
+ ], 1),
146
+ ],
147
+
148
+ // array in a hash
149
+ ['{{ {"a": [1, 2], "b": "c"} }}', new ArrayExpression([
150
+ new ConstantExpression('a', 1),
151
+ new ArrayExpression([
152
+ new ConstantExpression(0, 1),
153
+ new ConstantExpression(1, 1),
154
+
155
+ new ConstantExpression(1, 1),
156
+ new ConstantExpression(2, 1),
157
+ ], 1),
158
+ new ConstantExpression('b', 1),
159
+ new ConstantExpression('c', 1),
160
+ ], 1),
161
+ ],
162
+ ];
163
+ }
164
+
165
+ public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings()
166
+ {
167
+ $this->expectException('\Twig\Error\SyntaxError');
168
+
169
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]);
170
+ $stream = $env->tokenize(new Source('{{ "a" "b" }}', 'index'));
171
+ $parser = new Parser($env);
172
+
173
+ $parser->parse($stream);
174
+ }
175
+
176
+ /**
177
+ * @dataProvider getTestsForString
178
+ */
179
+ public function testStringExpression($template, $expected)
180
+ {
181
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]);
182
+ $stream = $env->tokenize($source = new Source($template, ''));
183
+ $parser = new Parser($env);
184
+ $expected->setSourceContext($source);
185
+
186
+ $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr'));
187
+ }
188
+
189
+ public function getTestsForString()
190
+ {
191
+ return [
192
+ [
193
+ '{{ "foo" }}', new ConstantExpression('foo', 1),
194
+ ],
195
+ [
196
+ '{{ "foo #{bar}" }}', new ConcatBinary(
197
+ new ConstantExpression('foo ', 1),
198
+ new NameExpression('bar', 1),
199
+ 1
200
+ ),
201
+ ],
202
+ [
203
+ '{{ "foo #{bar} baz" }}', new ConcatBinary(
204
+ new ConcatBinary(
205
+ new ConstantExpression('foo ', 1),
206
+ new NameExpression('bar', 1),
207
+ 1
208
+ ),
209
+ new ConstantExpression(' baz', 1),
210
+ 1
211
+ ),
212
+ ],
213
+
214
+ [
215
+ '{{ "foo #{"foo #{bar} baz"} baz" }}', new ConcatBinary(
216
+ new ConcatBinary(
217
+ new ConstantExpression('foo ', 1),
218
+ new ConcatBinary(
219
+ new ConcatBinary(
220
+ new ConstantExpression('foo ', 1),
221
+ new NameExpression('bar', 1),
222
+ 1
223
+ ),
224
+ new ConstantExpression(' baz', 1),
225
+ 1
226
+ ),
227
+ 1
228
+ ),
229
+ new ConstantExpression(' baz', 1),
230
+ 1
231
+ ),
232
+ ],
233
+ ];
234
+ }
235
+
236
+ public function testAttributeCallDoesNotSupportNamedArguments()
237
+ {
238
+ $this->expectException('\Twig\Error\SyntaxError');
239
+
240
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
241
+ $parser = new Parser($env);
242
+
243
+ $parser->parse($env->tokenize(new Source('{{ foo.bar(name="Foo") }}', 'index')));
244
+ }
245
+
246
+ public function testMacroCallDoesNotSupportNamedArguments()
247
+ {
248
+ $this->expectException('\Twig\Error\SyntaxError');
249
+
250
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
251
+ $parser = new Parser($env);
252
+
253
+ $parser->parse($env->tokenize(new Source('{% from _self import foo %}{% macro foo() %}{% endmacro %}{{ foo(name="Foo") }}', 'index')));
254
+ }
255
+
256
+ public function testMacroDefinitionDoesNotSupportNonNameVariableName()
257
+ {
258
+ $this->expectException('\Twig\Error\SyntaxError');
259
+ $this->expectExceptionMessage('An argument must be a name. Unexpected token "string" of value "a" ("name" expected) in "index" at line 1.');
260
+
261
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
262
+ $parser = new Parser($env);
263
+
264
+ $parser->parse($env->tokenize(new Source('{% macro foo("a") %}{% endmacro %}', 'index')));
265
+ }
266
+
267
+ /**
268
+ * @dataProvider getMacroDefinitionDoesNotSupportNonConstantDefaultValues
269
+ */
270
+ public function testMacroDefinitionDoesNotSupportNonConstantDefaultValues($template)
271
+ {
272
+ $this->expectException('\Twig\Error\SyntaxError');
273
+ $this->expectExceptionMessage('A default value for an argument must be a constant (a boolean, a string, a number, or an array) in "index" at line 1');
274
+
275
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
276
+ $parser = new Parser($env);
277
+
278
+ $parser->parse($env->tokenize(new Source($template, 'index')));
279
+ }
280
+
281
+ public function getMacroDefinitionDoesNotSupportNonConstantDefaultValues()
282
+ {
283
+ return [
284
+ ['{% macro foo(name = "a #{foo} a") %}{% endmacro %}'],
285
+ ['{% macro foo(name = [["b", "a #{foo} a"]]) %}{% endmacro %}'],
286
+ ];
287
+ }
288
+
289
+ /**
290
+ * @dataProvider getMacroDefinitionSupportsConstantDefaultValues
291
+ */
292
+ public function testMacroDefinitionSupportsConstantDefaultValues($template)
293
+ {
294
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
295
+ $parser = new Parser($env);
296
+
297
+ $parser->parse($env->tokenize(new Source($template, 'index')));
298
+
299
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
300
+ // can be executed without throwing any exceptions
301
+ $this->addToAssertionCount(1);
302
+ }
303
+
304
+ public function getMacroDefinitionSupportsConstantDefaultValues()
305
+ {
306
+ return [
307
+ ['{% macro foo(name = "aa") %}{% endmacro %}'],
308
+ ['{% macro foo(name = 12) %}{% endmacro %}'],
309
+ ['{% macro foo(name = true) %}{% endmacro %}'],
310
+ ['{% macro foo(name = ["a"]) %}{% endmacro %}'],
311
+ ['{% macro foo(name = [["a"]]) %}{% endmacro %}'],
312
+ ['{% macro foo(name = {a: "a"}) %}{% endmacro %}'],
313
+ ['{% macro foo(name = {a: {b: "a"}}) %}{% endmacro %}'],
314
+ ];
315
+ }
316
+
317
+ public function testUnknownFunction()
318
+ {
319
+ $this->expectException('\Twig\Error\SyntaxError');
320
+ $this->expectExceptionMessage('Unknown "cycl" function. Did you mean "cycle" in "index" at line 1?');
321
+
322
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
323
+ $parser = new Parser($env);
324
+
325
+ $parser->parse($env->tokenize(new Source('{{ cycl() }}', 'index')));
326
+ }
327
+
328
+ public function testUnknownFunctionWithoutSuggestions()
329
+ {
330
+ $this->expectException('\Twig\Error\SyntaxError');
331
+ $this->expectExceptionMessage('Unknown "foobar" function in "index" at line 1.');
332
+
333
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
334
+ $parser = new Parser($env);
335
+
336
+ $parser->parse($env->tokenize(new Source('{{ foobar() }}', 'index')));
337
+ }
338
+
339
+ public function testUnknownFilter()
340
+ {
341
+ $this->expectException('\Twig\Error\SyntaxError');
342
+ $this->expectExceptionMessage('Unknown "lowe" filter. Did you mean "lower" in "index" at line 1?');
343
+
344
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
345
+ $parser = new Parser($env);
346
+
347
+ $parser->parse($env->tokenize(new Source('{{ 1|lowe }}', 'index')));
348
+ }
349
+
350
+ public function testUnknownFilterWithoutSuggestions()
351
+ {
352
+ $this->expectException('\Twig\Error\SyntaxError');
353
+ $this->expectExceptionMessage('Unknown "foobar" filter in "index" at line 1.');
354
+
355
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
356
+ $parser = new Parser($env);
357
+
358
+ $parser->parse($env->tokenize(new Source('{{ 1|foobar }}', 'index')));
359
+ }
360
+
361
+ public function testUnknownTest()
362
+ {
363
+ $this->expectException('\Twig\Error\SyntaxError');
364
+ $this->expectExceptionMessage('Unknown "nul" test. Did you mean "null" in "index" at line 1');
365
+
366
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
367
+ $parser = new Parser($env);
368
+ $stream = $env->tokenize(new Source('{{ 1 is nul }}', 'index'));
369
+ $parser->parse($stream);
370
+ }
371
+
372
+ public function testUnknownTestWithoutSuggestions()
373
+ {
374
+ $this->expectException('\Twig\Error\SyntaxError');
375
+ $this->expectExceptionMessage('Unknown "foobar" test in "index" at line 1.');
376
+
377
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
378
+ $parser = new Parser($env);
379
+
380
+ $parser->parse($env->tokenize(new Source('{{ 1 is foobar }}', 'index')));
381
+ }
382
+ }
vendor/twig/twig/tests/Extension/CoreTest.php ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Extension;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+
16
+ class CoreTest extends \PHPUnit\Framework\TestCase
17
+ {
18
+ /**
19
+ * @dataProvider getRandomFunctionTestData
20
+ */
21
+ public function testRandomFunction(array $expectedInArray, $value1, $value2 = null)
22
+ {
23
+ $env = new Environment($this->createMock('Twig_LoaderInterface'));
24
+ for ($i = 0; $i < 100; ++$i) {
25
+ $this->assertTrue(\in_array(twig_random($env, $value1, $value2), $expectedInArray, true)); // assertContains() would not consider the type
26
+ }
27
+ }
28
+
29
+ public function getRandomFunctionTestData()
30
+ {
31
+ return [
32
+ 'array' => [
33
+ ['apple', 'orange', 'citrus'],
34
+ ['apple', 'orange', 'citrus'],
35
+ ],
36
+ 'Traversable' => [
37
+ ['apple', 'orange', 'citrus'],
38
+ new \ArrayObject(['apple', 'orange', 'citrus']),
39
+ ],
40
+ 'unicode string' => [
41
+ ['Ä', '€', 'é'],
42
+ 'Ä€é',
43
+ ],
44
+ 'numeric but string' => [
45
+ ['1', '2', '3'],
46
+ '123',
47
+ ],
48
+ 'integer' => [
49
+ range(0, 5, 1),
50
+ 5,
51
+ ],
52
+ 'float' => [
53
+ range(0, 5, 1),
54
+ 5.9,
55
+ ],
56
+ 'negative' => [
57
+ [0, -1, -2],
58
+ -2,
59
+ ],
60
+ 'min max int' => [
61
+ range(50, 100),
62
+ 50,
63
+ 100,
64
+ ],
65
+ 'min max float' => [
66
+ range(-10, 10),
67
+ -9.5,
68
+ 9.5,
69
+ ],
70
+ 'min null' => [
71
+ range(0, 100),
72
+ null,
73
+ 100,
74
+ ],
75
+ ];
76
+ }
77
+
78
+ public function testRandomFunctionWithoutParameter()
79
+ {
80
+ $max = mt_getrandmax();
81
+
82
+ for ($i = 0; $i < 100; ++$i) {
83
+ $val = twig_random(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
84
+ $this->assertTrue(\is_int($val) && $val >= 0 && $val <= $max);
85
+ }
86
+ }
87
+
88
+ public function testRandomFunctionReturnsAsIs()
89
+ {
90
+ $this->assertSame('', twig_random(new Environment($this->createMock('\Twig\Loader\LoaderInterface')), ''));
91
+ $this->assertSame('', twig_random(new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['charset' => null]), ''));
92
+
93
+ $instance = new \stdClass();
94
+ $this->assertSame($instance, twig_random(new Environment($this->createMock('\Twig\Loader\LoaderInterface')), $instance));
95
+ }
96
+
97
+ public function testRandomFunctionOfEmptyArrayThrowsException()
98
+ {
99
+ $this->expectException('\Twig\Error\RuntimeError');
100
+
101
+ twig_random(new Environment($this->createMock('\Twig\Loader\LoaderInterface')), []);
102
+ }
103
+
104
+ public function testRandomFunctionOnNonUTF8String()
105
+ {
106
+ if (!\function_exists('iconv') && !\function_exists('mb_convert_encoding')) {
107
+ $this->markTestSkipped('needs iconv or mbstring');
108
+ }
109
+
110
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
111
+ $twig->setCharset('ISO-8859-1');
112
+
113
+ $text = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8');
114
+ for ($i = 0; $i < 30; ++$i) {
115
+ $rand = twig_random($twig, $text);
116
+ $this->assertTrue(\in_array(twig_convert_encoding($rand, 'UTF-8', 'ISO-8859-1'), ['Ä', 'é'], true));
117
+ }
118
+ }
119
+
120
+ public function testReverseFilterOnNonUTF8String()
121
+ {
122
+ if (!\function_exists('iconv') && !\function_exists('mb_convert_encoding')) {
123
+ $this->markTestSkipped('needs iconv or mbstring');
124
+ }
125
+
126
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
127
+ $twig->setCharset('ISO-8859-1');
128
+
129
+ $input = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8');
130
+ $output = twig_convert_encoding(twig_reverse_filter($twig, $input), 'UTF-8', 'ISO-8859-1');
131
+
132
+ $this->assertEquals($output, 'éÄ');
133
+ }
134
+
135
+ /**
136
+ * @dataProvider provideCustomEscaperCases
137
+ */
138
+ public function testCustomEscaper($expected, $string, $strategy)
139
+ {
140
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
141
+ $twig->getExtension('\Twig\Extension\CoreExtension')->setEscaper('foo', '\Twig\Tests\Extension\foo_escaper_for_test');
142
+
143
+ $this->assertSame($expected, twig_escape_filter($twig, $string, $strategy));
144
+ }
145
+
146
+ public function provideCustomEscaperCases()
147
+ {
148
+ return [
149
+ ['fooUTF-8', 'foo', 'foo'],
150
+ ['UTF-8', null, 'foo'],
151
+ ['42UTF-8', 42, 'foo'],
152
+ ];
153
+ }
154
+
155
+ public function testUnknownCustomEscaper()
156
+ {
157
+ $this->expectException('\Twig\Error\RuntimeError');
158
+
159
+ twig_escape_filter(new Environment($this->createMock('\Twig\Loader\LoaderInterface')), 'foo', 'bar');
160
+ }
161
+
162
+ /**
163
+ * @dataProvider provideTwigFirstCases
164
+ */
165
+ public function testTwigFirst($expected, $input)
166
+ {
167
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
168
+ $this->assertSame($expected, twig_first($twig, $input));
169
+ }
170
+
171
+ public function provideTwigFirstCases()
172
+ {
173
+ $i = [1 => 'a', 2 => 'b', 3 => 'c'];
174
+
175
+ return [
176
+ ['a', 'abc'],
177
+ [1, [1, 2, 3]],
178
+ ['', null],
179
+ ['', ''],
180
+ ['a', new CoreTestIterator($i, array_keys($i), true, 3)],
181
+ ];
182
+ }
183
+
184
+ /**
185
+ * @dataProvider provideTwigLastCases
186
+ */
187
+ public function testTwigLast($expected, $input)
188
+ {
189
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
190
+ $this->assertSame($expected, twig_last($twig, $input));
191
+ }
192
+
193
+ public function provideTwigLastCases()
194
+ {
195
+ $i = [1 => 'a', 2 => 'b', 3 => 'c'];
196
+
197
+ return [
198
+ ['c', 'abc'],
199
+ [3, [1, 2, 3]],
200
+ ['', null],
201
+ ['', ''],
202
+ ['c', new CoreTestIterator($i, array_keys($i), true)],
203
+ ];
204
+ }
205
+
206
+ /**
207
+ * @dataProvider provideArrayKeyCases
208
+ */
209
+ public function testArrayKeysFilter(array $expected, $input)
210
+ {
211
+ $this->assertSame($expected, twig_get_array_keys_filter($input));
212
+ }
213
+
214
+ public function provideArrayKeyCases()
215
+ {
216
+ $array = ['a' => 'a1', 'b' => 'b1', 'c' => 'c1'];
217
+ $keys = array_keys($array);
218
+
219
+ return [
220
+ [$keys, $array],
221
+ [$keys, new CoreTestIterator($array, $keys)],
222
+ [$keys, new CoreTestIteratorAggregate($array, $keys)],
223
+ [$keys, new CoreTestIteratorAggregateAggregate($array, $keys)],
224
+ [[], null],
225
+ [['a'], new \SimpleXMLElement('<xml><a></a></xml>')],
226
+ ];
227
+ }
228
+
229
+ /**
230
+ * @dataProvider provideInFilterCases
231
+ */
232
+ public function testInFilter($expected, $value, $compare)
233
+ {
234
+ $this->assertSame($expected, twig_in_filter($value, $compare));
235
+ }
236
+
237
+ public function provideInFilterCases()
238
+ {
239
+ $array = [1, 2, 'a' => 3, 5, 6, 7];
240
+ $keys = array_keys($array);
241
+
242
+ return [
243
+ [true, 1, $array],
244
+ [true, '3', $array],
245
+ [true, '3', 'abc3def'],
246
+ [true, 1, new CoreTestIterator($array, $keys, true, 1)],
247
+ [true, '3', new CoreTestIterator($array, $keys, true, 3)],
248
+ [true, '3', new CoreTestIteratorAggregateAggregate($array, $keys, true, 3)],
249
+ [false, 4, $array],
250
+ [false, 4, new CoreTestIterator($array, $keys, true)],
251
+ [false, 4, new CoreTestIteratorAggregateAggregate($array, $keys, true)],
252
+ [false, 1, 1],
253
+ [true, 'b', new \SimpleXMLElement('<xml><a>b</a></xml>')],
254
+ ];
255
+ }
256
+
257
+ /**
258
+ * @dataProvider provideSliceFilterCases
259
+ */
260
+ public function testSliceFilter($expected, $input, $start, $length = null, $preserveKeys = false)
261
+ {
262
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
263
+ $this->assertSame($expected, twig_slice($twig, $input, $start, $length, $preserveKeys));
264
+ }
265
+
266
+ public function provideSliceFilterCases()
267
+ {
268
+ $i = ['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4];
269
+ $keys = array_keys($i);
270
+
271
+ return [
272
+ [['a' => 1], $i, 0, 1, true],
273
+ [['a' => 1], $i, 0, 1, false],
274
+ [['b' => 2, 'c' => 3], $i, 1, 2],
275
+ [[1], [1, 2, 3, 4], 0, 1],
276
+ [[2, 3], [1, 2, 3, 4], 1, 2],
277
+ [[2, 3], new CoreTestIterator($i, $keys, true), 1, 2],
278
+ [['c' => 3, 'd' => 4], new CoreTestIteratorAggregate($i, $keys, true), 2, null, true],
279
+ [$i, new CoreTestIterator($i, $keys, true), 0, \count($keys) + 10, true],
280
+ [[], new CoreTestIterator($i, $keys, true), \count($keys) + 10],
281
+ ['de', 'abcdef', 3, 2],
282
+ [[], new \SimpleXMLElement('<items><item>1</item><item>2</item></items>'), 3],
283
+ [[], new \ArrayIterator([1, 2]), 3],
284
+ ];
285
+ }
286
+ }
287
+
288
+ function foo_escaper_for_test(Environment $env, $string, $charset)
289
+ {
290
+ return $string.$charset;
291
+ }
292
+
293
+ final class CoreTestIteratorAggregate implements \IteratorAggregate
294
+ {
295
+ private $iterator;
296
+
297
+ public function __construct(array $array, array $keys, $allowAccess = false, $maxPosition = false)
298
+ {
299
+ $this->iterator = new CoreTestIterator($array, $keys, $allowAccess, $maxPosition);
300
+ }
301
+
302
+ public function getIterator()
303
+ {
304
+ return $this->iterator;
305
+ }
306
+ }
307
+
308
+ final class CoreTestIteratorAggregateAggregate implements \IteratorAggregate
309
+ {
310
+ private $iterator;
311
+
312
+ public function __construct(array $array, array $keys, $allowValueAccess = false, $maxPosition = false)
313
+ {
314
+ $this->iterator = new CoreTestIteratorAggregate($array, $keys, $allowValueAccess, $maxPosition);
315
+ }
316
+
317
+ public function getIterator()
318
+ {
319
+ return $this->iterator;
320
+ }
321
+ }
322
+
323
+ final class CoreTestIterator implements \Iterator
324
+ {
325
+ private $position;
326
+ private $array;
327
+ private $arrayKeys;
328
+ private $allowValueAccess;
329
+ private $maxPosition;
330
+
331
+ public function __construct(array $values, array $keys, $allowValueAccess = false, $maxPosition = false)
332
+ {
333
+ $this->array = $values;
334
+ $this->arrayKeys = $keys;
335
+ $this->position = 0;
336
+ $this->allowValueAccess = $allowValueAccess;
337
+ $this->maxPosition = false === $maxPosition ? \count($values) + 1 : $maxPosition;
338
+ }
339
+
340
+ public function rewind()
341
+ {
342
+ $this->position = 0;
343
+ }
344
+
345
+ public function current()
346
+ {
347
+ if ($this->allowValueAccess) {
348
+ return $this->array[$this->key()];
349
+ }
350
+
351
+ throw new \LogicException('Code should only use the keys, not the values provided by iterator.');
352
+ }
353
+
354
+ public function key()
355
+ {
356
+ return $this->arrayKeys[$this->position];
357
+ }
358
+
359
+ public function next()
360
+ {
361
+ ++$this->position;
362
+ if ($this->position === $this->maxPosition) {
363
+ throw new \LogicException(sprintf('Code should not iterate beyond %d.', $this->maxPosition));
364
+ }
365
+ }
366
+
367
+ public function valid()
368
+ {
369
+ return isset($this->arrayKeys[$this->position]);
370
+ }
371
+ }
vendor/twig/twig/tests/Extension/SandboxTest.php ADDED
@@ -0,0 +1,365 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Extension;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Extension\SandboxExtension;
16
+ use Twig\Loader\ArrayLoader;
17
+ use Twig\Sandbox\SecurityError;
18
+ use Twig\Sandbox\SecurityPolicy;
19
+
20
+ class SandboxTest extends \PHPUnit\Framework\TestCase
21
+ {
22
+ protected static $params;
23
+ protected static $templates;
24
+
25
+ protected function setUp()
26
+ {
27
+ self::$params = [
28
+ 'name' => 'Fabien',
29
+ 'obj' => new FooObject(),
30
+ 'arr' => ['obj' => new FooObject()],
31
+ ];
32
+
33
+ self::$templates = [
34
+ '1_basic1' => '{{ obj.foo }}',
35
+ '1_basic2' => '{{ name|upper }}',
36
+ '1_basic3' => '{% if name %}foo{% endif %}',
37
+ '1_basic4' => '{{ obj.bar }}',
38
+ '1_basic5' => '{{ obj }}',
39
+ '1_basic7' => '{{ cycle(["foo","bar"], 1) }}',
40
+ '1_basic8' => '{{ obj.getfoobar }}{{ obj.getFooBar }}',
41
+ '1_basic9' => '{{ obj.foobar }}{{ obj.fooBar }}',
42
+ '1_basic' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}',
43
+ '1_layout' => '{% block content %}{% endblock %}',
44
+ '1_child' => "{% extends \"1_layout\" %}\n{% block content %}\n{{ \"a\"|json_encode }}\n{% endblock %}",
45
+ '1_include' => '{{ include("1_basic1", sandboxed=true) }}',
46
+ '1_range_operator' => '{{ (1..2)[0] }}',
47
+ ];
48
+ }
49
+
50
+ public function testSandboxWithInheritance()
51
+ {
52
+ $this->expectException('\Twig\Sandbox\SecurityError');
53
+ $this->expectExceptionMessage('Filter "json_encode" is not allowed in "1_child" at line 3.');
54
+
55
+ $twig = $this->getEnvironment(true, [], self::$templates, ['block']);
56
+ $twig->load('1_child')->render([]);
57
+ }
58
+
59
+ public function testSandboxGloballySet()
60
+ {
61
+ $twig = $this->getEnvironment(false, [], self::$templates);
62
+ $this->assertEquals('FOO', $twig->load('1_basic')->render(self::$params), 'Sandbox does nothing if it is disabled globally');
63
+ }
64
+
65
+ public function testSandboxUnallowedMethodAccessor()
66
+ {
67
+ $twig = $this->getEnvironment(true, [], self::$templates);
68
+ try {
69
+ $twig->load('1_basic1')->render(self::$params);
70
+ $this->fail('Sandbox throws a SecurityError exception if an unallowed method is called');
71
+ } catch (SecurityError $e) {
72
+ $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError');
73
+ $this->assertEquals('Twig\Tests\Extension\FooObject', $e->getClassName(), 'Exception should be raised on the "Twig\Tests\Extension\FooObject" class');
74
+ $this->assertEquals('foo', $e->getMethodName(), 'Exception should be raised on the "foo" method');
75
+ }
76
+ }
77
+
78
+ public function testSandboxUnallowedFilter()
79
+ {
80
+ $twig = $this->getEnvironment(true, [], self::$templates);
81
+ try {
82
+ $twig->load('1_basic2')->render(self::$params);
83
+ $this->fail('Sandbox throws a SecurityError exception if an unallowed filter is called');
84
+ } catch (SecurityError $e) {
85
+ $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedFilterError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFilterError');
86
+ $this->assertEquals('upper', $e->getFilterName(), 'Exception should be raised on the "upper" filter');
87
+ }
88
+ }
89
+
90
+ public function testSandboxUnallowedTag()
91
+ {
92
+ $twig = $this->getEnvironment(true, [], self::$templates);
93
+ try {
94
+ $twig->load('1_basic3')->render(self::$params);
95
+ $this->fail('Sandbox throws a SecurityError exception if an unallowed tag is used in the template');
96
+ } catch (SecurityError $e) {
97
+ $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedTagError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedTagError');
98
+ $this->assertEquals('if', $e->getTagName(), 'Exception should be raised on the "if" tag');
99
+ }
100
+ }
101
+
102
+ public function testSandboxUnallowedProperty()
103
+ {
104
+ $twig = $this->getEnvironment(true, [], self::$templates);
105
+ try {
106
+ $twig->load('1_basic4')->render(self::$params);
107
+ $this->fail('Sandbox throws a SecurityError exception if an unallowed property is called in the template');
108
+ } catch (SecurityError $e) {
109
+ $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedPropertyError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedPropertyError');
110
+ $this->assertEquals('Twig\Tests\Extension\FooObject', $e->getClassName(), 'Exception should be raised on the "Twig\Tests\Extension\FooObject" class');
111
+ $this->assertEquals('bar', $e->getPropertyName(), 'Exception should be raised on the "bar" property');
112
+ }
113
+ }
114
+
115
+ /**
116
+ * @dataProvider getSandboxUnallowedToStringTests
117
+ */
118
+ public function testSandboxUnallowedToString($template)
119
+ {
120
+ $twig = $this->getEnvironment(true, [], ['index' => $template], [], ['upper'], ['Twig\Tests\Extension\FooObject' => 'getAnotherFooObject'], [], ['random']);
121
+ try {
122
+ $twig->load('index')->render(self::$params);
123
+ $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template');
124
+ } catch (SecurityError $e) {
125
+ $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError');
126
+ $this->assertEquals('Twig\Tests\Extension\FooObject', $e->getClassName(), 'Exception should be raised on the "Twig\Tests\Extension\FooObject" class');
127
+ $this->assertEquals('__tostring', $e->getMethodName(), 'Exception should be raised on the "__toString" method');
128
+ }
129
+ }
130
+
131
+ public function getSandboxUnallowedToStringTests()
132
+ {
133
+ return [
134
+ 'simple' => ['{{ obj }}'],
135
+ 'object_from_array' => ['{{ arr.obj }}'],
136
+ 'object_chain' => ['{{ obj.anotherFooObject }}'],
137
+ 'filter' => ['{{ obj|upper }}'],
138
+ 'filter_from_array' => ['{{ arr.obj|upper }}'],
139
+ 'function' => ['{{ random(obj) }}'],
140
+ 'function_from_array' => ['{{ random(arr.obj) }}'],
141
+ 'function_and_filter' => ['{{ random(obj|upper) }}'],
142
+ 'function_and_filter_from_array' => ['{{ random(arr.obj|upper) }}'],
143
+ 'object_chain_and_filter' => ['{{ obj.anotherFooObject|upper }}'],
144
+ 'object_chain_and_function' => ['{{ random(obj.anotherFooObject) }}'],
145
+ 'concat' => ['{{ obj ~ "" }}'],
146
+ 'concat_again' => ['{{ "" ~ obj }}'],
147
+ ];
148
+ }
149
+
150
+ /**
151
+ * @dataProvider getSandboxAllowedToStringTests
152
+ */
153
+ public function testSandboxAllowedToString($template, $output)
154
+ {
155
+ $twig = $this->getEnvironment(true, [], ['index' => $template], ['set'], [], ['Twig\Tests\Extension\FooObject' => ['foo', 'getAnotherFooObject']]);
156
+ $this->assertEquals($output, $twig->load('index')->render(self::$params));
157
+ }
158
+
159
+ public function getSandboxAllowedToStringTests()
160
+ {
161
+ return [
162
+ 'constant_test' => ['{{ obj is constant("PHP_INT_MAX") }}', ''],
163
+ 'set_object' => ['{% set a = obj.anotherFooObject %}{{ a.foo }}', 'foo'],
164
+ 'is_defined' => ['{{ obj.anotherFooObject is defined }}', '1'],
165
+ 'is_null' => ['{{ obj is null }}', ''],
166
+ 'is_sameas' => ['{{ obj is same as(obj) }}', '1'],
167
+ 'is_sameas_from_array' => ['{{ arr.obj is same as(arr.obj) }}', '1'],
168
+ 'is_sameas_from_another_method' => ['{{ obj.anotherFooObject is same as(obj.anotherFooObject) }}', ''],
169
+ ];
170
+ }
171
+
172
+ public function testSandboxAllowMethodToString()
173
+ {
174
+ $twig = $this->getEnvironment(true, [], self::$templates, [], [], ['Twig\Tests\Extension\FooObject' => '__toString']);
175
+ FooObject::reset();
176
+ $this->assertEquals('foo', $twig->load('1_basic5')->render(self::$params), 'Sandbox allow some methods');
177
+ $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once');
178
+ }
179
+
180
+ public function testSandboxAllowMethodToStringDisabled()
181
+ {
182
+ $twig = $this->getEnvironment(false, [], self::$templates);
183
+ FooObject::reset();
184
+ $this->assertEquals('foo', $twig->load('1_basic5')->render(self::$params), 'Sandbox allows __toString when sandbox disabled');
185
+ $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once');
186
+ }
187
+
188
+ public function testSandboxUnallowedFunction()
189
+ {
190
+ $twig = $this->getEnvironment(true, [], self::$templates);
191
+ try {
192
+ $twig->load('1_basic7')->render(self::$params);
193
+ $this->fail('Sandbox throws a SecurityError exception if an unallowed function is called in the template');
194
+ } catch (SecurityError $e) {
195
+ $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedFunctionError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFunctionError');
196
+ $this->assertEquals('cycle', $e->getFunctionName(), 'Exception should be raised on the "cycle" function');
197
+ }
198
+ }
199
+
200
+ public function testSandboxUnallowedRangeOperator()
201
+ {
202
+ $twig = $this->getEnvironment(true, [], self::$templates);
203
+ try {
204
+ $twig->load('1_range_operator')->render(self::$params);
205
+ $this->fail('Sandbox throws a SecurityError exception if the unallowed range operator is called');
206
+ } catch (SecurityError $e) {
207
+ $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedFunctionError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFunctionError');
208
+ $this->assertEquals('range', $e->getFunctionName(), 'Exception should be raised on the "range" function');
209
+ }
210
+ }
211
+
212
+ public function testSandboxAllowMethodFoo()
213
+ {
214
+ $twig = $this->getEnvironment(true, [], self::$templates, [], [], ['Twig\Tests\Extension\FooObject' => 'foo']);
215
+ FooObject::reset();
216
+ $this->assertEquals('foo', $twig->load('1_basic1')->render(self::$params), 'Sandbox allow some methods');
217
+ $this->assertEquals(1, FooObject::$called['foo'], 'Sandbox only calls method once');
218
+ }
219
+
220
+ public function testSandboxAllowFilter()
221
+ {
222
+ $twig = $this->getEnvironment(true, [], self::$templates, [], ['upper']);
223
+ $this->assertEquals('FABIEN', $twig->load('1_basic2')->render(self::$params), 'Sandbox allow some filters');
224
+ }
225
+
226
+ public function testSandboxAllowTag()
227
+ {
228
+ $twig = $this->getEnvironment(true, [], self::$templates, ['if']);
229
+ $this->assertEquals('foo', $twig->load('1_basic3')->render(self::$params), 'Sandbox allow some tags');
230
+ }
231
+
232
+ public function testSandboxAllowProperty()
233
+ {
234
+ $twig = $this->getEnvironment(true, [], self::$templates, [], [], [], ['Twig\Tests\Extension\FooObject' => 'bar']);
235
+ $this->assertEquals('bar', $twig->load('1_basic4')->render(self::$params), 'Sandbox allow some properties');
236
+ }
237
+
238
+ public function testSandboxAllowFunction()
239
+ {
240
+ $twig = $this->getEnvironment(true, [], self::$templates, [], [], [], [], ['cycle']);
241
+ $this->assertEquals('bar', $twig->load('1_basic7')->render(self::$params), 'Sandbox allow some functions');
242
+ }
243
+
244
+ public function testSandboxAllowRangeOperator()
245
+ {
246
+ $twig = $this->getEnvironment(true, [], self::$templates, [], [], [], [], ['range']);
247
+ $this->assertEquals('1', $twig->load('1_range_operator')->render(self::$params), 'Sandbox allow the range operator');
248
+ }
249
+
250
+ public function testSandboxAllowFunctionsCaseInsensitive()
251
+ {
252
+ foreach (['getfoobar', 'getFoobar', 'getFooBar'] as $name) {
253
+ $twig = $this->getEnvironment(true, [], self::$templates, [], [], ['Twig\Tests\Extension\FooObject' => $name]);
254
+ FooObject::reset();
255
+ $this->assertEquals('foobarfoobar', $twig->load('1_basic8')->render(self::$params), 'Sandbox allow methods in a case-insensitive way');
256
+ $this->assertEquals(2, FooObject::$called['getFooBar'], 'Sandbox only calls method once');
257
+
258
+ $this->assertEquals('foobarfoobar', $twig->load('1_basic9')->render(self::$params), 'Sandbox allow methods via shortcut names (ie. without get/set)');
259
+ }
260
+ }
261
+
262
+ public function testSandboxLocallySetForAnInclude()
263
+ {
264
+ self::$templates = [
265
+ '2_basic' => '{{ obj.foo }}{% include "2_included" %}{{ obj.foo }}',
266
+ '2_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}',
267
+ ];
268
+
269
+ $twig = $this->getEnvironment(false, [], self::$templates);
270
+ $this->assertEquals('fooFOOfoo', $twig->load('2_basic')->render(self::$params), 'Sandbox does nothing if disabled globally and sandboxed not used for the include');
271
+
272
+ self::$templates = [
273
+ '3_basic' => '{{ obj.foo }}{% sandbox %}{% include "3_included" %}{% endsandbox %}{{ obj.foo }}',
274
+ '3_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}',
275
+ ];
276
+
277
+ $twig = $this->getEnvironment(true, [], self::$templates);
278
+ try {
279
+ $twig->load('3_basic')->render(self::$params);
280
+ $this->fail('Sandbox throws a SecurityError exception when the included file is sandboxed');
281
+ } catch (SecurityError $e) {
282
+ $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedTagError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedTagError');
283
+ $this->assertEquals('sandbox', $e->getTagName());
284
+ }
285
+ }
286
+
287
+ public function testMacrosInASandbox()
288
+ {
289
+ $twig = $this->getEnvironment(true, ['autoescape' => 'html'], ['index' => <<<EOF
290
+ {%- import _self as macros %}
291
+
292
+ {%- macro test(text) %}<p>{{ text }}</p>{% endmacro %}
293
+
294
+ {{- macros.test('username') }}
295
+ EOF
296
+ ], ['macro', 'import'], ['escape']);
297
+
298
+ $this->assertEquals('<p>username</p>', $twig->load('index')->render([]));
299
+ }
300
+
301
+ public function testSandboxDisabledAfterIncludeFunctionError()
302
+ {
303
+ $twig = $this->getEnvironment(false, [], self::$templates);
304
+
305
+ $e = null;
306
+ try {
307
+ $twig->load('1_include')->render(self::$params);
308
+ } catch (\Throwable $e) {
309
+ } catch (\Exception $e) {
310
+ }
311
+ if (null === $e) {
312
+ $this->fail('An exception should be thrown for this test to be valid.');
313
+ }
314
+
315
+ $this->assertFalse($twig->getExtension('\Twig\Extension\SandboxExtension')->isSandboxed(), 'Sandboxed include() function call should not leave Sandbox enabled when an error occurs.');
316
+ }
317
+
318
+ protected function getEnvironment($sandboxed, $options, $templates, $tags = [], $filters = [], $methods = [], $properties = [], $functions = [])
319
+ {
320
+ $loader = new ArrayLoader($templates);
321
+ $twig = new Environment($loader, array_merge(['debug' => true, 'cache' => false, 'autoescape' => false], $options));
322
+ $policy = new SecurityPolicy($tags, $filters, $methods, $properties, $functions);
323
+ $twig->addExtension(new SandboxExtension($policy, $sandboxed));
324
+
325
+ return $twig;
326
+ }
327
+ }
328
+
329
+ class FooObject
330
+ {
331
+ public static $called = ['__toString' => 0, 'foo' => 0, 'getFooBar' => 0];
332
+
333
+ public $bar = 'bar';
334
+
335
+ public static function reset()
336
+ {
337
+ self::$called = ['__toString' => 0, 'foo' => 0, 'getFooBar' => 0];
338
+ }
339
+
340
+ public function __toString()
341
+ {
342
+ ++self::$called['__toString'];
343
+
344
+ return 'foo';
345
+ }
346
+
347
+ public function foo()
348
+ {
349
+ ++self::$called['foo'];
350
+
351
+ return 'foo';
352
+ }
353
+
354
+ public function getFooBar()
355
+ {
356
+ ++self::$called['getFooBar'];
357
+
358
+ return 'foobar';
359
+ }
360
+
361
+ public function getAnotherFooObject()
362
+ {
363
+ return new self();
364
+ }
365
+ }
vendor/twig/twig/tests/FactoryRuntimeLoaderTest.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\RuntimeLoader\FactoryRuntimeLoader;
15
+
16
+ class FactoryRuntimeLoaderTest extends \PHPUnit\Framework\TestCase
17
+ {
18
+ public function testLoad()
19
+ {
20
+ $loader = new FactoryRuntimeLoader(['stdClass' => '\Twig\Tests\getRuntime']);
21
+
22
+ $this->assertInstanceOf('stdClass', $loader->load('stdClass'));
23
+ }
24
+
25
+ public function testLoadReturnsNullForUnmappedRuntime()
26
+ {
27
+ $loader = new FactoryRuntimeLoader();
28
+
29
+ $this->assertNull($loader->load('stdClass'));
30
+ }
31
+ }
32
+
33
+ function getRuntime()
34
+ {
35
+ return new \stdClass();
36
+ }
vendor/twig/twig/tests/FileCachingTest.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Loader\ArrayLoader;
16
+
17
+ class FileCachingTest extends \PHPUnit\Framework\TestCase
18
+ {
19
+ private $env;
20
+ private $tmpDir;
21
+
22
+ protected function setUp()
23
+ {
24
+ $this->tmpDir = sys_get_temp_dir().'/TwigTests';
25
+ if (!file_exists($this->tmpDir)) {
26
+ @mkdir($this->tmpDir, 0777, true);
27
+ }
28
+
29
+ if (!is_writable($this->tmpDir)) {
30
+ $this->markTestSkipped(sprintf('Unable to run the tests as "%s" is not writable.', $this->tmpDir));
31
+ }
32
+
33
+ $this->env = new Environment(new ArrayLoader(['index' => 'index', 'index2' => 'index2']), ['cache' => $this->tmpDir]);
34
+ }
35
+
36
+ protected function tearDown()
37
+ {
38
+ FilesystemHelper::removeDir($this->tmpDir);
39
+ }
40
+
41
+ /**
42
+ * @group legacy
43
+ */
44
+ public function testWritingCacheFiles()
45
+ {
46
+ $name = 'index';
47
+ $this->env->load($name);
48
+ $cacheFileName = $this->env->getCacheFilename($name);
49
+
50
+ $this->assertFileExists($cacheFileName, 'Cache file does not exist.');
51
+ }
52
+
53
+ /**
54
+ * @group legacy
55
+ */
56
+ public function testClearingCacheFiles()
57
+ {
58
+ $name = 'index2';
59
+ $this->env->load($name);
60
+ $cacheFileName = $this->env->getCacheFilename($name);
61
+
62
+ $this->assertFileExists($cacheFileName, 'Cache file does not exist.');
63
+ $this->env->clearCacheFiles();
64
+ $this->assertFileNotExists($cacheFileName, 'Cache file was not cleared.');
65
+ }
66
+ }
vendor/twig/twig/tests/FileExtensionEscapingStrategyTest.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\FileExtensionEscapingStrategy;
15
+
16
+ class FileExtensionEscapingStrategyTest extends \PHPUnit\Framework\TestCase
17
+ {
18
+ /**
19
+ * @dataProvider getGuessData
20
+ */
21
+ public function testGuess($strategy, $filename)
22
+ {
23
+ $this->assertSame($strategy, FileExtensionEscapingStrategy::guess($filename));
24
+ }
25
+
26
+ public function getGuessData()
27
+ {
28
+ return [
29
+ // default
30
+ ['html', 'foo.html'],
31
+ ['html', 'foo.html.twig'],
32
+ ['html', 'foo'],
33
+ ['html', 'foo.bar.twig'],
34
+ ['html', 'foo.txt/foo'],
35
+ ['html', 'foo.txt/foo.js/'],
36
+
37
+ // css
38
+ ['css', 'foo.css'],
39
+ ['css', 'foo.css.twig'],
40
+ ['css', 'foo.twig.css'],
41
+ ['css', 'foo.js.css'],
42
+ ['css', 'foo.js.css.twig'],
43
+
44
+ // js
45
+ ['js', 'foo.js'],
46
+ ['js', 'foo.js.twig'],
47
+ ['js', 'foo.txt/foo.js'],
48
+ ['js', 'foo.txt.twig/foo.js'],
49
+
50
+ // txt
51
+ [false, 'foo.txt'],
52
+ [false, 'foo.txt.twig'],
53
+ ];
54
+ }
55
+ }
vendor/twig/twig/tests/FilesystemHelper.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ class FilesystemHelper
15
+ {
16
+ public static function removeDir($dir)
17
+ {
18
+ $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir, \PHP_VERSION_ID < 50300 ? 0 : \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST);
19
+ foreach ($iterator as $filename => $fileInfo) {
20
+ if ($iterator->isDot()) {
21
+ continue;
22
+ }
23
+
24
+ if ($fileInfo->isDir()) {
25
+ rmdir($filename);
26
+ } else {
27
+ unlink($filename);
28
+ }
29
+ }
30
+ rmdir($dir);
31
+ }
32
+ }
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/autoescape/block.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/autoescape/name.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/errors/base.html RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/errors/index.html RENAMED
File without changes
vendor/twig/twig/tests/Fixtures/errors/leak-output.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Fixtures\errors;
4
+
5
+ require __DIR__.'/../../../vendor/autoload.php';
6
+
7
+ use Twig\Environment;
8
+ use Twig\Extension\AbstractExtension;
9
+ use Twig\Loader\ArrayLoader;
10
+ use Twig\TwigFilter;
11
+
12
+ class BrokenExtension extends AbstractExtension
13
+ {
14
+ public function getFilters()
15
+ {
16
+ return [
17
+ new TwigFilter('broken', [$this, 'broken']),
18
+ ];
19
+ }
20
+
21
+ public function broken()
22
+ {
23
+ die('OOPS');
24
+ }
25
+ }
26
+
27
+ $loader = new ArrayLoader([
28
+ 'index.html.twig' => 'Hello {{ "world"|broken }}',
29
+ ]);
30
+ $twig = new Environment($loader, ['debug' => isset($argv[1])]);
31
+ $twig->addExtension(new BrokenExtension());
32
+
33
+ echo $twig->render('index.html.twig');
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/child_contents_outside_blocks.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/exception_in_extension_extends.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/exception_in_extension_include.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/multiline_array_with_undefined_variable.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/multiline_function_with_undefined_variable.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/multiline_function_with_unknown_argument.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/multiline_tag_with_undefined_variable.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/strict_comparison_operator.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/syntax_error_in_reused_template.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/unclosed_tag.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/undefined_parent.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/undefined_template_in_child_template.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/exceptions/undefined_trait.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/_self.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/array.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/array_call.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/binary.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/bitwise.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/call_argument_defined_twice.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/call_positional_arg_after_named_arg.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/comparison.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/divisibleby.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/dotdot.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/ends_with.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/floats.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/grouping.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/literals.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/magic_call.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/matches.test RENAMED
File without changes
vendor/twig/twig/tests/Fixtures/expressions/method_call.test ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ Twig supports method calls
3
+ --TEMPLATE--
4
+ {{ items.foo.foo }}
5
+ {{ items.foo.getFoo() }}
6
+ {{ items.foo.bar }}
7
+ {{ items.foo['bar'] }}
8
+ {{ items.foo.bar('a', 43) }}
9
+ {{ items.foo.bar(foo) }}
10
+ {{ items.foo.self.foo() }}
11
+ {{ items.foo.is }}
12
+ {{ items.foo.in }}
13
+ {{ items.foo.not }}
14
+ --DATA--
15
+ return ['foo' => 'bar', 'items' => ['foo' => new Twig\Tests\TwigTestFoo(), 'bar' => 'foo']]
16
+ --CONFIG--
17
+ return ['strict_variables' => false]
18
+ --EXPECT--
19
+ foo
20
+ foo
21
+ bar
22
+
23
+ bar_a-43
24
+ bar_bar
25
+ foo
26
+ is
27
+ in
28
+ not
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/negative_numbers.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/not_arrow_fn.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/operators_as_variables.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/postfix.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/power.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/sameas.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/starts_with.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/string_operator_as_var_assignment.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/strings.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/ternary_operator.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/ternary_operator_noelse.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/ternary_operator_nothen.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/two_word_operators_as_variables.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/unary.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/unary_macro_arguments.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/expressions/unary_precedence.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/abs.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_float.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_with_empty_fill.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_with_exact_elements.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_with_fill.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_with_keys.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_with_more_elements.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/batch_with_zero_elements.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/convert_encoding.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date_default_format.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date_default_format_interval.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date_immutable.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date_interval.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date_modify.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/date_namedargs.test RENAMED
File without changes
vendor/twig/twig/tests/Fixtures/filters/default.test ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "default" filter
3
+ --TEMPLATE--
4
+ Variable:
5
+ {{ definedVar |default('default') is same as('default') ? 'ko' : 'ok' }}
6
+ {{ zeroVar |default('default') is same as('default') ? 'ko' : 'ok' }}
7
+ {{ emptyVar |default('default') is same as('default') ? 'ok' : 'ko' }}
8
+ {{ nullVar |default('default') is same as('default') ? 'ok' : 'ko' }}
9
+ {{ undefinedVar |default('default') is same as('default') ? 'ok' : 'ko' }}
10
+ Array access:
11
+ {{ nested.definedVar |default('default') is same as('default') ? 'ko' : 'ok' }}
12
+ {{ nested['definedVar'] |default('default') is same as('default') ? 'ko' : 'ok' }}
13
+ {{ nested.zeroVar |default('default') is same as('default') ? 'ko' : 'ok' }}
14
+ {{ nested.emptyVar |default('default') is same as('default') ? 'ok' : 'ko' }}
15
+ {{ nested.nullVar |default('default') is same as('default') ? 'ok' : 'ko' }}
16
+ {{ nested.undefinedVar |default('default') is same as('default') ? 'ok' : 'ko' }}
17
+ {{ nested['undefinedVar'] |default('default') is same as('default') ? 'ok' : 'ko' }}
18
+ {{ undefinedVar.foo |default('default') is same as('default') ? 'ok' : 'ko' }}
19
+ Plain values:
20
+ {{ 'defined' |default('default') is same as('default') ? 'ko' : 'ok' }}
21
+ {{ 0 |default('default') is same as('default') ? 'ko' : 'ok' }}
22
+ {{ '' |default('default') is same as('default') ? 'ok' : 'ko' }}
23
+ {{ null |default('default') is same as('default') ? 'ok' : 'ko' }}
24
+ Precedence:
25
+ {{ 'o' ~ nullVar |default('k') }}
26
+ {{ 'o' ~ nested.nullVar |default('k') }}
27
+ Object methods:
28
+ {{ object.foo |default('default') is same as('default') ? 'ko' : 'ok' }}
29
+ {{ object.undefinedMethod |default('default') is same as('default') ? 'ok' : 'ko' }}
30
+ {{ object.getFoo() |default('default') is same as('default') ? 'ko' : 'ok' }}
31
+ {{ object.getFoo('a') |default('default') is same as('default') ? 'ko' : 'ok' }}
32
+ {{ object.undefinedMethod() |default('default') is same as('default') ? 'ok' : 'ko' }}
33
+ {{ object.undefinedMethod('a') |default('default') is same as('default') ? 'ok' : 'ko' }}
34
+ Deep nested:
35
+ {{ nested.undefinedVar.foo.bar |default('default') is same as('default') ? 'ok' : 'ko' }}
36
+ {{ nested.definedArray.0 |default('default') is same as('default') ? 'ko' : 'ok' }}
37
+ {{ nested['definedArray'][0] |default('default') is same as('default') ? 'ko' : 'ok' }}
38
+ {{ object.self.foo |default('default') is same as('default') ? 'ko' : 'ok' }}
39
+ {{ object.self.undefinedMethod |default('default') is same as('default') ? 'ok' : 'ko' }}
40
+ {{ object.undefinedMethod.self |default('default') is same as('default') ? 'ok' : 'ko' }}
41
+ --DATA--
42
+ return [
43
+ 'definedVar' => 'defined',
44
+ 'zeroVar' => 0,
45
+ 'emptyVar' => '',
46
+ 'nullVar' => null,
47
+ 'nested' => [
48
+ 'definedVar' => 'defined',
49
+ 'zeroVar' => 0,
50
+ 'emptyVar' => '',
51
+ 'nullVar' => null,
52
+ 'definedArray' => [0],
53
+ ],
54
+ 'object' => new Twig\Tests\TwigTestFoo(),
55
+ ]
56
+ --CONFIG--
57
+ return ['strict_variables' => false]
58
+ --EXPECT--
59
+ Variable:
60
+ ok
61
+ ok
62
+ ok
63
+ ok
64
+ ok
65
+ Array access:
66
+ ok
67
+ ok
68
+ ok
69
+ ok
70
+ ok
71
+ ok
72
+ ok
73
+ ok
74
+ Plain values:
75
+ ok
76
+ ok
77
+ ok
78
+ ok
79
+ Precedence:
80
+ ok
81
+ ok
82
+ Object methods:
83
+ ok
84
+ ok
85
+ ok
86
+ ok
87
+ ok
88
+ ok
89
+ Deep nested:
90
+ ok
91
+ ok
92
+ ok
93
+ ok
94
+ ok
95
+ ok
96
+ --DATA--
97
+ return [
98
+ 'definedVar' => 'defined',
99
+ 'zeroVar' => 0,
100
+ 'emptyVar' => '',
101
+ 'nullVar' => null,
102
+ 'nested' => [
103
+ 'definedVar' => 'defined',
104
+ 'zeroVar' => 0,
105
+ 'emptyVar' => '',
106
+ 'nullVar' => null,
107
+ 'definedArray' => [0],
108
+ ],
109
+ 'object' => new Twig\Tests\TwigTestFoo(),
110
+ ]
111
+ --CONFIG--
112
+ return ['strict_variables' => true]
113
+ --EXPECT--
114
+ Variable:
115
+ ok
116
+ ok
117
+ ok
118
+ ok
119
+ ok
120
+ Array access:
121
+ ok
122
+ ok
123
+ ok
124
+ ok
125
+ ok
126
+ ok
127
+ ok
128
+ ok
129
+ Plain values:
130
+ ok
131
+ ok
132
+ ok
133
+ ok
134
+ Precedence:
135
+ ok
136
+ ok
137
+ Object methods:
138
+ ok
139
+ ok
140
+ ok
141
+ ok
142
+ ok
143
+ ok
144
+ Deep nested:
145
+ ok
146
+ ok
147
+ ok
148
+ ok
149
+ ok
150
+ ok
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/dynamic_filter.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/escape.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/escape_html_attr.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/escape_javascript.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/escape_non_supported_charset.test RENAMED
File without changes
vendor/twig/twig/tests/Fixtures/filters/filter.test ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "filter" filter
3
+ --TEMPLATE--
4
+ {% set offset = 3 %}
5
+
6
+ {% for k, v in [1, 5, 3, 4, 5]|filter((v) => v > offset) -%}
7
+ {{ k }} = {{ v }}
8
+ {% endfor %}
9
+
10
+ {% for k, v in {a: 1, b: 2, c: 5, d: 8}|filter(v => v > offset) -%}
11
+ {{ k }} = {{ v }}
12
+ {% endfor %}
13
+
14
+ {% for k, v in [1, 5, 3, 4, 5]|filter(v => v > offset) -%}
15
+ {{ k }} = {{ v }}
16
+ {% endfor %}
17
+
18
+ {% for k, v in it|filter((v) => v > offset) -%}
19
+ {{ k }} = {{ v }}
20
+ {% endfor %}
21
+
22
+ {% for k, v in ita|filter(v => v > offset) -%}
23
+ {{ k }} = {{ v }}
24
+ {% endfor %}
25
+ --DATA--
26
+ return [
27
+ 'it' => new \ArrayIterator(['a' => 1, 'b' => 2, 'c' => 5, 'd' => 8]),
28
+ 'ita' => new Twig\Tests\IteratorAggregateStub(['a' => 1, 'b' => 2, 'c' => 5, 'd' => 8]),
29
+ ]
30
+ --EXPECT--
31
+ 1 = 5
32
+ 3 = 4
33
+ 4 = 5
34
+
35
+ c = 5
36
+ d = 8
37
+
38
+ 1 = 5
39
+ 3 = 4
40
+ 4 = 5
41
+
42
+ c = 5
43
+ d = 8
44
+
45
+ c = 5
46
+ d = 8
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/filter_php_55.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/filter_php_56.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/first.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/force_escape.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/format.test RENAMED
File without changes
vendor/twig/twig/tests/Fixtures/filters/join.test ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "join" filter
3
+ --TEMPLATE--
4
+ {{ ["foo", "bar"]|join(', ') }}
5
+ {{ foo|join(', ') }}
6
+ {{ bar|join(', ') }}
7
+
8
+ {{ ["foo", "bar"]|join(', ', ' and ') }}
9
+ {{ foo|join(', ', ' and ') }}
10
+ {{ bar|join(', ', ' and ') }}
11
+ {{ ["one", "two", "three"]|join(', ', ' and ') }}
12
+ {{ ["a", "b", "c"]|join('','-') }}
13
+ {{ ["a", "b", "c"]|join('-','-') }}
14
+ {{ ["a", "b", "c"]|join('-','') }}
15
+ {{ ["hello"]|join('|','-') }}
16
+
17
+ {{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join }}
18
+ {{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join(',') }}
19
+ {{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join(',','-') }}
20
+ --DATA--
21
+ return ['foo' => new Twig\Tests\TwigTestFoo(), 'bar' => new \ArrayObject([3, 4])]
22
+ --EXPECT--
23
+ foo, bar
24
+ 1, 2
25
+ 3, 4
26
+
27
+ foo and bar
28
+ 1 and 2
29
+ 3 and 4
30
+ one, two and three
31
+ ab-c
32
+ a-b-c
33
+ a-bc
34
+ hello
35
+
36
+ wxyz
37
+ w,x,y,z
38
+ w,x,y-z
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/json_encode.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/last.test RENAMED
File without changes
vendor/twig/twig/tests/Fixtures/filters/length.test ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "length" filter
3
+ --TEMPLATE--
4
+ {{ array|length }}
5
+ {{ string|length }}
6
+ {{ number|length }}
7
+ {{ to_string_able|length }}
8
+ {{ countable|length }}
9
+ {{ iterator_aggregate|length }}
10
+ {{ null|length }}
11
+ {{ magic|length }}
12
+ {{ non_countable|length }}
13
+ {{ simple_xml_element|length }}
14
+ {{ iterator|length }}
15
+ --DATA--
16
+ return [
17
+ 'array' => [1, 4],
18
+ 'string' => 'foo',
19
+ 'number' => 1000,
20
+ 'to_string_able' => new Twig\Tests\ToStringStub('foobar'),
21
+ 'countable' => new Twig\Tests\CountableStub(42), /* also asserts we do *not* call __toString() */
22
+ 'iterator_aggregate' => new Twig\Tests\IteratorAggregateStub(['a', 'b', 'c']), /* also asserts we do *not* call __toString() */
23
+ 'null' => null,
24
+ 'magic' => new Twig\Tests\MagicCallStub(), /* used to assert we do *not* call __call */
25
+ 'non_countable' => new \StdClass(),
26
+ 'simple_xml_element' => new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><doc><elem/><elem/></doc>'),
27
+ 'iterator' => new Twig\Tests\SimpleIteratorForTesting()
28
+ ]
29
+ --EXPECT--
30
+ 2
31
+ 3
32
+ 4
33
+ 6
34
+ 42
35
+ 3
36
+ 0
37
+ 1
38
+ 1
39
+ 2
40
+ 7
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/length_utf8.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/map.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/merge.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/nl2br.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/number_format.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/number_format_default.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/reduce.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/replace.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/replace_invalid_arg.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/reverse.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/round.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/slice.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/sort.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/spaceless.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/special_chars.test RENAMED
File without changes
vendor/twig/twig/tests/Fixtures/filters/split.test ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "split" filter
3
+ --TEMPLATE--
4
+ {{ "one,two,three,four,five"|split(',')|join('-') }}
5
+ {{ foo|split(',')|join('-') }}
6
+ {{ foo|split(',', 3)|join('-') }}
7
+ {{ baz|split('')|join('-') }}
8
+ {{ baz|split('', 1)|join('-') }}
9
+ {{ baz|split('', 2)|join('-') }}
10
+ {{ foo|split(',', -2)|join('-') }}
11
+ {{ "hello0world"|split('0')|join('-') }}
12
+ --DATA--
13
+ return ['foo' => "one,two,three,four,five", 'baz' => '12345',]
14
+ --EXPECT--
15
+ one-two-three-four-five
16
+ one-two-three-four-five
17
+ one-two-three,four,five
18
+ 1-2-3-4-5
19
+ 1-2-3-4-5
20
+ 12-34-5
21
+ one-two-three
22
+ hello-world
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/split_utf8.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/static_calls.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/trim.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/urlencode.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/filters/urlencode_deprecated.test RENAMED
File without changes
vendor/twig/twig/tests/Fixtures/functions/attribute.test ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "attribute" function
3
+ --TEMPLATE--
4
+ {{ attribute(obj, method) }}
5
+ {{ attribute(array, item) }}
6
+ {{ attribute(obj, "bar", ["a", "b"]) }}
7
+ {{ attribute(obj, "bar", arguments) }}
8
+ {{ attribute(obj, method) is defined ? 'ok' : 'ko' }}
9
+ {{ attribute(obj, nonmethod) is defined ? 'ok' : 'ko' }}
10
+ --DATA--
11
+ return ['obj' => new Twig\Tests\TwigTestFoo(), 'method' => 'foo', 'array' => ['foo' => 'bar'], 'item' => 'foo', 'nonmethod' => 'xxx', 'arguments' => ['a', 'b']]
12
+ --EXPECT--
13
+ foo
14
+ bar
15
+ bar_a-b
16
+ bar_a-b
17
+ ok
18
+ ko
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/block.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/block_with_template.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/block_without_name.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/constant.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/cycle.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/date.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/date_namedargs.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/dump.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/dump_array.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/dynamic_function.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/assignment.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/autoescaping.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/expression.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/ignore_missing.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/ignore_missing_exists.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/include_missing_extends.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/missing.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/missing_nested.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/sandbox.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/sandbox_disabling.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/sandbox_disabling_ignore_missing.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/template_instance.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/templates_as_array.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/with_context.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include/with_variables.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/include_template_from_string.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/magic_call.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/magic_call53.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/max.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/min.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/range.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/recursive_block_with_inheritance.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/source.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/special_chars.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/static_calls.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/template_from_string.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/functions/template_from_string_error.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/default_values.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/nested_calls.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/reserved_variables.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/simple.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/varargs.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/varargs_argument.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/macros/with_filters.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/block_names_unicity.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/combined_debug_info.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/empty_token.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/issue_1143.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/multi_word_tests.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/simple_xml_element.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/regression/strings_like_numbers.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/json_encode.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/multiple.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/nested.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/scope.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/with_for_tag.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/apply/with_if_tag.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/blocks.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/double_escaping.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/functions.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/literal.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/nested.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/objects.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/raw.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/strategy.legacy.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/strategy.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/type.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/with_filters.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/with_filters_arguments.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/with_pre_escape_filters.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/autoescape/with_preserves_safety_filters.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/block/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/block/block_unique_name.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/block/special_chars.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/deprecated/block.legacy.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/deprecated/macro.legacy.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/deprecated/template.legacy.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/complex_dynamic_parent.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/dynamic_parent.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/error_line.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/multiple.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/nested.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/embed/with_extends.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/json_encode.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/multiple.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/nested.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/scope.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/with_for_tag.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/filter/with_if_tag.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/condition.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/context.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/else.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/inner_variables.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/keys.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/keys_and_values.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/loop_context.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/loop_context_local.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/loop_not_defined.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/loop_not_defined_cond.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/nested_else.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/objects.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/objects_countable.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/recursive.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/for/values.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/from.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/if/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/if/expression.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/expression.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/ignore_missing.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/ignore_missing_exists.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/include_missing_extends.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/missing.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/missing_nested.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/only.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/template_instance.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/templates_as_array.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/include/with_variables.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/block_expr.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/block_expr2.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/conditional.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/dynamic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/empty.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/extends_as_array.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/extends_as_array_with_null_name.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/extends_in_block.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/extends_in_macro.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/multiple.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/multiple_dynamic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/nested_blocks.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/nested_blocks_parent_only.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/nested_inheritance.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent_as_template_wrapper.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent_change.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent_isolation.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent_nested.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent_without_extends.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/parent_without_extends_but_traits.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/template_instance.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/inheritance/use.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/endmacro_name.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/external.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_in_block_is_local.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_local_override.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_macro_in_a_macro.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_nested_blocks.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_nested_blocks_with_global_macro.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_syntax_error.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/from_with_reserved_name.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/global.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_and_blocks.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_from_string_template.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_in_block_is_local.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_local_override.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_macro_in_a_macro.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_nested_blocks.legacy.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_nested_blocks_with_global_macro.legacy.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_self_parent.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_syntax_error.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/import_with_reserved_name.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/reserved_name.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/self_import.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/special_chars.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/macro/super_globals.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/raw/basic.legacy.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/raw/whitespace_control.legacy.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/sandbox/array.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/sandbox/not_valid1.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/sandbox/not_valid2.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/sandbox/simple.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/capture-empty.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/capture.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/capture_scope.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/expression.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/inheritance.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/inheritance_overriding.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/set/mutating.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/spaceless/simple.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/special_chars.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/aliases.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/deep.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/deep_empty.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/inheritance.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/inheritance2.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/multiple.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/multiple_aliases.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/parent_block.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/parent_block2.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/parent_block3.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/use/use_with_parent.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/verbatim/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/verbatim/mixed_usage_with_raw.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/verbatim/whitespace_control.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/basic.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/expression.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/globals.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/iterable.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/nested.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/with_no_hash.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tags/with/with_only.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/array.test RENAMED
File without changes
vendor/twig/twig/tests/Fixtures/tests/constant.test ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "const" test
3
+ --TEMPLATE--
4
+ {{ 8 is constant('E_NOTICE') ? 'ok' : 'no' }}
5
+ {{ 'bar' is constant('Twig\\Tests\\TwigTestFoo::BAR_NAME') ? 'ok' : 'no' }}
6
+ {{ value is constant('Twig\\Tests\\TwigTestFoo::BAR_NAME') ? 'ok' : 'no' }}
7
+ {{ 2 is constant('ARRAY_AS_PROPS', object) ? 'ok' : 'no' }}
8
+ --DATA--
9
+ return ['value' => 'bar', 'object' => new \ArrayObject(['hi'])]
10
+ --EXPECT--
11
+ ok
12
+ ok
13
+ ok
14
+ ok
vendor/twig/twig/tests/Fixtures/tests/defined.test ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "defined" test
3
+ --TEMPLATE--
4
+ {{ definedVar is defined ? 'ok' : 'ko' }}
5
+ {{ definedVar is not defined ? 'ko' : 'ok' }}
6
+ {{ undefinedVar is defined ? 'ko' : 'ok' }}
7
+ {{ undefinedVar is not defined ? 'ok' : 'ko' }}
8
+ {{ zeroVar is defined ? 'ok' : 'ko' }}
9
+ {{ nullVar is defined ? 'ok' : 'ko' }}
10
+ {{ nested.definedVar is defined ? 'ok' : 'ko' }}
11
+ {{ nested['definedVar'] is defined ? 'ok' : 'ko' }}
12
+ {{ nested.definedVar is not defined ? 'ko' : 'ok' }}
13
+ {{ nested.undefinedVar is defined ? 'ko' : 'ok' }}
14
+ {{ nested['undefinedVar'] is defined ? 'ko' : 'ok' }}
15
+ {{ nested.undefinedVar is not defined ? 'ok' : 'ko' }}
16
+ {{ nested.zeroVar is defined ? 'ok' : 'ko' }}
17
+ {{ nested.nullVar is defined ? 'ok' : 'ko' }}
18
+ {{ nested.definedArray.0 is defined ? 'ok' : 'ko' }}
19
+ {{ nested['definedArray'][0] is defined ? 'ok' : 'ko' }}
20
+ {{ object.foo is defined ? 'ok' : 'ko' }}
21
+ {{ object.undefinedMethod is defined ? 'ko' : 'ok' }}
22
+ {{ object.getFoo() is defined ? 'ok' : 'ko' }}
23
+ {{ object.getFoo('a') is defined ? 'ok' : 'ko' }}
24
+ {{ object.undefinedMethod() is defined ? 'ko' : 'ok' }}
25
+ {{ object.undefinedMethod('a') is defined ? 'ko' : 'ok' }}
26
+ {{ object.self.foo is defined ? 'ok' : 'ko' }}
27
+ {{ object.self.undefinedMethod is defined ? 'ko' : 'ok' }}
28
+ {{ object.undefinedMethod.self is defined ? 'ko' : 'ok' }}
29
+ {{ 0 is defined ? 'ok' : 'ko' }}
30
+ {{ "foo" is defined ? 'ok' : 'ko' }}
31
+ {{ true is defined ? 'ok' : 'ko' }}
32
+ {{ false is defined ? 'ok' : 'ko' }}
33
+ {{ null is defined ? 'ok' : 'ko' }}
34
+ {{ [1, 2] is defined ? 'ok' : 'ko' }}
35
+ {{ { foo: "bar" } is defined ? 'ok' : 'ko' }}
36
+ --DATA--
37
+ return [
38
+ 'definedVar' => 'defined',
39
+ 'zeroVar' => 0,
40
+ 'nullVar' => null,
41
+ 'nested' => [
42
+ 'definedVar' => 'defined',
43
+ 'zeroVar' => 0,
44
+ 'nullVar' => null,
45
+ 'definedArray' => [0],
46
+ ],
47
+ 'object' => new Twig\Tests\TwigTestFoo(),
48
+ ]
49
+ --EXPECT--
50
+ ok
51
+ ok
52
+ ok
53
+ ok
54
+ ok
55
+ ok
56
+ ok
57
+ ok
58
+ ok
59
+ ok
60
+ ok
61
+ ok
62
+ ok
63
+ ok
64
+ ok
65
+ ok
66
+ ok
67
+ ok
68
+ ok
69
+ ok
70
+ ok
71
+ ok
72
+ ok
73
+ ok
74
+ ok
75
+ ok
76
+ ok
77
+ ok
78
+ ok
79
+ ok
80
+ ok
81
+ ok
82
+ --DATA--
83
+ return [
84
+ 'definedVar' => 'defined',
85
+ 'zeroVar' => 0,
86
+ 'nullVar' => null,
87
+ 'nested' => [
88
+ 'definedVar' => 'defined',
89
+ 'zeroVar' => 0,
90
+ 'nullVar' => null,
91
+ 'definedArray' => [0],
92
+ ],
93
+ 'object' => new Twig\Tests\TwigTestFoo(),
94
+ ]
95
+ --CONFIG--
96
+ return ['strict_variables' => false]
97
+ --EXPECT--
98
+ ok
99
+ ok
100
+ ok
101
+ ok
102
+ ok
103
+ ok
104
+ ok
105
+ ok
106
+ ok
107
+ ok
108
+ ok
109
+ ok
110
+ ok
111
+ ok
112
+ ok
113
+ ok
114
+ ok
115
+ ok
116
+ ok
117
+ ok
118
+ ok
119
+ ok
120
+ ok
121
+ ok
122
+ ok
123
+ ok
124
+ ok
125
+ ok
126
+ ok
127
+ ok
128
+ ok
129
+ ok
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/defined_for_attribute.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/defined_for_blocks.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/defined_for_blocks_with_template.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/defined_for_constants.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/defined_on_complex_expr.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/dynamic_test.test RENAMED
File without changes
vendor/twig/twig/tests/Fixtures/tests/empty.test ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "empty" test
3
+ --TEMPLATE--
4
+ {{ string_empty is empty ? 'ok' : 'ko' }}
5
+ {{ string_zero is empty ? 'ko' : 'ok' }}
6
+ {{ value_null is empty ? 'ok' : 'ko' }}
7
+ {{ value_false is empty ? 'ok' : 'ko' }}
8
+ {{ value_int_zero is empty ? 'ko' : 'ok' }}
9
+ {{ array_empty is empty ? 'ok' : 'ko' }}
10
+ {{ array_not_empty is empty ? 'ko' : 'ok' }}
11
+ {{ magically_callable is empty ? 'ko' : 'ok' }}
12
+ {{ countable_empty is empty ? 'ok' : 'ko' }}
13
+ {{ countable_not_empty is empty ? 'ko' : 'ok' }}
14
+ {{ tostring_empty is empty ? 'ok' : 'ko' }}
15
+ {{ tostring_not_empty is empty ? 'ko' : 'ok' }}
16
+ {{ markup_empty is empty ? 'ok' : 'ko' }}
17
+ {{ markup_not_empty is empty ? 'ko' : 'ok' }}
18
+ {{ iterator is empty ? 'ko' : 'ok' }}
19
+ {{ empty_iterator is empty ? 'ok' : 'ko' }}
20
+ {{ callback_iterator is empty ? 'ko' : 'ok' }}
21
+ {{ empty_callback_iterator is empty ? 'ok' : 'ko' }}
22
+ --DATA--
23
+ return [
24
+ 'string_empty' => '', 'string_zero' => '0',
25
+ 'value_null' => null, 'value_false' => false, 'value_int_zero' => 0,
26
+ 'array_empty' => [], 'array_not_empty' => [1, 2],
27
+ 'magically_callable' => new \Twig\Tests\MagicCallStub(),
28
+ 'countable_empty' => new \Twig\Tests\CountableStub([]), 'countable_not_empty' => new \Twig\Tests\CountableStub([1, 2]),
29
+ 'tostring_empty' => new \Twig\Tests\ToStringStub(''), 'tostring_not_empty' => new \Twig\Tests\ToStringStub('0' /* edge case of using "0" as the string */),
30
+ 'markup_empty' => new \Twig\Markup('', 'UTF-8'), 'markup_not_empty' => new \Twig\Markup('test', 'UTF-8'),
31
+ 'iterator' => $iter = new \ArrayIterator(['bar', 'foo']),
32
+ 'empty_iterator' => new \ArrayIterator(),
33
+ 'callback_iterator' => new \CallbackFilterIterator($iter, function ($el) { return true; }),
34
+ 'empty_callback_iterator' => new \CallbackFilterIterator($iter, function ($el) { return false; }),
35
+ ]
36
+ --EXPECT--
37
+ ok
38
+ ok
39
+ ok
40
+ ok
41
+ ok
42
+ ok
43
+ ok
44
+ ok
45
+ ok
46
+ ok
47
+ ok
48
+ ok
49
+ ok
50
+ ok
51
+ ok
52
+ ok
53
+ ok
54
+ ok
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/even.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/in.test RENAMED
File without changes
vendor/twig/twig/tests/Fixtures/tests/in_with_objects.test ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ Twig supports the in operator when using objects
3
+ --TEMPLATE--
4
+ {% if object in object_list %}
5
+ TRUE
6
+ {% endif %}
7
+ --DATA--
8
+ $foo = new Twig\Tests\TwigTestFoo();
9
+ $foo1 = new Twig\Tests\TwigTestFoo();
10
+
11
+ $foo->position = $foo1;
12
+ $foo1->position = $foo;
13
+
14
+ return [
15
+ 'object' => $foo,
16
+ 'object_list' => [$foo1, $foo],
17
+ ]
18
+ --EXPECT--
19
+ TRUE
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/iterable.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/null_coalesce.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/tests/odd.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/whitespace/trim_block.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/whitespace/trim_delimiter_as_strings.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/whitespace/trim_left.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/whitespace/trim_line_left.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/whitespace/trim_line_right.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Fixtures/whitespace/trim_right.test RENAMED
File without changes
vendor/twig/twig/tests/IntegrationTest.php ADDED
@@ -0,0 +1,386 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Extension\AbstractExtension;
15
+ use Twig\Extension\DebugExtension;
16
+ use Twig\Extension\SandboxExtension;
17
+ use Twig\Extension\StringLoaderExtension;
18
+ use Twig\Node\Expression\ConstantExpression;
19
+ use Twig\Node\PrintNode;
20
+ use Twig\Sandbox\SecurityPolicy;
21
+ use Twig\Test\IntegrationTestCase;
22
+ use Twig\Token;
23
+ use Twig\TokenParser\AbstractTokenParser;
24
+ use Twig\TwigFilter;
25
+ use Twig\TwigFunction;
26
+ use Twig\TwigTest;
27
+
28
+ // This function is defined to check that escaping strategies
29
+ // like html works even if a function with the same name is defined.
30
+ function html()
31
+ {
32
+ return 'foo';
33
+ }
34
+
35
+ class IntegrationTest extends IntegrationTestCase
36
+ {
37
+ public function getExtensions()
38
+ {
39
+ $policy = new SecurityPolicy([], [], [], [], ['dump']);
40
+
41
+ return [
42
+ new DebugExtension(),
43
+ new SandboxExtension($policy, false),
44
+ new StringLoaderExtension(),
45
+ new TwigTestExtension(),
46
+ ];
47
+ }
48
+
49
+ public function getFixturesDir()
50
+ {
51
+ return __DIR__.'/Fixtures/';
52
+ }
53
+ }
54
+
55
+ function test_foo($value = 'foo')
56
+ {
57
+ return $value;
58
+ }
59
+
60
+ class TwigTestFoo implements \Iterator
61
+ {
62
+ const BAR_NAME = 'bar';
63
+
64
+ public $position = 0;
65
+ public $array = [1, 2];
66
+
67
+ public function bar($param1 = null, $param2 = null)
68
+ {
69
+ return 'bar'.($param1 ? '_'.$param1 : '').($param2 ? '-'.$param2 : '');
70
+ }
71
+
72
+ public function getFoo()
73
+ {
74
+ return 'foo';
75
+ }
76
+
77
+ public function getSelf()
78
+ {
79
+ return $this;
80
+ }
81
+
82
+ public function is()
83
+ {
84
+ return 'is';
85
+ }
86
+
87
+ public function in()
88
+ {
89
+ return 'in';
90
+ }
91
+
92
+ public function not()
93
+ {
94
+ return 'not';
95
+ }
96
+
97
+ public function strToLower($value)
98
+ {
99
+ return strtolower($value);
100
+ }
101
+
102
+ public function rewind()
103
+ {
104
+ $this->position = 0;
105
+ }
106
+
107
+ public function current()
108
+ {
109
+ return $this->array[$this->position];
110
+ }
111
+
112
+ public function key()
113
+ {
114
+ return 'a';
115
+ }
116
+
117
+ public function next()
118
+ {
119
+ ++$this->position;
120
+ }
121
+
122
+ public function valid()
123
+ {
124
+ return isset($this->array[$this->position]);
125
+ }
126
+ }
127
+
128
+ class TwigTestTokenParser_§ extends AbstractTokenParser
129
+ {
130
+ public function parse(Token $token)
131
+ {
132
+ $this->parser->getStream()->expect(Token::BLOCK_END_TYPE);
133
+
134
+ return new PrintNode(new ConstantExpression('§', -1), -1);
135
+ }
136
+
137
+ public function getTag()
138
+ {
139
+ return '§';
140
+ }
141
+ }
142
+
143
+ class TwigTestExtension extends AbstractExtension
144
+ {
145
+ public function getTokenParsers()
146
+ {
147
+ return [
148
+ new TwigTestTokenParser_§(),
149
+ ];
150
+ }
151
+
152
+ public function getFilters()
153
+ {
154
+ return [
155
+ new TwigFilter('§', [$this, '§Filter']),
156
+ new TwigFilter('escape_and_nl2br', [$this, 'escape_and_nl2br'], ['needs_environment' => true, 'is_safe' => ['html']]),
157
+ new TwigFilter('nl2br', [$this, 'nl2br'], ['pre_escape' => 'html', 'is_safe' => ['html']]),
158
+ new TwigFilter('escape_something', [$this, 'escape_something'], ['is_safe' => ['something']]),
159
+ new TwigFilter('preserves_safety', [$this, 'preserves_safety'], ['preserves_safety' => ['html']]),
160
+ new TwigFilter('static_call_string', 'Twig\Tests\TwigTestExtension::staticCall'),
161
+ new TwigFilter('static_call_array', ['Twig\Tests\TwigTestExtension', 'staticCall']),
162
+ new TwigFilter('magic_call', [$this, 'magicCall']),
163
+ new TwigFilter('magic_call_string', 'Twig\Tests\TwigTestExtension::magicStaticCall'),
164
+ new TwigFilter('magic_call_array', ['Twig\Tests\TwigTestExtension', 'magicStaticCall']),
165
+ new TwigFilter('*_path', [$this, 'dynamic_path']),
166
+ new TwigFilter('*_foo_*_bar', [$this, 'dynamic_foo']),
167
+ ];
168
+ }
169
+
170
+ public function getFunctions()
171
+ {
172
+ return [
173
+ new TwigFunction('§', [$this, '§Function']),
174
+ new TwigFunction('safe_br', [$this, 'br'], ['is_safe' => ['html']]),
175
+ new TwigFunction('unsafe_br', [$this, 'br']),
176
+ new TwigFunction('static_call_string', 'Twig\Tests\TwigTestExtension::staticCall'),
177
+ new TwigFunction('static_call_array', ['Twig\Tests\TwigTestExtension', 'staticCall']),
178
+ new TwigFunction('*_path', [$this, 'dynamic_path']),
179
+ new TwigFunction('*_foo_*_bar', [$this, 'dynamic_foo']),
180
+ ];
181
+ }
182
+
183
+ public function getTests()
184
+ {
185
+ return [
186
+ new TwigTest('multi word', [$this, 'is_multi_word']),
187
+ new TwigTest('test_*', [$this, 'dynamic_test']),
188
+ ];
189
+ }
190
+
191
+ public function §Filter($value)
192
+ {
193
+ return "§{$value}§";
194
+ }
195
+
196
+ public function §Function($value)
197
+ {
198
+ return "§{$value}§";
199
+ }
200
+
201
+ /**
202
+ * nl2br which also escapes, for testing escaper filters.
203
+ */
204
+ public function escape_and_nl2br($env, $value, $sep = '<br />')
205
+ {
206
+ return $this->nl2br(twig_escape_filter($env, $value, 'html'), $sep);
207
+ }
208
+
209
+ /**
210
+ * nl2br only, for testing filters with pre_escape.
211
+ */
212
+ public function nl2br($value, $sep = '<br />')
213
+ {
214
+ // not secure if $value contains html tags (not only entities)
215
+ // don't use
216
+ return str_replace("\n", "$sep\n", $value);
217
+ }
218
+
219
+ public function dynamic_path($element, $item)
220
+ {
221
+ return $element.'/'.$item;
222
+ }
223
+
224
+ public function dynamic_foo($foo, $bar, $item)
225
+ {
226
+ return $foo.'/'.$bar.'/'.$item;
227
+ }
228
+
229
+ public function dynamic_test($element, $item)
230
+ {
231
+ return $element === $item;
232
+ }
233
+
234
+ public function escape_something($value)
235
+ {
236
+ return strtoupper($value);
237
+ }
238
+
239
+ public function preserves_safety($value)
240
+ {
241
+ return strtoupper($value);
242
+ }
243
+
244
+ public static function staticCall($value)
245
+ {
246
+ return "*$value*";
247
+ }
248
+
249
+ public function br()
250
+ {
251
+ return '<br />';
252
+ }
253
+
254
+ public function is_multi_word($value)
255
+ {
256
+ return false !== strpos($value, ' ');
257
+ }
258
+
259
+ public function __call($method, $arguments)
260
+ {
261
+ if ('magicCall' !== $method) {
262
+ throw new \BadMethodCallException('Unexpected call to __call');
263
+ }
264
+
265
+ return 'magic_'.$arguments[0];
266
+ }
267
+
268
+ public static function __callStatic($method, $arguments)
269
+ {
270
+ if ('magicStaticCall' !== $method) {
271
+ throw new \BadMethodCallException('Unexpected call to __callStatic');
272
+ }
273
+
274
+ return 'static_magic_'.$arguments[0];
275
+ }
276
+ }
277
+
278
+ /**
279
+ * This class is used in tests for the "length" filter and "empty" test. It asserts that __call is not
280
+ * used to convert such objects to strings.
281
+ */
282
+ class MagicCallStub
283
+ {
284
+ public function __call($name, $args)
285
+ {
286
+ throw new \Exception('__call shall not be called');
287
+ }
288
+ }
289
+
290
+ class ToStringStub
291
+ {
292
+ /**
293
+ * @var string
294
+ */
295
+ private $string;
296
+
297
+ public function __construct($string)
298
+ {
299
+ $this->string = $string;
300
+ }
301
+
302
+ public function __toString()
303
+ {
304
+ return $this->string;
305
+ }
306
+ }
307
+
308
+ /**
309
+ * This class is used in tests for the length filter and empty test to show
310
+ * that when \Countable is implemented, it is preferred over the __toString()
311
+ * method.
312
+ */
313
+ class CountableStub implements \Countable
314
+ {
315
+ private $count;
316
+
317
+ public function __construct($count)
318
+ {
319
+ $this->count = $count;
320
+ }
321
+
322
+ public function count()
323
+ {
324
+ return $this->count;
325
+ }
326
+
327
+ public function __toString()
328
+ {
329
+ throw new \Exception('__toString shall not be called on \Countables');
330
+ }
331
+ }
332
+
333
+ /**
334
+ * This class is used in tests for the length filter.
335
+ */
336
+ class IteratorAggregateStub implements \IteratorAggregate
337
+ {
338
+ private $data;
339
+
340
+ public function __construct(array $data)
341
+ {
342
+ $this->data = $data;
343
+ }
344
+
345
+ public function getIterator()
346
+ {
347
+ return new \ArrayIterator($this->data);
348
+ }
349
+ }
350
+
351
+ class SimpleIteratorForTesting implements \Iterator
352
+ {
353
+ private $data = [1, 2, 3, 4, 5, 6, 7];
354
+ private $key = 0;
355
+
356
+ public function current()
357
+ {
358
+ return $this->key;
359
+ }
360
+
361
+ public function next()
362
+ {
363
+ ++$this->key;
364
+ }
365
+
366
+ public function key()
367
+ {
368
+ return $this->key;
369
+ }
370
+
371
+ public function valid()
372
+ {
373
+ return isset($this->data[$this->key]);
374
+ }
375
+
376
+ public function rewind()
377
+ {
378
+ $this->key = 0;
379
+ }
380
+
381
+ public function __toString()
382
+ {
383
+ // for testing, make sure string length returned is not the same as the `iterator_count`
384
+ return str_repeat('X', iterator_count($this) + 10);
385
+ }
386
+ }
vendor/twig/twig/{test/Twig/Tests → tests}/LegacyFixtures/autoescape/filename.legacy.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/LegacyFixtures/functions/undefined_block.legacy.test RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/LegacyFixtures/test.legacy.test RENAMED
File without changes
vendor/twig/twig/tests/LegacyIntegrationTest.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Extension\AbstractExtension;
15
+ use Twig\Test\IntegrationTestCase;
16
+
17
+ class LegacyIntegrationTest extends IntegrationTestCase
18
+ {
19
+ public function getExtensions()
20
+ {
21
+ return [
22
+ new LegacyTwigTestExtension(),
23
+ ];
24
+ }
25
+
26
+ public function getFixturesDir()
27
+ {
28
+ return __DIR__.'/LegacyFixtures/';
29
+ }
30
+
31
+ public function getTests($name, $legacyTests = false)
32
+ {
33
+ if (!$legacyTests) {
34
+ return [['', '', '', [], '', []]];
35
+ }
36
+
37
+ return parent::getTests($name, true);
38
+ }
39
+ }
40
+
41
+ class LegacyTwigTestExtension extends AbstractExtension
42
+ {
43
+ public function getTests()
44
+ {
45
+ return [
46
+ 'multi word' => new \Twig_Test_Method($this, 'is_multi_word'),
47
+ ];
48
+ }
49
+
50
+ public function is_multi_word($value)
51
+ {
52
+ return false !== strpos($value, ' ');
53
+ }
54
+
55
+ public function getName()
56
+ {
57
+ return 'legacy_integration_test';
58
+ }
59
+ }
vendor/twig/twig/tests/LexerTest.php ADDED
@@ -0,0 +1,378 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Lexer;
16
+ use Twig\Source;
17
+ use Twig\Token;
18
+
19
+ class LexerTest extends \PHPUnit\Framework\TestCase
20
+ {
21
+ /**
22
+ * @group legacy
23
+ */
24
+ public function testLegacyConstructorSignature()
25
+ {
26
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
27
+ $stream = $lexer->tokenize('{{ foo }}', 'foo');
28
+ $this->assertEquals('foo', $stream->getFilename());
29
+ $this->assertEquals('{{ foo }}', $stream->getSource());
30
+ }
31
+
32
+ public function testNameLabelForTag()
33
+ {
34
+ $template = '{% § %}';
35
+
36
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
37
+ $stream = $lexer->tokenize(new Source($template, 'index'));
38
+
39
+ $stream->expect(Token::BLOCK_START_TYPE);
40
+ $this->assertSame('§', $stream->expect(Token::NAME_TYPE)->getValue());
41
+ }
42
+
43
+ public function testNameLabelForFunction()
44
+ {
45
+ $template = '{{ §() }}';
46
+
47
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
48
+ $stream = $lexer->tokenize(new Source($template, 'index'));
49
+
50
+ $stream->expect(Token::VAR_START_TYPE);
51
+ $this->assertSame('§', $stream->expect(Token::NAME_TYPE)->getValue());
52
+ }
53
+
54
+ public function testBracketsNesting()
55
+ {
56
+ $template = '{{ {"a":{"b":"c"}} }}';
57
+
58
+ $this->assertEquals(2, $this->countToken($template, Token::PUNCTUATION_TYPE, '{'));
59
+ $this->assertEquals(2, $this->countToken($template, Token::PUNCTUATION_TYPE, '}'));
60
+ }
61
+
62
+ protected function countToken($template, $type, $value = null)
63
+ {
64
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
65
+ $stream = $lexer->tokenize(new Source($template, 'index'));
66
+
67
+ $count = 0;
68
+ while (!$stream->isEOF()) {
69
+ $token = $stream->next();
70
+ if ($type === $token->getType()) {
71
+ if (null === $value || $value === $token->getValue()) {
72
+ ++$count;
73
+ }
74
+ }
75
+ }
76
+
77
+ return $count;
78
+ }
79
+
80
+ public function testLineDirective()
81
+ {
82
+ $template = "foo\n"
83
+ ."bar\n"
84
+ ."{% line 10 %}\n"
85
+ ."{{\n"
86
+ ."baz\n"
87
+ ."}}\n";
88
+
89
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
90
+ $stream = $lexer->tokenize(new Source($template, 'index'));
91
+
92
+ // foo\nbar\n
93
+ $this->assertSame(1, $stream->expect(Token::TEXT_TYPE)->getLine());
94
+ // \n (after {% line %})
95
+ $this->assertSame(10, $stream->expect(Token::TEXT_TYPE)->getLine());
96
+ // {{
97
+ $this->assertSame(11, $stream->expect(Token::VAR_START_TYPE)->getLine());
98
+ // baz
99
+ $this->assertSame(12, $stream->expect(Token::NAME_TYPE)->getLine());
100
+ }
101
+
102
+ public function testLineDirectiveInline()
103
+ {
104
+ $template = "foo\n"
105
+ ."bar{% line 10 %}{{\n"
106
+ ."baz\n"
107
+ ."}}\n";
108
+
109
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
110
+ $stream = $lexer->tokenize(new Source($template, 'index'));
111
+
112
+ // foo\nbar
113
+ $this->assertSame(1, $stream->expect(Token::TEXT_TYPE)->getLine());
114
+ // {{
115
+ $this->assertSame(10, $stream->expect(Token::VAR_START_TYPE)->getLine());
116
+ // baz
117
+ $this->assertSame(11, $stream->expect(Token::NAME_TYPE)->getLine());
118
+ }
119
+
120
+ public function testLongComments()
121
+ {
122
+ $template = '{# '.str_repeat('*', 100000).' #}';
123
+
124
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
125
+ $lexer->tokenize(new Source($template, 'index'));
126
+
127
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
128
+ // can be executed without throwing any exceptions
129
+ $this->addToAssertionCount(1);
130
+ }
131
+
132
+ public function testLongVerbatim()
133
+ {
134
+ $template = '{% verbatim %}'.str_repeat('*', 100000).'{% endverbatim %}';
135
+
136
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
137
+ $lexer->tokenize(new Source($template, 'index'));
138
+
139
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
140
+ // can be executed without throwing any exceptions
141
+ $this->addToAssertionCount(1);
142
+ }
143
+
144
+ public function testLongVar()
145
+ {
146
+ $template = '{{ '.str_repeat('x', 100000).' }}';
147
+
148
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
149
+ $lexer->tokenize(new Source($template, 'index'));
150
+
151
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
152
+ // can be executed without throwing any exceptions
153
+ $this->addToAssertionCount(1);
154
+ }
155
+
156
+ public function testLongBlock()
157
+ {
158
+ $template = '{% '.str_repeat('x', 100000).' %}';
159
+
160
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
161
+ $lexer->tokenize(new Source($template, 'index'));
162
+
163
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
164
+ // can be executed without throwing any exceptions
165
+ $this->addToAssertionCount(1);
166
+ }
167
+
168
+ public function testBigNumbers()
169
+ {
170
+ $template = '{{ 922337203685477580700 }}';
171
+
172
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
173
+ $stream = $lexer->tokenize(new Source($template, 'index'));
174
+ $stream->next();
175
+ $node = $stream->next();
176
+ $this->assertEquals('922337203685477580700', $node->getValue());
177
+ }
178
+
179
+ public function testStringWithEscapedDelimiter()
180
+ {
181
+ $tests = [
182
+ "{{ 'foo \' bar' }}" => 'foo \' bar',
183
+ '{{ "foo \" bar" }}' => 'foo " bar',
184
+ ];
185
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
186
+ foreach ($tests as $template => $expected) {
187
+ $stream = $lexer->tokenize(new Source($template, 'index'));
188
+ $stream->expect(Token::VAR_START_TYPE);
189
+ $stream->expect(Token::STRING_TYPE, $expected);
190
+
191
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
192
+ // can be executed without throwing any exceptions
193
+ $this->addToAssertionCount(1);
194
+ }
195
+ }
196
+
197
+ public function testStringWithInterpolation()
198
+ {
199
+ $template = 'foo {{ "bar #{ baz + 1 }" }}';
200
+
201
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
202
+ $stream = $lexer->tokenize(new Source($template, 'index'));
203
+ $stream->expect(Token::TEXT_TYPE, 'foo ');
204
+ $stream->expect(Token::VAR_START_TYPE);
205
+ $stream->expect(Token::STRING_TYPE, 'bar ');
206
+ $stream->expect(Token::INTERPOLATION_START_TYPE);
207
+ $stream->expect(Token::NAME_TYPE, 'baz');
208
+ $stream->expect(Token::OPERATOR_TYPE, '+');
209
+ $stream->expect(Token::NUMBER_TYPE, '1');
210
+ $stream->expect(Token::INTERPOLATION_END_TYPE);
211
+ $stream->expect(Token::VAR_END_TYPE);
212
+
213
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
214
+ // can be executed without throwing any exceptions
215
+ $this->addToAssertionCount(1);
216
+ }
217
+
218
+ public function testStringWithEscapedInterpolation()
219
+ {
220
+ $template = '{{ "bar \#{baz+1}" }}';
221
+
222
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
223
+ $stream = $lexer->tokenize(new Source($template, 'index'));
224
+ $stream->expect(Token::VAR_START_TYPE);
225
+ $stream->expect(Token::STRING_TYPE, 'bar #{baz+1}');
226
+ $stream->expect(Token::VAR_END_TYPE);
227
+
228
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
229
+ // can be executed without throwing any exceptions
230
+ $this->addToAssertionCount(1);
231
+ }
232
+
233
+ public function testStringWithHash()
234
+ {
235
+ $template = '{{ "bar # baz" }}';
236
+
237
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
238
+ $stream = $lexer->tokenize(new Source($template, 'index'));
239
+ $stream->expect(Token::VAR_START_TYPE);
240
+ $stream->expect(Token::STRING_TYPE, 'bar # baz');
241
+ $stream->expect(Token::VAR_END_TYPE);
242
+
243
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
244
+ // can be executed without throwing any exceptions
245
+ $this->addToAssertionCount(1);
246
+ }
247
+
248
+ public function testStringWithUnterminatedInterpolation()
249
+ {
250
+ $this->expectException('\Twig\Error\SyntaxError');
251
+ $this->expectExceptionMessage('Unclosed """');
252
+
253
+ $template = '{{ "bar #{x" }}';
254
+
255
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
256
+ $lexer->tokenize(new Source($template, 'index'));
257
+ }
258
+
259
+ public function testStringWithNestedInterpolations()
260
+ {
261
+ $template = '{{ "bar #{ "foo#{bar}" }" }}';
262
+
263
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
264
+ $stream = $lexer->tokenize(new Source($template, 'index'));
265
+ $stream->expect(Token::VAR_START_TYPE);
266
+ $stream->expect(Token::STRING_TYPE, 'bar ');
267
+ $stream->expect(Token::INTERPOLATION_START_TYPE);
268
+ $stream->expect(Token::STRING_TYPE, 'foo');
269
+ $stream->expect(Token::INTERPOLATION_START_TYPE);
270
+ $stream->expect(Token::NAME_TYPE, 'bar');
271
+ $stream->expect(Token::INTERPOLATION_END_TYPE);
272
+ $stream->expect(Token::INTERPOLATION_END_TYPE);
273
+ $stream->expect(Token::VAR_END_TYPE);
274
+
275
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
276
+ // can be executed without throwing any exceptions
277
+ $this->addToAssertionCount(1);
278
+ }
279
+
280
+ public function testStringWithNestedInterpolationsInBlock()
281
+ {
282
+ $template = '{% foo "bar #{ "foo#{bar}" }" %}';
283
+
284
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
285
+ $stream = $lexer->tokenize(new Source($template, 'index'));
286
+ $stream->expect(Token::BLOCK_START_TYPE);
287
+ $stream->expect(Token::NAME_TYPE, 'foo');
288
+ $stream->expect(Token::STRING_TYPE, 'bar ');
289
+ $stream->expect(Token::INTERPOLATION_START_TYPE);
290
+ $stream->expect(Token::STRING_TYPE, 'foo');
291
+ $stream->expect(Token::INTERPOLATION_START_TYPE);
292
+ $stream->expect(Token::NAME_TYPE, 'bar');
293
+ $stream->expect(Token::INTERPOLATION_END_TYPE);
294
+ $stream->expect(Token::INTERPOLATION_END_TYPE);
295
+ $stream->expect(Token::BLOCK_END_TYPE);
296
+
297
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
298
+ // can be executed without throwing any exceptions
299
+ $this->addToAssertionCount(1);
300
+ }
301
+
302
+ public function testOperatorEndingWithALetterAtTheEndOfALine()
303
+ {
304
+ $template = "{{ 1 and\n0}}";
305
+
306
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
307
+ $stream = $lexer->tokenize(new Source($template, 'index'));
308
+ $stream->expect(Token::VAR_START_TYPE);
309
+ $stream->expect(Token::NUMBER_TYPE, 1);
310
+ $stream->expect(Token::OPERATOR_TYPE, 'and');
311
+
312
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
313
+ // can be executed without throwing any exceptions
314
+ $this->addToAssertionCount(1);
315
+ }
316
+
317
+ public function testUnterminatedVariable()
318
+ {
319
+ $this->expectException('\Twig\Error\SyntaxError');
320
+ $this->expectExceptionMessage('Unclosed "variable" in "index" at line 3');
321
+
322
+ $template = '
323
+
324
+ {{
325
+
326
+ bar
327
+
328
+
329
+ ';
330
+
331
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
332
+ $lexer->tokenize(new Source($template, 'index'));
333
+ }
334
+
335
+ public function testUnterminatedBlock()
336
+ {
337
+ $this->expectException('\Twig\Error\SyntaxError');
338
+ $this->expectExceptionMessage('Unclosed "block" in "index" at line 3');
339
+
340
+ $template = '
341
+
342
+ {%
343
+
344
+ bar
345
+
346
+
347
+ ';
348
+
349
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
350
+ $lexer->tokenize(new Source($template, 'index'));
351
+ }
352
+
353
+ public function testOverridingSyntax()
354
+ {
355
+ $template = '[# comment #]{# variable #}/# if true #/true/# endif #/';
356
+ $lexer = new Lexer(new Environment($this->createMock('\Twig\Loader\LoaderInterface')), [
357
+ 'tag_comment' => ['[#', '#]'],
358
+ 'tag_block' => ['/#', '#/'],
359
+ 'tag_variable' => ['{#', '#}'],
360
+ ]);
361
+ $stream = $lexer->tokenize(new Source($template, 'index'));
362
+ $stream->expect(Token::VAR_START_TYPE);
363
+ $stream->expect(Token::NAME_TYPE, 'variable');
364
+ $stream->expect(Token::VAR_END_TYPE);
365
+ $stream->expect(Token::BLOCK_START_TYPE);
366
+ $stream->expect(Token::NAME_TYPE, 'if');
367
+ $stream->expect(Token::NAME_TYPE, 'true');
368
+ $stream->expect(Token::BLOCK_END_TYPE);
369
+ $stream->expect(Token::TEXT_TYPE, 'true');
370
+ $stream->expect(Token::BLOCK_START_TYPE);
371
+ $stream->expect(Token::NAME_TYPE, 'endif');
372
+ $stream->expect(Token::BLOCK_END_TYPE);
373
+
374
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
375
+ // can be executed without throwing any exceptions
376
+ $this->addToAssertionCount(1);
377
+ }
378
+ }
vendor/twig/twig/tests/Loader/ArrayTest.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Loader;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Loader\ArrayLoader;
15
+
16
+ class ArrayTest extends \PHPUnit\Framework\TestCase
17
+ {
18
+ /**
19
+ * @group legacy
20
+ */
21
+ public function testGetSource()
22
+ {
23
+ $loader = new ArrayLoader(['foo' => 'bar']);
24
+
25
+ $this->assertEquals('bar', $loader->getSource('foo'));
26
+ }
27
+
28
+ /**
29
+ * @group legacy
30
+ */
31
+ public function testGetSourceWhenTemplateDoesNotExist()
32
+ {
33
+ $this->expectException('\Twig\Error\LoaderError');
34
+
35
+ $loader = new ArrayLoader([]);
36
+
37
+ $loader->getSource('foo');
38
+ }
39
+
40
+ public function testGetSourceContextWhenTemplateDoesNotExist()
41
+ {
42
+ $this->expectException('\Twig\Error\LoaderError');
43
+
44
+ $loader = new ArrayLoader([]);
45
+
46
+ $loader->getSourceContext('foo');
47
+ }
48
+
49
+ public function testGetCacheKey()
50
+ {
51
+ $loader = new ArrayLoader(['foo' => 'bar']);
52
+
53
+ $this->assertEquals('foo:bar', $loader->getCacheKey('foo'));
54
+ }
55
+
56
+ public function testGetCacheKeyWhenTemplateHasDuplicateContent()
57
+ {
58
+ $loader = new ArrayLoader([
59
+ 'foo' => 'bar',
60
+ 'baz' => 'bar',
61
+ ]);
62
+
63
+ $this->assertEquals('foo:bar', $loader->getCacheKey('foo'));
64
+ $this->assertEquals('baz:bar', $loader->getCacheKey('baz'));
65
+ }
66
+
67
+ public function testGetCacheKeyIsProtectedFromEdgeCollisions()
68
+ {
69
+ $loader = new ArrayLoader([
70
+ 'foo__' => 'bar',
71
+ 'foo' => '__bar',
72
+ ]);
73
+
74
+ $this->assertEquals('foo__:bar', $loader->getCacheKey('foo__'));
75
+ $this->assertEquals('foo:__bar', $loader->getCacheKey('foo'));
76
+ }
77
+
78
+ public function testGetCacheKeyWhenTemplateDoesNotExist()
79
+ {
80
+ $this->expectException('\Twig\Error\LoaderError');
81
+
82
+ $loader = new ArrayLoader([]);
83
+
84
+ $loader->getCacheKey('foo');
85
+ }
86
+
87
+ public function testSetTemplate()
88
+ {
89
+ $loader = new ArrayLoader([]);
90
+ $loader->setTemplate('foo', 'bar');
91
+
92
+ $this->assertEquals('bar', $loader->getSourceContext('foo')->getCode());
93
+ }
94
+
95
+ public function testIsFresh()
96
+ {
97
+ $loader = new ArrayLoader(['foo' => 'bar']);
98
+ $this->assertTrue($loader->isFresh('foo', time()));
99
+ }
100
+
101
+ public function testIsFreshWhenTemplateDoesNotExist()
102
+ {
103
+ $this->expectException('\Twig\Error\LoaderError');
104
+
105
+ $loader = new ArrayLoader([]);
106
+
107
+ $loader->isFresh('foo', time());
108
+ }
109
+
110
+ public function testTemplateReference()
111
+ {
112
+ $name = new Twig_Test_Loader_TemplateReference('foo');
113
+ $loader = new ArrayLoader(['foo' => 'bar']);
114
+
115
+ $loader->getCacheKey($name);
116
+ $loader->getSourceContext($name);
117
+ $loader->isFresh($name, time());
118
+ $loader->setTemplate($name, 'foo:bar');
119
+
120
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
121
+ // can be executed without crashing PHP
122
+ $this->addToAssertionCount(1);
123
+ }
124
+ }
125
+
126
+ class Twig_Test_Loader_TemplateReference
127
+ {
128
+ private $name;
129
+
130
+ public function __construct($name)
131
+ {
132
+ $this->name = $name;
133
+ }
134
+
135
+ public function __toString()
136
+ {
137
+ return $this->name;
138
+ }
139
+ }
vendor/twig/twig/tests/Loader/ChainTest.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Loader;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Loader\ArrayLoader;
15
+ use Twig\Loader\ChainLoader;
16
+ use Twig\Loader\ExistsLoaderInterface;
17
+ use Twig\Loader\FilesystemLoader;
18
+ use Twig\Loader\LoaderInterface;
19
+ use Twig\Loader\SourceContextLoaderInterface;
20
+ use Twig\Source;
21
+
22
+ class ChainTest extends \PHPUnit\Framework\TestCase
23
+ {
24
+ /**
25
+ * @group legacy
26
+ */
27
+ public function testGetSource()
28
+ {
29
+ $loader = new ChainLoader([
30
+ new ArrayLoader(['foo' => 'bar']),
31
+ new ArrayLoader(['foo' => 'foobar', 'bar' => 'foo']),
32
+ ]);
33
+
34
+ $this->assertEquals('bar', $loader->getSource('foo'));
35
+ $this->assertEquals('foo', $loader->getSource('bar'));
36
+ }
37
+
38
+ public function testGetSourceContext()
39
+ {
40
+ $path = __DIR__.'/../Fixtures';
41
+ $loader = new ChainLoader([
42
+ new ArrayLoader(['foo' => 'bar']),
43
+ new ArrayLoader(['errors/index.html' => 'baz']),
44
+ new FilesystemLoader([$path]),
45
+ ]);
46
+
47
+ $this->assertEquals('foo', $loader->getSourceContext('foo')->getName());
48
+ $this->assertSame('', $loader->getSourceContext('foo')->getPath());
49
+
50
+ $this->assertEquals('errors/index.html', $loader->getSourceContext('errors/index.html')->getName());
51
+ $this->assertSame('', $loader->getSourceContext('errors/index.html')->getPath());
52
+ $this->assertEquals('baz', $loader->getSourceContext('errors/index.html')->getCode());
53
+
54
+ $this->assertEquals('errors/base.html', $loader->getSourceContext('errors/base.html')->getName());
55
+ $this->assertEquals(realpath($path.'/errors/base.html'), realpath($loader->getSourceContext('errors/base.html')->getPath()));
56
+ $this->assertNotEquals('baz', $loader->getSourceContext('errors/base.html')->getCode());
57
+ }
58
+
59
+ public function testGetSourceContextWhenTemplateDoesNotExist()
60
+ {
61
+ $this->expectException('\Twig\Error\LoaderError');
62
+
63
+ $loader = new ChainLoader([]);
64
+
65
+ $loader->getSourceContext('foo');
66
+ }
67
+
68
+ /**
69
+ * @group legacy
70
+ */
71
+ public function testGetSourceWhenTemplateDoesNotExist()
72
+ {
73
+ $this->expectException('\Twig\Error\LoaderError');
74
+
75
+ $loader = new ChainLoader([]);
76
+
77
+ $loader->getSource('foo');
78
+ }
79
+
80
+ public function testGetCacheKey()
81
+ {
82
+ $loader = new ChainLoader([
83
+ new ArrayLoader(['foo' => 'bar']),
84
+ new ArrayLoader(['foo' => 'foobar', 'bar' => 'foo']),
85
+ ]);
86
+
87
+ $this->assertEquals('foo:bar', $loader->getCacheKey('foo'));
88
+ $this->assertEquals('bar:foo', $loader->getCacheKey('bar'));
89
+ }
90
+
91
+ public function testGetCacheKeyWhenTemplateDoesNotExist()
92
+ {
93
+ $this->expectException('\Twig\Error\LoaderError');
94
+
95
+ $loader = new ChainLoader([]);
96
+
97
+ $loader->getCacheKey('foo');
98
+ }
99
+
100
+ public function testAddLoader()
101
+ {
102
+ $loader = new ChainLoader();
103
+ $loader->addLoader(new ArrayLoader(['foo' => 'bar']));
104
+
105
+ $this->assertEquals('bar', $loader->getSourceContext('foo')->getCode());
106
+ }
107
+
108
+ public function testExists()
109
+ {
110
+ $loader1 = $this->createMock('Twig\Tests\Loader\ChainTestLoaderWithExistsInterface');
111
+ $loader1->expects($this->once())->method('exists')->willReturn(false);
112
+ $loader1->expects($this->never())->method('getSourceContext');
113
+
114
+ // can be removed in 2.0
115
+ $loader2 = $this->createMock('Twig\Tests\Loader\ChainTestLoaderInterface');
116
+ //$loader2 = $this->createMock(['\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface']);
117
+ $loader2->expects($this->once())->method('getSourceContext')->willReturn(new Source('content', 'index'));
118
+
119
+ $loader = new ChainLoader();
120
+ $loader->addLoader($loader1);
121
+ $loader->addLoader($loader2);
122
+
123
+ $this->assertTrue($loader->exists('foo'));
124
+ }
125
+ }
126
+
127
+ interface ChainTestLoaderInterface extends LoaderInterface, SourceContextLoaderInterface
128
+ {
129
+ }
130
+
131
+ interface ChainTestLoaderWithExistsInterface extends LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface
132
+ {
133
+ }
vendor/twig/twig/tests/Loader/FilesystemTest.php ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Loader;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Error\LoaderError;
16
+ use Twig\Loader\FilesystemLoader;
17
+
18
+ class FilesystemTest extends \PHPUnit\Framework\TestCase
19
+ {
20
+ public function testGetSourceContext()
21
+ {
22
+ $path = __DIR__.'/../Fixtures';
23
+ $loader = new FilesystemLoader([$path]);
24
+ $this->assertEquals('errors/index.html', $loader->getSourceContext('errors/index.html')->getName());
25
+ $this->assertEquals(realpath($path.'/errors/index.html'), realpath($loader->getSourceContext('errors/index.html')->getPath()));
26
+ }
27
+
28
+ /**
29
+ * @dataProvider getSecurityTests
30
+ */
31
+ public function testSecurity($template)
32
+ {
33
+ $loader = new FilesystemLoader([__DIR__.'/../Fixtures']);
34
+
35
+ try {
36
+ $loader->getCacheKey($template);
37
+ $this->fail();
38
+ } catch (LoaderError $e) {
39
+ $this->assertStringNotContainsString('Unable to find template', $e->getMessage());
40
+ }
41
+ }
42
+
43
+ public function getSecurityTests()
44
+ {
45
+ return [
46
+ ["AutoloaderTest\0.php"],
47
+ ['..\\AutoloaderTest.php'],
48
+ ['..\\\\\\AutoloaderTest.php'],
49
+ ['../AutoloaderTest.php'],
50
+ ['..////AutoloaderTest.php'],
51
+ ['./../AutoloaderTest.php'],
52
+ ['.\\..\\AutoloaderTest.php'],
53
+ ['././././././../AutoloaderTest.php'],
54
+ ['.\\./.\\./.\\./../AutoloaderTest.php'],
55
+ ['foo/../../AutoloaderTest.php'],
56
+ ['foo\\..\\..\\AutoloaderTest.php'],
57
+ ['foo/../bar/../../AutoloaderTest.php'],
58
+ ['foo/bar/../../../AutoloaderTest.php'],
59
+ ['filters/../../AutoloaderTest.php'],
60
+ ['filters//..//..//AutoloaderTest.php'],
61
+ ['filters\\..\\..\\AutoloaderTest.php'],
62
+ ['filters\\\\..\\\\..\\\\AutoloaderTest.php'],
63
+ ['filters\\//../\\/\\..\\AutoloaderTest.php'],
64
+ ['/../AutoloaderTest.php'],
65
+ ];
66
+ }
67
+
68
+ /**
69
+ * @dataProvider getBasePaths
70
+ */
71
+ public function testPaths($basePath, $cacheKey, $rootPath)
72
+ {
73
+ $loader = new FilesystemLoader([$basePath.'/normal', $basePath.'/normal_bis'], $rootPath);
74
+ $loader->setPaths([$basePath.'/named', $basePath.'/named_bis'], 'named');
75
+ $loader->addPath($basePath.'/named_ter', 'named');
76
+ $loader->addPath($basePath.'/normal_ter');
77
+ $loader->prependPath($basePath.'/normal_final');
78
+ $loader->prependPath($basePath.'/named/../named_quater', 'named');
79
+ $loader->prependPath($basePath.'/named_final', 'named');
80
+
81
+ $this->assertEquals([
82
+ $basePath.'/normal_final',
83
+ $basePath.'/normal',
84
+ $basePath.'/normal_bis',
85
+ $basePath.'/normal_ter',
86
+ ], $loader->getPaths());
87
+ $this->assertEquals([
88
+ $basePath.'/named_final',
89
+ $basePath.'/named/../named_quater',
90
+ $basePath.'/named',
91
+ $basePath.'/named_bis',
92
+ $basePath.'/named_ter',
93
+ ], $loader->getPaths('named'));
94
+
95
+ // do not use realpath here as it would make the test unuseful
96
+ $this->assertEquals($cacheKey, str_replace('\\', '/', $loader->getCacheKey('@named/named_absolute.html')));
97
+ $this->assertEquals("path (final)\n", $loader->getSourceContext('index.html')->getCode());
98
+ $this->assertEquals("path (final)\n", $loader->getSourceContext('@__main__/index.html')->getCode());
99
+ $this->assertEquals("named path (final)\n", $loader->getSourceContext('@named/index.html')->getCode());
100
+ }
101
+
102
+ public function getBasePaths()
103
+ {
104
+ return [
105
+ [
106
+ __DIR__.'/Fixtures',
107
+ 'tests/Loader/Fixtures/named_quater/named_absolute.html',
108
+ null,
109
+ ],
110
+ [
111
+ __DIR__.'/Fixtures/../Fixtures',
112
+ 'tests/Loader/Fixtures/named_quater/named_absolute.html',
113
+ null,
114
+ ],
115
+ [
116
+ 'tests/Loader/Fixtures',
117
+ 'tests/Loader/Fixtures/named_quater/named_absolute.html',
118
+ getcwd(),
119
+ ],
120
+ [
121
+ 'Fixtures',
122
+ 'Fixtures/named_quater/named_absolute.html',
123
+ getcwd().'/tests/Loader',
124
+ ],
125
+ [
126
+ 'Fixtures',
127
+ 'Fixtures/named_quater/named_absolute.html',
128
+ getcwd().'/tests/../tests/Loader',
129
+ ],
130
+ ];
131
+ }
132
+
133
+ public function testEmptyConstructor()
134
+ {
135
+ $loader = new FilesystemLoader();
136
+ $this->assertEquals([], $loader->getPaths());
137
+ }
138
+
139
+ public function testGetNamespaces()
140
+ {
141
+ $loader = new FilesystemLoader(sys_get_temp_dir());
142
+ $this->assertEquals([FilesystemLoader::MAIN_NAMESPACE], $loader->getNamespaces());
143
+
144
+ $loader->addPath(sys_get_temp_dir(), 'named');
145
+ $this->assertEquals([FilesystemLoader::MAIN_NAMESPACE, 'named'], $loader->getNamespaces());
146
+ }
147
+
148
+ public function testFindTemplateExceptionNamespace()
149
+ {
150
+ $basePath = __DIR__.'/Fixtures';
151
+
152
+ $loader = new FilesystemLoader([$basePath.'/normal']);
153
+ $loader->addPath($basePath.'/named', 'named');
154
+
155
+ try {
156
+ $loader->getSourceContext('@named/nowhere.html');
157
+ } catch (\Exception $e) {
158
+ $this->assertInstanceOf('\Twig\Error\LoaderError', $e);
159
+ $this->assertStringContainsString('Unable to find template "@named/nowhere.html"', $e->getMessage());
160
+ }
161
+ }
162
+
163
+ public function testFindTemplateWithCache()
164
+ {
165
+ $basePath = __DIR__.'/Fixtures';
166
+
167
+ $loader = new FilesystemLoader([$basePath.'/normal']);
168
+ $loader->addPath($basePath.'/named', 'named');
169
+
170
+ // prime the cache for index.html in the named namespace
171
+ $namedSource = $loader->getSourceContext('@named/index.html')->getCode();
172
+ $this->assertEquals("named path\n", $namedSource);
173
+
174
+ // get index.html from the main namespace
175
+ $this->assertEquals("path\n", $loader->getSourceContext('index.html')->getCode());
176
+ }
177
+
178
+ public function testLoadTemplateAndRenderBlockWithCache()
179
+ {
180
+ $loader = new FilesystemLoader([]);
181
+ $loader->addPath(__DIR__.'/Fixtures/themes/theme2');
182
+ $loader->addPath(__DIR__.'/Fixtures/themes/theme1');
183
+ $loader->addPath(__DIR__.'/Fixtures/themes/theme1', 'default_theme');
184
+
185
+ $twig = new Environment($loader);
186
+
187
+ $template = $twig->load('blocks.html.twig');
188
+ $this->assertSame('block from theme 1', $template->renderBlock('b1', []));
189
+
190
+ $template = $twig->load('blocks.html.twig');
191
+ $this->assertSame('block from theme 2', $template->renderBlock('b2', []));
192
+ }
193
+
194
+ public function getArrayInheritanceTests()
195
+ {
196
+ return [
197
+ 'valid array inheritance' => ['array_inheritance_valid_parent.html.twig'],
198
+ 'array inheritance with null first template' => ['array_inheritance_null_parent.html.twig'],
199
+ 'array inheritance with empty first template' => ['array_inheritance_empty_parent.html.twig'],
200
+ 'array inheritance with non-existent first template' => ['array_inheritance_nonexistent_parent.html.twig'],
201
+ ];
202
+ }
203
+
204
+ /**
205
+ * @dataProvider getArrayInheritanceTests
206
+ *
207
+ * @param $templateName string Template name with array inheritance
208
+ */
209
+ public function testArrayInheritance($templateName)
210
+ {
211
+ $loader = new FilesystemLoader([]);
212
+ $loader->addPath(__DIR__.'/Fixtures/inheritance');
213
+
214
+ $twig = new Environment($loader);
215
+
216
+ $template = $twig->load($templateName);
217
+ $this->assertSame('VALID Child', $template->renderBlock('body', []));
218
+ }
219
+
220
+ /**
221
+ * @requires PHP 5.3
222
+ */
223
+ public function testLoadTemplateFromPhar()
224
+ {
225
+ $loader = new FilesystemLoader([]);
226
+ // phar-sample.phar was created with the following script:
227
+ // $f = new Phar('phar-test.phar');
228
+ // $f->addFromString('hello.twig', 'hello from phar');
229
+ $loader->addPath('phar://'.__DIR__.'/Fixtures/phar/phar-sample.phar');
230
+ $this->assertSame('hello from phar', $loader->getSourceContext('hello.twig')->getCode());
231
+ }
232
+
233
+ public function testTemplateExistsAlwaysReturnsBool()
234
+ {
235
+ $loader = new FilesystemLoader([]);
236
+ $this->assertFalse($loader->exists("foo\0.twig"));
237
+ $this->assertFalse($loader->exists('../foo.twig'));
238
+ $this->assertFalse($loader->exists('@foo'));
239
+ $this->assertFalse($loader->exists('foo'));
240
+ $this->assertFalse($loader->exists('@foo/bar.twig'));
241
+
242
+ $loader->addPath(__DIR__.'/Fixtures/normal');
243
+ $this->assertTrue($loader->exists('index.html'));
244
+ $loader->addPath(__DIR__.'/Fixtures/normal', 'foo');
245
+ $this->assertTrue($loader->exists('@foo/index.html'));
246
+ }
247
+ }
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/inheritance/parent.html.twig RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/inheritance/spare_parent.html.twig RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/named/index.html RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/named_bis/index.html RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/named_final/index.html RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/named_quater/named_absolute.html RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/named_ter/index.html RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/normal/index.html RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/normal_bis/index.html RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/normal_final/index.html RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/normal_ter/index.html RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/phar/phar-sample.phar RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/themes/theme1/blocks.html.twig RENAMED
File without changes
vendor/twig/twig/{test/Twig/Tests → tests}/Loader/Fixtures/themes/theme2/blocks.html.twig RENAMED
File without changes
vendor/twig/twig/tests/NativeExtensionTest.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ namespace Twig\Tests;
6
+
7
+ /*
8
+ * This file is part of Twig.
9
+ *
10
+ * (c) Fabien Potencier
11
+ *
12
+ * For the full copyright and license information, please view the LICENSE
13
+ * file that was distributed with this source code.
14
+ */
15
+
16
+ use Twig\Environment;
17
+ use Twig\Loader\ArrayLoader;
18
+
19
+ class NativeExtensionTest extends \PHPUnit\Framework\TestCase
20
+ {
21
+ /**
22
+ * @requires PHP 5.3
23
+ */
24
+ public function testGetProperties()
25
+ {
26
+ if (\PHP_VERSION_ID >= 70000) {
27
+ $this->markTestSkipped('Extension is not available on PHP 7+');
28
+ }
29
+
30
+ $twig = new Environment(new ArrayLoader(['index' => '{{ d1.date }}{{ d2.date }}']), [
31
+ 'debug' => true,
32
+ 'cache' => false,
33
+ 'autoescape' => false,
34
+ ]);
35
+
36
+ $d1 = new \DateTime();
37
+ $d2 = new \DateTime();
38
+ $output = $twig->render('index', compact('d1', 'd2'));
39
+
40
+ // If it fails, PHP will crash.
41
+ $this->assertEquals($output, $d1->date.$d2->date);
42
+ }
43
+ }
vendor/twig/twig/tests/Node/AutoEscapeTest.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\AutoEscapeNode;
15
+ use Twig\Node\Node;
16
+ use Twig\Node\TextNode;
17
+ use Twig\Test\NodeTestCase;
18
+
19
+ class AutoEscapeTest extends NodeTestCase
20
+ {
21
+ public function testConstructor()
22
+ {
23
+ $body = new Node([new TextNode('foo', 1)]);
24
+ $node = new AutoEscapeNode(true, $body, 1);
25
+
26
+ $this->assertEquals($body, $node->getNode('body'));
27
+ $this->assertTrue($node->getAttribute('value'));
28
+ }
29
+
30
+ public function getTests()
31
+ {
32
+ $body = new Node([new TextNode('foo', 1)]);
33
+ $node = new AutoEscapeNode(true, $body, 1);
34
+
35
+ return [
36
+ [$node, "// line 1\necho \"foo\";"],
37
+ ];
38
+ }
39
+ }
vendor/twig/twig/tests/Node/BlockReferenceTest.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\BlockReferenceNode;
15
+ use Twig\Test\NodeTestCase;
16
+
17
+ class BlockReferenceTest extends NodeTestCase
18
+ {
19
+ public function testConstructor()
20
+ {
21
+ $node = new BlockReferenceNode('foo', 1);
22
+
23
+ $this->assertEquals('foo', $node->getAttribute('name'));
24
+ }
25
+
26
+ public function getTests()
27
+ {
28
+ return [
29
+ [new BlockReferenceNode('foo', 1), <<<EOF
30
+ // line 1
31
+ \$this->displayBlock('foo', \$context, \$blocks);
32
+ EOF
33
+ ],
34
+ ];
35
+ }
36
+ }
vendor/twig/twig/tests/Node/BlockTest.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\BlockNode;
15
+ use Twig\Node\TextNode;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class BlockTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $body = new TextNode('foo', 1);
23
+ $node = new BlockNode('foo', $body, 1);
24
+
25
+ $this->assertEquals($body, $node->getNode('body'));
26
+ $this->assertEquals('foo', $node->getAttribute('name'));
27
+ }
28
+
29
+ public function getTests()
30
+ {
31
+ $body = new TextNode('foo', 1);
32
+ $node = new BlockNode('foo', $body, 1);
33
+
34
+ return [
35
+ [$node, <<<EOF
36
+ // line 1
37
+ public function block_foo(\$context, array \$blocks = [])
38
+ {
39
+ echo "foo";
40
+ }
41
+ EOF
42
+ ],
43
+ ];
44
+ }
45
+ }
vendor/twig/twig/tests/Node/DeprecatedTest.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Node\DeprecatedNode;
16
+ use Twig\Node\Expression\ConstantExpression;
17
+ use Twig\Node\Expression\FunctionExpression;
18
+ use Twig\Node\IfNode;
19
+ use Twig\Node\Node;
20
+ use Twig\Test\NodeTestCase;
21
+ use Twig\TwigFunction;
22
+
23
+ class DeprecatedTest extends NodeTestCase
24
+ {
25
+ public function testConstructor()
26
+ {
27
+ $expr = new ConstantExpression('foo', 1);
28
+ $node = new DeprecatedNode($expr, 1);
29
+
30
+ $this->assertEquals($expr, $node->getNode('expr'));
31
+ }
32
+
33
+ public function getTests()
34
+ {
35
+ $tests = [];
36
+
37
+ $expr = new ConstantExpression('This section is deprecated', 1);
38
+ $node = new DeprecatedNode($expr, 1, 'deprecated');
39
+ $node->setTemplateName('foo.twig');
40
+
41
+ $tests[] = [$node, <<<EOF
42
+ // line 1
43
+ @trigger_error("This section is deprecated"." (\"foo.twig\" at line 1).", E_USER_DEPRECATED);
44
+ EOF
45
+ ];
46
+
47
+ $t = new Node([
48
+ new ConstantExpression(true, 1),
49
+ new DeprecatedNode($expr, 2, 'deprecated'),
50
+ ], [], 1);
51
+ $node = new IfNode($t, null, 1);
52
+ $node->setTemplateName('foo.twig');
53
+
54
+ $tests[] = [$node, <<<EOF
55
+ // line 1
56
+ if (true) {
57
+ // line 2
58
+ @trigger_error("This section is deprecated"." (\"foo.twig\" at line 2).", E_USER_DEPRECATED);
59
+ }
60
+ EOF
61
+ ];
62
+
63
+ $environment = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
64
+ $environment->addFunction(new TwigFunction('foo', 'foo', []));
65
+
66
+ $expr = new FunctionExpression('foo', new Node(), 1);
67
+ $node = new DeprecatedNode($expr, 1, 'deprecated');
68
+ $node->setTemplateName('foo.twig');
69
+
70
+ $compiler = $this->getCompiler($environment);
71
+ $varName = $compiler->getVarName();
72
+
73
+ $tests[] = [$node, <<<EOF
74
+ // line 1
75
+ \$$varName = foo();
76
+ @trigger_error(\$$varName." (\"foo.twig\" at line 1).", E_USER_DEPRECATED);
77
+ EOF
78
+ , $environment];
79
+
80
+ return $tests;
81
+ }
82
+ }
vendor/twig/twig/tests/Node/DoTest.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\DoNode;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class DoTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $expr = new ConstantExpression('foo', 1);
23
+ $node = new DoNode($expr, 1);
24
+
25
+ $this->assertEquals($expr, $node->getNode('expr'));
26
+ }
27
+
28
+ public function getTests()
29
+ {
30
+ $tests = [];
31
+
32
+ $expr = new ConstantExpression('foo', 1);
33
+ $node = new DoNode($expr, 1);
34
+ $tests[] = [$node, "// line 1\n\"foo\";"];
35
+
36
+ return $tests;
37
+ }
38
+ }
vendor/twig/twig/tests/Node/Expression/ArrayTest.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\ArrayExpression;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class ArrayTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $elements = [new ConstantExpression('foo', 1), $foo = new ConstantExpression('bar', 1)];
23
+ $node = new ArrayExpression($elements, 1);
24
+
25
+ $this->assertEquals($foo, $node->getNode(1));
26
+ }
27
+
28
+ public function getTests()
29
+ {
30
+ $elements = [
31
+ new ConstantExpression('foo', 1),
32
+ new ConstantExpression('bar', 1),
33
+
34
+ new ConstantExpression('bar', 1),
35
+ new ConstantExpression('foo', 1),
36
+ ];
37
+ $node = new ArrayExpression($elements, 1);
38
+
39
+ return [
40
+ [$node, '["foo" => "bar", "bar" => "foo"]'],
41
+ ];
42
+ }
43
+ }
vendor/twig/twig/tests/Node/Expression/AssignNameTest.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\AssignNameExpression;
15
+ use Twig\Test\NodeTestCase;
16
+
17
+ class AssignNameTest extends NodeTestCase
18
+ {
19
+ public function testConstructor()
20
+ {
21
+ $node = new AssignNameExpression('foo', 1);
22
+
23
+ $this->assertEquals('foo', $node->getAttribute('name'));
24
+ }
25
+
26
+ public function getTests()
27
+ {
28
+ $node = new AssignNameExpression('foo', 1);
29
+
30
+ return [
31
+ [$node, '$context["foo"]'],
32
+ ];
33
+ }
34
+ }
vendor/twig/twig/tests/Node/Expression/Binary/AddTest.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\Binary;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\Binary\AddBinary;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class AddTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $left = new ConstantExpression(1, 1);
23
+ $right = new ConstantExpression(2, 1);
24
+ $node = new AddBinary($left, $right, 1);
25
+
26
+ $this->assertEquals($left, $node->getNode('left'));
27
+ $this->assertEquals($right, $node->getNode('right'));
28
+ }
29
+
30
+ public function getTests()
31
+ {
32
+ $left = new ConstantExpression(1, 1);
33
+ $right = new ConstantExpression(2, 1);
34
+ $node = new AddBinary($left, $right, 1);
35
+
36
+ return [
37
+ [$node, '(1 + 2)'],
38
+ ];
39
+ }
40
+ }
vendor/twig/twig/tests/Node/Expression/Binary/AndTest.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\Binary;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\Binary\AndBinary;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class AndTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $left = new ConstantExpression(1, 1);
23
+ $right = new ConstantExpression(2, 1);
24
+ $node = new AndBinary($left, $right, 1);
25
+
26
+ $this->assertEquals($left, $node->getNode('left'));
27
+ $this->assertEquals($right, $node->getNode('right'));
28
+ }
29
+
30
+ public function getTests()
31
+ {
32
+ $left = new ConstantExpression(1, 1);
33
+ $right = new ConstantExpression(2, 1);
34
+ $node = new AndBinary($left, $right, 1);
35
+
36
+ return [
37
+ [$node, '(1 && 2)'],
38
+ ];
39
+ }
40
+ }
vendor/twig/twig/tests/Node/Expression/Binary/ConcatTest.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\Binary;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\Binary\ConcatBinary;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class ConcatTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $left = new ConstantExpression(1, 1);
23
+ $right = new ConstantExpression(2, 1);
24
+ $node = new ConcatBinary($left, $right, 1);
25
+
26
+ $this->assertEquals($left, $node->getNode('left'));
27
+ $this->assertEquals($right, $node->getNode('right'));
28
+ }
29
+
30
+ public function getTests()
31
+ {
32
+ $left = new ConstantExpression(1, 1);
33
+ $right = new ConstantExpression(2, 1);
34
+ $node = new ConcatBinary($left, $right, 1);
35
+
36
+ return [
37
+ [$node, '(1 . 2)'],
38
+ ];
39
+ }
40
+ }
vendor/twig/twig/tests/Node/Expression/Binary/DivTest.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\Binary;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\Binary\DivBinary;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class DivTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $left = new ConstantExpression(1, 1);
23
+ $right = new ConstantExpression(2, 1);
24
+ $node = new DivBinary($left, $right, 1);
25
+
26
+ $this->assertEquals($left, $node->getNode('left'));
27
+ $this->assertEquals($right, $node->getNode('right'));
28
+ }
29
+
30
+ public function getTests()
31
+ {
32
+ $left = new ConstantExpression(1, 1);
33
+ $right = new ConstantExpression(2, 1);
34
+ $node = new DivBinary($left, $right, 1);
35
+
36
+ return [
37
+ [$node, '(1 / 2)'],
38
+ ];
39
+ }
40
+ }
vendor/twig/twig/tests/Node/Expression/Binary/FloorDivTest.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\Binary;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\Binary\FloorDivBinary;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class FloorDivTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $left = new ConstantExpression(1, 1);
23
+ $right = new ConstantExpression(2, 1);
24
+ $node = new FloorDivBinary($left, $right, 1);
25
+
26
+ $this->assertEquals($left, $node->getNode('left'));
27
+ $this->assertEquals($right, $node->getNode('right'));
28
+ }
29
+
30
+ public function getTests()
31
+ {
32
+ $left = new ConstantExpression(1, 1);
33
+ $right = new ConstantExpression(2, 1);
34
+ $node = new FloorDivBinary($left, $right, 1);
35
+
36
+ return [
37
+ [$node, '(int) floor((1 / 2))'],
38
+ ];
39
+ }
40
+ }
vendor/twig/twig/tests/Node/Expression/Binary/ModTest.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\Binary;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\Binary\ModBinary;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class ModTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $left = new ConstantExpression(1, 1);
23
+ $right = new ConstantExpression(2, 1);
24
+ $node = new ModBinary($left, $right, 1);
25
+
26
+ $this->assertEquals($left, $node->getNode('left'));
27
+ $this->assertEquals($right, $node->getNode('right'));
28
+ }
29
+
30
+ public function getTests()
31
+ {
32
+ $left = new ConstantExpression(1, 1);
33
+ $right = new ConstantExpression(2, 1);
34
+ $node = new ModBinary($left, $right, 1);
35
+
36
+ return [
37
+ [$node, '(1 % 2)'],
38
+ ];
39
+ }
40
+ }
vendor/twig/twig/tests/Node/Expression/Binary/MulTest.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\Binary;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\Binary\MulBinary;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class MulTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $left = new ConstantExpression(1, 1);
23
+ $right = new ConstantExpression(2, 1);
24
+ $node = new MulBinary($left, $right, 1);
25
+
26
+ $this->assertEquals($left, $node->getNode('left'));
27
+ $this->assertEquals($right, $node->getNode('right'));
28
+ }
29
+
30
+ public function getTests()
31
+ {
32
+ $left = new ConstantExpression(1, 1);
33
+ $right = new ConstantExpression(2, 1);
34
+ $node = new MulBinary($left, $right, 1);
35
+
36
+ return [
37
+ [$node, '(1 * 2)'],
38
+ ];
39
+ }
40
+ }
vendor/twig/twig/tests/Node/Expression/Binary/OrTest.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\Binary;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\Binary\OrBinary;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class OrTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $left = new ConstantExpression(1, 1);
23
+ $right = new ConstantExpression(2, 1);
24
+ $node = new OrBinary($left, $right, 1);
25
+
26
+ $this->assertEquals($left, $node->getNode('left'));
27
+ $this->assertEquals($right, $node->getNode('right'));
28
+ }
29
+
30
+ public function getTests()
31
+ {
32
+ $left = new ConstantExpression(1, 1);
33
+ $right = new ConstantExpression(2, 1);
34
+ $node = new OrBinary($left, $right, 1);
35
+
36
+ return [
37
+ [$node, '(1 || 2)'],
38
+ ];
39
+ }
40
+ }
vendor/twig/twig/tests/Node/Expression/Binary/SubTest.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\Binary;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\Binary\SubBinary;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class SubTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $left = new ConstantExpression(1, 1);
23
+ $right = new ConstantExpression(2, 1);
24
+ $node = new SubBinary($left, $right, 1);
25
+
26
+ $this->assertEquals($left, $node->getNode('left'));
27
+ $this->assertEquals($right, $node->getNode('right'));
28
+ }
29
+
30
+ public function getTests()
31
+ {
32
+ $left = new ConstantExpression(1, 1);
33
+ $right = new ConstantExpression(2, 1);
34
+ $node = new SubBinary($left, $right, 1);
35
+
36
+ return [
37
+ [$node, '(1 - 2)'],
38
+ ];
39
+ }
40
+ }
vendor/twig/twig/tests/Node/Expression/CallTest.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\CallExpression;
15
+
16
+ class CallTest extends \PHPUnit\Framework\TestCase
17
+ {
18
+ public function testGetArguments()
19
+ {
20
+ $node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
21
+ $this->assertEquals(['U', null], $node->getArguments('date', ['format' => 'U', 'timestamp' => null]));
22
+ }
23
+
24
+ public function testGetArgumentsWhenPositionalArgumentsAfterNamedArguments()
25
+ {
26
+ $this->expectException('\Twig\Error\SyntaxError');
27
+ $this->expectExceptionMessage('Positional arguments cannot be used after named arguments for function "date".');
28
+
29
+ $node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
30
+ $node->getArguments('date', ['timestamp' => 123456, 'Y-m-d']);
31
+ }
32
+
33
+ public function testGetArgumentsWhenArgumentIsDefinedTwice()
34
+ {
35
+ $this->expectException('\Twig\Error\SyntaxError');
36
+ $this->expectExceptionMessage('Argument "format" is defined twice for function "date".');
37
+
38
+ $node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
39
+ $node->getArguments('date', ['Y-m-d', 'format' => 'U']);
40
+ }
41
+
42
+ public function testGetArgumentsWithWrongNamedArgumentName()
43
+ {
44
+ $this->expectException('\Twig\Error\SyntaxError');
45
+ $this->expectExceptionMessage('Unknown argument "unknown" for function "date(format, timestamp)".');
46
+
47
+ $node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
48
+ $node->getArguments('date', ['Y-m-d', 'timestamp' => null, 'unknown' => '']);
49
+ }
50
+
51
+ public function testGetArgumentsWithWrongNamedArgumentNames()
52
+ {
53
+ $this->expectException('\Twig\Error\SyntaxError');
54
+ $this->expectExceptionMessage('Unknown arguments "unknown1", "unknown2" for function "date(format, timestamp)".');
55
+
56
+ $node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
57
+ $node->getArguments('date', ['Y-m-d', 'timestamp' => null, 'unknown1' => '', 'unknown2' => '']);
58
+ }
59
+
60
+ public function testResolveArgumentsWithMissingValueForOptionalArgument()
61
+ {
62
+ $this->expectException('\Twig\Error\SyntaxError');
63
+ $this->expectExceptionMessage('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".');
64
+
65
+ $node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'substr_compare']);
66
+ $node->getArguments('substr_compare', ['abcd', 'bc', 'offset' => 1, 'case_sensitivity' => true]);
67
+ }
68
+
69
+ public function testResolveArgumentsOnlyNecessaryArgumentsForCustomFunction()
70
+ {
71
+ $node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'custom_function']);
72
+
73
+ $this->assertEquals(['arg1'], $node->getArguments([$this, 'customFunction'], ['arg1' => 'arg1']));
74
+ }
75
+
76
+ public function testGetArgumentsForStaticMethod()
77
+ {
78
+ $node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'custom_static_function']);
79
+ $this->assertEquals(['arg1'], $node->getArguments(__CLASS__.'::customStaticFunction', ['arg1' => 'arg1']));
80
+ }
81
+
82
+ public function testResolveArgumentsWithMissingParameterForArbitraryArguments()
83
+ {
84
+ $this->expectException('\LogicException');
85
+ $this->expectExceptionMessage('The last parameter of "Twig\\Tests\\Node\\Expression\\CallTest::customFunctionWithArbitraryArguments" for function "foo" must be an array with default value, eg. "array $arg = []".');
86
+
87
+ $node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]);
88
+ $node->getArguments([$this, 'customFunctionWithArbitraryArguments'], []);
89
+ }
90
+
91
+ public static function customStaticFunction($arg1, $arg2 = 'default', $arg3 = [])
92
+ {
93
+ }
94
+
95
+ public function customFunction($arg1, $arg2 = 'default', $arg3 = [])
96
+ {
97
+ }
98
+
99
+ public function customFunctionWithArbitraryArguments()
100
+ {
101
+ }
102
+
103
+ public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnFunction()
104
+ {
105
+ $this->expectException('\LogicException');
106
+ $this->expectExceptionMessageRegExp('#^The last parameter of "Twig\\\\Tests\\\\Node\\\\Expression\\\\custom_Twig_Tests_Node_Expression_CallTest_function" for function "foo" must be an array with default value, eg\\. "array \\$arg \\= \\[\\]"\\.$#');
107
+
108
+ $node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]);
109
+ $node->getArguments('Twig\Tests\Node\Expression\custom_Twig_Tests_Node_Expression_CallTest_function', []);
110
+ }
111
+
112
+ public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnObject()
113
+ {
114
+ $this->expectException('\LogicException');
115
+ $this->expectExceptionMessageRegExp('#^The last parameter of "Twig\\\\Tests\\\\Node\\\\Expression\\\\CallableTestClass\\:\\:__invoke" for function "foo" must be an array with default value, eg\\. "array \\$arg \\= \\[\\]"\\.$#');
116
+
117
+ $node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]);
118
+ $node->getArguments(new CallableTestClass(), []);
119
+ }
120
+ }
121
+
122
+ class Node_Expression_Call extends CallExpression
123
+ {
124
+ public function getArguments($callable, $arguments)
125
+ {
126
+ return parent::getArguments($callable, $arguments);
127
+ }
128
+ }
129
+
130
+ class CallableTestClass
131
+ {
132
+ public function __invoke($required)
133
+ {
134
+ }
135
+ }
136
+
137
+ function custom_Twig_Tests_Node_Expression_CallTest_function($required)
138
+ {
139
+ }
vendor/twig/twig/tests/Node/Expression/ConditionalTest.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\ConditionalExpression;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class ConditionalTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $expr1 = new ConstantExpression(1, 1);
23
+ $expr2 = new ConstantExpression(2, 1);
24
+ $expr3 = new ConstantExpression(3, 1);
25
+ $node = new ConditionalExpression($expr1, $expr2, $expr3, 1);
26
+
27
+ $this->assertEquals($expr1, $node->getNode('expr1'));
28
+ $this->assertEquals($expr2, $node->getNode('expr2'));
29
+ $this->assertEquals($expr3, $node->getNode('expr3'));
30
+ }
31
+
32
+ public function getTests()
33
+ {
34
+ $tests = [];
35
+
36
+ $expr1 = new ConstantExpression(1, 1);
37
+ $expr2 = new ConstantExpression(2, 1);
38
+ $expr3 = new ConstantExpression(3, 1);
39
+ $node = new ConditionalExpression($expr1, $expr2, $expr3, 1);
40
+ $tests[] = [$node, '((1) ? (2) : (3))'];
41
+
42
+ return $tests;
43
+ }
44
+ }
vendor/twig/twig/tests/Node/Expression/ConstantTest.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\ConstantExpression;
15
+ use Twig\Test\NodeTestCase;
16
+
17
+ class ConstantTest extends NodeTestCase
18
+ {
19
+ public function testConstructor()
20
+ {
21
+ $node = new ConstantExpression('foo', 1);
22
+
23
+ $this->assertEquals('foo', $node->getAttribute('value'));
24
+ }
25
+
26
+ public function getTests()
27
+ {
28
+ $tests = [];
29
+
30
+ $node = new ConstantExpression('foo', 1);
31
+ $tests[] = [$node, '"foo"'];
32
+
33
+ return $tests;
34
+ }
35
+ }
vendor/twig/twig/tests/Node/Expression/FilterTest.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Node\Expression\FilterExpression;
17
+ use Twig\Node\Node;
18
+ use Twig\Test\NodeTestCase;
19
+ use Twig\TwigFilter;
20
+
21
+ class FilterTest extends NodeTestCase
22
+ {
23
+ public function testConstructor()
24
+ {
25
+ $expr = new ConstantExpression('foo', 1);
26
+ $name = new ConstantExpression('upper', 1);
27
+ $args = new Node();
28
+ $node = new FilterExpression($expr, $name, $args, 1);
29
+
30
+ $this->assertEquals($expr, $node->getNode('node'));
31
+ $this->assertEquals($name, $node->getNode('filter'));
32
+ $this->assertEquals($args, $node->getNode('arguments'));
33
+ }
34
+
35
+ public function getTests()
36
+ {
37
+ $environment = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
38
+ $environment->addFilter(new TwigFilter('bar', 'bar', ['needs_environment' => true]));
39
+ $environment->addFilter(new TwigFilter('barbar', 'Twig\Tests\Node\Expression\twig_tests_filter_barbar', ['needs_context' => true, 'is_variadic' => true]));
40
+
41
+ $tests = [];
42
+
43
+ $expr = new ConstantExpression('foo', 1);
44
+ $node = $this->createFilter($expr, 'upper');
45
+ $node = $this->createFilter($node, 'number_format', [new ConstantExpression(2, 1), new ConstantExpression('.', 1), new ConstantExpression(',', 1)]);
46
+
47
+ if (\function_exists('mb_get_info')) {
48
+ $tests[] = [$node, 'twig_number_format_filter($this->env, twig_upper_filter($this->env, "foo"), 2, ".", ",")'];
49
+ } else {
50
+ $tests[] = [$node, 'twig_number_format_filter($this->env, strtoupper("foo"), 2, ".", ",")'];
51
+ }
52
+
53
+ // named arguments
54
+ $date = new ConstantExpression(0, 1);
55
+ $node = $this->createFilter($date, 'date', [
56
+ 'timezone' => new ConstantExpression('America/Chicago', 1),
57
+ 'format' => new ConstantExpression('d/m/Y H:i:s P', 1),
58
+ ]);
59
+ $tests[] = [$node, 'twig_date_format_filter($this->env, 0, "d/m/Y H:i:s P", "America/Chicago")'];
60
+
61
+ // skip an optional argument
62
+ $date = new ConstantExpression(0, 1);
63
+ $node = $this->createFilter($date, 'date', [
64
+ 'timezone' => new ConstantExpression('America/Chicago', 1),
65
+ ]);
66
+ $tests[] = [$node, 'twig_date_format_filter($this->env, 0, null, "America/Chicago")'];
67
+
68
+ // underscores vs camelCase for named arguments
69
+ $string = new ConstantExpression('abc', 1);
70
+ $node = $this->createFilter($string, 'reverse', [
71
+ 'preserve_keys' => new ConstantExpression(true, 1),
72
+ ]);
73
+ $tests[] = [$node, 'twig_reverse_filter($this->env, "abc", true)'];
74
+ $node = $this->createFilter($string, 'reverse', [
75
+ 'preserveKeys' => new ConstantExpression(true, 1),
76
+ ]);
77
+ $tests[] = [$node, 'twig_reverse_filter($this->env, "abc", true)'];
78
+
79
+ // filter as an anonymous function
80
+ if (\PHP_VERSION_ID >= 50300) {
81
+ $node = $this->createFilter(new ConstantExpression('foo', 1), 'anonymous');
82
+ $tests[] = [$node, 'call_user_func_array($this->env->getFilter(\'anonymous\')->getCallable(), ["foo"])'];
83
+ }
84
+
85
+ // needs environment
86
+ $node = $this->createFilter($string, 'bar');
87
+ $tests[] = [$node, 'bar($this->env, "abc")', $environment];
88
+
89
+ $node = $this->createFilter($string, 'bar', [new ConstantExpression('bar', 1)]);
90
+ $tests[] = [$node, 'bar($this->env, "abc", "bar")', $environment];
91
+
92
+ // arbitrary named arguments
93
+ $node = $this->createFilter($string, 'barbar');
94
+ $tests[] = [$node, 'Twig\Tests\Node\Expression\twig_tests_filter_barbar($context, "abc")', $environment];
95
+
96
+ $node = $this->createFilter($string, 'barbar', ['foo' => new ConstantExpression('bar', 1)]);
97
+ $tests[] = [$node, 'Twig\Tests\Node\Expression\twig_tests_filter_barbar($context, "abc", null, null, ["foo" => "bar"])', $environment];
98
+
99
+ $node = $this->createFilter($string, 'barbar', ['arg2' => new ConstantExpression('bar', 1)]);
100
+ $tests[] = [$node, 'Twig\Tests\Node\Expression\twig_tests_filter_barbar($context, "abc", null, "bar")', $environment];
101
+
102
+ $node = $this->createFilter($string, 'barbar', [
103
+ new ConstantExpression('1', 1),
104
+ new ConstantExpression('2', 1),
105
+ new ConstantExpression('3', 1),
106
+ 'foo' => new ConstantExpression('bar', 1),
107
+ ]);
108
+ $tests[] = [$node, 'Twig\Tests\Node\Expression\twig_tests_filter_barbar($context, "abc", "1", "2", [0 => "3", "foo" => "bar"])', $environment];
109
+
110
+ return $tests;
111
+ }
112
+
113
+ public function testCompileWithWrongNamedArgumentName()
114
+ {
115
+ $this->expectException('\Twig\Error\SyntaxError');
116
+ $this->expectExceptionMessage('Unknown argument "foobar" for filter "date(format, timezone)" at line 1.');
117
+
118
+ $date = new ConstantExpression(0, 1);
119
+ $node = $this->createFilter($date, 'date', [
120
+ 'foobar' => new ConstantExpression('America/Chicago', 1),
121
+ ]);
122
+
123
+ $compiler = $this->getCompiler();
124
+ $compiler->compile($node);
125
+ }
126
+
127
+ public function testCompileWithMissingNamedArgument()
128
+ {
129
+ $this->expectException('\Twig\Error\SyntaxError');
130
+ $this->expectExceptionMessage('Value for argument "from" is required for filter "replace" at line 1.');
131
+
132
+ $value = new ConstantExpression(0, 1);
133
+ $node = $this->createFilter($value, 'replace', [
134
+ 'to' => new ConstantExpression('foo', 1),
135
+ ]);
136
+
137
+ $compiler = $this->getCompiler();
138
+ $compiler->compile($node);
139
+ }
140
+
141
+ protected function createFilter($node, $name, array $arguments = [])
142
+ {
143
+ $name = new ConstantExpression($name, 1);
144
+ $arguments = new Node($arguments);
145
+
146
+ return new FilterExpression($node, $name, $arguments, 1);
147
+ }
148
+
149
+ protected function getEnvironment()
150
+ {
151
+ if (\PHP_VERSION_ID >= 50300) {
152
+ return include 'PHP53/FilterInclude.php';
153
+ }
154
+
155
+ return parent::getEnvironment();
156
+ }
157
+ }
158
+
159
+ function twig_tests_filter_barbar($context, $string, $arg1 = null, $arg2 = null, array $args = [])
160
+ {
161
+ }
vendor/twig/twig/tests/Node/Expression/FunctionTest.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Node\Expression\FunctionExpression;
17
+ use Twig\Node\Node;
18
+ use Twig\Test\NodeTestCase;
19
+ use Twig\TwigFunction;
20
+
21
+ class FunctionTest extends NodeTestCase
22
+ {
23
+ public function testConstructor()
24
+ {
25
+ $name = 'function';
26
+ $args = new Node();
27
+ $node = new FunctionExpression($name, $args, 1);
28
+
29
+ $this->assertEquals($name, $node->getAttribute('name'));
30
+ $this->assertEquals($args, $node->getNode('arguments'));
31
+ }
32
+
33
+ public function getTests()
34
+ {
35
+ $environment = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
36
+ $environment->addFunction(new TwigFunction('foo', 'foo', []));
37
+ $environment->addFunction(new TwigFunction('bar', 'bar', ['needs_environment' => true]));
38
+ $environment->addFunction(new TwigFunction('foofoo', 'foofoo', ['needs_context' => true]));
39
+ $environment->addFunction(new TwigFunction('foobar', 'foobar', ['needs_environment' => true, 'needs_context' => true]));
40
+ $environment->addFunction(new TwigFunction('barbar', 'Twig\Tests\Node\Expression\twig_tests_function_barbar', ['is_variadic' => true]));
41
+
42
+ $tests = [];
43
+
44
+ $node = $this->createFunction('foo');
45
+ $tests[] = [$node, 'foo()', $environment];
46
+
47
+ $node = $this->createFunction('foo', [new ConstantExpression('bar', 1), new ConstantExpression('foobar', 1)]);
48
+ $tests[] = [$node, 'foo("bar", "foobar")', $environment];
49
+
50
+ $node = $this->createFunction('bar');
51
+ $tests[] = [$node, 'bar($this->env)', $environment];
52
+
53
+ $node = $this->createFunction('bar', [new ConstantExpression('bar', 1)]);
54
+ $tests[] = [$node, 'bar($this->env, "bar")', $environment];
55
+
56
+ $node = $this->createFunction('foofoo');
57
+ $tests[] = [$node, 'foofoo($context)', $environment];
58
+
59
+ $node = $this->createFunction('foofoo', [new ConstantExpression('bar', 1)]);
60
+ $tests[] = [$node, 'foofoo($context, "bar")', $environment];
61
+
62
+ $node = $this->createFunction('foobar');
63
+ $tests[] = [$node, 'foobar($this->env, $context)', $environment];
64
+
65
+ $node = $this->createFunction('foobar', [new ConstantExpression('bar', 1)]);
66
+ $tests[] = [$node, 'foobar($this->env, $context, "bar")', $environment];
67
+
68
+ // named arguments
69
+ $node = $this->createFunction('date', [
70
+ 'timezone' => new ConstantExpression('America/Chicago', 1),
71
+ 'date' => new ConstantExpression(0, 1),
72
+ ]);
73
+ $tests[] = [$node, 'twig_date_converter($this->env, 0, "America/Chicago")'];
74
+
75
+ // arbitrary named arguments
76
+ $node = $this->createFunction('barbar');
77
+ $tests[] = [$node, 'Twig\Tests\Node\Expression\twig_tests_function_barbar()', $environment];
78
+
79
+ $node = $this->createFunction('barbar', ['foo' => new ConstantExpression('bar', 1)]);
80
+ $tests[] = [$node, 'Twig\Tests\Node\Expression\twig_tests_function_barbar(null, null, ["foo" => "bar"])', $environment];
81
+
82
+ $node = $this->createFunction('barbar', ['arg2' => new ConstantExpression('bar', 1)]);
83
+ $tests[] = [$node, 'Twig\Tests\Node\Expression\twig_tests_function_barbar(null, "bar")', $environment];
84
+
85
+ $node = $this->createFunction('barbar', [
86
+ new ConstantExpression('1', 1),
87
+ new ConstantExpression('2', 1),
88
+ new ConstantExpression('3', 1),
89
+ 'foo' => new ConstantExpression('bar', 1),
90
+ ]);
91
+ $tests[] = [$node, 'Twig\Tests\Node\Expression\twig_tests_function_barbar("1", "2", [0 => "3", "foo" => "bar"])', $environment];
92
+
93
+ // function as an anonymous function
94
+ if (\PHP_VERSION_ID >= 50300) {
95
+ $node = $this->createFunction('anonymous', [new ConstantExpression('foo', 1)]);
96
+ $tests[] = [$node, 'call_user_func_array($this->env->getFunction(\'anonymous\')->getCallable(), ["foo"])'];
97
+ }
98
+
99
+ return $tests;
100
+ }
101
+
102
+ protected function createFunction($name, array $arguments = [])
103
+ {
104
+ return new FunctionExpression($name, new Node($arguments), 1);
105
+ }
106
+
107
+ protected function getEnvironment()
108
+ {
109
+ if (\PHP_VERSION_ID >= 50300) {
110
+ return include 'PHP53/FunctionInclude.php';
111
+ }
112
+
113
+ return parent::getEnvironment();
114
+ }
115
+ }
116
+
117
+ function twig_tests_function_barbar($arg1 = null, $arg2 = null, array $args = [])
118
+ {
119
+ }
vendor/twig/twig/tests/Node/Expression/GetAttrTest.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\ArrayExpression;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Node\Expression\GetAttrExpression;
17
+ use Twig\Node\Expression\NameExpression;
18
+ use Twig\Template;
19
+ use Twig\Test\NodeTestCase;
20
+
21
+ class GetAttrTest extends NodeTestCase
22
+ {
23
+ public function testConstructor()
24
+ {
25
+ $expr = new NameExpression('foo', 1);
26
+ $attr = new ConstantExpression('bar', 1);
27
+ $args = new ArrayExpression([], 1);
28
+ $args->addElement(new NameExpression('foo', 1));
29
+ $args->addElement(new ConstantExpression('bar', 1));
30
+ $node = new GetAttrExpression($expr, $attr, $args, Template::ARRAY_CALL, 1);
31
+
32
+ $this->assertEquals($expr, $node->getNode('node'));
33
+ $this->assertEquals($attr, $node->getNode('attribute'));
34
+ $this->assertEquals($args, $node->getNode('arguments'));
35
+ $this->assertEquals(Template::ARRAY_CALL, $node->getAttribute('type'));
36
+ }
37
+
38
+ public function getTests()
39
+ {
40
+ $tests = [];
41
+
42
+ $expr = new NameExpression('foo', 1);
43
+ $attr = new ConstantExpression('bar', 1);
44
+ $args = new ArrayExpression([], 1);
45
+ $node = new GetAttrExpression($expr, $attr, $args, Template::ANY_CALL, 1);
46
+ $tests[] = [$node, sprintf('%s%s, "bar", [])', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))];
47
+
48
+ $node = new GetAttrExpression($expr, $attr, $args, Template::ARRAY_CALL, 1);
49
+ $tests[] = [$node, sprintf('%s%s, "bar", [], "array")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))];
50
+
51
+ $args = new ArrayExpression([], 1);
52
+ $args->addElement(new NameExpression('foo', 1));
53
+ $args->addElement(new ConstantExpression('bar', 1));
54
+ $node = new GetAttrExpression($expr, $attr, $args, Template::METHOD_CALL, 1);
55
+ $tests[] = [$node, sprintf('%s%s, "bar", [0 => %s, 1 => "bar"], "method")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1), $this->getVariableGetter('foo'))];
56
+
57
+ return $tests;
58
+ }
59
+ }
vendor/twig/twig/tests/Node/Expression/NameTest.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Node\Expression\NameExpression;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class NameTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $node = new NameExpression('foo', 1);
23
+
24
+ $this->assertEquals('foo', $node->getAttribute('name'));
25
+ }
26
+
27
+ public function getTests()
28
+ {
29
+ $node = new NameExpression('foo', 1);
30
+ $context = new NameExpression('_context', 1);
31
+
32
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['strict_variables' => true]);
33
+ $env1 = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['strict_variables' => false]);
34
+
35
+ if (\PHP_VERSION_ID >= 70000) {
36
+ $output = '($context["foo"] ?? $this->getContext($context, "foo"))';
37
+ } elseif (\PHP_VERSION_ID >= 50400) {
38
+ $output = '(isset($context["foo"]) ? $context["foo"] : $this->getContext($context, "foo"))';
39
+ } else {
40
+ $output = '$this->getContext($context, "foo")';
41
+ }
42
+
43
+ return [
44
+ [$node, "// line 1\n".$output, $env],
45
+ [$node, $this->getVariableGetter('foo', 1), $env1],
46
+ [$context, "// line 1\n\$context"],
47
+ ];
48
+ }
49
+ }
vendor/twig/twig/tests/Node/Expression/NullCoalesceTest.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\ConstantExpression;
15
+ use Twig\Node\Expression\NameExpression;
16
+ use Twig\Node\Expression\NullCoalesceExpression;
17
+ use Twig\Test\NodeTestCase;
18
+
19
+ class NullCoalesceTest extends NodeTestCase
20
+ {
21
+ public function getTests()
22
+ {
23
+ $tests = [];
24
+
25
+ $left = new NameExpression('foo', 1);
26
+ $right = new ConstantExpression(2, 1);
27
+ $node = new NullCoalesceExpression($left, $right, 1);
28
+ if (\PHP_VERSION_ID >= 70000) {
29
+ $tests[] = [$node, "((// line 1\n\$context[\"foo\"]) ?? (2))"];
30
+ } elseif (\PHP_VERSION_ID >= 50400) {
31
+ $tests[] = [$node, "(((// line 1\n(isset(\$context[\"foo\"]) || array_key_exists(\"foo\", \$context)) && !(null === (isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)))) ? ((isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)) : (2))"];
32
+ } else {
33
+ $tests[] = [$node, "(((// line 1\n(isset(\$context[\"foo\"]) || array_key_exists(\"foo\", \$context)) && !(null === \$this->getContext(\$context, \"foo\")))) ? (\$this->getContext(\$context, \"foo\")) : (2))"];
34
+ }
35
+
36
+ return $tests;
37
+ }
38
+ }
vendor/twig/twig/tests/Node/Expression/PHP53/FilterInclude.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\PHP53;
4
+
5
+ $env = new \Twig\Environment(new \Twig\Loader\ArrayLoader([]));
6
+ $env->addFilter(new \Twig\TwigFilter('anonymous', function () {}));
7
+
8
+ return $env;
vendor/twig/twig/tests/Node/Expression/PHP53/FunctionInclude.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\PHP53;
4
+
5
+ $env = new \Twig\Environment(new \Twig\Loader\ArrayLoader([]));
6
+ $env->addFunction(new \Twig\TwigFunction('anonymous', function () {}));
7
+
8
+ return $env;
vendor/twig/twig/tests/Node/Expression/PHP53/TestInclude.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\PHP53;
4
+
5
+ $env = new \Twig\Environment(new \Twig\Loader\ArrayLoader([]));
6
+ $env->addTest(new \Twig\TwigTest('anonymous', function () {}));
7
+
8
+ return $env;
vendor/twig/twig/tests/Node/Expression/ParentTest.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\ParentExpression;
15
+ use Twig\Test\NodeTestCase;
16
+
17
+ class ParentTest extends NodeTestCase
18
+ {
19
+ public function testConstructor()
20
+ {
21
+ $node = new ParentExpression('foo', 1);
22
+
23
+ $this->assertEquals('foo', $node->getAttribute('name'));
24
+ }
25
+
26
+ public function getTests()
27
+ {
28
+ $tests = [];
29
+ $tests[] = [new ParentExpression('foo', 1), '$this->renderParentBlock("foo", $context, $blocks)'];
30
+
31
+ return $tests;
32
+ }
33
+ }
vendor/twig/twig/tests/Node/Expression/TestTest.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Node\Expression\Test\NullTest;
17
+ use Twig\Node\Expression\TestExpression;
18
+ use Twig\Node\Node;
19
+ use Twig\Test\NodeTestCase;
20
+ use Twig\TwigTest;
21
+
22
+ class TestTest extends NodeTestCase
23
+ {
24
+ public function testConstructor()
25
+ {
26
+ $expr = new ConstantExpression('foo', 1);
27
+ $name = new ConstantExpression('null', 1);
28
+ $args = new Node();
29
+ $node = new TestExpression($expr, $name, $args, 1);
30
+
31
+ $this->assertEquals($expr, $node->getNode('node'));
32
+ $this->assertEquals($args, $node->getNode('arguments'));
33
+ $this->assertEquals($name, $node->getAttribute('name'));
34
+ }
35
+
36
+ public function getTests()
37
+ {
38
+ $environment = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
39
+ $environment->addTest(new TwigTest('barbar', 'Twig\Tests\Node\Expression\twig_tests_test_barbar', ['is_variadic' => true, 'need_context' => true]));
40
+
41
+ $tests = [];
42
+
43
+ $expr = new ConstantExpression('foo', 1);
44
+ $node = new NullTest($expr, 'null', new Node([]), 1);
45
+ $tests[] = [$node, '(null === "foo")'];
46
+
47
+ // test as an anonymous function
48
+ if (\PHP_VERSION_ID >= 50300) {
49
+ $node = $this->createTest(new ConstantExpression('foo', 1), 'anonymous', [new ConstantExpression('foo', 1)]);
50
+ $tests[] = [$node, 'call_user_func_array($this->env->getTest(\'anonymous\')->getCallable(), ["foo", "foo"])'];
51
+ }
52
+
53
+ // arbitrary named arguments
54
+ $string = new ConstantExpression('abc', 1);
55
+ $node = $this->createTest($string, 'barbar');
56
+ $tests[] = [$node, 'Twig\Tests\Node\Expression\twig_tests_test_barbar("abc")', $environment];
57
+
58
+ $node = $this->createTest($string, 'barbar', ['foo' => new ConstantExpression('bar', 1)]);
59
+ $tests[] = [$node, 'Twig\Tests\Node\Expression\twig_tests_test_barbar("abc", null, null, ["foo" => "bar"])', $environment];
60
+
61
+ $node = $this->createTest($string, 'barbar', ['arg2' => new ConstantExpression('bar', 1)]);
62
+ $tests[] = [$node, 'Twig\Tests\Node\Expression\twig_tests_test_barbar("abc", null, "bar")', $environment];
63
+
64
+ $node = $this->createTest($string, 'barbar', [
65
+ new ConstantExpression('1', 1),
66
+ new ConstantExpression('2', 1),
67
+ new ConstantExpression('3', 1),
68
+ 'foo' => new ConstantExpression('bar', 1),
69
+ ]);
70
+ $tests[] = [$node, 'Twig\Tests\Node\Expression\twig_tests_test_barbar("abc", "1", "2", [0 => "3", "foo" => "bar"])', $environment];
71
+
72
+ return $tests;
73
+ }
74
+
75
+ protected function createTest($node, $name, array $arguments = [])
76
+ {
77
+ return new TestExpression($node, $name, new Node($arguments), 1);
78
+ }
79
+
80
+ protected function getEnvironment()
81
+ {
82
+ if (\PHP_VERSION_ID >= 50300) {
83
+ return include 'PHP53/TestInclude.php';
84
+ }
85
+
86
+ return parent::getEnvironment();
87
+ }
88
+ }
89
+
90
+ function twig_tests_test_barbar($string, $arg1 = null, $arg2 = null, array $args = [])
91
+ {
92
+ }
vendor/twig/twig/tests/Node/Expression/Unary/NegTest.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\Unary;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\ConstantExpression;
15
+ use Twig\Node\Expression\Unary\NegUnary;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class NegTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $expr = new ConstantExpression(1, 1);
23
+ $node = new NegUnary($expr, 1);
24
+
25
+ $this->assertEquals($expr, $node->getNode('node'));
26
+ }
27
+
28
+ public function getTests()
29
+ {
30
+ $node = new ConstantExpression(1, 1);
31
+ $node = new NegUnary($node, 1);
32
+
33
+ return [
34
+ [$node, '-1'],
35
+ [new NegUnary($node, 1), '- -1'],
36
+ ];
37
+ }
38
+ }
vendor/twig/twig/tests/Node/Expression/Unary/NotTest.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\Unary;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\ConstantExpression;
15
+ use Twig\Node\Expression\Unary\NotUnary;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class NotTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $expr = new ConstantExpression(1, 1);
23
+ $node = new NotUnary($expr, 1);
24
+
25
+ $this->assertEquals($expr, $node->getNode('node'));
26
+ }
27
+
28
+ public function getTests()
29
+ {
30
+ $node = new ConstantExpression(1, 1);
31
+ $node = new NotUnary($node, 1);
32
+
33
+ return [
34
+ [$node, '!1'],
35
+ ];
36
+ }
37
+ }
vendor/twig/twig/tests/Node/Expression/Unary/PosTest.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node\Expression\Unary;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\ConstantExpression;
15
+ use Twig\Node\Expression\Unary\PosUnary;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class PosTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $expr = new ConstantExpression(1, 1);
23
+ $node = new PosUnary($expr, 1);
24
+
25
+ $this->assertEquals($expr, $node->getNode('node'));
26
+ }
27
+
28
+ public function getTests()
29
+ {
30
+ $node = new ConstantExpression(1, 1);
31
+ $node = new PosUnary($node, 1);
32
+
33
+ return [
34
+ [$node, '+1'],
35
+ ];
36
+ }
37
+ }
vendor/twig/twig/tests/Node/ForTest.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\AssignNameExpression;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Node\Expression\NameExpression;
17
+ use Twig\Node\ForNode;
18
+ use Twig\Node\Node;
19
+ use Twig\Node\PrintNode;
20
+ use Twig\Test\NodeTestCase;
21
+
22
+ class ForTest extends NodeTestCase
23
+ {
24
+ public function testConstructor()
25
+ {
26
+ $keyTarget = new AssignNameExpression('key', 1);
27
+ $valueTarget = new AssignNameExpression('item', 1);
28
+ $seq = new NameExpression('items', 1);
29
+ $ifexpr = new ConstantExpression(true, 1);
30
+ $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1);
31
+ $else = null;
32
+ $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
33
+ $node->setAttribute('with_loop', false);
34
+
35
+ $this->assertEquals($keyTarget, $node->getNode('key_target'));
36
+ $this->assertEquals($valueTarget, $node->getNode('value_target'));
37
+ $this->assertEquals($seq, $node->getNode('seq'));
38
+ $this->assertTrue($node->getAttribute('ifexpr'));
39
+ $this->assertInstanceOf('\Twig\Node\IfNode', $node->getNode('body'));
40
+ $this->assertEquals($body, $node->getNode('body')->getNode('tests')->getNode(1)->getNode(0));
41
+ $this->assertFalse($node->hasNode('else'));
42
+
43
+ $else = new PrintNode(new NameExpression('foo', 1), 1);
44
+ $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
45
+ $node->setAttribute('with_loop', false);
46
+ $this->assertEquals($else, $node->getNode('else'));
47
+ }
48
+
49
+ public function getTests()
50
+ {
51
+ $tests = [];
52
+
53
+ $keyTarget = new AssignNameExpression('key', 1);
54
+ $valueTarget = new AssignNameExpression('item', 1);
55
+ $seq = new NameExpression('items', 1);
56
+ $ifexpr = null;
57
+ $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1);
58
+ $else = null;
59
+ $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
60
+ $node->setAttribute('with_loop', false);
61
+
62
+ $tests[] = [$node, <<<EOF
63
+ // line 1
64
+ \$context['_parent'] = \$context;
65
+ \$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('items')});
66
+ foreach (\$context['_seq'] as \$context["key"] => \$context["item"]) {
67
+ echo {$this->getVariableGetter('foo')};
68
+ }
69
+ \$_parent = \$context['_parent'];
70
+ unset(\$context['_seq'], \$context['_iterated'], \$context['key'], \$context['item'], \$context['_parent'], \$context['loop']);
71
+ \$context = array_intersect_key(\$context, \$_parent) + \$_parent;
72
+ EOF
73
+ ];
74
+
75
+ $keyTarget = new AssignNameExpression('k', 1);
76
+ $valueTarget = new AssignNameExpression('v', 1);
77
+ $seq = new NameExpression('values', 1);
78
+ $ifexpr = null;
79
+ $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1);
80
+ $else = null;
81
+ $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
82
+ $node->setAttribute('with_loop', true);
83
+
84
+ $tests[] = [$node, <<<EOF
85
+ // line 1
86
+ \$context['_parent'] = \$context;
87
+ \$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('values')});
88
+ \$context['loop'] = [
89
+ 'parent' => \$context['_parent'],
90
+ 'index0' => 0,
91
+ 'index' => 1,
92
+ 'first' => true,
93
+ ];
94
+ if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof \Countable)) {
95
+ \$length = count(\$context['_seq']);
96
+ \$context['loop']['revindex0'] = \$length - 1;
97
+ \$context['loop']['revindex'] = \$length;
98
+ \$context['loop']['length'] = \$length;
99
+ \$context['loop']['last'] = 1 === \$length;
100
+ }
101
+ foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) {
102
+ echo {$this->getVariableGetter('foo')};
103
+ ++\$context['loop']['index0'];
104
+ ++\$context['loop']['index'];
105
+ \$context['loop']['first'] = false;
106
+ if (isset(\$context['loop']['length'])) {
107
+ --\$context['loop']['revindex0'];
108
+ --\$context['loop']['revindex'];
109
+ \$context['loop']['last'] = 0 === \$context['loop']['revindex0'];
110
+ }
111
+ }
112
+ \$_parent = \$context['_parent'];
113
+ unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']);
114
+ \$context = array_intersect_key(\$context, \$_parent) + \$_parent;
115
+ EOF
116
+ ];
117
+
118
+ $keyTarget = new AssignNameExpression('k', 1);
119
+ $valueTarget = new AssignNameExpression('v', 1);
120
+ $seq = new NameExpression('values', 1);
121
+ $ifexpr = new ConstantExpression(true, 1);
122
+ $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1);
123
+ $else = null;
124
+ $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
125
+ $node->setAttribute('with_loop', true);
126
+
127
+ $tests[] = [$node, <<<EOF
128
+ // line 1
129
+ \$context['_parent'] = \$context;
130
+ \$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('values')});
131
+ \$context['loop'] = [
132
+ 'parent' => \$context['_parent'],
133
+ 'index0' => 0,
134
+ 'index' => 1,
135
+ 'first' => true,
136
+ ];
137
+ foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) {
138
+ if (true) {
139
+ echo {$this->getVariableGetter('foo')};
140
+ ++\$context['loop']['index0'];
141
+ ++\$context['loop']['index'];
142
+ \$context['loop']['first'] = false;
143
+ }
144
+ }
145
+ \$_parent = \$context['_parent'];
146
+ unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']);
147
+ \$context = array_intersect_key(\$context, \$_parent) + \$_parent;
148
+ EOF
149
+ ];
150
+
151
+ $keyTarget = new AssignNameExpression('k', 1);
152
+ $valueTarget = new AssignNameExpression('v', 1);
153
+ $seq = new NameExpression('values', 1);
154
+ $ifexpr = null;
155
+ $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1);
156
+ $else = new PrintNode(new NameExpression('foo', 1), 1);
157
+ $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
158
+ $node->setAttribute('with_loop', true);
159
+
160
+ $tests[] = [$node, <<<EOF
161
+ // line 1
162
+ \$context['_parent'] = \$context;
163
+ \$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('values')});
164
+ \$context['_iterated'] = false;
165
+ \$context['loop'] = [
166
+ 'parent' => \$context['_parent'],
167
+ 'index0' => 0,
168
+ 'index' => 1,
169
+ 'first' => true,
170
+ ];
171
+ if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof \Countable)) {
172
+ \$length = count(\$context['_seq']);
173
+ \$context['loop']['revindex0'] = \$length - 1;
174
+ \$context['loop']['revindex'] = \$length;
175
+ \$context['loop']['length'] = \$length;
176
+ \$context['loop']['last'] = 1 === \$length;
177
+ }
178
+ foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) {
179
+ echo {$this->getVariableGetter('foo')};
180
+ \$context['_iterated'] = true;
181
+ ++\$context['loop']['index0'];
182
+ ++\$context['loop']['index'];
183
+ \$context['loop']['first'] = false;
184
+ if (isset(\$context['loop']['length'])) {
185
+ --\$context['loop']['revindex0'];
186
+ --\$context['loop']['revindex'];
187
+ \$context['loop']['last'] = 0 === \$context['loop']['revindex0'];
188
+ }
189
+ }
190
+ if (!\$context['_iterated']) {
191
+ echo {$this->getVariableGetter('foo')};
192
+ }
193
+ \$_parent = \$context['_parent'];
194
+ unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']);
195
+ \$context = array_intersect_key(\$context, \$_parent) + \$_parent;
196
+ EOF
197
+ ];
198
+
199
+ return $tests;
200
+ }
201
+ }
vendor/twig/twig/tests/Node/IfTest.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\ConstantExpression;
15
+ use Twig\Node\Expression\NameExpression;
16
+ use Twig\Node\IfNode;
17
+ use Twig\Node\Node;
18
+ use Twig\Node\PrintNode;
19
+ use Twig\Test\NodeTestCase;
20
+
21
+ class IfTest extends NodeTestCase
22
+ {
23
+ public function testConstructor()
24
+ {
25
+ $t = new Node([
26
+ new ConstantExpression(true, 1),
27
+ new PrintNode(new NameExpression('foo', 1), 1),
28
+ ], [], 1);
29
+ $else = null;
30
+ $node = new IfNode($t, $else, 1);
31
+
32
+ $this->assertEquals($t, $node->getNode('tests'));
33
+ $this->assertFalse($node->hasNode('else'));
34
+
35
+ $else = new PrintNode(new NameExpression('bar', 1), 1);
36
+ $node = new IfNode($t, $else, 1);
37
+ $this->assertEquals($else, $node->getNode('else'));
38
+ }
39
+
40
+ public function getTests()
41
+ {
42
+ $tests = [];
43
+
44
+ $t = new Node([
45
+ new ConstantExpression(true, 1),
46
+ new PrintNode(new NameExpression('foo', 1), 1),
47
+ ], [], 1);
48
+ $else = null;
49
+ $node = new IfNode($t, $else, 1);
50
+
51
+ $tests[] = [$node, <<<EOF
52
+ // line 1
53
+ if (true) {
54
+ echo {$this->getVariableGetter('foo')};
55
+ }
56
+ EOF
57
+ ];
58
+
59
+ $t = new Node([
60
+ new ConstantExpression(true, 1),
61
+ new PrintNode(new NameExpression('foo', 1), 1),
62
+ new ConstantExpression(false, 1),
63
+ new PrintNode(new NameExpression('bar', 1), 1),
64
+ ], [], 1);
65
+ $else = null;
66
+ $node = new IfNode($t, $else, 1);
67
+
68
+ $tests[] = [$node, <<<EOF
69
+ // line 1
70
+ if (true) {
71
+ echo {$this->getVariableGetter('foo')};
72
+ } elseif (false) {
73
+ echo {$this->getVariableGetter('bar')};
74
+ }
75
+ EOF
76
+ ];
77
+
78
+ $t = new Node([
79
+ new ConstantExpression(true, 1),
80
+ new PrintNode(new NameExpression('foo', 1), 1),
81
+ ], [], 1);
82
+ $else = new PrintNode(new NameExpression('bar', 1), 1);
83
+ $node = new IfNode($t, $else, 1);
84
+
85
+ $tests[] = [$node, <<<EOF
86
+ // line 1
87
+ if (true) {
88
+ echo {$this->getVariableGetter('foo')};
89
+ } else {
90
+ echo {$this->getVariableGetter('bar')};
91
+ }
92
+ EOF
93
+ ];
94
+
95
+ return $tests;
96
+ }
97
+ }
vendor/twig/twig/tests/Node/ImportTest.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\AssignNameExpression;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Node\ImportNode;
17
+ use Twig\Test\NodeTestCase;
18
+
19
+ class ImportTest extends NodeTestCase
20
+ {
21
+ public function testConstructor()
22
+ {
23
+ $macro = new ConstantExpression('foo.twig', 1);
24
+ $var = new AssignNameExpression('macro', 1);
25
+ $node = new ImportNode($macro, $var, 1);
26
+
27
+ $this->assertEquals($macro, $node->getNode('expr'));
28
+ $this->assertEquals($var, $node->getNode('var'));
29
+ }
30
+
31
+ public function getTests()
32
+ {
33
+ $tests = [];
34
+
35
+ $macro = new ConstantExpression('foo.twig', 1);
36
+ $var = new AssignNameExpression('macro', 1);
37
+ $node = new ImportNode($macro, $var, 1);
38
+
39
+ $tests[] = [$node, <<<EOF
40
+ // line 1
41
+ \$context["macro"] = \$this->loadTemplate("foo.twig", null, 1)->unwrap();
42
+ EOF
43
+ ];
44
+
45
+ return $tests;
46
+ }
47
+ }
vendor/twig/twig/tests/Node/IncludeTest.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\ArrayExpression;
15
+ use Twig\Node\Expression\ConditionalExpression;
16
+ use Twig\Node\Expression\ConstantExpression;
17
+ use Twig\Node\IncludeNode;
18
+ use Twig\Test\NodeTestCase;
19
+
20
+ class IncludeTest extends NodeTestCase
21
+ {
22
+ public function testConstructor()
23
+ {
24
+ $expr = new ConstantExpression('foo.twig', 1);
25
+ $node = new IncludeNode($expr, null, false, false, 1);
26
+
27
+ $this->assertFalse($node->hasNode('variables'));
28
+ $this->assertEquals($expr, $node->getNode('expr'));
29
+ $this->assertFalse($node->getAttribute('only'));
30
+
31
+ $vars = new ArrayExpression([new ConstantExpression('foo', 1), new ConstantExpression(true, 1)], 1);
32
+ $node = new IncludeNode($expr, $vars, true, false, 1);
33
+ $this->assertEquals($vars, $node->getNode('variables'));
34
+ $this->assertTrue($node->getAttribute('only'));
35
+ }
36
+
37
+ public function getTests()
38
+ {
39
+ $tests = [];
40
+
41
+ $expr = new ConstantExpression('foo.twig', 1);
42
+ $node = new IncludeNode($expr, null, false, false, 1);
43
+ $tests[] = [$node, <<<EOF
44
+ // line 1
45
+ \$this->loadTemplate("foo.twig", null, 1)->display(\$context);
46
+ EOF
47
+ ];
48
+
49
+ $expr = new ConditionalExpression(
50
+ new ConstantExpression(true, 1),
51
+ new ConstantExpression('foo', 1),
52
+ new ConstantExpression('foo', 1),
53
+ 0
54
+ );
55
+ $node = new IncludeNode($expr, null, false, false, 1);
56
+ $tests[] = [$node, <<<EOF
57
+ // line 1
58
+ \$this->loadTemplate(((true) ? ("foo") : ("foo")), null, 1)->display(\$context);
59
+ EOF
60
+ ];
61
+
62
+ $expr = new ConstantExpression('foo.twig', 1);
63
+ $vars = new ArrayExpression([new ConstantExpression('foo', 1), new ConstantExpression(true, 1)], 1);
64
+ $node = new IncludeNode($expr, $vars, false, false, 1);
65
+ $tests[] = [$node, <<<EOF
66
+ // line 1
67
+ \$this->loadTemplate("foo.twig", null, 1)->display(twig_array_merge(\$context, ["foo" => true]));
68
+ EOF
69
+ ];
70
+
71
+ $node = new IncludeNode($expr, $vars, true, false, 1);
72
+ $tests[] = [$node, <<<EOF
73
+ // line 1
74
+ \$this->loadTemplate("foo.twig", null, 1)->display(twig_to_array(["foo" => true]));
75
+ EOF
76
+ ];
77
+
78
+ $node = new IncludeNode($expr, $vars, true, true, 1);
79
+ $tests[] = [$node, <<<EOF
80
+ // line 1
81
+ \$__internal_%s = null;
82
+ try {
83
+ \$__internal_%s = \$this->loadTemplate("foo.twig", null, 1);
84
+ } catch (LoaderError \$e) {
85
+ // ignore missing template
86
+ }
87
+ if (\$__internal_%s) {
88
+ \$__internal_%s->display(twig_to_array(["foo" => true]));
89
+ }
90
+ EOF
91
+ , null, true];
92
+
93
+ return $tests;
94
+ }
95
+ }
vendor/twig/twig/tests/Node/MacroTest.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\ConstantExpression;
15
+ use Twig\Node\Expression\NameExpression;
16
+ use Twig\Node\MacroNode;
17
+ use Twig\Node\Node;
18
+ use Twig\Node\TextNode;
19
+ use Twig\Test\NodeTestCase;
20
+
21
+ class MacroTest extends NodeTestCase
22
+ {
23
+ public function testConstructor()
24
+ {
25
+ $body = new TextNode('foo', 1);
26
+ $arguments = new Node([new NameExpression('foo', 1)], [], 1);
27
+ $node = new MacroNode('foo', $body, $arguments, 1);
28
+
29
+ $this->assertEquals($body, $node->getNode('body'));
30
+ $this->assertEquals($arguments, $node->getNode('arguments'));
31
+ $this->assertEquals('foo', $node->getAttribute('name'));
32
+ }
33
+
34
+ public function getTests()
35
+ {
36
+ $body = new TextNode('foo', 1);
37
+ $arguments = new Node([
38
+ 'foo' => new ConstantExpression(null, 1),
39
+ 'bar' => new ConstantExpression('Foo', 1),
40
+ ], [], 1);
41
+ $node = new MacroNode('foo', $body, $arguments, 1);
42
+
43
+ if (\PHP_VERSION_ID >= 50600) {
44
+ $declaration = ', ...$__varargs__';
45
+ $varargs = '$__varargs__';
46
+ } else {
47
+ $declaration = '';
48
+ $varargs = 'func_num_args() > 2 ? array_slice(func_get_args(), 2) : []';
49
+ }
50
+
51
+ return [
52
+ [$node, <<<EOF
53
+ // line 1
54
+ public function getfoo(\$__foo__ = null, \$__bar__ = "Foo"$declaration)
55
+ {
56
+ \$context = \$this->env->mergeGlobals([
57
+ "foo" => \$__foo__,
58
+ "bar" => \$__bar__,
59
+ "varargs" => $varargs,
60
+ ]);
61
+
62
+ \$blocks = [];
63
+
64
+ ob_start(function () { return ''; });
65
+ try {
66
+ echo "foo";
67
+ } catch (\Exception \$e) {
68
+ ob_end_clean();
69
+
70
+ throw \$e;
71
+ } catch (\Throwable \$e) {
72
+ ob_end_clean();
73
+
74
+ throw \$e;
75
+ }
76
+
77
+ return ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset());
78
+ }
79
+ EOF
80
+ ],
81
+ ];
82
+ }
83
+ }
vendor/twig/twig/tests/Node/ModuleTest.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Node\Expression\AssignNameExpression;
16
+ use Twig\Node\Expression\ConditionalExpression;
17
+ use Twig\Node\Expression\ConstantExpression;
18
+ use Twig\Node\ImportNode;
19
+ use Twig\Node\ModuleNode;
20
+ use Twig\Node\Node;
21
+ use Twig\Node\SetNode;
22
+ use Twig\Node\TextNode;
23
+ use Twig\Source;
24
+ use Twig\Test\NodeTestCase;
25
+
26
+ class ModuleTest extends NodeTestCase
27
+ {
28
+ public function testConstructor()
29
+ {
30
+ $body = new TextNode('foo', 1);
31
+ $parent = new ConstantExpression('layout.twig', 1);
32
+ $blocks = new Node();
33
+ $macros = new Node();
34
+ $traits = new Node();
35
+ $source = new Source('{{ foo }}', 'foo.twig');
36
+ $node = new ModuleNode($body, $parent, $blocks, $macros, $traits, new Node([]), $source);
37
+
38
+ $this->assertEquals($body, $node->getNode('body'));
39
+ $this->assertEquals($blocks, $node->getNode('blocks'));
40
+ $this->assertEquals($macros, $node->getNode('macros'));
41
+ $this->assertEquals($parent, $node->getNode('parent'));
42
+ $this->assertEquals($source->getName(), $node->getTemplateName());
43
+ }
44
+
45
+ public function getTests()
46
+ {
47
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
48
+
49
+ $tests = [];
50
+
51
+ $body = new TextNode('foo', 1);
52
+ $extends = null;
53
+ $blocks = new Node();
54
+ $macros = new Node();
55
+ $traits = new Node();
56
+ $source = new Source('{{ foo }}', 'foo.twig');
57
+
58
+ $node = new ModuleNode($body, $extends, $blocks, $macros, $traits, new Node([]), $source);
59
+ $tests[] = [$node, <<<EOF
60
+ <?php
61
+
62
+ use Twig\Environment;
63
+ use Twig\Error\LoaderError;
64
+ use Twig\Error\RuntimeError;
65
+ use Twig\Markup;
66
+ use Twig\Sandbox\SecurityError;
67
+ use Twig\Sandbox\SecurityNotAllowedTagError;
68
+ use Twig\Sandbox\SecurityNotAllowedFilterError;
69
+ use Twig\Sandbox\SecurityNotAllowedFunctionError;
70
+ use Twig\Source;
71
+ use Twig\Template;
72
+
73
+ /* foo.twig */
74
+ class __TwigTemplate_%x extends \Twig\Template
75
+ {
76
+ public function __construct(Environment \$env)
77
+ {
78
+ parent::__construct(\$env);
79
+
80
+ \$this->parent = false;
81
+
82
+ \$this->blocks = [
83
+ ];
84
+ }
85
+
86
+ protected function doDisplay(array \$context, array \$blocks = [])
87
+ {
88
+ // line 1
89
+ echo "foo";
90
+ }
91
+
92
+ public function getTemplateName()
93
+ {
94
+ return "foo.twig";
95
+ }
96
+
97
+ public function getDebugInfo()
98
+ {
99
+ return array ( 30 => 1,);
100
+ }
101
+
102
+ /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
103
+ public function getSource()
104
+ {
105
+ @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);
106
+
107
+ return \$this->getSourceContext()->getCode();
108
+ }
109
+
110
+ public function getSourceContext()
111
+ {
112
+ return new Source("", "foo.twig", "");
113
+ }
114
+ }
115
+ EOF
116
+ , $twig, true];
117
+
118
+ $import = new ImportNode(new ConstantExpression('foo.twig', 1), new AssignNameExpression('macro', 1), 2);
119
+
120
+ $body = new Node([$import]);
121
+ $extends = new ConstantExpression('layout.twig', 1);
122
+
123
+ $node = new ModuleNode($body, $extends, $blocks, $macros, $traits, new Node([]), $source);
124
+ $tests[] = [$node, <<<EOF
125
+ <?php
126
+
127
+ use Twig\Environment;
128
+ use Twig\Error\LoaderError;
129
+ use Twig\Error\RuntimeError;
130
+ use Twig\Markup;
131
+ use Twig\Sandbox\SecurityError;
132
+ use Twig\Sandbox\SecurityNotAllowedTagError;
133
+ use Twig\Sandbox\SecurityNotAllowedFilterError;
134
+ use Twig\Sandbox\SecurityNotAllowedFunctionError;
135
+ use Twig\Source;
136
+ use Twig\Template;
137
+
138
+ /* foo.twig */
139
+ class __TwigTemplate_%x extends \Twig\Template
140
+ {
141
+ public function __construct(Environment \$env)
142
+ {
143
+ parent::__construct(\$env);
144
+
145
+ \$this->blocks = [
146
+ ];
147
+ }
148
+
149
+ protected function doGetParent(array \$context)
150
+ {
151
+ // line 1
152
+ return "layout.twig";
153
+ }
154
+
155
+ protected function doDisplay(array \$context, array \$blocks = [])
156
+ {
157
+ // line 2
158
+ \$context["macro"] = \$this->loadTemplate("foo.twig", "foo.twig", 2)->unwrap();
159
+ // line 1
160
+ \$this->parent = \$this->loadTemplate("layout.twig", "foo.twig", 1);
161
+ \$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks));
162
+ }
163
+
164
+ public function getTemplateName()
165
+ {
166
+ return "foo.twig";
167
+ }
168
+
169
+ public function isTraitable()
170
+ {
171
+ return false;
172
+ }
173
+
174
+ public function getDebugInfo()
175
+ {
176
+ return array ( 36 => 1, 34 => 2, 28 => 1,);
177
+ }
178
+
179
+ /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
180
+ public function getSource()
181
+ {
182
+ @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);
183
+
184
+ return \$this->getSourceContext()->getCode();
185
+ }
186
+
187
+ public function getSourceContext()
188
+ {
189
+ return new Source("", "foo.twig", "");
190
+ }
191
+ }
192
+ EOF
193
+ , $twig, true];
194
+
195
+ $set = new SetNode(false, new Node([new AssignNameExpression('foo', 4)]), new Node([new ConstantExpression('foo', 4)]), 4);
196
+ $body = new Node([$set]);
197
+ $extends = new ConditionalExpression(
198
+ new ConstantExpression(true, 2),
199
+ new ConstantExpression('foo', 2),
200
+ new ConstantExpression('foo', 2),
201
+ 2
202
+ );
203
+
204
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['debug' => true]);
205
+ $node = new ModuleNode($body, $extends, $blocks, $macros, $traits, new Node([]), $source);
206
+ $tests[] = [$node, <<<EOF
207
+ <?php
208
+
209
+ use Twig\Environment;
210
+ use Twig\Error\LoaderError;
211
+ use Twig\Error\RuntimeError;
212
+ use Twig\Markup;
213
+ use Twig\Sandbox\SecurityError;
214
+ use Twig\Sandbox\SecurityNotAllowedTagError;
215
+ use Twig\Sandbox\SecurityNotAllowedFilterError;
216
+ use Twig\Sandbox\SecurityNotAllowedFunctionError;
217
+ use Twig\Source;
218
+ use Twig\Template;
219
+
220
+ /* foo.twig */
221
+ class __TwigTemplate_%x extends \Twig\Template
222
+ {
223
+ protected function doGetParent(array \$context)
224
+ {
225
+ // line 2
226
+ return \$this->loadTemplate(((true) ? ("foo") : ("foo")), "foo.twig", 2);
227
+ }
228
+
229
+ protected function doDisplay(array \$context, array \$blocks = [])
230
+ {
231
+ // line 4
232
+ \$context["foo"] = "foo";
233
+ // line 2
234
+ \$this->getParent(\$context)->display(\$context, array_merge(\$this->blocks, \$blocks));
235
+ }
236
+
237
+ public function getTemplateName()
238
+ {
239
+ return "foo.twig";
240
+ }
241
+
242
+ public function isTraitable()
243
+ {
244
+ return false;
245
+ }
246
+
247
+ public function getDebugInfo()
248
+ {
249
+ return array ( 28 => 2, 26 => 4, 20 => 2,);
250
+ }
251
+
252
+ /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
253
+ public function getSource()
254
+ {
255
+ @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);
256
+
257
+ return \$this->getSourceContext()->getCode();
258
+ }
259
+
260
+ public function getSourceContext()
261
+ {
262
+ return new Source("{{ foo }}", "foo.twig", "");
263
+ }
264
+ }
265
+ EOF
266
+ , $twig, true];
267
+
268
+ return $tests;
269
+ }
270
+ }
vendor/twig/twig/tests/Node/PrintTest.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\ConstantExpression;
15
+ use Twig\Node\PrintNode;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class PrintTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $expr = new ConstantExpression('foo', 1);
23
+ $node = new PrintNode($expr, 1);
24
+
25
+ $this->assertEquals($expr, $node->getNode('expr'));
26
+ }
27
+
28
+ public function getTests()
29
+ {
30
+ $tests = [];
31
+ $tests[] = [new PrintNode(new ConstantExpression('foo', 1), 1), "// line 1\necho \"foo\";"];
32
+
33
+ return $tests;
34
+ }
35
+ }
vendor/twig/twig/tests/Node/SandboxTest.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\SandboxNode;
15
+ use Twig\Node\TextNode;
16
+ use Twig\Test\NodeTestCase;
17
+
18
+ class SandboxTest extends NodeTestCase
19
+ {
20
+ public function testConstructor()
21
+ {
22
+ $body = new TextNode('foo', 1);
23
+ $node = new SandboxNode($body, 1);
24
+
25
+ $this->assertEquals($body, $node->getNode('body'));
26
+ }
27
+
28
+ public function getTests()
29
+ {
30
+ $tests = [];
31
+
32
+ $body = new TextNode('foo', 1);
33
+ $node = new SandboxNode($body, 1);
34
+
35
+ $tests[] = [$node, <<<EOF
36
+ // line 1
37
+ if (!\$alreadySandboxed = \$this->sandbox->isSandboxed()) {
38
+ \$this->sandbox->enableSandbox();
39
+ }
40
+ echo "foo";
41
+ if (!\$alreadySandboxed) {
42
+ \$this->sandbox->disableSandbox();
43
+ }
44
+ EOF
45
+ ];
46
+
47
+ return $tests;
48
+ }
49
+ }
vendor/twig/twig/tests/Node/SetTest.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Expression\AssignNameExpression;
15
+ use Twig\Node\Expression\ConstantExpression;
16
+ use Twig\Node\Expression\NameExpression;
17
+ use Twig\Node\Node;
18
+ use Twig\Node\PrintNode;
19
+ use Twig\Node\SetNode;
20
+ use Twig\Node\TextNode;
21
+ use Twig\Test\NodeTestCase;
22
+
23
+ class SetTest extends NodeTestCase
24
+ {
25
+ public function testConstructor()
26
+ {
27
+ $names = new Node([new AssignNameExpression('foo', 1)], [], 1);
28
+ $values = new Node([new ConstantExpression('foo', 1)], [], 1);
29
+ $node = new SetNode(false, $names, $values, 1);
30
+
31
+ $this->assertEquals($names, $node->getNode('names'));
32
+ $this->assertEquals($values, $node->getNode('values'));
33
+ $this->assertFalse($node->getAttribute('capture'));
34
+ }
35
+
36
+ public function getTests()
37
+ {
38
+ $tests = [];
39
+
40
+ $names = new Node([new AssignNameExpression('foo', 1)], [], 1);
41
+ $values = new Node([new ConstantExpression('foo', 1)], [], 1);
42
+ $node = new SetNode(false, $names, $values, 1);
43
+ $tests[] = [$node, <<<EOF
44
+ // line 1
45
+ \$context["foo"] = "foo";
46
+ EOF
47
+ ];
48
+
49
+ $names = new Node([new AssignNameExpression('foo', 1)], [], 1);
50
+ $values = new Node([new PrintNode(new ConstantExpression('foo', 1), 1)], [], 1);
51
+ $node = new SetNode(true, $names, $values, 1);
52
+ $tests[] = [$node, <<<EOF
53
+ // line 1
54
+ ob_start(function () { return ''; });
55
+ echo "foo";
56
+ \$context["foo"] = ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset());
57
+ EOF
58
+ ];
59
+
60
+ $names = new Node([new AssignNameExpression('foo', 1)], [], 1);
61
+ $values = new TextNode('foo', 1);
62
+ $node = new SetNode(true, $names, $values, 1);
63
+ $tests[] = [$node, <<<EOF
64
+ // line 1
65
+ \$context["foo"] = ('' === \$tmp = "foo") ? '' : new Markup(\$tmp, \$this->env->getCharset());
66
+ EOF
67
+ ];
68
+
69
+ $names = new Node([new AssignNameExpression('foo', 1), new AssignNameExpression('bar', 1)], [], 1);
70
+ $values = new Node([new ConstantExpression('foo', 1), new NameExpression('bar', 1)], [], 1);
71
+ $node = new SetNode(false, $names, $values, 1);
72
+ $tests[] = [$node, <<<EOF
73
+ // line 1
74
+ list(\$context["foo"], \$context["bar"]) = ["foo", {$this->getVariableGetter('bar')}];
75
+ EOF
76
+ ];
77
+
78
+ return $tests;
79
+ }
80
+ }
vendor/twig/twig/tests/Node/SpacelessTest.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\Node;
15
+ use Twig\Node\SpacelessNode;
16
+ use Twig\Node\TextNode;
17
+ use Twig\Test\NodeTestCase;
18
+
19
+ class SpacelessTest extends NodeTestCase
20
+ {
21
+ public function testConstructor()
22
+ {
23
+ $body = new Node([new TextNode('<div> <div> foo </div> </div>', 1)]);
24
+ $node = new SpacelessNode($body, 1);
25
+
26
+ $this->assertEquals($body, $node->getNode('body'));
27
+ }
28
+
29
+ public function getTests()
30
+ {
31
+ $body = new Node([new TextNode('<div> <div> foo </div> </div>', 1)]);
32
+ $node = new SpacelessNode($body, 1);
33
+
34
+ return [
35
+ [$node, <<<EOF
36
+ // line 1
37
+ ob_start(function () { return ''; });
38
+ echo "<div> <div> foo </div> </div>";
39
+ echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));
40
+ EOF
41
+ ],
42
+ ];
43
+ }
44
+ }
vendor/twig/twig/tests/Node/TextTest.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Node;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Node\TextNode;
15
+ use Twig\Test\NodeTestCase;
16
+
17
+ class TextTest extends NodeTestCase
18
+ {
19
+ public function testConstructor()
20
+ {
21
+ $node = new TextNode('foo', 1);
22
+
23
+ $this->assertEquals('foo', $node->getAttribute('data'));
24
+ }
25
+
26
+ public function getTests()
27
+ {
28
+ $tests = [];
29
+ $tests[] = [new TextNode('foo', 1), "// line 1\necho \"foo\";"];
30
+
31
+ return $tests;
32
+ }
33
+ }
vendor/twig/twig/tests/NodeTraverserTest.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Node\Node;
16
+ use Twig\NodeTraverser;
17
+ use Twig\NodeVisitor\NodeVisitorInterface;
18
+
19
+ class NodeTraverserTest extends \PHPUnit\Framework\TestCase
20
+ {
21
+ /**
22
+ * @group legacy
23
+ */
24
+ public function testNodeIsNullWhenTraversing()
25
+ {
26
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
27
+ $traverser = new NodeTraverser($env, [new IdentityVisitor()]);
28
+ $n = new Node([new Node([]), null, new Node([])]);
29
+ $this->assertCount(3, $traverser->traverse($n));
30
+ }
31
+ }
32
+
33
+ class IdentityVisitor implements NodeVisitorInterface
34
+ {
35
+ public function enterNode(\Twig_NodeInterface $node, Environment $env)
36
+ {
37
+ return $node;
38
+ }
39
+
40
+ public function leaveNode(\Twig_NodeInterface $node, Environment $env)
41
+ {
42
+ return $node;
43
+ }
44
+
45
+ public function getPriority()
46
+ {
47
+ return 0;
48
+ }
49
+ }
vendor/twig/twig/tests/NodeVisitor/OptimizerTest.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\NodeVisitor;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Node\ForNode;
16
+ use Twig\Source;
17
+
18
+ class OptimizerTest extends \PHPUnit\Framework\TestCase
19
+ {
20
+ public function testRenderBlockOptimizer()
21
+ {
22
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
23
+
24
+ $stream = $env->parse($env->tokenize(new Source('{{ block("foo") }}', 'index')));
25
+
26
+ $node = $stream->getNode('body')->getNode(0);
27
+
28
+ $this->assertInstanceOf('\Twig\Node\Expression\BlockReferenceExpression', $node);
29
+ $this->assertTrue($node->getAttribute('output'));
30
+ }
31
+
32
+ public function testRenderParentBlockOptimizer()
33
+ {
34
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false, 'autoescape' => false]);
35
+
36
+ $stream = $env->parse($env->tokenize(new Source('{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}', 'index')));
37
+
38
+ $node = $stream->getNode('blocks')->getNode('content')->getNode(0)->getNode('body');
39
+
40
+ $this->assertInstanceOf('\Twig\Node\Expression\ParentExpression', $node);
41
+ $this->assertTrue($node->getAttribute('output'));
42
+ }
43
+
44
+ /**
45
+ * @dataProvider getTestsForForOptimizer
46
+ */
47
+ public function testForOptimizer($template, $expected)
48
+ {
49
+ $env = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['cache' => false]);
50
+
51
+ $stream = $env->parse($env->tokenize(new Source($template, 'index')));
52
+
53
+ foreach ($expected as $target => $withLoop) {
54
+ $this->assertTrue($this->checkForConfiguration($stream, $target, $withLoop), sprintf('variable %s is %soptimized', $target, $withLoop ? 'not ' : ''));
55
+ }
56
+ }
57
+
58
+ public function getTestsForForOptimizer()
59
+ {
60
+ return [
61
+ ['{% for i in foo %}{% endfor %}', ['i' => false]],
62
+
63
+ ['{% for i in foo %}{{ loop.index }}{% endfor %}', ['i' => true]],
64
+
65
+ ['{% for i in foo %}{% for j in foo %}{% endfor %}{% endfor %}', ['i' => false, 'j' => false]],
66
+
67
+ ['{% for i in foo %}{% include "foo" %}{% endfor %}', ['i' => true]],
68
+
69
+ ['{% for i in foo %}{% include "foo" only %}{% endfor %}', ['i' => false]],
70
+
71
+ ['{% for i in foo %}{% include "foo" with { "foo": "bar" } only %}{% endfor %}', ['i' => false]],
72
+
73
+ ['{% for i in foo %}{% include "foo" with { "foo": loop.index } only %}{% endfor %}', ['i' => true]],
74
+
75
+ ['{% for i in foo %}{% for j in foo %}{{ loop.index }}{% endfor %}{% endfor %}', ['i' => false, 'j' => true]],
76
+
77
+ ['{% for i in foo %}{% for j in foo %}{{ loop.parent.loop.index }}{% endfor %}{% endfor %}', ['i' => true, 'j' => true]],
78
+
79
+ ['{% for i in foo %}{% set l = loop %}{% for j in foo %}{{ l.index }}{% endfor %}{% endfor %}', ['i' => true, 'j' => false]],
80
+
81
+ ['{% for i in foo %}{% for j in foo %}{{ foo.parent.loop.index }}{% endfor %}{% endfor %}', ['i' => false, 'j' => false]],
82
+
83
+ ['{% for i in foo %}{% for j in foo %}{{ loop["parent"].loop.index }}{% endfor %}{% endfor %}', ['i' => true, 'j' => true]],
84
+
85
+ ['{% for i in foo %}{{ include("foo") }}{% endfor %}', ['i' => true]],
86
+
87
+ ['{% for i in foo %}{{ include("foo", with_context = false) }}{% endfor %}', ['i' => false]],
88
+
89
+ ['{% for i in foo %}{{ include("foo", with_context = true) }}{% endfor %}', ['i' => true]],
90
+
91
+ ['{% for i in foo %}{{ include("foo", { "foo": "bar" }, with_context = false) }}{% endfor %}', ['i' => false]],
92
+
93
+ ['{% for i in foo %}{{ include("foo", { "foo": loop.index }, with_context = false) }}{% endfor %}', ['i' => true]],
94
+ ];
95
+ }
96
+
97
+ public function checkForConfiguration(\Twig_NodeInterface $node = null, $target, $withLoop)
98
+ {
99
+ if (null === $node) {
100
+ return;
101
+ }
102
+
103
+ foreach ($node as $n) {
104
+ if ($n instanceof ForNode) {
105
+ if ($target === $n->getNode('value_target')->getAttribute('name')) {
106
+ return $withLoop == $n->getAttribute('with_loop');
107
+ }
108
+ }
109
+
110
+ $ret = $this->checkForConfiguration($n, $target, $withLoop);
111
+ if (null !== $ret) {
112
+ return $ret;
113
+ }
114
+ }
115
+ }
116
+ }
vendor/twig/twig/tests/ParserTest.php ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Node\MacroNode;
16
+ use Twig\Node\Node;
17
+ use Twig\Node\SetNode;
18
+ use Twig\Node\TextNode;
19
+ use Twig\Parser;
20
+ use Twig\Source;
21
+ use Twig\Token;
22
+ use Twig\TokenParser\AbstractTokenParser;
23
+ use Twig\TokenStream;
24
+
25
+ class ParserTest extends \PHPUnit\Framework\TestCase
26
+ {
27
+ public function testSetMacroThrowsExceptionOnReservedMethods()
28
+ {
29
+ $this->expectException('\Twig\Error\SyntaxError');
30
+
31
+ $parser = $this->getParser();
32
+ $parser->setMacro('parent', new MacroNode('foo', new Node(), new Node(), 1));
33
+ }
34
+
35
+ public function testUnknownTag()
36
+ {
37
+ $this->expectException('\Twig\Error\SyntaxError');
38
+ $this->expectExceptionMessage('Unknown "foo" tag. Did you mean "for" at line 1?');
39
+
40
+ $stream = new TokenStream([
41
+ new Token(Token::BLOCK_START_TYPE, '', 1),
42
+ new Token(Token::NAME_TYPE, 'foo', 1),
43
+ new Token(Token::BLOCK_END_TYPE, '', 1),
44
+ new Token(Token::EOF_TYPE, '', 1),
45
+ ]);
46
+ $parser = new Parser(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
47
+ $parser->parse($stream);
48
+ }
49
+
50
+ public function testUnknownTagWithoutSuggestions()
51
+ {
52
+ $this->expectException('\Twig\Error\SyntaxError');
53
+ $this->expectExceptionMessage('Unknown "foobar" tag at line 1.');
54
+
55
+ $stream = new TokenStream([
56
+ new Token(Token::BLOCK_START_TYPE, '', 1),
57
+ new Token(Token::NAME_TYPE, 'foobar', 1),
58
+ new Token(Token::BLOCK_END_TYPE, '', 1),
59
+ new Token(Token::EOF_TYPE, '', 1),
60
+ ]);
61
+ $parser = new Parser(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
62
+ $parser->parse($stream);
63
+ }
64
+
65
+ /**
66
+ * @dataProvider getFilterBodyNodesData
67
+ */
68
+ public function testFilterBodyNodes($input, $expected)
69
+ {
70
+ $parser = $this->getParser();
71
+
72
+ $this->assertEquals($expected, $parser->filterBodyNodes($input));
73
+ }
74
+
75
+ public function getFilterBodyNodesData()
76
+ {
77
+ return [
78
+ [
79
+ new Node([new TextNode(' ', 1)]),
80
+ new Node([]),
81
+ ],
82
+ [
83
+ $input = new Node([new SetNode(false, new Node(), new Node(), 1)]),
84
+ $input,
85
+ ],
86
+ [
87
+ $input = new Node([new SetNode(true, new Node(), new Node([new Node([new TextNode('foo', 1)])]), 1)]),
88
+ $input,
89
+ ],
90
+ ];
91
+ }
92
+
93
+ /**
94
+ * @dataProvider getFilterBodyNodesDataThrowsException
95
+ */
96
+ public function testFilterBodyNodesThrowsException($input)
97
+ {
98
+ $this->expectException('\Twig\Error\SyntaxError');
99
+
100
+ $parser = $this->getParser();
101
+
102
+ $parser->filterBodyNodes($input);
103
+ }
104
+
105
+ public function getFilterBodyNodesDataThrowsException()
106
+ {
107
+ return [
108
+ [new TextNode('foo', 1)],
109
+ [new Node([new Node([new TextNode('foo', 1)])])],
110
+ ];
111
+ }
112
+
113
+ /**
114
+ * @dataProvider getFilterBodyNodesWithBOMData
115
+ */
116
+ public function testFilterBodyNodesWithBOM($emptyNode)
117
+ {
118
+ $this->assertNull($this->getParser()->filterBodyNodes(new TextNode(\chr(0xEF).\chr(0xBB).\chr(0xBF).$emptyNode, 1)));
119
+ }
120
+
121
+ public function getFilterBodyNodesWithBOMData()
122
+ {
123
+ return [
124
+ [' '],
125
+ ["\t"],
126
+ ["\n"],
127
+ ["\n\t\n "],
128
+ ];
129
+ }
130
+
131
+ public function testParseIsReentrant()
132
+ {
133
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), [
134
+ 'autoescape' => false,
135
+ 'optimizations' => 0,
136
+ ]);
137
+ $twig->addTokenParser(new TestTokenParser());
138
+
139
+ $parser = new Parser($twig);
140
+
141
+ $parser->parse(new TokenStream([
142
+ new Token(Token::BLOCK_START_TYPE, '', 1),
143
+ new Token(Token::NAME_TYPE, 'test', 1),
144
+ new Token(Token::BLOCK_END_TYPE, '', 1),
145
+ new Token(Token::VAR_START_TYPE, '', 1),
146
+ new Token(Token::NAME_TYPE, 'foo', 1),
147
+ new Token(Token::VAR_END_TYPE, '', 1),
148
+ new Token(Token::EOF_TYPE, '', 1),
149
+ ]));
150
+
151
+ $this->assertNull($parser->getParent());
152
+ }
153
+
154
+ public function testGetVarName()
155
+ {
156
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'), [
157
+ 'autoescape' => false,
158
+ 'optimizations' => 0,
159
+ ]);
160
+
161
+ $twig->parse($twig->tokenize(new Source(<<<EOF
162
+ {% from _self import foo %}
163
+
164
+ {% macro foo() %}
165
+ {{ foo }}
166
+ {% endmacro %}
167
+ EOF
168
+ , 'index')));
169
+
170
+ // The getVarName() must not depend on the template loaders,
171
+ // If this test does not throw any exception, that's good.
172
+ // see https://github.com/symfony/symfony/issues/4218
173
+ $this->addToAssertionCount(1);
174
+ }
175
+
176
+ protected function getParser()
177
+ {
178
+ $parser = new TestParser(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
179
+ $parser->setParent(new Node());
180
+ $parser->stream = new TokenStream([]);
181
+
182
+ return $parser;
183
+ }
184
+ }
185
+
186
+ class TestParser extends Parser
187
+ {
188
+ public $stream;
189
+
190
+ public function filterBodyNodes(\Twig_NodeInterface $node)
191
+ {
192
+ return parent::filterBodyNodes($node);
193
+ }
194
+ }
195
+
196
+ class TestTokenParser extends AbstractTokenParser
197
+ {
198
+ public function parse(Token $token)
199
+ {
200
+ // simulate the parsing of another template right in the middle of the parsing of the current template
201
+ $this->parser->parse(new TokenStream([
202
+ new Token(Token::BLOCK_START_TYPE, '', 1),
203
+ new Token(Token::NAME_TYPE, 'extends', 1),
204
+ new Token(Token::STRING_TYPE, 'base', 1),
205
+ new Token(Token::BLOCK_END_TYPE, '', 1),
206
+ new Token(Token::EOF_TYPE, '', 1),
207
+ ]));
208
+
209
+ $this->parser->getStream()->expect(Token::BLOCK_END_TYPE);
210
+
211
+ return new Node([]);
212
+ }
213
+
214
+ public function getTag()
215
+ {
216
+ return 'test';
217
+ }
218
+ }
vendor/twig/twig/tests/Profiler/Dumper/AbstractTest.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Profiler\Dumper;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Profiler\Profile;
15
+
16
+ abstract class AbstractTest extends \PHPUnit\Framework\TestCase
17
+ {
18
+ protected function getProfile()
19
+ {
20
+ $profile = new Profile('main');
21
+ $subProfiles = [
22
+ $this->getIndexProfile(
23
+ [
24
+ $this->getEmbeddedBlockProfile(),
25
+ $this->getEmbeddedTemplateProfile(
26
+ [
27
+ $this->getIncludedTemplateProfile(),
28
+ ]
29
+ ),
30
+ $this->getMacroProfile(),
31
+ $this->getEmbeddedTemplateProfile(
32
+ [
33
+ $this->getIncludedTemplateProfile(),
34
+ ]
35
+ ),
36
+ ]
37
+ ),
38
+ ];
39
+
40
+ $p = new \ReflectionProperty($profile, 'profiles');
41
+ $p->setAccessible(true);
42
+ $p->setValue($profile, $subProfiles);
43
+
44
+ return $profile;
45
+ }
46
+
47
+ private function getIndexProfile(array $subProfiles = [])
48
+ {
49
+ return $this->generateProfile('main', 1, 'template', 'index.twig', $subProfiles);
50
+ }
51
+
52
+ private function getEmbeddedBlockProfile(array $subProfiles = [])
53
+ {
54
+ return $this->generateProfile('body', 0.0001, 'block', 'embedded.twig', $subProfiles);
55
+ }
56
+
57
+ private function getEmbeddedTemplateProfile(array $subProfiles = [])
58
+ {
59
+ return $this->generateProfile('main', 0.0001, 'template', 'embedded.twig', $subProfiles);
60
+ }
61
+
62
+ private function getIncludedTemplateProfile(array $subProfiles = [])
63
+ {
64
+ return $this->generateProfile('main', 0.0001, 'template', 'included.twig', $subProfiles);
65
+ }
66
+
67
+ private function getMacroProfile(array $subProfiles = [])
68
+ {
69
+ return $this->generateProfile('foo', 0.0001, 'macro', 'index.twig', $subProfiles);
70
+ }
71
+
72
+ /**
73
+ * @param string $name
74
+ * @param float $duration
75
+ * @param bool $isTemplate
76
+ * @param string $type
77
+ * @param string $templateName
78
+ * @param array $subProfiles
79
+ *
80
+ * @return Profile
81
+ */
82
+ private function generateProfile($name, $duration, $type, $templateName, array $subProfiles = [])
83
+ {
84
+ $profile = new Profile($templateName, $type, $name);
85
+
86
+ $p = new \ReflectionProperty($profile, 'profiles');
87
+ $p->setAccessible(true);
88
+ $p->setValue($profile, $subProfiles);
89
+
90
+ $starts = new \ReflectionProperty($profile, 'starts');
91
+ $starts->setAccessible(true);
92
+ $starts->setValue($profile, [
93
+ 'wt' => 0,
94
+ 'mu' => 0,
95
+ 'pmu' => 0,
96
+ ]);
97
+ $ends = new \ReflectionProperty($profile, 'ends');
98
+ $ends->setAccessible(true);
99
+ $ends->setValue($profile, [
100
+ 'wt' => $duration,
101
+ 'mu' => 0,
102
+ 'pmu' => 0,
103
+ ]);
104
+
105
+ return $profile;
106
+ }
107
+ }
vendor/twig/twig/tests/Profiler/Dumper/BlackfireTest.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Profiler\Dumper;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Profiler\Dumper\BlackfireDumper;
15
+
16
+ class BlackfireTest extends AbstractTest
17
+ {
18
+ public function testDump()
19
+ {
20
+ $dumper = new BlackfireDumper();
21
+
22
+ $this->assertStringMatchesFormat(<<<EOF
23
+ file-format: BlackfireProbe
24
+ cost-dimensions: wt mu pmu
25
+ request-start: %d.%d
26
+
27
+ main()//1 %d %d %d
28
+ main()==>index.twig//1 %d %d %d
29
+ index.twig==>embedded.twig::block(body)//1 %d %d 0
30
+ index.twig==>embedded.twig//2 %d %d %d
31
+ embedded.twig==>included.twig//2 %d %d %d
32
+ index.twig==>index.twig::macro(foo)//1 %d %d %d
33
+ EOF
34
+ , $dumper->dump($this->getProfile()));
35
+ }
36
+ }
vendor/twig/twig/tests/Profiler/Dumper/HtmlTest.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Profiler\Dumper;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Profiler\Dumper\HtmlDumper;
15
+
16
+ class HtmlTest extends AbstractTest
17
+ {
18
+ public function testDump()
19
+ {
20
+ $dumper = new HtmlDumper();
21
+ $this->assertStringMatchesFormat(<<<EOF
22
+ <pre>main <span style="color: #d44">%d.%dms/%d%</span>
23
+ â”” <span style="background-color: #ffd">index.twig</span> <span style="color: #d44">%d.%dms/%d%</span>
24
+ â”” embedded.twig::block(<span style="background-color: #dfd">body</span>)
25
+ â”” <span style="background-color: #ffd">embedded.twig</span>
26
+ │ └ <span style="background-color: #ffd">included.twig</span>
27
+ â”” index.twig::macro(<span style="background-color: #ddf">foo</span>)
28
+ â”” <span style="background-color: #ffd">embedded.twig</span>
29
+ â”” <span style="background-color: #ffd">included.twig</span>
30
+ </pre>
31
+ EOF
32
+ , $dumper->dump($this->getProfile()));
33
+ }
34
+ }
vendor/twig/twig/tests/Profiler/Dumper/TextTest.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Profiler\Dumper;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Profiler\Dumper\TextDumper;
15
+
16
+ class TextTest extends AbstractTest
17
+ {
18
+ public function testDump()
19
+ {
20
+ $dumper = new TextDumper();
21
+ $this->assertStringMatchesFormat(<<<EOF
22
+ main %d.%dms/%d%
23
+ â”” index.twig %d.%dms/%d%
24
+ â”” embedded.twig::block(body)
25
+ â”” embedded.twig
26
+ │ └ included.twig
27
+ â”” index.twig::macro(foo)
28
+ â”” embedded.twig
29
+ â”” included.twig
30
+
31
+ EOF
32
+ , $dumper->dump($this->getProfile()));
33
+ }
34
+ }
vendor/twig/twig/tests/Profiler/ProfileTest.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Profiler;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Profiler\Profile;
15
+
16
+ class ProfileTest extends \PHPUnit\Framework\TestCase
17
+ {
18
+ public function testConstructor()
19
+ {
20
+ $profile = new Profile('template', 'type', 'name');
21
+
22
+ $this->assertEquals('template', $profile->getTemplate());
23
+ $this->assertEquals('type', $profile->getType());
24
+ $this->assertEquals('name', $profile->getName());
25
+ }
26
+
27
+ public function testIsRoot()
28
+ {
29
+ $profile = new Profile('template', Profile::ROOT);
30
+ $this->assertTrue($profile->isRoot());
31
+
32
+ $profile = new Profile('template', Profile::TEMPLATE);
33
+ $this->assertFalse($profile->isRoot());
34
+ }
35
+
36
+ public function testIsTemplate()
37
+ {
38
+ $profile = new Profile('template', Profile::TEMPLATE);
39
+ $this->assertTrue($profile->isTemplate());
40
+
41
+ $profile = new Profile('template', Profile::ROOT);
42
+ $this->assertFalse($profile->isTemplate());
43
+ }
44
+
45
+ public function testIsBlock()
46
+ {
47
+ $profile = new Profile('template', Profile::BLOCK);
48
+ $this->assertTrue($profile->isBlock());
49
+
50
+ $profile = new Profile('template', Profile::ROOT);
51
+ $this->assertFalse($profile->isBlock());
52
+ }
53
+
54
+ public function testIsMacro()
55
+ {
56
+ $profile = new Profile('template', Profile::MACRO);
57
+ $this->assertTrue($profile->isMacro());
58
+
59
+ $profile = new Profile('template', Profile::ROOT);
60
+ $this->assertFalse($profile->isMacro());
61
+ }
62
+
63
+ public function testGetAddProfile()
64
+ {
65
+ $profile = new Profile();
66
+ $profile->addProfile($a = new Profile());
67
+ $profile->addProfile($b = new Profile());
68
+
69
+ $this->assertSame([$a, $b], $profile->getProfiles());
70
+ $this->assertSame([$a, $b], iterator_to_array($profile));
71
+ }
72
+
73
+ public function testGetDuration()
74
+ {
75
+ $profile = new Profile();
76
+ usleep(1);
77
+ $profile->leave();
78
+
79
+ $this->assertTrue($profile->getDuration() > 0, sprintf('Expected duration > 0, got: %f', $profile->getDuration()));
80
+ }
81
+
82
+ public function testSerialize()
83
+ {
84
+ $profile = new Profile('template', 'type', 'name');
85
+ $profile1 = new Profile('template1', 'type1', 'name1');
86
+ $profile->addProfile($profile1);
87
+ $profile->leave();
88
+ $profile1->leave();
89
+
90
+ $profile2 = unserialize(serialize($profile));
91
+ $profiles = $profile->getProfiles();
92
+ $this->assertCount(1, $profiles);
93
+ $profile3 = $profiles[0];
94
+
95
+ $this->assertEquals($profile->getTemplate(), $profile2->getTemplate());
96
+ $this->assertEquals($profile->getType(), $profile2->getType());
97
+ $this->assertEquals($profile->getName(), $profile2->getName());
98
+ $this->assertEquals($profile->getDuration(), $profile2->getDuration());
99
+
100
+ $this->assertEquals($profile1->getTemplate(), $profile3->getTemplate());
101
+ $this->assertEquals($profile1->getType(), $profile3->getType());
102
+ $this->assertEquals($profile1->getName(), $profile3->getName());
103
+ }
104
+
105
+ public function testReset()
106
+ {
107
+ $profile = new Profile();
108
+ usleep(1);
109
+ $profile->leave();
110
+ $profile->reset();
111
+
112
+ $this->assertEquals(0, $profile->getDuration());
113
+ }
114
+ }
vendor/twig/twig/tests/TemplateTest.php ADDED
@@ -0,0 +1,809 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Error\RuntimeError;
16
+ use Twig\Extension\SandboxExtension;
17
+ use Twig\Loader\ArrayLoader;
18
+ use Twig\Loader\LoaderInterface;
19
+ use Twig\Loader\SourceContextLoaderInterface;
20
+ use Twig\Node\Expression\GetAttrExpression;
21
+ use Twig\NodeVisitor\NodeVisitorInterface;
22
+ use Twig\Sandbox\SecurityError;
23
+ use Twig\Sandbox\SecurityPolicy;
24
+ use Twig\Template;
25
+
26
+ class TemplateTest extends \PHPUnit\Framework\TestCase
27
+ {
28
+ public function testDisplayBlocksAcceptTemplateOnlyAsBlocks()
29
+ {
30
+ $this->expectException('\LogicException');
31
+
32
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
33
+ $template = new TemplateForTest($twig);
34
+ $template->displayBlock('foo', [], ['foo' => [new \stdClass(), 'foo']]);
35
+ }
36
+
37
+ /**
38
+ * @dataProvider getAttributeExceptions
39
+ */
40
+ public function testGetAttributeExceptions($template, $message)
41
+ {
42
+ $templates = ['index' => $template];
43
+ $env = new Environment(new ArrayLoader($templates), ['strict_variables' => true]);
44
+ $template = $env->load('index');
45
+
46
+ $context = [
47
+ 'string' => 'foo',
48
+ 'null' => null,
49
+ 'empty_array' => [],
50
+ 'array' => ['foo' => 'foo'],
51
+ 'array_access' => new TemplateArrayAccessObject(),
52
+ 'magic_exception' => new TemplateMagicPropertyObjectWithException(),
53
+ 'object' => new \stdClass(),
54
+ ];
55
+
56
+ try {
57
+ $template->render($context);
58
+ $this->fail('Accessing an invalid attribute should throw an exception.');
59
+ } catch (RuntimeError $e) {
60
+ $this->assertSame(sprintf($message, 'index'), $e->getMessage());
61
+ }
62
+ }
63
+
64
+ public function getAttributeExceptions()
65
+ {
66
+ return [
67
+ ['{{ string["a"] }}', 'Impossible to access a key ("a") on a string variable ("foo") in "%s" at line 1.'],
68
+ ['{{ null["a"] }}', 'Impossible to access a key ("a") on a null variable in "%s" at line 1.'],
69
+ ['{{ empty_array["a"] }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'],
70
+ ['{{ array["a"] }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'],
71
+ ['{{ array_access["a"] }}', 'Key "a" in object with ArrayAccess of class "Twig\Tests\TemplateArrayAccessObject" does not exist in "%s" at line 1.'],
72
+ ['{{ string.a }}', 'Impossible to access an attribute ("a") on a string variable ("foo") in "%s" at line 1.'],
73
+ ['{{ string.a() }}', 'Impossible to invoke a method ("a") on a string variable ("foo") in "%s" at line 1.'],
74
+ ['{{ null.a }}', 'Impossible to access an attribute ("a") on a null variable in "%s" at line 1.'],
75
+ ['{{ null.a() }}', 'Impossible to invoke a method ("a") on a null variable in "%s" at line 1.'],
76
+ ['{{ array.a() }}', 'Impossible to invoke a method ("a") on an array in "%s" at line 1.'],
77
+ ['{{ empty_array.a }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'],
78
+ ['{{ array.a }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'],
79
+ ['{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1.'],
80
+ ['{{ array_access.a }}', 'Neither the property "a" nor one of the methods "a()", "geta()"/"isa()" or "__call()" exist and have public access in class "Twig\Tests\TemplateArrayAccessObject" in "%s" at line 1.'],
81
+ ['{% from _self import foo %}{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ foo(array_access) }}', 'Neither the property "missing_method" nor one of the methods "missing_method()", "getmissing_method()"/"ismissing_method()" or "__call()" exist and have public access in class "Twig\Tests\TemplateArrayAccessObject" in "%s" at line 1.'],
82
+ ['{{ 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.'],
83
+ ['{{ 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.'],
84
+ ];
85
+ }
86
+
87
+ /**
88
+ * @dataProvider getGetAttributeWithSandbox
89
+ */
90
+ public function testGetAttributeWithSandbox($object, $item, $allowed)
91
+ {
92
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
93
+ $policy = new SecurityPolicy([], [], [/*method*/], [/*prop*/], []);
94
+ $twig->addExtension(new SandboxExtension($policy, !$allowed));
95
+ $template = new TemplateForTest($twig);
96
+
97
+ try {
98
+ $template->getAttribute($object, $item, [], 'any');
99
+
100
+ if (!$allowed) {
101
+ $this->fail();
102
+ } else {
103
+ $this->addToAssertionCount(1);
104
+ }
105
+ } catch (SecurityError $e) {
106
+ if ($allowed) {
107
+ $this->fail();
108
+ } else {
109
+ $this->addToAssertionCount(1);
110
+ }
111
+
112
+ $this->assertStringContainsString('is not allowed', $e->getMessage());
113
+ }
114
+ }
115
+
116
+ public function getGetAttributeWithSandbox()
117
+ {
118
+ return [
119
+ [new TemplatePropertyObject(), 'defined', false],
120
+ [new TemplatePropertyObject(), 'defined', true],
121
+ [new TemplateMethodObject(), 'defined', false],
122
+ [new TemplateMethodObject(), 'defined', true],
123
+ ];
124
+ }
125
+
126
+ /**
127
+ * @group legacy
128
+ */
129
+ public function testGetAttributeWithTemplateAsObject()
130
+ {
131
+ // to be removed in 2.0
132
+ $twig = new Environment($this->createMock('Twig\Tests\TemplateTestLoaderInterface'));
133
+ //$twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface'));
134
+
135
+ $template = new TemplateForTest($twig, 'index.twig');
136
+ $template1 = new TemplateForTest($twig, 'index1.twig');
137
+
138
+ $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'string'));
139
+ $this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
140
+
141
+ $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'true'));
142
+ $this->assertEquals('1', $template->getAttribute($template1, 'true'));
143
+
144
+ $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'zero'));
145
+ $this->assertEquals('0', $template->getAttribute($template1, 'zero'));
146
+
147
+ $this->assertNotInstanceof('\Twig\Markup', $template->getAttribute($template1, 'empty'));
148
+ $this->assertSame('', $template->getAttribute($template1, 'empty'));
149
+
150
+ $this->assertFalse($template->getAttribute($template1, 'env', [], Template::ANY_CALL, true));
151
+ $this->assertFalse($template->getAttribute($template1, 'environment', [], Template::ANY_CALL, true));
152
+ $this->assertFalse($template->getAttribute($template1, 'getEnvironment', [], Template::METHOD_CALL, true));
153
+ $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', [], Template::METHOD_CALL, true));
154
+ }
155
+
156
+ /**
157
+ * @group legacy
158
+ * @expectedDeprecation Calling "string" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
159
+ * @expectedDeprecation Calling "string" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
160
+ * @expectedDeprecation Calling "true" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
161
+ * @expectedDeprecation Calling "true" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
162
+ * @expectedDeprecation Calling "zero" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
163
+ * @expectedDeprecation Calling "zero" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
164
+ * @expectedDeprecation Calling "empty" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
165
+ * @expectedDeprecation Calling "empty" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
166
+ * @expectedDeprecation Calling "renderBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name") instead).
167
+ * @expectedDeprecation Calling "displayBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name") instead).
168
+ * @expectedDeprecation Calling "hasBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use "block("name") is defined" instead).
169
+ * @expectedDeprecation Calling "render" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index.twig") instead).
170
+ * @expectedDeprecation Calling "display" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index.twig") instead).
171
+ * @expectedDeprecation Calling "renderBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name", template) instead).
172
+ * @expectedDeprecation Calling "displayBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name", template) instead).
173
+ * @expectedDeprecation Calling "hasBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use "block("name", template) is defined" instead).
174
+ * @expectedDeprecation Calling "render" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index1.twig") instead).
175
+ * @expectedDeprecation Calling "display" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index1.twig") instead).
176
+ */
177
+ public function testGetAttributeWithTemplateAsObjectForDeprecations()
178
+ {
179
+ // to be removed in 2.0
180
+ $twig = new Environment($this->createMock('Twig\Tests\TemplateTestLoaderInterface'));
181
+ //$twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface'));
182
+
183
+ $template = new TemplateForTest($twig, 'index.twig');
184
+ $template1 = new TemplateForTest($twig, 'index1.twig');
185
+
186
+ $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'string'));
187
+ $this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
188
+
189
+ $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'true'));
190
+ $this->assertEquals('1', $template->getAttribute($template1, 'true'));
191
+
192
+ $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'zero'));
193
+ $this->assertEquals('0', $template->getAttribute($template1, 'zero'));
194
+
195
+ $this->assertNotInstanceof('\Twig\Markup', $template->getAttribute($template1, 'empty'));
196
+ $this->assertSame('', $template->getAttribute($template1, 'empty'));
197
+
198
+ $blocks = ['name' => [$template1, 'block_name']];
199
+
200
+ // trigger some deprecation notice messages to check them with @expectedDeprecation
201
+ $template->getAttribute($template, 'renderBlock', ['name', [], $blocks]);
202
+ $template->getAttribute($template, 'displayBlock', ['name', [], $blocks]);
203
+ $template->getAttribute($template, 'hasBlock', ['name', []]);
204
+ $template->getAttribute($template, 'render', [[]]);
205
+ $template->getAttribute($template, 'display', [[]]);
206
+
207
+ $template->getAttribute($template1, 'renderBlock', ['name', [], $blocks]);
208
+ $template->getAttribute($template1, 'displayBlock', ['name', [], $blocks]);
209
+ $template->getAttribute($template1, 'hasBlock', ['name', []]);
210
+ $template->getAttribute($template1, 'render', [[]]);
211
+ $template->getAttribute($template1, 'display', [[]]);
212
+
213
+ $this->assertFalse($template->getAttribute($template1, 'env', [], Template::ANY_CALL, true));
214
+ $this->assertFalse($template->getAttribute($template1, 'environment', [], Template::ANY_CALL, true));
215
+ $this->assertFalse($template->getAttribute($template1, 'getEnvironment', [], Template::METHOD_CALL, true));
216
+ $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', [], Template::METHOD_CALL, true));
217
+ }
218
+
219
+ /**
220
+ * @group legacy
221
+ * @expectedDeprecation Silent display of undefined block "unknown" in template "index.twig" is deprecated since version 1.29 and will throw an exception in 2.0. Use the "block('unknown') is defined" expression to test for block existence.
222
+ * @expectedDeprecation Silent display of undefined block "unknown" in template "index.twig" is deprecated since version 1.29 and will throw an exception in 2.0. Use the "block('unknown') is defined" expression to test for block existence.
223
+ */
224
+ public function testRenderBlockWithUndefinedBlock()
225
+ {
226
+ $twig = new Environment($this->createMock('Twig\Tests\TemplateTestLoaderInterface'));
227
+
228
+ $template = new TemplateForTest($twig, 'index.twig');
229
+ $template->renderBlock('unknown', []);
230
+ $template->displayBlock('unknown', []);
231
+ }
232
+
233
+ public function testGetAttributeOnArrayWithConfusableKey()
234
+ {
235
+ $template = new TemplateForTest(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
236
+
237
+ $array = ['Zero', 'One', -1 => 'MinusOne', '' => 'EmptyString', '1.5' => 'FloatButString', '01' => 'IntegerButStringWithLeadingZeros'];
238
+
239
+ $this->assertSame('Zero', $array[false]);
240
+ $this->assertSame('One', $array[true]);
241
+ $this->assertSame('One', $array[1.5]);
242
+ $this->assertSame('One', $array['1']);
243
+ $this->assertSame('MinusOne', $array[-1.5]);
244
+ $this->assertSame('FloatButString', $array['1.5']);
245
+ $this->assertSame('IntegerButStringWithLeadingZeros', $array['01']);
246
+ $this->assertSame('EmptyString', $array[null]);
247
+
248
+ $this->assertSame('Zero', $template->getAttribute($array, false), 'false is treated as 0 when accessing an array (equals PHP behavior)');
249
+ $this->assertSame('One', $template->getAttribute($array, true), 'true is treated as 1 when accessing an array (equals PHP behavior)');
250
+ $this->assertSame('One', $template->getAttribute($array, 1.5), 'float is casted to int when accessing an array (equals PHP behavior)');
251
+ $this->assertSame('One', $template->getAttribute($array, '1'), '"1" is treated as integer 1 when accessing an array (equals PHP behavior)');
252
+ $this->assertSame('MinusOne', $template->getAttribute($array, -1.5), 'negative float is casted to int when accessing an array (equals PHP behavior)');
253
+ $this->assertSame('FloatButString', $template->getAttribute($array, '1.5'), '"1.5" is treated as-is when accessing an array (equals PHP behavior)');
254
+ $this->assertSame('IntegerButStringWithLeadingZeros', $template->getAttribute($array, '01'), '"01" is treated as-is when accessing an array (equals PHP behavior)');
255
+ $this->assertSame('EmptyString', $template->getAttribute($array, null), 'null is treated as "" when accessing an array (equals PHP behavior)');
256
+ }
257
+
258
+ /**
259
+ * @dataProvider getGetAttributeTests
260
+ */
261
+ public function testGetAttribute($defined, $value, $object, $item, $arguments, $type)
262
+ {
263
+ $template = new TemplateForTest(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
264
+
265
+ $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
266
+ }
267
+
268
+ /**
269
+ * @dataProvider getGetAttributeTests
270
+ */
271
+ public function testGetAttributeStrict($defined, $value, $object, $item, $arguments, $type, $exceptionMessage = null)
272
+ {
273
+ $template = new TemplateForTest(new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['strict_variables' => true]));
274
+
275
+ if ($defined) {
276
+ $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
277
+ } else {
278
+ $this->expectException('\Twig\Error\RuntimeError');
279
+ if (null !== $exceptionMessage) {
280
+ $this->expectExceptionMessage($exceptionMessage);
281
+ }
282
+ $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
283
+ }
284
+ }
285
+
286
+ /**
287
+ * @dataProvider getGetAttributeTests
288
+ */
289
+ public function testGetAttributeDefined($defined, $value, $object, $item, $arguments, $type)
290
+ {
291
+ $template = new TemplateForTest(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
292
+
293
+ $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true));
294
+ }
295
+
296
+ /**
297
+ * @dataProvider getGetAttributeTests
298
+ */
299
+ public function testGetAttributeDefinedStrict($defined, $value, $object, $item, $arguments, $type)
300
+ {
301
+ $template = new TemplateForTest(new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['strict_variables' => true]));
302
+
303
+ $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true));
304
+ }
305
+
306
+ public function testGetAttributeCallExceptions()
307
+ {
308
+ $template = new TemplateForTest(new Environment($this->createMock('\Twig\Loader\LoaderInterface')));
309
+
310
+ $object = new TemplateMagicMethodExceptionObject();
311
+
312
+ $this->assertNull($template->getAttribute($object, 'foo'));
313
+ }
314
+
315
+ public function getGetAttributeTests()
316
+ {
317
+ $array = [
318
+ 'defined' => 'defined',
319
+ 'zero' => 0,
320
+ 'null' => null,
321
+ '1' => 1,
322
+ 'bar' => true,
323
+ 'baz' => 'baz',
324
+ '09' => '09',
325
+ '+4' => '+4',
326
+ ];
327
+
328
+ $objectArray = new TemplateArrayAccessObject();
329
+ $arrayObject = new \ArrayObject($array);
330
+ $stdObject = (object) $array;
331
+ $magicPropertyObject = new TemplateMagicPropertyObject();
332
+ $propertyObject = new TemplatePropertyObject();
333
+ $propertyObject1 = new TemplatePropertyObjectAndIterator();
334
+ $propertyObject2 = new TemplatePropertyObjectAndArrayAccess();
335
+ $propertyObject3 = new TemplatePropertyObjectDefinedWithUndefinedValue();
336
+ $methodObject = new TemplateMethodObject();
337
+ $magicMethodObject = new TemplateMagicMethodObject();
338
+
339
+ $anyType = Template::ANY_CALL;
340
+ $methodType = Template::METHOD_CALL;
341
+ $arrayType = Template::ARRAY_CALL;
342
+
343
+ $basicTests = [
344
+ // array(defined, value, property to fetch)
345
+ [true, 'defined', 'defined'],
346
+ [false, null, 'undefined'],
347
+ [false, null, 'protected'],
348
+ [true, 0, 'zero'],
349
+ [true, 1, 1],
350
+ [true, 1, 1.0],
351
+ [true, null, 'null'],
352
+ [true, true, 'bar'],
353
+ [true, 'baz', 'baz'],
354
+ [true, '09', '09'],
355
+ [true, '+4', '+4'],
356
+ ];
357
+ $testObjects = [
358
+ // array(object, type of fetch)
359
+ [$array, $arrayType],
360
+ [$objectArray, $arrayType],
361
+ [$arrayObject, $anyType],
362
+ [$stdObject, $anyType],
363
+ [$magicPropertyObject, $anyType],
364
+ [$methodObject, $methodType],
365
+ [$methodObject, $anyType],
366
+ [$propertyObject, $anyType],
367
+ [$propertyObject1, $anyType],
368
+ [$propertyObject2, $anyType],
369
+ ];
370
+
371
+ $tests = [];
372
+ foreach ($testObjects as $testObject) {
373
+ foreach ($basicTests as $test) {
374
+ // properties cannot be numbers
375
+ if (($testObject[0] instanceof \stdClass || $testObject[0] instanceof TemplatePropertyObject) && is_numeric($test[2])) {
376
+ continue;
377
+ }
378
+
379
+ if ('+4' === $test[2] && $methodObject === $testObject[0]) {
380
+ continue;
381
+ }
382
+
383
+ $tests[] = [$test[0], $test[1], $testObject[0], $test[2], [], $testObject[1]];
384
+ }
385
+ }
386
+
387
+ // additional properties tests
388
+ $tests = array_merge($tests, [
389
+ [true, null, $propertyObject3, 'foo', [], $anyType],
390
+ ]);
391
+
392
+ // additional method tests
393
+ $tests = array_merge($tests, [
394
+ [true, 'defined', $methodObject, 'defined', [], $methodType],
395
+ [true, 'defined', $methodObject, 'DEFINED', [], $methodType],
396
+ [true, 'defined', $methodObject, 'getDefined', [], $methodType],
397
+ [true, 'defined', $methodObject, 'GETDEFINED', [], $methodType],
398
+ [true, 'static', $methodObject, 'static', [], $methodType],
399
+ [true, 'static', $methodObject, 'getStatic', [], $methodType],
400
+
401
+ [true, '__call_undefined', $magicMethodObject, 'undefined', [], $methodType],
402
+ [true, '__call_UNDEFINED', $magicMethodObject, 'UNDEFINED', [], $methodType],
403
+ ]);
404
+
405
+ // add the same tests for the any type
406
+ foreach ($tests as $test) {
407
+ if ($anyType !== $test[5]) {
408
+ $test[5] = $anyType;
409
+ $tests[] = $test;
410
+ }
411
+ }
412
+
413
+ $methodAndPropObject = new TemplateMethodAndPropObject();
414
+
415
+ // additional method tests
416
+ $tests = array_merge($tests, [
417
+ [true, 'a', $methodAndPropObject, 'a', [], $anyType],
418
+ [true, 'a', $methodAndPropObject, 'a', [], $methodType],
419
+ [false, null, $methodAndPropObject, 'a', [], $arrayType],
420
+
421
+ [true, 'b_prop', $methodAndPropObject, 'b', [], $anyType],
422
+ [true, 'b', $methodAndPropObject, 'B', [], $anyType],
423
+ [true, 'b', $methodAndPropObject, 'b', [], $methodType],
424
+ [true, 'b', $methodAndPropObject, 'B', [], $methodType],
425
+ [false, null, $methodAndPropObject, 'b', [], $arrayType],
426
+
427
+ [false, null, $methodAndPropObject, 'c', [], $anyType],
428
+ [false, null, $methodAndPropObject, 'c', [], $methodType],
429
+ [false, null, $methodAndPropObject, 'c', [], $arrayType],
430
+ ]);
431
+
432
+ $arrayAccess = new TemplateArrayAccess();
433
+ $tests = array_merge($tests, [
434
+ [true, ['foo' => 'bar'], $arrayAccess, 'vars', [], $anyType],
435
+ ]);
436
+
437
+ // tests when input is not an array or object
438
+ $tests = array_merge($tests, [
439
+ [false, null, 42, 'a', [], $anyType, 'Impossible to access an attribute ("a") on a integer variable ("42") in "index.twig".'],
440
+ [false, null, 'string', 'a', [], $anyType, 'Impossible to access an attribute ("a") on a string variable ("string") in "index.twig".'],
441
+ [false, null, [], 'a', [], $anyType, 'Key "a" does not exist as the array is empty in "index.twig".'],
442
+ ]);
443
+
444
+ return $tests;
445
+ }
446
+
447
+ public function testGetIsMethods()
448
+ {
449
+ $this->expectException('\Twig\Error\RuntimeError');
450
+
451
+ $getIsObject = new TemplateGetIsMethods();
452
+ $template = new TemplateForTest(new Environment($this->createMock('\Twig\Loader\LoaderInterface'), ['strict_variables' => true]));
453
+ // first time should not create a cache for "get"
454
+ $this->assertNull($template->getAttribute($getIsObject, 'get'));
455
+ // 0 should be in the method cache now, so this should fail
456
+ $this->assertNull($template->getAttribute($getIsObject, 0));
457
+ }
458
+ }
459
+
460
+ class TemplateForTest extends Template
461
+ {
462
+ private $name;
463
+
464
+ public function __construct(Environment $env, $name = 'index.twig')
465
+ {
466
+ parent::__construct($env);
467
+ self::$cache = [];
468
+ $this->name = $name;
469
+ }
470
+
471
+ public function getZero()
472
+ {
473
+ return 0;
474
+ }
475
+
476
+ public function getEmpty()
477
+ {
478
+ return '';
479
+ }
480
+
481
+ public function getString()
482
+ {
483
+ return 'some_string';
484
+ }
485
+
486
+ public function getTrue()
487
+ {
488
+ return true;
489
+ }
490
+
491
+ public function getTemplateName()
492
+ {
493
+ return $this->name;
494
+ }
495
+
496
+ public function getDebugInfo()
497
+ {
498
+ return [];
499
+ }
500
+
501
+ protected function doGetParent(array $context)
502
+ {
503
+ return false;
504
+ }
505
+
506
+ protected function doDisplay(array $context, array $blocks = [])
507
+ {
508
+ }
509
+
510
+ public function getAttribute($object, $item, array $arguments = [], $type = Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false)
511
+ {
512
+ if (\function_exists('twig_template_get_attributes')) {
513
+ return twig_template_get_attributes($this, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);
514
+ } else {
515
+ return parent::getAttribute($object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);
516
+ }
517
+ }
518
+
519
+ public function block_name($context, array $blocks = [])
520
+ {
521
+ }
522
+ }
523
+
524
+ class TemplateArrayAccessObject implements \ArrayAccess
525
+ {
526
+ protected $protected = 'protected';
527
+
528
+ public $attributes = [
529
+ 'defined' => 'defined',
530
+ 'zero' => 0,
531
+ 'null' => null,
532
+ '1' => 1,
533
+ 'bar' => true,
534
+ 'baz' => 'baz',
535
+ '09' => '09',
536
+ '+4' => '+4',
537
+ ];
538
+
539
+ public function offsetExists($name)
540
+ {
541
+ return \array_key_exists($name, $this->attributes);
542
+ }
543
+
544
+ public function offsetGet($name)
545
+ {
546
+ return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null;
547
+ }
548
+
549
+ public function offsetSet($name, $value)
550
+ {
551
+ }
552
+
553
+ public function offsetUnset($name)
554
+ {
555
+ }
556
+ }
557
+
558
+ class TemplateMagicPropertyObject
559
+ {
560
+ public $defined = 'defined';
561
+
562
+ public $attributes = [
563
+ 'zero' => 0,
564
+ 'null' => null,
565
+ '1' => 1,
566
+ 'bar' => true,
567
+ 'baz' => 'baz',
568
+ '09' => '09',
569
+ '+4' => '+4',
570
+ ];
571
+
572
+ protected $protected = 'protected';
573
+
574
+ public function __isset($name)
575
+ {
576
+ return \array_key_exists($name, $this->attributes);
577
+ }
578
+
579
+ public function __get($name)
580
+ {
581
+ return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null;
582
+ }
583
+ }
584
+
585
+ class TemplateMagicPropertyObjectWithException
586
+ {
587
+ public function __isset($key)
588
+ {
589
+ throw new \Exception('Hey! Don\'t try to isset me!');
590
+ }
591
+ }
592
+
593
+ class TemplatePropertyObject
594
+ {
595
+ public $defined = 'defined';
596
+ public $zero = 0;
597
+ public $null = null;
598
+ public $bar = true;
599
+ public $baz = 'baz';
600
+
601
+ protected $protected = 'protected';
602
+ }
603
+
604
+ class TemplatePropertyObjectAndIterator extends TemplatePropertyObject implements \IteratorAggregate
605
+ {
606
+ public function getIterator()
607
+ {
608
+ return new \ArrayIterator(['foo', 'bar']);
609
+ }
610
+ }
611
+
612
+ class TemplatePropertyObjectAndArrayAccess extends TemplatePropertyObject implements \ArrayAccess
613
+ {
614
+ private $data = [
615
+ 'defined' => 'defined',
616
+ 'zero' => 0,
617
+ 'null' => null,
618
+ 'bar' => true,
619
+ 'foo' => true,
620
+ 'baz' => 'baz',
621
+ 'baf' => 'baf',
622
+ ];
623
+
624
+ public function offsetExists($offset)
625
+ {
626
+ return \array_key_exists($offset, $this->data);
627
+ }
628
+
629
+ public function offsetGet($offset)
630
+ {
631
+ return $this->offsetExists($offset) ? $this->data[$offset] : 'n/a';
632
+ }
633
+
634
+ public function offsetSet($offset, $value)
635
+ {
636
+ }
637
+
638
+ public function offsetUnset($offset)
639
+ {
640
+ }
641
+ }
642
+
643
+ class TemplatePropertyObjectDefinedWithUndefinedValue
644
+ {
645
+ public $foo;
646
+
647
+ public function __construct()
648
+ {
649
+ $this->foo = @$notExist;
650
+ }
651
+ }
652
+
653
+ class TemplateMethodObject
654
+ {
655
+ public function getDefined()
656
+ {
657
+ return 'defined';
658
+ }
659
+
660
+ public function get1()
661
+ {
662
+ return 1;
663
+ }
664
+
665
+ public function get09()
666
+ {
667
+ return '09';
668
+ }
669
+
670
+ public function getZero()
671
+ {
672
+ return 0;
673
+ }
674
+
675
+ public function getNull()
676
+ {
677
+ }
678
+
679
+ public function isBar()
680
+ {
681
+ return true;
682
+ }
683
+
684
+ public function isBaz()
685
+ {
686
+ return 'should never be returned';
687
+ }
688
+
689
+ public function getBaz()
690
+ {
691
+ return 'baz';
692
+ }
693
+
694
+ protected function getProtected()
695
+ {
696
+ return 'protected';
697
+ }
698
+
699
+ public static function getStatic()
700
+ {
701
+ return 'static';
702
+ }
703
+ }
704
+
705
+ class TemplateGetIsMethods
706
+ {
707
+ public function get()
708
+ {
709
+ }
710
+
711
+ public function is()
712
+ {
713
+ }
714
+ }
715
+
716
+ class TemplateMethodAndPropObject
717
+ {
718
+ private $a = 'a_prop';
719
+
720
+ public function getA()
721
+ {
722
+ return 'a';
723
+ }
724
+
725
+ public $b = 'b_prop';
726
+
727
+ public function getB()
728
+ {
729
+ return 'b';
730
+ }
731
+
732
+ private $c = 'c_prop';
733
+
734
+ private function getC()
735
+ {
736
+ return 'c';
737
+ }
738
+ }
739
+
740
+ class TemplateArrayAccess implements \ArrayAccess
741
+ {
742
+ public $vars = [
743
+ 'foo' => 'bar',
744
+ ];
745
+ private $children = [];
746
+
747
+ public function offsetExists($offset)
748
+ {
749
+ return \array_key_exists($offset, $this->children);
750
+ }
751
+
752
+ public function offsetGet($offset)
753
+ {
754
+ return $this->children[$offset];
755
+ }
756
+
757
+ public function offsetSet($offset, $value)
758
+ {
759
+ $this->children[$offset] = $value;
760
+ }
761
+
762
+ public function offsetUnset($offset)
763
+ {
764
+ unset($this->children[$offset]);
765
+ }
766
+ }
767
+
768
+ class TemplateMagicMethodObject
769
+ {
770
+ public function __call($method, $arguments)
771
+ {
772
+ return '__call_'.$method;
773
+ }
774
+ }
775
+
776
+ class TemplateMagicMethodExceptionObject
777
+ {
778
+ public function __call($method, $arguments)
779
+ {
780
+ throw new \BadMethodCallException(sprintf('Unknown method "%s".', $method));
781
+ }
782
+ }
783
+
784
+ class CExtDisablingNodeVisitor implements NodeVisitorInterface
785
+ {
786
+ public function enterNode(\Twig_NodeInterface $node, Environment $env)
787
+ {
788
+ if ($node instanceof GetAttrExpression) {
789
+ $node->setAttribute('disable_c_ext', true);
790
+ }
791
+
792
+ return $node;
793
+ }
794
+
795
+ public function leaveNode(\Twig_NodeInterface $node, Environment $env)
796
+ {
797
+ return $node;
798
+ }
799
+
800
+ public function getPriority()
801
+ {
802
+ return 0;
803
+ }
804
+ }
805
+
806
+ // to be removed in 2.0
807
+ interface TemplateTestLoaderInterface extends LoaderInterface, SourceContextLoaderInterface
808
+ {
809
+ }
vendor/twig/twig/tests/TemplateWrapperTest.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\Loader\ArrayLoader;
16
+
17
+ class TemplateWrapperTest extends \PHPUnit\Framework\TestCase
18
+ {
19
+ public function testHasGetBlocks()
20
+ {
21
+ $twig = new Environment(new ArrayLoader([
22
+ 'index' => '{% block foo %}{% endblock %}',
23
+ 'index_with_use' => '{% use "imported" %}{% block foo %}{% endblock %}',
24
+ 'index_with_extends' => '{% extends "extended" %}{% block foo %}{% endblock %}',
25
+ 'imported' => '{% block imported %}{% endblock %}',
26
+ 'extended' => '{% block extended %}{% endblock %}',
27
+ ]));
28
+
29
+ $wrapper = $twig->load('index');
30
+ $this->assertTrue($wrapper->hasBlock('foo'));
31
+ $this->assertFalse($wrapper->hasBlock('bar'));
32
+ $this->assertEquals(['foo'], $wrapper->getBlockNames());
33
+
34
+ $wrapper = $twig->load('index_with_use');
35
+ $this->assertTrue($wrapper->hasBlock('foo'));
36
+ $this->assertTrue($wrapper->hasBlock('imported'));
37
+ $this->assertEquals(['imported', 'foo'], $wrapper->getBlockNames());
38
+
39
+ $wrapper = $twig->load('index_with_extends');
40
+ $this->assertTrue($wrapper->hasBlock('foo'));
41
+ $this->assertTrue($wrapper->hasBlock('extended'));
42
+ $this->assertEquals(['foo', 'extended'], $wrapper->getBlockNames());
43
+ }
44
+
45
+ public function testRenderBlock()
46
+ {
47
+ $twig = new Environment(new ArrayLoader([
48
+ 'index' => '{% block foo %}{{ foo }}{{ bar }}{% endblock %}',
49
+ ]));
50
+ $twig->addGlobal('bar', 'BAR');
51
+
52
+ $wrapper = $twig->load('index');
53
+ $this->assertEquals('FOOBAR', $wrapper->renderBlock('foo', ['foo' => 'FOO']));
54
+ }
55
+
56
+ public function testDisplayBlock()
57
+ {
58
+ $twig = new Environment(new ArrayLoader([
59
+ 'index' => '{% block foo %}{{ foo }}{{ bar }}{% endblock %}',
60
+ ]));
61
+ $twig->addGlobal('bar', 'BAR');
62
+
63
+ $wrapper = $twig->load('index');
64
+
65
+ ob_start();
66
+ $wrapper->displayBlock('foo', ['foo' => 'FOO']);
67
+
68
+ $this->assertEquals('FOOBAR', ob_get_clean());
69
+ }
70
+ }
vendor/twig/twig/tests/TokenStreamTest.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Token;
15
+ use Twig\TokenStream;
16
+
17
+ class TokenStreamTest extends \PHPUnit\Framework\TestCase
18
+ {
19
+ protected static $tokens;
20
+
21
+ protected function setUp()
22
+ {
23
+ self::$tokens = [
24
+ new Token(Token::TEXT_TYPE, 1, 1),
25
+ new Token(Token::TEXT_TYPE, 2, 1),
26
+ new Token(Token::TEXT_TYPE, 3, 1),
27
+ new Token(Token::TEXT_TYPE, 4, 1),
28
+ new Token(Token::TEXT_TYPE, 5, 1),
29
+ new Token(Token::TEXT_TYPE, 6, 1),
30
+ new Token(Token::TEXT_TYPE, 7, 1),
31
+ new Token(Token::EOF_TYPE, 0, 1),
32
+ ];
33
+ }
34
+
35
+ /**
36
+ * @group legacy
37
+ */
38
+ public function testLegacyConstructorSignature()
39
+ {
40
+ $stream = new TokenStream([], 'foo', '{{ foo }}');
41
+ $this->assertEquals('foo', $stream->getFilename());
42
+ $this->assertEquals('{{ foo }}', $stream->getSource());
43
+ $this->assertEquals('foo', $stream->getSourceContext()->getName());
44
+ $this->assertEquals('{{ foo }}', $stream->getSourceContext()->getCode());
45
+ }
46
+
47
+ public function testNext()
48
+ {
49
+ $stream = new TokenStream(self::$tokens);
50
+ $repr = [];
51
+ while (!$stream->isEOF()) {
52
+ $token = $stream->next();
53
+
54
+ $repr[] = $token->getValue();
55
+ }
56
+ $this->assertEquals('1, 2, 3, 4, 5, 6, 7', implode(', ', $repr), '->next() advances the pointer and returns the current token');
57
+ }
58
+
59
+ public function testEndOfTemplateNext()
60
+ {
61
+ $this->expectException('\Twig\Error\SyntaxError');
62
+ $this->expectExceptionMessage('Unexpected end of template');
63
+
64
+ $stream = new TokenStream([
65
+ new Token(Token::BLOCK_START_TYPE, 1, 1),
66
+ ]);
67
+ while (!$stream->isEOF()) {
68
+ $stream->next();
69
+ }
70
+ }
71
+
72
+ public function testEndOfTemplateLook()
73
+ {
74
+ $this->expectException('\Twig\Error\SyntaxError');
75
+ $this->expectExceptionMessage('Unexpected end of template');
76
+
77
+ $stream = new TokenStream([
78
+ new Token(Token::BLOCK_START_TYPE, 1, 1),
79
+ ]);
80
+ while (!$stream->isEOF()) {
81
+ $stream->look();
82
+ $stream->next();
83
+ }
84
+ }
85
+ }
vendor/twig/twig/tests/Util/DeprecationCollectorTest.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests\Util;
4
+
5
+ /*
6
+ * This file is part of Twig.
7
+ *
8
+ * (c) Fabien Potencier
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ use Twig\Environment;
15
+ use Twig\TwigFunction;
16
+ use Twig\Util\DeprecationCollector;
17
+
18
+ class DeprecationCollectorTest extends \PHPUnit\Framework\TestCase
19
+ {
20
+ /**
21
+ * @requires PHP 5.3
22
+ */
23
+ public function testCollect()
24
+ {
25
+ $twig = new Environment($this->createMock('\Twig\Loader\LoaderInterface'));
26
+ $twig->addFunction(new TwigFunction('deprec', [$this, 'deprec'], ['deprecated' => true]));
27
+
28
+ $collector = new DeprecationCollector($twig);
29
+ $deprecations = $collector->collect(new Twig_Tests_Util_Iterator());
30
+
31
+ $this->assertEquals(['Twig Function "deprec" is deprecated in deprec.twig at line 1.'], $deprecations);
32
+ }
33
+
34
+ public function deprec()
35
+ {
36
+ }
37
+ }
38
+
39
+ class Twig_Tests_Util_Iterator implements \IteratorAggregate
40
+ {
41
+ public function getIterator()
42
+ {
43
+ return new \ArrayIterator([
44
+ 'ok.twig' => '{{ foo }}',
45
+ 'deprec.twig' => '{{ deprec("foo") }}',
46
+ ]);
47
+ }
48
+ }
vendor/twig/twig/tests/escapingTest.php ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Twig\Tests;
4
+
5
+ /**
6
+ * This class is adapted from code coming from Zend Framework.
7
+ *
8
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (https://www.zend.com)
9
+ * @license https://framework.zend.com/license/new-bsd New BSD License
10
+ */
11
+ class Twig_Test_EscapingTest extends \PHPUnit\Framework\TestCase
12
+ {
13
+ /**
14
+ * All character encodings supported by htmlspecialchars().
15
+ */
16
+ protected $htmlSpecialChars = [
17
+ '\'' => '&#039;',
18
+ '"' => '&quot;',
19
+ '<' => '&lt;',
20
+ '>' => '&gt;',
21
+ '&' => '&amp;',
22
+ ];
23
+
24
+ protected $htmlAttrSpecialChars = [
25
+ '\'' => '&#x27;',
26
+ /* Characters beyond ASCII value 255 to unicode escape */
27
+ 'Ä€' => '&#x0100;',
28
+ '😀' => '&#x1F600;',
29
+ /* Immune chars excluded */
30
+ ',' => ',',
31
+ '.' => '.',
32
+ '-' => '-',
33
+ '_' => '_',
34
+ /* Basic alnums excluded */
35
+ 'a' => 'a',
36
+ 'A' => 'A',
37
+ 'z' => 'z',
38
+ 'Z' => 'Z',
39
+ '0' => '0',
40
+ '9' => '9',
41
+ /* Basic control characters and null */
42
+ "\r" => '&#x0D;',
43
+ "\n" => '&#x0A;',
44
+ "\t" => '&#x09;',
45
+ "\0" => '&#xFFFD;', // should use Unicode replacement char
46
+ /* Encode chars as named entities where possible */
47
+ '<' => '&lt;',
48
+ '>' => '&gt;',
49
+ '&' => '&amp;',
50
+ '"' => '&quot;',
51
+ /* Encode spaces for quoteless attribute protection */
52
+ ' ' => '&#x20;',
53
+ ];
54
+
55
+ protected $jsSpecialChars = [
56
+ /* HTML special chars - escape without exception to hex */
57
+ '<' => '\\u003C',
58
+ '>' => '\\u003E',
59
+ '\'' => '\\u0027',
60
+ '"' => '\\u0022',
61
+ '&' => '\\u0026',
62
+ '/' => '\\/',
63
+ /* Characters beyond ASCII value 255 to unicode escape */
64
+ 'Ä€' => '\\u0100',
65
+ '😀' => '\\uD83D\\uDE00',
66
+ /* Immune chars excluded */
67
+ ',' => ',',
68
+ '.' => '.',
69
+ '_' => '_',
70
+ /* Basic alnums excluded */
71
+ 'a' => 'a',
72
+ 'A' => 'A',
73
+ 'z' => 'z',
74
+ 'Z' => 'Z',
75
+ '0' => '0',
76
+ '9' => '9',
77
+ /* Basic control characters and null */
78
+ "\r" => '\r',
79
+ "\n" => '\n',
80
+ "\x08" => '\b',
81
+ "\t" => '\t',
82
+ "\x0C" => '\f',
83
+ "\0" => '\\u0000',
84
+ /* Encode spaces for quoteless attribute protection */
85
+ ' ' => '\\u0020',
86
+ ];
87
+
88
+ protected $urlSpecialChars = [
89
+ /* HTML special chars - escape without exception to percent encoding */
90
+ '<' => '%3C',
91
+ '>' => '%3E',
92
+ '\'' => '%27',
93
+ '"' => '%22',
94
+ '&' => '%26',
95
+ /* Characters beyond ASCII value 255 to hex sequence */
96
+ 'Ä€' => '%C4%80',
97
+ /* Punctuation and unreserved check */
98
+ ',' => '%2C',
99
+ '.' => '.',
100
+ '_' => '_',
101
+ '-' => '-',
102
+ ':' => '%3A',
103
+ ';' => '%3B',
104
+ '!' => '%21',
105
+ /* Basic alnums excluded */
106
+ 'a' => 'a',
107
+ 'A' => 'A',
108
+ 'z' => 'z',
109
+ 'Z' => 'Z',
110
+ '0' => '0',
111
+ '9' => '9',
112
+ /* Basic control characters and null */
113
+ "\r" => '%0D',
114
+ "\n" => '%0A',
115
+ "\t" => '%09',
116
+ "\0" => '%00',
117
+ /* PHP quirks from the past */
118
+ ' ' => '%20',
119
+ '~' => '~',
120
+ '+' => '%2B',
121
+ ];
122
+
123
+ protected $cssSpecialChars = [
124
+ /* HTML special chars - escape without exception to hex */
125
+ '<' => '\\3C ',
126
+ '>' => '\\3E ',
127
+ '\'' => '\\27 ',
128
+ '"' => '\\22 ',
129
+ '&' => '\\26 ',
130
+ /* Characters beyond ASCII value 255 to unicode escape */
131
+ 'Ä€' => '\\100 ',
132
+ /* Immune chars excluded */
133
+ ',' => '\\2C ',
134
+ '.' => '\\2E ',
135
+ '_' => '\\5F ',
136
+ /* Basic alnums excluded */
137
+ 'a' => 'a',
138
+ 'A' => 'A',
139
+ 'z' => 'z',
140
+ 'Z' => 'Z',
141
+ '0' => '0',
142
+ '9' => '9',
143
+ /* Basic control characters and null */
144
+ "\r" => '\\D ',
145
+ "\n" => '\\A ',
146
+ "\t" => '\\9 ',
147
+ "\0" => '\\0 ',
148
+ /* Encode spaces for quoteless attribute protection */
149
+ ' ' => '\\20 ',
150
+ ];
151
+
152
+ protected $env;
153
+
154
+ protected function setUp()
155
+ {
156
+ $this->env = new \Twig\Environment($this->createMock('\Twig\Loader\LoaderInterface'));
157
+ }
158
+
159
+ public function testHtmlEscapingConvertsSpecialChars()
160
+ {
161
+ foreach ($this->htmlSpecialChars as $key => $value) {
162
+ $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html'), 'Failed to escape: '.$key);
163
+ }
164
+ }
165
+
166
+ public function testHtmlAttributeEscapingConvertsSpecialChars()
167
+ {
168
+ foreach ($this->htmlAttrSpecialChars as $key => $value) {
169
+ $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html_attr'), 'Failed to escape: '.$key);
170
+ }
171
+ }
172
+
173
+ public function testJavascriptEscapingConvertsSpecialChars()
174
+ {
175
+ foreach ($this->jsSpecialChars as $key => $value) {
176
+ $this->assertEquals($value, twig_escape_filter($this->env, $key, 'js'), 'Failed to escape: '.$key);
177
+ }
178
+ }
179
+
180
+ public function testJavascriptEscapingReturnsStringIfZeroLength()
181
+ {
182
+ $this->assertEquals('', twig_escape_filter($this->env, '', 'js'));
183
+ }
184
+
185
+ public function testJavascriptEscapingReturnsStringIfContainsOnlyDigits()
186
+ {
187
+ $this->assertEquals('123', twig_escape_filter($this->env, '123', 'js'));
188
+ }
189
+
190
+ public function testCssEscapingConvertsSpecialChars()
191
+ {
192
+ foreach ($this->cssSpecialChars as $key => $value) {
193
+ $this->assertEquals($value, twig_escape_filter($this->env, $key, 'css'), 'Failed to escape: '.$key);
194
+ }
195
+ }
196
+
197
+ public function testCssEscapingReturnsStringIfZeroLength()
198
+ {
199
+ $this->assertEquals('', twig_escape_filter($this->env, '', 'css'));
200
+ }
201
+
202
+ public function testCssEscapingReturnsStringIfContainsOnlyDigits()
203
+ {
204
+ $this->assertEquals('123', twig_escape_filter($this->env, '123', 'css'));
205
+ }
206
+
207
+ public function testUrlEscapingConvertsSpecialChars()
208
+ {
209
+ foreach ($this->urlSpecialChars as $key => $value) {
210
+ $this->assertEquals($value, twig_escape_filter($this->env, $key, 'url'), 'Failed to escape: '.$key);
211
+ }
212
+ }
213
+
214
+ /**
215
+ * Range tests to confirm escaped range of characters is within OWASP recommendation.
216
+ */
217
+
218
+ /**
219
+ * Only testing the first few 2 ranges on this prot. function as that's all these
220
+ * other range tests require.
221
+ */
222
+ public function testUnicodeCodepointConversionToUtf8()
223
+ {
224
+ $expected = ' ~Þ™';
225
+ $codepoints = [0x20, 0x7e, 0x799];
226
+ $result = '';
227
+ foreach ($codepoints as $value) {
228
+ $result .= $this->codepointToUtf8($value);
229
+ }
230
+ $this->assertEquals($expected, $result);
231
+ }
232
+
233
+ /**
234
+ * Convert a Unicode Codepoint to a literal UTF-8 character.
235
+ *
236
+ * @param int $codepoint Unicode codepoint in hex notation
237
+ *
238
+ * @return string UTF-8 literal string
239
+ */
240
+ protected function codepointToUtf8($codepoint)
241
+ {
242
+ if ($codepoint < 0x80) {
243
+ return \chr($codepoint);
244
+ }
245
+ if ($codepoint < 0x800) {
246
+ return \chr($codepoint >> 6 & 0x3f | 0xc0)
247
+ .\chr($codepoint & 0x3f | 0x80);
248
+ }
249
+ if ($codepoint < 0x10000) {
250
+ return \chr($codepoint >> 12 & 0x0f | 0xe0)
251
+ .\chr($codepoint >> 6 & 0x3f | 0x80)
252
+ .\chr($codepoint & 0x3f | 0x80);
253
+ }
254
+ if ($codepoint < 0x110000) {
255
+ return \chr($codepoint >> 18 & 0x07 | 0xf0)
256
+ .\chr($codepoint >> 12 & 0x3f | 0x80)
257
+ .\chr($codepoint >> 6 & 0x3f | 0x80)
258
+ .\chr($codepoint & 0x3f | 0x80);
259
+ }
260
+ throw new \Exception('Codepoint requested outside of Unicode range.');
261
+ }
262
+
263
+ public function testJavascriptEscapingEscapesOwaspRecommendedRanges()
264
+ {
265
+ $immune = [',', '.', '_']; // Exceptions to escaping ranges
266
+ for ($chr = 0; $chr < 0xFF; ++$chr) {
267
+ if ($chr >= 0x30 && $chr <= 0x39
268
+ || $chr >= 0x41 && $chr <= 0x5A
269
+ || $chr >= 0x61 && $chr <= 0x7A) {
270
+ $literal = $this->codepointToUtf8($chr);
271
+ $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js'));
272
+ } else {
273
+ $literal = $this->codepointToUtf8($chr);
274
+ if (\in_array($literal, $immune)) {
275
+ $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js'));
276
+ } else {
277
+ $this->assertNotEquals(
278
+ $literal,
279
+ twig_escape_filter($this->env, $literal, 'js'),
280
+ "$literal should be escaped!");
281
+ }
282
+ }
283
+ }
284
+ }
285
+
286
+ public function testHtmlAttributeEscapingEscapesOwaspRecommendedRanges()
287
+ {
288
+ $immune = [',', '.', '-', '_']; // Exceptions to escaping ranges
289
+ for ($chr = 0; $chr < 0xFF; ++$chr) {
290
+ if ($chr >= 0x30 && $chr <= 0x39
291
+ || $chr >= 0x41 && $chr <= 0x5A
292
+ || $chr >= 0x61 && $chr <= 0x7A) {
293
+ $literal = $this->codepointToUtf8($chr);
294
+ $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr'));
295
+ } else {
296
+ $literal = $this->codepointToUtf8($chr);
297
+ if (\in_array($literal, $immune)) {
298
+ $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr'));
299
+ } else {
300
+ $this->assertNotEquals(
301
+ $literal,
302
+ twig_escape_filter($this->env, $literal, 'html_attr'),
303
+ "$literal should be escaped!");
304
+ }
305
+ }
306
+ }
307
+ }
308
+
309
+ public function testCssEscapingEscapesOwaspRecommendedRanges()
310
+ {
311
+ // CSS has no exceptions to escaping ranges
312
+ for ($chr = 0; $chr < 0xFF; ++$chr) {
313
+ if ($chr >= 0x30 && $chr <= 0x39
314
+ || $chr >= 0x41 && $chr <= 0x5A
315
+ || $chr >= 0x61 && $chr <= 0x7A) {
316
+ $literal = $this->codepointToUtf8($chr);
317
+ $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'css'));
318
+ } else {
319
+ $literal = $this->codepointToUtf8($chr);
320
+ $this->assertNotEquals(
321
+ $literal,
322
+ twig_escape_filter($this->env, $literal, 'css'),
323
+ "$literal should be escaped!");
324
+ }
325
+ }
326
+ }
327
+ }
vendor/vendor/altorouter/altorouter/AltoRouter.php ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AltoRouter {
4
+
5
+ /**
6
+ * @var array Array of all routes (incl. named routes).
7
+ */
8
+ protected $routes = array();
9
+
10
+ /**
11
+ * @var array Array of all named routes.
12
+ */
13
+ protected $namedRoutes = array();
14
+
15
+ /**
16
+ * @var string Can be used to ignore leading part of the Request URL (if main file lives in subdirectory of host)
17
+ */
18
+ protected $basePath = '';
19
+
20
+ /**
21
+ * @var array Array of default match types (regex helpers)
22
+ */
23
+ protected $matchTypes = array(
24
+ 'i' => '[0-9]++',
25
+ 'a' => '[0-9A-Za-z]++',
26
+ 'h' => '[0-9A-Fa-f]++',
27
+ '*' => '.+?',
28
+ '**' => '.++',
29
+ '' => '[^/\.]++'
30
+ );
31
+
32
+ /**
33
+ * Create router in one call from config.
34
+ *
35
+ * @param array $routes
36
+ * @param string $basePath
37
+ * @param array $matchTypes
38
+ */
39
+ public function __construct( $routes = array(), $basePath = '', $matchTypes = array() ) {
40
+ $this->addRoutes($routes);
41
+ $this->setBasePath($basePath);
42
+ $this->addMatchTypes($matchTypes);
43
+ }
44
+
45
+ /**
46
+ * Retrieves all routes.
47
+ * Useful if you want to process or display routes.
48
+ * @return array All routes.
49
+ */
50
+ public function getRoutes() {
51
+ return $this->routes;
52
+ }
53
+
54
+ /**
55
+ * Add multiple routes at once from array in the following format:
56
+ *
57
+ * $routes = array(
58
+ * array($method, $route, $target, $name)
59
+ * );
60
+ *
61
+ * @param array $routes
62
+ * @return void
63
+ * @author Koen Punt
64
+ * @throws Exception
65
+ */
66
+ public function addRoutes($routes){
67
+ if(!is_array($routes) && !$routes instanceof Traversable) {
68
+ throw new \Exception('Routes should be an array or an instance of Traversable');
69
+ }
70
+ foreach($routes as $route) {
71
+ call_user_func_array(array($this, 'map'), $route);
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Set the base path.
77
+ * Useful if you are running your application from a subdirectory.
78
+ */
79
+ public function setBasePath($basePath) {
80
+ $this->basePath = $basePath;
81
+ }
82
+
83
+ /**
84
+ * Add named match types. It uses array_merge so keys can be overwritten.
85
+ *
86
+ * @param array $matchTypes The key is the name and the value is the regex.
87
+ */
88
+ public function addMatchTypes($matchTypes) {
89
+ $this->matchTypes = array_merge($this->matchTypes, $matchTypes);
90
+ }
91
+
92
+ /**
93
+ * Map a route to a target
94
+ *
95
+ * @param string $method One of 5 HTTP Methods, or a pipe-separated list of multiple HTTP Methods (GET|POST|PATCH|PUT|DELETE)
96
+ * @param string $route The route regex, custom regex must start with an @. You can use multiple pre-set regex filters, like [i:id]
97
+ * @param mixed $target The target where this route should point to. Can be anything.
98
+ * @param string $name Optional name of this route. Supply if you want to reverse route this url in your application.
99
+ * @throws Exception
100
+ */
101
+ public function map($method, $route, $target, $name = null) {
102
+
103
+ $this->routes[] = array($method, $route, $target, $name);
104
+
105
+ if($name) {
106
+ if(isset($this->namedRoutes[$name])) {
107
+ throw new \Exception("Can not redeclare route '{$name}'");
108
+ } else {
109
+ $this->namedRoutes[$name] = $route;
110
+ }
111
+
112
+ }
113
+
114
+ return;
115
+ }
116
+
117
+ /**
118
+ * Reversed routing
119
+ *
120
+ * Generate the URL for a named route. Replace regexes with supplied parameters
121
+ *
122
+ * @param string $routeName The name of the route.
123
+ * @param array @params Associative array of parameters to replace placeholders with.
124
+ * @return string The URL of the route with named parameters in place.
125
+ * @throws Exception
126
+ */
127
+ public function generate($routeName, array $params = array()) {
128
+
129
+ // Check if named route exists
130
+ if(!isset($this->namedRoutes[$routeName])) {
131
+ throw new \Exception("Route '{$routeName}' does not exist.");
132
+ }
133
+
134
+ // Replace named parameters
135
+ $route = $this->namedRoutes[$routeName];
136
+
137
+ // prepend base path to route url again
138
+ $url = $this->basePath . $route;
139
+
140
+ if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) {
141
+
142
+ foreach($matches as $match) {
143
+ list($block, $pre, $type, $param, $optional) = $match;
144
+
145
+ if ($pre) {
146
+ $block = substr($block, 1);
147
+ }
148
+
149
+ if(isset($params[$param])) {
150
+ $url = str_replace($block, $params[$param], $url);
151
+ } elseif ($optional) {
152
+ $url = str_replace($pre . $block, '', $url);
153
+ }
154
+ }
155
+
156
+
157
+ }
158
+
159
+ return $url;
160
+ }
161
+
162
+ /**
163
+ * Match a given Request Url against stored routes
164
+ * @param string $requestUrl
165
+ * @param string $requestMethod
166
+ * @return array|boolean Array with route information on success, false on failure (no match).
167
+ */
168
+ public function match($requestUrl = null, $requestMethod = null) {
169
+
170
+ $params = array();
171
+ $match = false;
172
+
173
+ // set Request Url if it isn't passed as parameter
174
+ if($requestUrl === null) {
175
+ $requestUrl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
176
+ }
177
+
178
+ // strip base path from request url
179
+ $requestUrl = substr($requestUrl, strlen($this->basePath));
180
+
181
+ // Strip query string (?a=b) from Request Url
182
+ if (($strpos = strpos($requestUrl, '?')) !== false) {
183
+ $requestUrl = substr($requestUrl, 0, $strpos);
184
+ }
185
+
186
+ // set Request Method if it isn't passed as a parameter
187
+ if($requestMethod === null) {
188
+ $requestMethod = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
189
+ }
190
+
191
+ foreach($this->routes as $handler) {
192
+ list($method, $_route, $target, $name) = $handler;
193
+
194
+ $methods = explode('|', $method);
195
+ $method_match = false;
196
+
197
+ // Check if request method matches. If not, abandon early. (CHEAP)
198
+ foreach($methods as $method) {
199
+ if (strcasecmp($requestMethod, $method) === 0) {
200
+ $method_match = true;
201
+ break;
202
+ }
203
+ }
204
+
205
+ // Method did not match, continue to next route.
206
+ if(!$method_match) continue;
207
+
208
+ // Check for a wildcard (matches all)
209
+ if ($_route === '*') {
210
+ $match = true;
211
+ } elseif (isset($_route[0]) && $_route[0] === '@') {
212
+ $pattern = '`' . substr($_route, 1) . '`u';
213
+ $match = preg_match($pattern, $requestUrl, $params);
214
+ } else {
215
+ $route = null;
216
+ $regex = false;
217
+ $j = 0;
218
+ $n = isset($_route[0]) ? $_route[0] : null;
219
+ $i = 0;
220
+
221
+ // Find the longest non-regex substring and match it against the URI
222
+ while (true) {
223
+ if (!isset($_route[$i])) {
224
+ break;
225
+ } elseif (false === $regex) {
226
+ $c = $n;
227
+ $regex = $c === '[' || $c === '(' || $c === '.';
228
+ if (false === $regex && false !== isset($_route[$i+1])) {
229
+ $n = $_route[$i + 1];
230
+ $regex = $n === '?' || $n === '+' || $n === '*' || $n === '{';
231
+ }
232
+ if (false === $regex && $c !== '/' && (!isset($requestUrl[$j]) || $c !== $requestUrl[$j])) {
233
+ continue 2;
234
+ }
235
+ $j++;
236
+ }
237
+ $route .= $_route[$i++];
238
+ }
239
+
240
+ $regex = $this->compileRoute($route);
241
+ $match = preg_match($regex, $requestUrl, $params);
242
+ }
243
+
244
+ if(($match == true || $match > 0)) {
245
+
246
+ if($params) {
247
+ foreach($params as $key => $value) {
248
+ if(is_numeric($key)) unset($params[$key]);
249
+ }
250
+ }
251
+
252
+ return array(
253
+ 'target' => $target,
254
+ 'params' => $params,
255
+ 'name' => $name
256
+ );
257
+ }
258
+ }
259
+ return false;
260
+ }
261
+
262
+ /**
263
+ * Compile the regex for a given route (EXPENSIVE)
264
+ */
265
+ private function compileRoute($route) {
266
+ if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) {
267
+
268
+ $matchTypes = $this->matchTypes;
269
+ foreach($matches as $match) {
270
+ list($block, $pre, $type, $param, $optional) = $match;
271
+
272
+ if (isset($matchTypes[$type])) {
273
+ $type = $matchTypes[$type];
274
+ }
275
+ if ($pre === '.') {
276
+ $pre = '\.';
277
+ }
278
+
279
+ //Older versions of PCRE require the 'P' in (?P<named>)
280
+ $pattern = '(?:'
281
+ . ($pre !== '' ? $pre : null)
282
+ . '('
283
+ . ($param !== '' ? "?P<$param>" : null)
284
+ . $type
285
+ . '))'
286
+ . ($optional !== '' ? '?' : null);
287
+
288
+ $route = str_replace($block, $pattern, $route);
289
+ }
290
+
291
+ }
292
+ return "`^$route$`u";
293
+ }
294
+ }
vendor/vendor/altorouter/altorouter/README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AltoRouter [![Build Status](https://api.travis-ci.org/dannyvankooten/AltoRouter.png)](http://travis-ci.org/dannyvankooten/AltoRouter) [![Latest Stable Version](https://poser.pugx.org/altorouter/altorouter/v/stable.svg)](https://packagist.org/packages/altorouter/altorouter) [![License](https://poser.pugx.org/altorouter/altorouter/license.svg)](https://packagist.org/packages/altorouter/altorouter) [![Code Climate](https://codeclimate.com/github/dannyvankooten/AltoRouter/badges/gpa.svg)](https://codeclimate.com/github/dannyvankooten/AltoRouter) [![Test Coverage](https://codeclimate.com/github/dannyvankooten/AltoRouter/badges/coverage.svg)](https://codeclimate.com/github/dannyvankooten/AltoRouter)
2
+ AltoRouter is a small but powerful routing class for PHP 5.3+, heavily inspired by [klein.php](https://github.com/chriso/klein.php/).
3
+
4
+ ```php
5
+ $router = new AltoRouter();
6
+
7
+ // map homepage
8
+ $router->map( 'GET', '/', function() {
9
+ require __DIR__ . '/views/home.php';
10
+ });
11
+
12
+ // map users details page
13
+ $router->map( 'GET|POST', '/users/[i:id]/', function( $id ) {
14
+ $user = .....
15
+ require __DIR__ . '/views/user/details.php';
16
+ });
17
+ ```
18
+
19
+ ## Features
20
+
21
+ * Can be used with all HTTP Methods
22
+ * Dynamic routing with named route parameters
23
+ * Reversed routing
24
+ * Flexible regular expression routing (inspired by [Sinatra](http://www.sinatrarb.com/))
25
+ * Custom regexes
26
+
27
+ ## Getting started
28
+
29
+ You need PHP >= 5.3 to use AltoRouter.
30
+
31
+ - [Install AltoRouter](http://altorouter.com/usage/install.html)
32
+ - [Rewrite all requests to AltoRouter](http://altorouter.com/usage/rewrite-requests.html)
33
+ - [Map your routes](http://altorouter.com/usage/mapping-routes.html)
34
+ - [Match requests](http://altorouter.com/usage/matching-requests.html)
35
+ - [Process the request your preferred way](http://altorouter.com/usage/processing-requests.html)
36
+
37
+ ## Contributors
38
+ - [Danny van Kooten](https://github.com/dannyvankooten)
39
+ - [Koen Punt](https://github.com/koenpunt)
40
+ - [John Long](https://github.com/adduc)
41
+ - [Niahoo Osef](https://github.com/niahoo)
42
+
43
+ ## License
44
+
45
+ (MIT License)
46
+
47
+ Copyright (c) 2012-2015 Danny van Kooten <hi@dannyvankooten.com>
48
+
49
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
50
+
51
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
52
+
53
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vendor/vendor/altorouter/altorouter/composer.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "altorouter/altorouter",
3
+ "description": "A lightning fast router for PHP",
4
+ "keywords": ["router", "routing", "lightweight"],
5
+ "homepage": "https://github.com/dannyvankooten/AltoRouter",
6
+ "license": "MIT",
7
+ "authors": [
8
+ {
9
+ "name": "Danny van Kooten",
10
+ "email": "dannyvankooten@gmail.com",
11
+ "homepage": "http://dannyvankooten.com/"
12
+ },
13
+ {
14
+ "name": "Koen Punt",
15
+ "homepage": "https://github.com/koenpunt"
16
+ },
17
+ {
18
+ "name": "niahoo",
19
+ "homepage": "https://github.com/niahoo"
20
+ }
21
+ ],
22
+ "require": {
23
+ "php": ">=5.3.0"
24
+ },
25
+ "require-dev": {
26
+ "phpunit/phpunit": "4.5.*",
27
+ "codeclimate/php-test-reporter": "dev-master"
28
+ },
29
+ "autoload": {
30
+ "classmap": ["AltoRouter.php"]
31
+ },
32
+ "scripts": {
33
+ "test": "vendor/bin/phpunit"
34
+ }
35
+ }
vendor/vendor/asm89/twig-cache-extension/.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ phpunit.xml
2
+ composer.lock
3
+ composer.phar
4
+ /vendor/
vendor/vendor/asm89/twig-cache-extension/.travis.yml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ language: php
2
+
3
+ cache:
4
+ directories:
5
+ - vendor
6
+ - $HOME/.composer/cache
7
+
8
+ env:
9
+ - TWIG_VERSION="^1.0"
10
+ - TWIG_VERSION="^2.0"
11
+
12
+ php:
13
+ - 5.3
14
+ - 5.4
15
+ - 5.5
16
+ - 5.6
17
+ - 7.0
18
+ - 7.1
19
+ - hhvm
20
+
21
+ matrix:
22
+ exclude:
23
+ - php: 5.3
24
+ env: TWIG_VERSION="^2.0"
25
+ - php: 5.4
26
+ env: TWIG_VERSION="^2.0"
27
+ - php: 5.5
28
+ env: TWIG_VERSION="^2.0"
29
+ - php: 5.6
30
+ env: TWIG_VERSION="^2.0"
31
+ - php: hhvm
32
+ env: TWIG_VERSION="^2.0"
33
+
34
+ install: composer require twig/twig:${TWIG_VERSION}
35
+
36
+ script: phpunit
vendor/vendor/asm89/twig-cache-extension/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2013 Alexander <iam.asm89@gmail.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is furnished
8
+ to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
vendor/vendor/asm89/twig-cache-extension/README.md ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Twig cache extension
2
+ ====================
3
+
4
+ The missing cache extension for Twig. The extension allows for caching rendered parts of
5
+ templates using several cache strategies.
6
+
7
+ [![Build Status](https://secure.travis-ci.org/asm89/twig-cache-extension.png?branch=master)](http://travis-ci.org/asm89/twig-cache-extension)
8
+
9
+ ## Installation
10
+
11
+ The extension is installable via composer:
12
+
13
+ ```json
14
+ {
15
+ "require": {
16
+ "asm89/twig-cache-extension": "~1.0"
17
+ }
18
+ }
19
+ ```
20
+
21
+ ## Quick start
22
+
23
+ ### Setup
24
+
25
+ A minimal setup for adding the extension with the `LifeTimeCacheStrategy` and
26
+ doctrine array cache is as following:
27
+
28
+ ```php
29
+ <?php
30
+
31
+ use Doctrine\Common\Cache\ArrayCache;
32
+ use Asm89\Twig\CacheExtension\CacheProvider\DoctrineCacheAdapter;
33
+ use Asm89\Twig\CacheExtension\CacheStrategy\LifetimeCacheStrategy;
34
+ use Asm89\Twig\CacheExtension\Extension as CacheExtension;
35
+
36
+ $cacheProvider = new DoctrineCacheAdapter(new ArrayCache());
37
+ $cacheStrategy = new LifetimeCacheStrategy($cacheProvider);
38
+ $cacheExtension = new CacheExtension($cacheStrategy);
39
+
40
+ $twig->addExtension($cacheExtension);
41
+ ```
42
+
43
+ ### Want to use a PSR-6 cache pool?
44
+
45
+ Instead of using the default `DoctrineCacheAdapter` the extension also has
46
+ a `PSR-6` compatible adapter. You need to instantiate one of the cache pool
47
+ implementations as can be found on: http://php-cache.readthedocs.io/en/latest/
48
+
49
+ Example: Making use of the `ApcuCachePool` via the `PsrCacheAdapter`:
50
+
51
+ ```bash
52
+ composer require cache/apcu-adapter
53
+ ```
54
+
55
+ ```php
56
+ <?php
57
+
58
+ use Asm89\Twig\CacheExtension\CacheProvider\PsrCacheAdapter;
59
+ use Asm89\Twig\CacheExtension\CacheStrategy\LifetimeCacheStrategy;
60
+ use Asm89\Twig\CacheExtension\Extension as CacheExtension;
61
+ use Cache\Adapter\Apcu\ApcuCachePool;
62
+
63
+ $cacheProvider = new PsrCacheAdapter(new ApcuCachePool());
64
+ $cacheStrategy = new LifetimeCacheStrategy($cacheProvider);
65
+ $cacheExtension = new CacheExtension($cacheStrategy);
66
+
67
+ $twig->addExtension($cacheExtension);
68
+ ```
69
+
70
+ ### Usage
71
+
72
+ To cache a part of a template in Twig surround the code with a `cache` block.
73
+ The cache block takes two parameters, first an "annotation" part, second the
74
+ "value" the cache strategy can work with. Example:
75
+
76
+ ```jinja
77
+ {% cache 'v1/summary' 900 %}
78
+ {# heavy lifting template stuff here, include/render other partials etc #}
79
+ {% endcache %}
80
+ ```
81
+
82
+ Cache blocks can be nested:
83
+
84
+ ```jinja
85
+ {% cache 'v1' 900 %}
86
+ {% for item in items %}
87
+ {% cache 'v1' item %}
88
+ {# ... #}
89
+ {% endcache %}
90
+ {% endfor %}
91
+ {% endcache %}
92
+ ```
93
+
94
+ The annotation can also be an expression:
95
+
96
+ ```jinja
97
+ {% set version = 42 %}
98
+ {% cache 'hello_v' ~ version 900 %}
99
+ Hello {{ name }}!
100
+ {% endcache %}
101
+ ```
102
+
103
+ ## Cache strategies
104
+
105
+ The extension ships with a few cache strategies out of the box. Setup and usage
106
+ of all of them is described below.
107
+
108
+ ### Lifetime
109
+
110
+ See the ["Quick start"](#quick-start) for usage information of the `LifetimeCacheStrategy`.
111
+
112
+ ### Generational
113
+
114
+ Strategy for generational caching.
115
+
116
+ In theory the strategy only saves fragments to the cache with infinite
117
+ lifetime. The key of the strategy lies in the fact that the keys for blocks
118
+ will change as the value for which the key is generated changes.
119
+
120
+ For example: entities containing a last update time, would include a timestamp
121
+ in the key. For an interesting blog post about this type of caching see:
122
+ http://37signals.com/svn/posts/3113-how-key-based-cache-expiration-works
123
+
124
+ ### Blackhole
125
+
126
+ Strategy for development mode.
127
+
128
+ In development mode it often not very useful to cache fragments. The blackhole
129
+ strategy provides an easy way to not cache anything it all. It always generates
130
+ a new key and does not fetch or save any fragments.
131
+
132
+ #### Setup
133
+
134
+ In order to use the strategy you need to setup a `KeyGenerator` class that is
135
+ able to generate a cache key for a given value.
136
+
137
+ The following naive example always assumes the value is an object with the methods
138
+ `getId()` and `getUpdatedAt()` method. The key then composed from the class
139
+ name, the id and the updated time of the object:
140
+
141
+ ```php
142
+ <?php
143
+
144
+ use Asm89\Twig\CacheExtension\CacheStrategy\KeyGeneratorInterface;
145
+
146
+ class MyKeyGenerator implements KeyGeneratorInterface
147
+ {
148
+ public function generateKey($value)
149
+ {
150
+ return get_class($value) . '_' . $value->getId() . '_' . $value->getUpdatedAt();
151
+ }
152
+
153
+ }
154
+ ```
155
+
156
+ Next the `GenerationalCacheStrategy` needs to be setup with the keygenerator.
157
+
158
+ ```php
159
+ <?php
160
+
161
+ use Asm89\Twig\CacheExtension\CacheStrategy\GenerationalCacheStrategy;
162
+ use Asm89\Twig\CacheExtension\Extension as CacheExtension;
163
+
164
+ $keyGenerator = new MyKeyGenerator();
165
+ $cacheProvider = /* see Quick start */;
166
+ $cacheStrategy = new GenerationalCacheStrategy($cacheProvider, $keyGenerator, 0 /* = infinite lifetime */);
167
+ $cacheExtension = new CacheExtension($cacheStrategy);
168
+
169
+ $twig->addExtension($cacheExtension);
170
+ ```
171
+
172
+ #### Usage
173
+
174
+ The strategy expects an object as value for determining the cache key of the
175
+ block:
176
+
177
+ ```jinja
178
+ {% cache 'v1/summary' item %}
179
+ {# heavy lifting template stuff here, include/render other partials etc #}
180
+ {% endcache %}
181
+ ```
182
+
183
+ ### Using multiple strategies
184
+
185
+ Different cache strategies are useful for different usecases. It is possible to
186
+ mix multiple strategies in an application with the
187
+ `IndexedChainingCacheStrategy`. The strategy takes an array of `'name' =>
188
+ $strategy` and delegates the caching to the appropriate strategy.
189
+
190
+ #### Setup
191
+
192
+ ```php
193
+ <?php
194
+
195
+ use Asm89\Twig\CacheExtension\CacheStrategy\IndexedChainingCacheStrategy;
196
+ use Asm89\Twig\CacheExtension\Extension as CacheExtension;
197
+
198
+ $cacheStrategy = new IndexedChainingCacheStrategy(array(
199
+ 'time' => $lifetimeCacheStrategy,
200
+ 'gen' => $generationalCacheStrategy,
201
+ ));
202
+ $cacheExtension = new CacheExtension($cacheStrategy);
203
+
204
+ $twig->addExtension($cacheExtension);
205
+ ```
206
+
207
+ #### Usage
208
+
209
+ The strategy expects an array with as key the name of the strategy which it
210
+ needs to delegate to and as value the appropriate value for the delegated
211
+ strategy.
212
+
213
+ ```jinja
214
+ {# delegate to lifetime strategy #}
215
+ {% cache 'v1/summary' {time: 300} %}
216
+ {# heavy lifting template stuff here, include/render other partials etc #}
217
+ {% endcache %}
218
+
219
+ {# delegate to generational strategy #}
220
+ {% cache 'v1/summary' {gen: item} %}
221
+ {# heavy lifting template stuff here, include/render other partials etc #}
222
+ {% endcache %}
223
+ ```
224
+
225
+ ## Implementing a cache strategy
226
+
227
+ Creating separate caches for different access levels, languages or other
228
+ usecases can be done by implementing a custom cache strategy. In order to do so
229
+ implement the `CacheProviderInterface`. It is recommended to use composition
230
+ and wrap a custom strategy around an existing one.
231
+
232
+ ## Authors
233
+
234
+ Alexander <iam.asm89@gmail.com>
235
+
236
+ ## License
237
+
238
+ twig-cache-extension is licensed under the MIT License - see the LICENSE file for details
vendor/vendor/asm89/twig-cache-extension/composer.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "asm89/twig-cache-extension",
3
+ "description": "Cache fragments of templates directly within Twig.",
4
+ "keywords": ["twig", "cache", "extension"],
5
+ "homepage": "https://github.com/asm89/twig-cache-extension",
6
+ "type": "library",
7
+ "license": "MIT",
8
+ "authors": [
9
+ {
10
+ "name": "Alexander",
11
+ "email": "iam.asm89@gmail.com"
12
+ }
13
+ ],
14
+ "require": {
15
+ "php": ">=5.3.2",
16
+ "twig/twig": "^1.0|^2.0"
17
+ },
18
+ "require-dev": {
19
+ "doctrine/cache": "~1.0"
20
+ },
21
+ "suggest": {
22
+ "psr/cache-implementation": "To make use of PSR-6 cache implementation via PsrCacheAdapter."
23
+ },
24
+ "autoload": {
25
+ "psr-4": {
26
+ "": "lib/"
27
+ }
28
+ },
29
+ "autoload-dev": {
30
+ "psr-4": {
31
+ "": "test/"
32
+ }
33
+ },
34
+ "extra": {
35
+ "branch-alias": {
36
+ "dev-master": "1.3-dev"
37
+ }
38
+ }
39
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheProvider/DoctrineCacheAdapter.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\CacheProvider;
13
+
14
+ use Asm89\Twig\CacheExtension\CacheProviderInterface;
15
+ use Doctrine\Common\Cache\Cache;
16
+
17
+ /**
18
+ * Adapter class to use the cache classes provider by Doctrine.
19
+ *
20
+ * @author Alexander <iam.asm89@gmail.com>
21
+ */
22
+ class DoctrineCacheAdapter implements CacheProviderInterface
23
+ {
24
+ private $cache;
25
+
26
+ /**
27
+ * @param Cache $cache
28
+ */
29
+ public function __construct(Cache $cache)
30
+ {
31
+ $this->cache = $cache;
32
+ }
33
+
34
+ /**
35
+ * {@inheritDoc}
36
+ */
37
+ public function fetch($key)
38
+ {
39
+ return $this->cache->fetch($key);
40
+ }
41
+
42
+ /**
43
+ * {@inheritDoc}
44
+ */
45
+ public function save($key, $value, $lifetime = 0)
46
+ {
47
+ return $this->cache->save($key, $value, $lifetime);
48
+ }
49
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheProvider/PsrCacheAdapter.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\CacheProvider;
13
+
14
+ use Asm89\Twig\CacheExtension\CacheProviderInterface;
15
+ use Psr\Cache\CacheItemPoolInterface;
16
+
17
+ /**
18
+ * Adapter class to make extension interoperable with every PSR-6 adapter.
19
+ *
20
+ * @see http://php-cache.readthedocs.io/
21
+ *
22
+ * @author Rvanlaak <rvanlaak@gmail.com>
23
+ */
24
+ class PsrCacheAdapter implements CacheProviderInterface
25
+ {
26
+ /**
27
+ * @var CacheItemPoolInterface
28
+ */
29
+ private $cache;
30
+
31
+ /**
32
+ * @param CacheItemPoolInterface $cache
33
+ */
34
+ public function __construct(CacheItemPoolInterface $cache)
35
+ {
36
+ $this->cache = $cache;
37
+ }
38
+
39
+ /**
40
+ * @param string $key
41
+ * @return mixed|false
42
+ */
43
+ public function fetch($key)
44
+ {
45
+ // PSR-6 implementation returns null, CacheProviderInterface expects false
46
+ $item = $this->cache->getItem($key);
47
+ if ($item->isHit()) {
48
+ return $item->get();
49
+ }
50
+ return false;
51
+ }
52
+
53
+ /**
54
+ * @param string $key
55
+ * @param string $value
56
+ * @param int|\DateInterval $lifetime
57
+ * @return bool
58
+ */
59
+ public function save($key, $value, $lifetime = 0)
60
+ {
61
+ $item = $this->cache->getItem($key);
62
+ $item->set($value);
63
+ $item->expiresAfter($lifetime);
64
+
65
+ return $this->cache->save($item);
66
+ }
67
+
68
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheProviderInterface.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension;
13
+
14
+ /**
15
+ * Cache provider interface.
16
+ *
17
+ * @author Alexander <iam.asm89@gmail.com>
18
+ */
19
+ interface CacheProviderInterface
20
+ {
21
+ /**
22
+ * @param string $key
23
+ *
24
+ * @return mixed False, if there was no value to be fetched. Null or a string otherwise.
25
+ */
26
+ public function fetch($key);
27
+
28
+ /**
29
+ * @param string $key
30
+ * @param string $value
31
+ * @param integer $lifetime
32
+ *
33
+ * @return boolean
34
+ */
35
+ public function save($key, $value, $lifetime = 0);
36
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/BlackholeCacheStrategy.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\CacheStrategy;
13
+
14
+ use Asm89\Twig\CacheExtension\CacheStrategyInterface;
15
+
16
+ /**
17
+ * CacheStrategy which doesn't cache at all
18
+ *
19
+ * This strategy can be used in development mode, e.g. editing twig templates,
20
+ * to prevent previously cached versions from being rendered.
21
+ *
22
+ * @see https://github.com/asm89/twig-cache-extension/pull/29
23
+ *
24
+ * @author Hagen Hübel <hhuebel@itinance.com>
25
+ *
26
+ * @package Asm89\Twig\CacheExtension\CacheStrategy
27
+ */
28
+ class BlackholeCacheStrategy implements CacheStrategyInterface
29
+ {
30
+ /**
31
+ * {@inheritDoc}
32
+ */
33
+ public function fetchBlock($key)
34
+ {
35
+ return false;
36
+ }
37
+
38
+ /**
39
+ * {@inheritDoc}
40
+ */
41
+ public function generateKey($annotation, $value)
42
+ {
43
+ return microtime(true) . mt_rand();
44
+ }
45
+
46
+ /**
47
+ * {@inheritDoc}
48
+ */
49
+ public function saveBlock($key, $block)
50
+ {
51
+ // fire and forget
52
+ }
53
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/GenerationalCacheStrategy.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\CacheStrategy;
13
+
14
+ use Asm89\Twig\CacheExtension\CacheProviderInterface;
15
+ use Asm89\Twig\CacheExtension\CacheStrategyInterface;
16
+ use Asm89\Twig\CacheExtension\Exception\InvalidCacheKeyException;
17
+
18
+ /**
19
+ * Strategy for generational caching.
20
+ *
21
+ * In theory the strategy only saves fragments to the cache with infinite
22
+ * lifetime. The key of the strategy lies in the fact that the keys for blocks
23
+ * will change as the value for which the key is generated changes.
24
+ *
25
+ * For example: entities containing a last update time, would include a
26
+ * timestamp in the key.
27
+ *
28
+ * @see http://37signals.com/svn/posts/3113-how-key-based-cache-expiration-works
29
+ *
30
+ * @author Alexander <iam.asm89@gmail.com>
31
+ */
32
+ class GenerationalCacheStrategy implements CacheStrategyInterface
33
+ {
34
+ private $keyGenerator;
35
+ private $cache;
36
+ private $lifetime;
37
+
38
+ /**
39
+ * @param CacheProviderInterface $cache
40
+ * @param KeyGeneratorInterface $keyGenerator
41
+ * @param integer $lifetime
42
+ */
43
+ public function __construct(CacheProviderInterface $cache, KeyGeneratorInterface $keyGenerator, $lifetime = 0)
44
+ {
45
+ $this->keyGenerator = $keyGenerator;
46
+ $this->cache = $cache;
47
+ $this->lifetime = $lifetime;
48
+ }
49
+
50
+ /**
51
+ * {@inheritDoc}
52
+ */
53
+ public function fetchBlock($key)
54
+ {
55
+ return $this->cache->fetch($key);
56
+ }
57
+
58
+ /**
59
+ * {@inheritDoc}
60
+ */
61
+ public function generateKey($annotation, $value)
62
+ {
63
+ $key = $this->keyGenerator->generateKey($value);
64
+
65
+ if (null === $key) {
66
+ throw new InvalidCacheKeyException();
67
+ }
68
+
69
+ return $annotation . '__GCS__' . $key;
70
+ }
71
+
72
+ /**
73
+ * {@inheritDoc}
74
+ */
75
+ public function saveBlock($key, $block)
76
+ {
77
+ return $this->cache->save($key, $block, $this->lifetime);
78
+ }
79
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/IndexedChainingCacheStrategy.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\CacheStrategy;
13
+
14
+ use Asm89\Twig\CacheExtension\CacheStrategyInterface;
15
+ use Asm89\Twig\CacheExtension\Exception\NonExistingStrategyException;
16
+ use Asm89\Twig\CacheExtension\Exception\NonExistingStrategyKeyException;
17
+
18
+ /**
19
+ * Combines several configured cache strategies.
20
+ *
21
+ * Useful for combining for example generational cache strategy with a lifetime
22
+ * cache strategy, but also useful when combining several generational cache
23
+ * strategies which differ on cache lifetime (infinite, 1hr, 5m).
24
+ *
25
+ * @author Alexander <iam.asm89@gmail.com>
26
+ */
27
+ class IndexedChainingCacheStrategy implements CacheStrategyInterface
28
+ {
29
+ /**
30
+ * @var CacheStrategyInterface[]
31
+ */
32
+ private $strategies;
33
+
34
+ /**
35
+ * @param array $strategies
36
+ */
37
+ public function __construct(array $strategies)
38
+ {
39
+ $this->strategies = $strategies;
40
+ }
41
+
42
+ /**
43
+ * {@inheritDoc}
44
+ */
45
+ public function fetchBlock($key)
46
+ {
47
+ return $this->strategies[$key['strategyKey']]->fetchBlock($key['key']);
48
+ }
49
+
50
+ /**
51
+ * {@inheritDoc}
52
+ */
53
+ public function generateKey($annotation, $value)
54
+ {
55
+ if (!is_array($value) || null === $strategyKey = key($value)) {
56
+ throw new NonExistingStrategyKeyException();
57
+ }
58
+
59
+ if (!isset($this->strategies[$strategyKey])) {
60
+ throw new NonExistingStrategyException($strategyKey);
61
+ }
62
+
63
+ return array(
64
+ 'strategyKey' => $strategyKey,
65
+ 'key' => $this->strategies[$strategyKey]->generateKey($annotation, current($value)),
66
+ );
67
+ }
68
+
69
+ /**
70
+ * {@inheritDoc}
71
+ */
72
+ public function saveBlock($key, $block)
73
+ {
74
+ return $this->strategies[$key['strategyKey']]->saveBlock($key['key'], $block);
75
+ }
76
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/KeyGeneratorInterface.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\CacheStrategy;
13
+
14
+ /**
15
+ * Generates a key for a given value.
16
+ *
17
+ * @author Alexander <iam.asm89@gmail.com>
18
+ */
19
+ interface KeyGeneratorInterface
20
+ {
21
+ /**
22
+ * Generate a cache key for a given value.
23
+ *
24
+ * @param mixed $value
25
+ *
26
+ * @return string
27
+ */
28
+ public function generateKey($value);
29
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/LifetimeCacheStrategy.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\CacheStrategy;
13
+
14
+ use Asm89\Twig\CacheExtension\CacheProviderInterface;
15
+ use Asm89\Twig\CacheExtension\CacheStrategyInterface;
16
+ use Asm89\Twig\CacheExtension\Exception\InvalidCacheLifetimeException;
17
+
18
+ /**
19
+ * Strategy for caching with a pre-defined lifetime.
20
+ *
21
+ * The value passed to the strategy is the lifetime of the cache block in
22
+ * seconds.
23
+ *
24
+ * @author Alexander <iam.asm89@gmail.com>
25
+ */
26
+ class LifetimeCacheStrategy implements CacheStrategyInterface
27
+ {
28
+ private $cache;
29
+
30
+ /**
31
+ * @param CacheProviderInterface $cache
32
+ */
33
+ public function __construct(CacheProviderInterface $cache)
34
+ {
35
+ $this->cache = $cache;
36
+ }
37
+
38
+ /**
39
+ * {@inheritDoc}
40
+ */
41
+ public function fetchBlock($key)
42
+ {
43
+ return $this->cache->fetch($key['key']);
44
+ }
45
+
46
+ /**
47
+ * {@inheritDoc}
48
+ */
49
+ public function generateKey($annotation, $value)
50
+ {
51
+ if (!is_numeric($value)) {
52
+ throw new InvalidCacheLifetimeException($value);
53
+ }
54
+
55
+ return array(
56
+ 'lifetime' => $value,
57
+ 'key' => '__LCS__' . $annotation,
58
+ );
59
+ }
60
+
61
+ /**
62
+ * {@inheritDoc}
63
+ */
64
+ public function saveBlock($key, $block)
65
+ {
66
+ return $this->cache->save($key['key'], $block, $key['lifetime']);
67
+ }
68
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategyInterface.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension;
13
+
14
+ /**
15
+ * Cache strategy interface.
16
+ *
17
+ * @author Alexander <iam.asm89@gmail.com>
18
+ */
19
+ interface CacheStrategyInterface
20
+ {
21
+ /**
22
+ * Fetch the block for a given key.
23
+ *
24
+ * @param mixed $key
25
+ *
26
+ * @return mixed
27
+ */
28
+ public function fetchBlock($key);
29
+
30
+ /**
31
+ * Generate a key for the value.
32
+ *
33
+ * @param string $annotation
34
+ * @param mixed $value
35
+ *
36
+ * @return mixed
37
+ */
38
+ public function generateKey($annotation, $value);
39
+
40
+ /**
41
+ * Save the contents of a rendered block.
42
+ *
43
+ * @param mixed $key
44
+ * @param string $block
45
+ *
46
+ * @return mixed
47
+ */
48
+ public function saveBlock($key, $block);
49
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/BaseException.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\Exception;
13
+
14
+ /**
15
+ * @todo Replace \RuntimeException with \InvalidArgumentException at version 2.0
16
+ */
17
+ class BaseException extends \RuntimeException
18
+ {
19
+
20
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/InvalidCacheKeyException.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\Exception;
13
+
14
+ class InvalidCacheKeyException extends BaseException
15
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public function __construct($message = 'Key generator did not return a key.', $code = 0, \Exception $previous = null)
20
+ {
21
+ parent::__construct($message, $code, $previous);
22
+ }
23
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/InvalidCacheLifetimeException.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\Exception;
13
+
14
+ class InvalidCacheLifetimeException extends BaseException
15
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public function __construct($lifetime, $code = 0, \Exception $previous = null)
20
+ {
21
+ parent::__construct(sprintf('Value "%s" is not a valid lifetime.', gettype($lifetime)), $code, $previous);
22
+ }
23
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/NonExistingStrategyException.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\Exception;
13
+
14
+ class NonExistingStrategyException extends BaseException
15
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public function __construct($strategyKey, $code = 0, \Exception $previous = null)
20
+ {
21
+ parent::__construct(sprintf('No strategy configured with key "%s".', $strategyKey), $code, $previous);
22
+ }
23
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/NonExistingStrategyKeyException.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\Exception;
13
+
14
+ class NonExistingStrategyKeyException extends BaseException
15
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public function __construct($message = 'No strategy key found in value.', $code = 0, \Exception $previous = null)
20
+ {
21
+ parent::__construct($message, $code, $previous);
22
+ }
23
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Extension.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension;
13
+
14
+ /**
15
+ * Extension for caching template blocks with twig.
16
+ *
17
+ * @author Alexander <iam.asm89@gmail.com>
18
+ */
19
+ class Extension extends \Twig_Extension
20
+ {
21
+ private $cacheStrategy;
22
+
23
+ /**
24
+ * @param CacheStrategyInterface $cacheStrategy
25
+ */
26
+ public function __construct(CacheStrategyInterface $cacheStrategy)
27
+ {
28
+ $this->cacheStrategy = $cacheStrategy;
29
+ }
30
+
31
+ /**
32
+ * @return CacheStrategyInterface
33
+ */
34
+ public function getCacheStrategy()
35
+ {
36
+ return $this->cacheStrategy;
37
+ }
38
+
39
+ /**
40
+ * {@inheritDoc}
41
+ */
42
+ public function getName()
43
+ {
44
+ if (version_compare(\Twig_Environment::VERSION, '1.26.0', '>=')) {
45
+ return get_class($this);
46
+ }
47
+ return 'asm89_cache';
48
+ }
49
+
50
+ /**
51
+ * {@inheritDoc}
52
+ */
53
+ public function getTokenParsers()
54
+ {
55
+ return array(
56
+ new TokenParser\Cache(),
57
+ );
58
+ }
59
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Node/CacheNode.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\Node;
13
+
14
+ /**
15
+ * Cache twig node.
16
+ *
17
+ * @author Alexander <iam.asm89@gmail.com>
18
+ */
19
+ class CacheNode extends \Twig_Node
20
+ {
21
+ private static $cacheCount = 1;
22
+
23
+ /**
24
+ * @param \Twig_Node_Expression $annotation
25
+ * @param \Twig_Node_Expression $keyInfo
26
+ * @param \Twig_NodeInterface $body
27
+ * @param integer $lineno
28
+ * @param string $tag
29
+ */
30
+ public function __construct(\Twig_Node_Expression $annotation, \Twig_Node_Expression $keyInfo, \Twig_Node $body, $lineno, $tag = null)
31
+ {
32
+ parent::__construct(array('key_info' => $keyInfo, 'body' => $body, 'annotation' => $annotation), array(), $lineno, $tag);
33
+ }
34
+
35
+ /**
36
+ * {@inheritDoc}
37
+ */
38
+ public function compile(\Twig_Compiler $compiler)
39
+ {
40
+ $i = self::$cacheCount++;
41
+
42
+ if (version_compare(\Twig_Environment::VERSION, '1.26.0', '>=')) {
43
+ $extension = 'Asm89\Twig\CacheExtension\Extension';
44
+ } else {
45
+ $extension = 'asm89_cache';
46
+ }
47
+
48
+ $compiler
49
+ ->addDebugInfo($this)
50
+ ->write("\$asm89CacheStrategy".$i." = \$this->env->getExtension('{$extension}')->getCacheStrategy();\n")
51
+ ->write("\$asm89Key".$i." = \$asm89CacheStrategy".$i."->generateKey(")
52
+ ->subcompile($this->getNode('annotation'))
53
+ ->raw(", ")
54
+ ->subcompile($this->getNode('key_info'))
55
+ ->write(");\n")
56
+ ->write("\$asm89CacheBody".$i." = \$asm89CacheStrategy".$i."->fetchBlock(\$asm89Key".$i.");\n")
57
+ ->write("if (\$asm89CacheBody".$i." === false) {\n")
58
+ ->indent()
59
+ ->write("ob_start();\n")
60
+ ->indent()
61
+ ->subcompile($this->getNode('body'))
62
+ ->outdent()
63
+ ->write("\n")
64
+ ->write("\$asm89CacheBody".$i." = ob_get_clean();\n")
65
+ ->write("\$asm89CacheStrategy".$i."->saveBlock(\$asm89Key".$i.", \$asm89CacheBody".$i.");\n")
66
+ ->outdent()
67
+ ->write("}\n")
68
+ ->write("echo \$asm89CacheBody".$i.";\n")
69
+ ;
70
+ }
71
+ }
vendor/vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/TokenParser/Cache.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\TokenParser;
13
+
14
+ use Asm89\Twig\CacheExtension\Node\CacheNode;
15
+
16
+ /**
17
+ * Parser for cache/endcache blocks.
18
+ *
19
+ * @author Alexander <iam.asm89@gmail.com>
20
+ */
21
+ class Cache extends \Twig_TokenParser
22
+ {
23
+ /**
24
+ * @param \Twig_Token $token
25
+ *
26
+ * @return boolean
27
+ */
28
+ public function decideCacheEnd(\Twig_Token $token)
29
+ {
30
+ return $token->test('endcache');
31
+ }
32
+
33
+ /**
34
+ * {@inheritDoc}
35
+ */
36
+ public function getTag()
37
+ {
38
+ return 'cache';
39
+ }
40
+
41
+ /**
42
+ * {@inheritDoc}
43
+ */
44
+ public function parse(\Twig_Token $token)
45
+ {
46
+ $lineno = $token->getLine();
47
+ $stream = $this->parser->getStream();
48
+
49
+ $annotation = $this->parser->getExpressionParser()->parseExpression();
50
+
51
+ $key = $this->parser->getExpressionParser()->parseExpression();
52
+
53
+ $stream->expect(\Twig_Token::BLOCK_END_TYPE);
54
+ $body = $this->parser->subparse(array($this, 'decideCacheEnd'), true);
55
+ $stream->expect(\Twig_Token::BLOCK_END_TYPE);
56
+
57
+ return new CacheNode($annotation, $key, $body, $lineno, $this->getTag());
58
+ }
59
+ }
vendor/vendor/asm89/twig-cache-extension/phpunit.xml.dist ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <phpunit backupGlobals="false"
4
+ backupStaticAttributes="false"
5
+ colors="true"
6
+ convertErrorsToExceptions="true"
7
+ convertNoticesToExceptions="true"
8
+ convertWarningsToExceptions="true"
9
+ processIsolation="false"
10
+ stopOnFailure="false"
11
+ syntaxCheck="false"
12
+ bootstrap="test/bootstrap.php"
13
+ >
14
+ <testsuites>
15
+ <testsuite name="Twig Cache Extension Test Suite">
16
+ <directory>./test/Asm89/</directory>
17
+ </testsuite>
18
+ </testsuites>
19
+
20
+ <filter>
21
+ <whitelist>
22
+ <directory suffix=".php">./lib/</directory>
23
+ </whitelist>
24
+ </filter>
25
+ </phpunit>
vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/CacheProvider/DoctrineCacheAdapterTest.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\Tests\CacheProvider;
13
+
14
+ use Asm89\Twig\CacheExtension\CacheProvider\DoctrineCacheAdapter;
15
+
16
+ class DoctrineCacheAdapterTest extends \PHPUnit_Framework_TestCase
17
+ {
18
+ public function testFetch()
19
+ {
20
+ $cacheMock = $this->createCacheMock();
21
+ $cacheMock->expects($this->any())
22
+ ->method('fetch')
23
+ ->will($this->returnValue('fromcache'));
24
+
25
+ $cache = new DoctrineCacheAdapter($cacheMock);
26
+
27
+ $this->assertEquals('fromcache', $cache->fetch('test'));
28
+ }
29
+
30
+ public function testSave()
31
+ {
32
+ $cacheMock = $this->createCacheMock();
33
+ $cacheMock->expects($this->once())
34
+ ->method('save')
35
+ ->with('key', 'value', 42);
36
+
37
+ $cache = new DoctrineCacheAdapter($cacheMock);
38
+
39
+ $cache->save('key', 'value', 42);
40
+ }
41
+
42
+ public function createCacheMock()
43
+ {
44
+ return $this->getMock('Doctrine\Common\Cache\Cache');
45
+ }
46
+ }
vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/CacheStrategy/GenerationCacheStrategyTest.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\Tests\CacheStrategy;
13
+
14
+ use Asm89\Twig\CacheExtension\CacheStrategy\GenerationalCacheStrategy;
15
+
16
+ class GenerationalCacheStrategyTest extends \PHPUnit_Framework_TestCase
17
+ {
18
+ private $keyGeneratorMock;
19
+ private $cacheProviderMock;
20
+
21
+ public function createCacheStrategy($lifetime = 0)
22
+ {
23
+ $this->keyGeneratorMock = $this->createKeyGeneratorMock();
24
+ $this->cacheProviderMock = $this->createCacheProviderMock();
25
+
26
+ return new GenerationalCacheStrategy($this->cacheProviderMock, $this->keyGeneratorMock, $lifetime);
27
+ }
28
+
29
+ public function testGenerateKeyContainsAnnotation()
30
+ {
31
+ $strategy = $this->createCacheStrategy();
32
+ $this->keyGeneratorMock->expects($this->any())
33
+ ->method('generateKey')
34
+ ->will($this->returnValue('foo'));
35
+
36
+ $this->assertEquals('v42__GCS__foo', $strategy->generateKey('v42', 'value'));
37
+ }
38
+
39
+ /**
40
+ * @expectedException \Asm89\Twig\CacheExtension\Exception\InvalidCacheKeyException
41
+ */
42
+ public function testGenerationKeyThrowsExceptionWhenKeyGeneratorReturnsNull()
43
+ {
44
+ $strategy = $this->createCacheStrategy();
45
+
46
+ $strategy->generateKey('v42', 'value');
47
+ }
48
+
49
+ /**
50
+ * @dataProvider getLifeTimes
51
+ */
52
+ public function testSaveBlockUsesConfiguredLifetime($lifetime)
53
+ {
54
+ $strategy = $this->createCacheStrategy($lifetime);
55
+ $this->cacheProviderMock->expects($this->any())
56
+ ->method('save')
57
+ ->with('key', 'value', $lifetime)
58
+ ->will($this->returnValue('foo'));
59
+
60
+ $strategy->saveBlock('key', 'value');
61
+ }
62
+
63
+ public function getLifetimes()
64
+ {
65
+ return array(
66
+ array(0),
67
+ array(60),
68
+ );
69
+ }
70
+
71
+ public function createKeyGeneratorMock()
72
+ {
73
+ return $this->getMock('Asm89\Twig\CacheExtension\CacheStrategy\KeyGeneratorInterface');
74
+ }
75
+
76
+ public function createCacheProviderMock()
77
+ {
78
+ return $this->getMock('Asm89\Twig\CacheExtension\CacheProviderInterface');
79
+ }
80
+ }
vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/CacheStrategy/IndexedChainingCacheStrategyTest.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\Tests\CacheStrategy;
13
+
14
+ use Asm89\Twig\CacheExtension\CacheStrategy\IndexedChainingCacheStrategy;
15
+
16
+ class IndexedChainingCacheStrategyTest extends \PHPUnit_Framework_TestCase
17
+ {
18
+ private $cacheStrategyMocks = array();
19
+
20
+ public function createCacheStrategy()
21
+ {
22
+ foreach($this->getStrategies() as $config) {
23
+ list($key, $return) = $config;
24
+
25
+ $cacheStrategyMock = $this->createCacheStrategyMock();
26
+ $cacheStrategyMock->expects($this->any())
27
+ ->method('generateKey')
28
+ ->will($this->returnValue($return));
29
+
30
+ $this->cacheStrategyMocks[$key] = $cacheStrategyMock;
31
+ }
32
+
33
+ return new IndexedChainingCacheStrategy($this->cacheStrategyMocks);
34
+ }
35
+
36
+ /**
37
+ * @dataProvider getStrategies
38
+ */
39
+ public function testGenerateKeyProxiesToAppropriateStrategy($key, $return)
40
+ {
41
+ $strategy = $this->createCacheStrategy();
42
+
43
+ $generatedKey = $strategy->generateKey('v42', array($key => 'proxied_value'));
44
+
45
+ $this->assertEquals($return, $generatedKey['key']);
46
+ $this->assertEquals($key, $generatedKey['strategyKey']);
47
+ }
48
+
49
+ /**
50
+ * @expectedException \Asm89\Twig\CacheExtension\Exception\NonExistingStrategyKeyException
51
+ */
52
+ public function testGenerateKeyThrowsExceptionOnMissingKey()
53
+ {
54
+ $strategy = $this->createCacheStrategy();
55
+ $strategy->generateKey('v42', 'proxied_value');
56
+ }
57
+
58
+ /**
59
+ * @expectedException \Asm89\Twig\CacheExtension\Exception\NonExistingStrategyException
60
+ * @expectedExceptionMessage No strategy configured with key "unknown"
61
+ */
62
+ public function testGenerateKeyThrowsExceptionOnUnknownKey()
63
+ {
64
+ $strategy = $this->createCacheStrategy();
65
+ $strategy->generateKey('v42', array('unknown' => 'proxied_value'));
66
+ }
67
+
68
+ public function getStrategies()
69
+ {
70
+ return array(
71
+ array('foo', 'foo_key'),
72
+ array('bar', 'bar_key'),
73
+ );
74
+ }
75
+
76
+ public function createCacheStrategyMock()
77
+ {
78
+ return $this->getMock('Asm89\Twig\CacheExtension\CacheStrategyInterface');
79
+ }
80
+ }
vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/CacheStrategy/LifetimeCacheStrategyTest.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\Tests\CacheStrategy;
13
+
14
+ use Asm89\Twig\CacheExtension\CacheStrategy\LifetimeCacheStrategy;
15
+
16
+ class LifetimeCacheStrategyTest extends \PHPUnit_Framework_TestCase
17
+ {
18
+ private $cacheProviderMock;
19
+
20
+ public function createCacheStrategy()
21
+ {
22
+ $this->cacheProviderMock = $this->createCacheProviderMock();
23
+
24
+ return new LifetimeCacheStrategy($this->cacheProviderMock);
25
+ }
26
+
27
+ public function testGenerateKeyUsesGivenLifetime()
28
+ {
29
+ $strategy = $this->createCacheStrategy();
30
+
31
+ $key = $strategy->generateKey('v42', 42);
32
+
33
+ $this->assertEquals(42, $key['lifetime']);
34
+ }
35
+
36
+ public function testGenerateKeyAnnotatesKey()
37
+ {
38
+ $strategy = $this->createCacheStrategy();
39
+
40
+ $key = $strategy->generateKey('the_annotation', 42);
41
+
42
+ $this->assertContains('the_annotation', $key['key']);
43
+ }
44
+
45
+ /**
46
+ * @dataProvider getInvalidLifetimeValues
47
+ * @expectedException \Asm89\Twig\CacheExtension\Exception\InvalidCacheLifetimeException
48
+ */
49
+ public function testGenerateKeyThrowsExceptionWhenNoLifetimeProvided($value)
50
+ {
51
+ $strategy = $this->createCacheStrategy();
52
+
53
+ $strategy->generateKey('v42', $value);
54
+ }
55
+
56
+ public function getInvalidLifetimeValues()
57
+ {
58
+ return array(
59
+ array('foo'),
60
+ array(array('foo')),
61
+ );
62
+ }
63
+
64
+ public function createCacheProviderMock()
65
+ {
66
+ return $this->getMock('Asm89\Twig\CacheExtension\CacheProviderInterface');
67
+ }
68
+ }
vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/FunctionalExtensionTest.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89\Twig\CacheExtension\Tests;
13
+
14
+ use Asm89\Twig\CacheExtension\CacheProvider\DoctrineCacheAdapter;
15
+ use Asm89\Twig\CacheExtension\CacheStrategy\KeyGeneratorInterface;
16
+ use Asm89\Twig\CacheExtension\CacheStrategy\GenerationalCacheStrategy;
17
+ use Asm89\Twig\CacheExtension\CacheStrategy\IndexedChainingCacheStrategy;
18
+ use Asm89\Twig\CacheExtension\CacheStrategy\LifetimeCacheStrategy;
19
+ use Asm89\Twig\CacheExtension\Extension;
20
+ use Doctrine\Common\Cache\ArrayCache;
21
+ use Twig_Loader_Filesystem;
22
+ use Twig_Environment;
23
+
24
+ class FunctionalExtensionTest extends \PHPUnit_Framework_TestCase
25
+ {
26
+ private $cache;
27
+
28
+ protected function createCacheProvider()
29
+ {
30
+ $this->cache = new ArrayCache();
31
+
32
+ return new DoctrineCacheAdapter($this->cache);
33
+ }
34
+
35
+ protected function createCacheStrategy($name = null)
36
+ {
37
+ $cacheProvider = $this->createCacheProvider();
38
+ $keyGenerator = $this->createKeyGenerator();
39
+ $lifetime = 0;
40
+
41
+ switch ($name) {
42
+ case 'time':
43
+ return new LifetimeCacheStrategy($cacheProvider);
44
+ case 'indexed':
45
+ return new IndexedChainingCacheStrategy(array(
46
+ 'gcs' => new GenerationalCacheStrategy($cacheProvider, $keyGenerator, $lifetime),
47
+ 'time' => new LifetimeCacheStrategy($cacheProvider),
48
+ ));
49
+ default:
50
+ return new GenerationalCacheStrategy($cacheProvider, $keyGenerator, $lifetime);
51
+ }
52
+ }
53
+
54
+ protected function createKeyGenerator()
55
+ {
56
+ return new KeyGenerator();
57
+ }
58
+
59
+ protected function createTwig($cacheStrategyName = null)
60
+ {
61
+ $loader = new Twig_Loader_Filesystem(__DIR__ . '/fixtures/');
62
+ $twig = new Twig_Environment($loader);
63
+
64
+ $cacheExtension = new Extension($this->createCacheStrategy($cacheStrategyName));
65
+
66
+ $twig->addExtension($cacheExtension);
67
+
68
+ return $twig;
69
+ }
70
+
71
+ protected function getValue($value, $updatedAt)
72
+ {
73
+ return new Value($value, $updatedAt);
74
+ }
75
+
76
+ public function testCachesWithSameCacheKey()
77
+ {
78
+ $twig = $this->createTwig();
79
+
80
+ $rendered = $twig->render('gcs_value.twig', array('value' => $this->getValue('asm89', 1)));
81
+ $this->assertEquals('Hello asm89!', $rendered);
82
+
83
+ $rendered2 = $twig->render('gcs_value.twig', array('value' => $this->getValue('fabpot', 1)));
84
+ $this->assertEquals('Hello asm89!', $rendered2);
85
+ }
86
+
87
+ public function testDifferentCacheOnDifferentAnnotation()
88
+ {
89
+ $twig = $this->createTwig();
90
+
91
+ $rendered = $twig->render('gcs_value.twig', array('value' => $this->getValue('asm89', 1)));
92
+ $this->assertEquals('Hello asm89!', $rendered);
93
+
94
+ $rendered2 = $twig->render('gcs_value.twig', array('value' => $this->getValue('fabpot', 1)));
95
+ $this->assertEquals('Hello asm89!', $rendered2);
96
+
97
+ $rendered3 = $twig->render('gcs_value_v2.twig', array('value' => $this->getValue('fabpot', 1)));
98
+ $this->assertEquals('Hello fabpot!', $rendered3);
99
+ }
100
+
101
+ public function testLifetimeCacheStrategy()
102
+ {
103
+ $twig = $this->createTwig('time');
104
+
105
+ $rendered = $twig->render('lcs_value.twig', array('value' => $this->getValue('asm89', 1)));
106
+ $this->assertEquals('Hello asm89!', $rendered);
107
+
108
+ $rendered2 = $twig->render('lcs_value.twig', array('value' => $this->getValue('fabpot', 1)));
109
+ $this->assertEquals('Hello asm89!', $rendered2);
110
+
111
+ $this->cache->flushAll();
112
+
113
+ $rendered3 = $twig->render('lcs_value.twig', array('value' => $this->getValue('fabpot', 1)));
114
+ $this->assertEquals('Hello fabpot!', $rendered3);
115
+ }
116
+
117
+ public function testIndexedChainingStrategy()
118
+ {
119
+ $twig = $this->createTwig('indexed');
120
+
121
+ $rendered = $twig->render('ics_value.twig', array('value' => $this->getValue('asm89', 1)));
122
+ $this->assertEquals('Hello asm89!', $rendered);
123
+
124
+ $rendered2 = $twig->render('ics_value.twig', array('value' => $this->getValue('fabpot', 1)));
125
+ $this->assertEquals('Hello asm89!', $rendered2);
126
+
127
+ $this->cache->flushAll();
128
+
129
+ $rendered3 = $twig->render('ics_value.twig', array('value' => $this->getValue('fabpot', 1)));
130
+ $this->assertEquals('Hello fabpot!', $rendered3);
131
+ }
132
+
133
+ /**
134
+ * @expectedException Twig_Error_Runtime
135
+ * @expectedExceptionMessage An exception has been thrown during the rendering of a template ("No strategy key found in value.")
136
+ */
137
+ public function testIndexedChainingStrategyNeedsKey()
138
+ {
139
+ $twig = $this->createTwig('indexed');
140
+
141
+ $twig->render('ics_no_key.twig', array('value' => $this->getValue('asm89', 1)));
142
+ }
143
+
144
+ public function testAnnotationExpression()
145
+ {
146
+ $twig = $this->createTwig('indexed');
147
+
148
+ $rendered = $twig->render('annotation_expression.twig', array('value' => $this->getValue('asm89', 1), 'version' => 1));
149
+ $this->assertEquals('Hello asm89!Hello asm89!', $rendered);
150
+ }
151
+ }
152
+
153
+ class KeyGenerator implements KeyGeneratorInterface
154
+ {
155
+ public function generateKey($value)
156
+ {
157
+ return get_class($value) . '_' . $value->getUpdatedAt();
158
+ }
159
+
160
+ }
161
+
162
+ class Value
163
+ {
164
+ private $value;
165
+ private $updatedAt;
166
+
167
+ public function __construct($value, $updatedAt)
168
+ {
169
+ $this->value = $value;
170
+ $this->updatedAt = $updatedAt;
171
+ }
172
+
173
+ public function getUpdatedAt()
174
+ {
175
+ return $this->updatedAt;
176
+ }
177
+
178
+ public function __toString()
179
+ {
180
+ return $this->value;
181
+ }
182
+ }
vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/annotation_expression.twig ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ {%- set k = "v'" ~ version -%}
2
+ {%- cache k {time: 10} -%}Hello {{ value }}!{%- endcache -%}
3
+ {%- cache 'bob'|capitalize {gcs: value} %}Hello {{ value }}!{%- endcache -%}
vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/annotation_not_string.twig ADDED
@@ -0,0 +1,2 @@
 
 
1
+ {% set annotation = 'v1' %}
2
+ {% cache annotation value %}Hello {{ value }}!{% endcache %}
vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/gcs_value.twig ADDED
@@ -0,0 +1 @@
 
1
+ {% cache 'v1' value %}Hello {{ value }}!{% endcache %}
vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/gcs_value_v2.twig ADDED
@@ -0,0 +1 @@
 
1
+ {% cache 'v2' value %}Hello {{ value }}!{% endcache %}
vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/ics_no_key.twig ADDED
@@ -0,0 +1 @@
 
1
+ {% cache 'v1' 10 %}Hello {{ value }}!{% endcache %}
vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/ics_value.twig ADDED
@@ -0,0 +1 @@
 
1
+ {% cache 'v1' {time: 10} %}Hello {{ value }}!{% endcache %}
vendor/vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/fixtures/lcs_value.twig ADDED
@@ -0,0 +1 @@
 
1
+ {% cache 'v1' 10 %}Hello {{ value }}!{% endcache %}
vendor/vendor/asm89/twig-cache-extension/test/bootstrap.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of twig-cache-extension.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ if (file_exists($file = __DIR__.'/../vendor/autoload.php')) {
13
+ $autoload = require_once $file;
14
+ } else {
15
+ throw new RuntimeException('Install dependencies to run test suite.');
16
+ }
vendor/vendor/autoload.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload.php @generated by Composer
4
+
5
+ require_once __DIR__ . '/composer/autoload_real.php';
6
+
7
+ return ComposerAutoloaderInit5cc6415a5b760b89bb0a84ca350b6b2a::getLoader();
vendor/vendor/composer/ClassLoader.php ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer\Autoload;
14
+
15
+ /**
16
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17
+ *
18
+ * $loader = new \Composer\Autoload\ClassLoader();
19
+ *
20
+ * // register classes with namespaces
21
+ * $loader->add('Symfony\Component', __DIR__.'/component');
22
+ * $loader->add('Symfony', __DIR__.'/framework');
23
+ *
24
+ * // activate the autoloader
25
+ * $loader->register();
26
+ *
27
+ * // to enable searching the include path (eg. for PEAR packages)
28
+ * $loader->setUseIncludePath(true);
29
+ *
30
+ * In this example, if you try to use a class in the Symfony\Component
31
+ * namespace or one of its children (Symfony\Component\Console for instance),
32
+ * the autoloader will first look for the class under the component/
33
+ * directory, and it will then fallback to the framework/ directory if not
34
+ * found before giving up.
35
+ *
36
+ * This class is loosely based on the Symfony UniversalClassLoader.
37
+ *
38
+ * @author Fabien Potencier <fabien@symfony.com>
39
+ * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see http://www.php-fig.org/psr/psr-0/
41
+ * @see http://www.php-fig.org/psr/psr-4/
42
+ */
43
+ class ClassLoader
44
+ {
45
+ // PSR-4
46
+ private $prefixLengthsPsr4 = array();
47
+ private $prefixDirsPsr4 = array();
48
+ private $fallbackDirsPsr4 = array();
49
+
50
+ // PSR-0
51
+ private $prefixesPsr0 = array();
52
+ private $fallbackDirsPsr0 = array();
53
+
54
+ private $useIncludePath = false;
55
+ private $classMap = array();
56
+ private $classMapAuthoritative = false;
57
+ private $missingClasses = array();
58
+ private $apcuPrefix;
59
+
60
+ public function getPrefixes()
61
+ {
62
+ if (!empty($this->prefixesPsr0)) {
63
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
64
+ }
65
+
66
+ return array();
67
+ }
68
+
69
+ public function getPrefixesPsr4()
70
+ {
71
+ return $this->prefixDirsPsr4;
72
+ }
73
+
74
+ public function getFallbackDirs()
75
+ {
76
+ return $this->fallbackDirsPsr0;
77
+ }
78
+
79
+ public function getFallbackDirsPsr4()
80
+ {
81
+ return $this->fallbackDirsPsr4;
82
+ }
83
+
84
+ public function getClassMap()
85
+ {
86
+ return $this->classMap;
87
+ }
88
+
89
+ /**
90
+ * @param array $classMap Class to filename map
91
+ */
92
+ public function addClassMap(array $classMap)
93
+ {
94
+ if ($this->classMap) {
95
+ $this->classMap = array_merge($this->classMap, $classMap);
96
+ } else {
97
+ $this->classMap = $classMap;
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Registers a set of PSR-0 directories for a given prefix, either
103
+ * appending or prepending to the ones previously set for this prefix.
104
+ *
105
+ * @param string $prefix The prefix
106
+ * @param array|string $paths The PSR-0 root directories
107
+ * @param bool $prepend Whether to prepend the directories
108
+ */
109
+ public function add($prefix, $paths, $prepend = false)
110
+ {
111
+ if (!$prefix) {
112
+ if ($prepend) {
113
+ $this->fallbackDirsPsr0 = array_merge(
114
+ (array) $paths,
115
+ $this->fallbackDirsPsr0
116
+ );
117
+ } else {
118
+ $this->fallbackDirsPsr0 = array_merge(
119
+ $this->fallbackDirsPsr0,
120
+ (array) $paths
121
+ );
122
+ }
123
+
124
+ return;
125
+ }
126
+
127
+ $first = $prefix[0];
128
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
129
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
130
+
131
+ return;
132
+ }
133
+ if ($prepend) {
134
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
135
+ (array) $paths,
136
+ $this->prefixesPsr0[$first][$prefix]
137
+ );
138
+ } else {
139
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
140
+ $this->prefixesPsr0[$first][$prefix],
141
+ (array) $paths
142
+ );
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Registers a set of PSR-4 directories for a given namespace, either
148
+ * appending or prepending to the ones previously set for this namespace.
149
+ *
150
+ * @param string $prefix The prefix/namespace, with trailing '\\'
151
+ * @param array|string $paths The PSR-4 base directories
152
+ * @param bool $prepend Whether to prepend the directories
153
+ *
154
+ * @throws \InvalidArgumentException
155
+ */
156
+ public function addPsr4($prefix, $paths, $prepend = false)
157
+ {
158
+ if (!$prefix) {
159
+ // Register directories for the root namespace.
160
+ if ($prepend) {
161
+ $this->fallbackDirsPsr4 = array_merge(
162
+ (array) $paths,
163
+ $this->fallbackDirsPsr4
164
+ );
165
+ } else {
166
+ $this->fallbackDirsPsr4 = array_merge(
167
+ $this->fallbackDirsPsr4,
168
+ (array) $paths
169
+ );
170
+ }
171
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
172
+ // Register directories for a new namespace.
173
+ $length = strlen($prefix);
174
+ if ('\\' !== $prefix[$length - 1]) {
175
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
176
+ }
177
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
179
+ } elseif ($prepend) {
180
+ // Prepend directories for an already registered namespace.
181
+ $this->prefixDirsPsr4[$prefix] = array_merge(
182
+ (array) $paths,
183
+ $this->prefixDirsPsr4[$prefix]
184
+ );
185
+ } else {
186
+ // Append directories for an already registered namespace.
187
+ $this->prefixDirsPsr4[$prefix] = array_merge(
188
+ $this->prefixDirsPsr4[$prefix],
189
+ (array) $paths
190
+ );
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Registers a set of PSR-0 directories for a given prefix,
196
+ * replacing any others previously set for this prefix.
197
+ *
198
+ * @param string $prefix The prefix
199
+ * @param array|string $paths The PSR-0 base directories
200
+ */
201
+ public function set($prefix, $paths)
202
+ {
203
+ if (!$prefix) {
204
+ $this->fallbackDirsPsr0 = (array) $paths;
205
+ } else {
206
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
207
+ }
208
+ }
209
+
210
+ /**
211
+ * Registers a set of PSR-4 directories for a given namespace,
212
+ * replacing any others previously set for this namespace.
213
+ *
214
+ * @param string $prefix The prefix/namespace, with trailing '\\'
215
+ * @param array|string $paths The PSR-4 base directories
216
+ *
217
+ * @throws \InvalidArgumentException
218
+ */
219
+ public function setPsr4($prefix, $paths)
220
+ {
221
+ if (!$prefix) {
222
+ $this->fallbackDirsPsr4 = (array) $paths;
223
+ } else {
224
+ $length = strlen($prefix);
225
+ if ('\\' !== $prefix[$length - 1]) {
226
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
227
+ }
228
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
229
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
230
+ }
231
+ }
232
+
233
+ /**
234
+ * Turns on searching the include path for class files.
235
+ *
236
+ * @param bool $useIncludePath
237
+ */
238
+ public function setUseIncludePath($useIncludePath)
239
+ {
240
+ $this->useIncludePath = $useIncludePath;
241
+ }
242
+
243
+ /**
244
+ * Can be used to check if the autoloader uses the include path to check
245
+ * for classes.
246
+ *
247
+ * @return bool
248
+ */
249
+ public function getUseIncludePath()
250
+ {
251
+ return $this->useIncludePath;
252
+ }
253
+
254
+ /**
255
+ * Turns off searching the prefix and fallback directories for classes
256
+ * that have not been registered with the class map.
257
+ *
258
+ * @param bool $classMapAuthoritative
259
+ */
260
+ public function setClassMapAuthoritative($classMapAuthoritative)
261
+ {
262
+ $this->classMapAuthoritative = $classMapAuthoritative;
263
+ }
264
+
265
+ /**
266
+ * Should class lookup fail if not found in the current class map?
267
+ *
268
+ * @return bool
269
+ */
270
+ public function isClassMapAuthoritative()
271
+ {
272
+ return $this->classMapAuthoritative;
273
+ }
274
+
275
+ /**
276
+ * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
+ *
278
+ * @param string|null $apcuPrefix
279
+ */
280
+ public function setApcuPrefix($apcuPrefix)
281
+ {
282
+ $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
283
+ }
284
+
285
+ /**
286
+ * The APCu prefix in use, or null if APCu caching is not enabled.
287
+ *
288
+ * @return string|null
289
+ */
290
+ public function getApcuPrefix()
291
+ {
292
+ return $this->apcuPrefix;
293
+ }
294
+
295
+ /**
296
+ * Registers this instance as an autoloader.
297
+ *
298
+ * @param bool $prepend Whether to prepend the autoloader or not
299
+ */
300
+ public function register($prepend = false)
301
+ {
302
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
303
+ }
304
+
305
+ /**
306
+ * Unregisters this instance as an autoloader.
307
+ */
308
+ public function unregister()
309
+ {
310
+ spl_autoload_unregister(array($this, 'loadClass'));
311
+ }
312
+
313
+ /**
314
+ * Loads the given class or interface.
315
+ *
316
+ * @param string $class The name of the class
317
+ * @return bool|null True if loaded, null otherwise
318
+ */
319
+ public function loadClass($class)
320
+ {
321
+ if ($file = $this->findFile($class)) {
322
+ includeFile($file);
323
+
324
+ return true;
325
+ }
326
+ }
327
+
328
+ /**
329
+ * Finds the path to the file where the class is defined.
330
+ *
331
+ * @param string $class The name of the class
332
+ *
333
+ * @return string|false The path if found, false otherwise
334
+ */
335
+ public function findFile($class)
336
+ {
337
+ // class map lookup
338
+ if (isset($this->classMap[$class])) {
339
+ return $this->classMap[$class];
340
+ }
341
+ if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342
+ return false;
343
+ }
344
+ if (null !== $this->apcuPrefix) {
345
+ $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
+ if ($hit) {
347
+ return $file;
348
+ }
349
+ }
350
+
351
+ $file = $this->findFileWithExtension($class, '.php');
352
+
353
+ // Search for Hack files if we are running on HHVM
354
+ if (false === $file && defined('HHVM_VERSION')) {
355
+ $file = $this->findFileWithExtension($class, '.hh');
356
+ }
357
+
358
+ if (null !== $this->apcuPrefix) {
359
+ apcu_add($this->apcuPrefix.$class, $file);
360
+ }
361
+
362
+ if (false === $file) {
363
+ // Remember that this class does not exist.
364
+ $this->missingClasses[$class] = true;
365
+ }
366
+
367
+ return $file;
368
+ }
369
+
370
+ private function findFileWithExtension($class, $ext)
371
+ {
372
+ // PSR-4 lookup
373
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
374
+
375
+ $first = $class[0];
376
+ if (isset($this->prefixLengthsPsr4[$first])) {
377
+ $subPath = $class;
378
+ while (false !== $lastPos = strrpos($subPath, '\\')) {
379
+ $subPath = substr($subPath, 0, $lastPos);
380
+ $search = $subPath . '\\';
381
+ if (isset($this->prefixDirsPsr4[$search])) {
382
+ $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
+ foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
+ if (file_exists($file = $dir . $pathEnd)) {
385
+ return $file;
386
+ }
387
+ }
388
+ }
389
+ }
390
+ }
391
+
392
+ // PSR-4 fallback dirs
393
+ foreach ($this->fallbackDirsPsr4 as $dir) {
394
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
395
+ return $file;
396
+ }
397
+ }
398
+
399
+ // PSR-0 lookup
400
+ if (false !== $pos = strrpos($class, '\\')) {
401
+ // namespaced class name
402
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
403
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
404
+ } else {
405
+ // PEAR-like class name
406
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
407
+ }
408
+
409
+ if (isset($this->prefixesPsr0[$first])) {
410
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
411
+ if (0 === strpos($class, $prefix)) {
412
+ foreach ($dirs as $dir) {
413
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
414
+ return $file;
415
+ }
416
+ }
417
+ }
418
+ }
419
+ }
420
+
421
+ // PSR-0 fallback dirs
422
+ foreach ($this->fallbackDirsPsr0 as $dir) {
423
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
424
+ return $file;
425
+ }
426
+ }
427
+
428
+ // PSR-0 include paths.
429
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
430
+ return $file;
431
+ }
432
+
433
+ return false;
434
+ }
435
+ }
436
+
437
+ /**
438
+ * Scope isolated include.
439
+ *
440
+ * Prevents access to $this/self from included files.
441
+ */
442
+ function includeFile($file)
443
+ {
444
+ include $file;
445
+ }
vendor/vendor/composer/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Copyright (c) Nils Adermann, Jordi Boggiano
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is furnished
9
+ to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+
vendor/vendor/composer/autoload_classmap.php ADDED
@@ -0,0 +1,552 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_classmap.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'AltoRouter' => $vendorDir . '/altorouter/altorouter/AltoRouter.php',
10
+ 'Asm89\\Twig\\CacheExtension\\CacheProviderInterface' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheProviderInterface.php',
11
+ 'Asm89\\Twig\\CacheExtension\\CacheProvider\\DoctrineCacheAdapter' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheProvider/DoctrineCacheAdapter.php',
12
+ 'Asm89\\Twig\\CacheExtension\\CacheProvider\\PsrCacheAdapter' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheProvider/PsrCacheAdapter.php',
13
+ 'Asm89\\Twig\\CacheExtension\\CacheStrategyInterface' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategyInterface.php',
14
+ 'Asm89\\Twig\\CacheExtension\\CacheStrategy\\BlackholeCacheStrategy' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/BlackholeCacheStrategy.php',
15
+ 'Asm89\\Twig\\CacheExtension\\CacheStrategy\\GenerationalCacheStrategy' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/GenerationalCacheStrategy.php',
16
+ 'Asm89\\Twig\\CacheExtension\\CacheStrategy\\IndexedChainingCacheStrategy' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/IndexedChainingCacheStrategy.php',
17
+ 'Asm89\\Twig\\CacheExtension\\CacheStrategy\\KeyGeneratorInterface' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/KeyGeneratorInterface.php',
18
+ 'Asm89\\Twig\\CacheExtension\\CacheStrategy\\LifetimeCacheStrategy' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/LifetimeCacheStrategy.php',
19
+ 'Asm89\\Twig\\CacheExtension\\Exception\\BaseException' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/BaseException.php',
20
+ 'Asm89\\Twig\\CacheExtension\\Exception\\InvalidCacheKeyException' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/InvalidCacheKeyException.php',
21
+ 'Asm89\\Twig\\CacheExtension\\Exception\\InvalidCacheLifetimeException' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/InvalidCacheLifetimeException.php',
22
+ 'Asm89\\Twig\\CacheExtension\\Exception\\NonExistingStrategyException' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/NonExistingStrategyException.php',
23
+ 'Asm89\\Twig\\CacheExtension\\Exception\\NonExistingStrategyKeyException' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Exception/NonExistingStrategyKeyException.php',
24
+ 'Asm89\\Twig\\CacheExtension\\Extension' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Extension.php',
25
+ 'Asm89\\Twig\\CacheExtension\\Node\\CacheNode' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Node/CacheNode.php',
26
+ 'Asm89\\Twig\\CacheExtension\\TokenParser\\Cache' => $vendorDir . '/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/TokenParser/Cache.php',
27
+ 'Composer\\Installers\\AglInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AglInstaller.php',
28
+ 'Composer\\Installers\\AimeosInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AimeosInstaller.php',
29
+ 'Composer\\Installers\\AnnotateCmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php',
30
+ 'Composer\\Installers\\AsgardInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AsgardInstaller.php',
31
+ 'Composer\\Installers\\AttogramInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AttogramInstaller.php',
32
+ 'Composer\\Installers\\BaseInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/BaseInstaller.php',
33
+ 'Composer\\Installers\\BitrixInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/BitrixInstaller.php',
34
+ 'Composer\\Installers\\BonefishInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/BonefishInstaller.php',
35
+ 'Composer\\Installers\\CakePHPInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CakePHPInstaller.php',
36
+ 'Composer\\Installers\\ChefInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ChefInstaller.php',
37
+ 'Composer\\Installers\\CiviCrmInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CiviCrmInstaller.php',
38
+ 'Composer\\Installers\\ClanCatsFrameworkInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php',
39
+ 'Composer\\Installers\\CockpitInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CockpitInstaller.php',
40
+ 'Composer\\Installers\\CodeIgniterInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php',
41
+ 'Composer\\Installers\\Concrete5Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Concrete5Installer.php',
42
+ 'Composer\\Installers\\CraftInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CraftInstaller.php',
43
+ 'Composer\\Installers\\CroogoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CroogoInstaller.php',
44
+ 'Composer\\Installers\\DecibelInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DecibelInstaller.php',
45
+ 'Composer\\Installers\\DframeInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DframeInstaller.php',
46
+ 'Composer\\Installers\\DokuWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DokuWikiInstaller.php',
47
+ 'Composer\\Installers\\DolibarrInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DolibarrInstaller.php',
48
+ 'Composer\\Installers\\DrupalInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DrupalInstaller.php',
49
+ 'Composer\\Installers\\ElggInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ElggInstaller.php',
50
+ 'Composer\\Installers\\EliasisInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/EliasisInstaller.php',
51
+ 'Composer\\Installers\\ExpressionEngineInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php',
52
+ 'Composer\\Installers\\EzPlatformInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/EzPlatformInstaller.php',
53
+ 'Composer\\Installers\\FuelInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/FuelInstaller.php',
54
+ 'Composer\\Installers\\FuelphpInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/FuelphpInstaller.php',
55
+ 'Composer\\Installers\\GravInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/GravInstaller.php',
56
+ 'Composer\\Installers\\HuradInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/HuradInstaller.php',
57
+ 'Composer\\Installers\\ImageCMSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ImageCMSInstaller.php',
58
+ 'Composer\\Installers\\Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Installer.php',
59
+ 'Composer\\Installers\\ItopInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ItopInstaller.php',
60
+ 'Composer\\Installers\\JoomlaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/JoomlaInstaller.php',
61
+ 'Composer\\Installers\\KanboardInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KanboardInstaller.php',
62
+ 'Composer\\Installers\\KirbyInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KirbyInstaller.php',
63
+ 'Composer\\Installers\\KnownInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KnownInstaller.php',
64
+ 'Composer\\Installers\\KodiCMSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KodiCMSInstaller.php',
65
+ 'Composer\\Installers\\KohanaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KohanaInstaller.php',
66
+ 'Composer\\Installers\\LanManagementSystemInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php',
67
+ 'Composer\\Installers\\LaravelInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LaravelInstaller.php',
68
+ 'Composer\\Installers\\LavaLiteInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LavaLiteInstaller.php',
69
+ 'Composer\\Installers\\LithiumInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LithiumInstaller.php',
70
+ 'Composer\\Installers\\MODULEWorkInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php',
71
+ 'Composer\\Installers\\MODXEvoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MODXEvoInstaller.php',
72
+ 'Composer\\Installers\\MagentoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MagentoInstaller.php',
73
+ 'Composer\\Installers\\MajimaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MajimaInstaller.php',
74
+ 'Composer\\Installers\\MakoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MakoInstaller.php',
75
+ 'Composer\\Installers\\MauticInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MauticInstaller.php',
76
+ 'Composer\\Installers\\MayaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MayaInstaller.php',
77
+ 'Composer\\Installers\\MediaWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MediaWikiInstaller.php',
78
+ 'Composer\\Installers\\MicroweberInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MicroweberInstaller.php',
79
+ 'Composer\\Installers\\ModxInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ModxInstaller.php',
80
+ 'Composer\\Installers\\MoodleInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MoodleInstaller.php',
81
+ 'Composer\\Installers\\OctoberInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OctoberInstaller.php',
82
+ 'Composer\\Installers\\OntoWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OntoWikiInstaller.php',
83
+ 'Composer\\Installers\\OsclassInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OsclassInstaller.php',
84
+ 'Composer\\Installers\\OxidInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OxidInstaller.php',
85
+ 'Composer\\Installers\\PPIInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PPIInstaller.php',
86
+ 'Composer\\Installers\\PhiftyInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PhiftyInstaller.php',
87
+ 'Composer\\Installers\\PhpBBInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PhpBBInstaller.php',
88
+ 'Composer\\Installers\\PimcoreInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PimcoreInstaller.php',
89
+ 'Composer\\Installers\\PiwikInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PiwikInstaller.php',
90
+ 'Composer\\Installers\\PlentymarketsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php',
91
+ 'Composer\\Installers\\Plugin' => $vendorDir . '/composer/installers/src/Composer/Installers/Plugin.php',
92
+ 'Composer\\Installers\\PortoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PortoInstaller.php',
93
+ 'Composer\\Installers\\PrestashopInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PrestashopInstaller.php',
94
+ 'Composer\\Installers\\PuppetInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PuppetInstaller.php',
95
+ 'Composer\\Installers\\PxcmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PxcmsInstaller.php',
96
+ 'Composer\\Installers\\RadPHPInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RadPHPInstaller.php',
97
+ 'Composer\\Installers\\ReIndexInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ReIndexInstaller.php',
98
+ 'Composer\\Installers\\Redaxo5Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Redaxo5Installer.php',
99
+ 'Composer\\Installers\\RedaxoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RedaxoInstaller.php',
100
+ 'Composer\\Installers\\RoundcubeInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RoundcubeInstaller.php',
101
+ 'Composer\\Installers\\SMFInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SMFInstaller.php',
102
+ 'Composer\\Installers\\ShopwareInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ShopwareInstaller.php',
103
+ 'Composer\\Installers\\SilverStripeInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SilverStripeInstaller.php',
104
+ 'Composer\\Installers\\SiteDirectInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SiteDirectInstaller.php',
105
+ 'Composer\\Installers\\SyDESInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SyDESInstaller.php',
106
+ 'Composer\\Installers\\Symfony1Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Symfony1Installer.php',
107
+ 'Composer\\Installers\\TYPO3CmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php',
108
+ 'Composer\\Installers\\TYPO3FlowInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php',
109
+ 'Composer\\Installers\\TaoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TaoInstaller.php',
110
+ 'Composer\\Installers\\TheliaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TheliaInstaller.php',
111
+ 'Composer\\Installers\\TuskInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TuskInstaller.php',
112
+ 'Composer\\Installers\\UserFrostingInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/UserFrostingInstaller.php',
113
+ 'Composer\\Installers\\VanillaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/VanillaInstaller.php',
114
+ 'Composer\\Installers\\VgmcpInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/VgmcpInstaller.php',
115
+ 'Composer\\Installers\\WHMCSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/WHMCSInstaller.php',
116
+ 'Composer\\Installers\\WolfCMSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/WolfCMSInstaller.php',
117
+ 'Composer\\Installers\\WordPressInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/WordPressInstaller.php',
118
+ 'Composer\\Installers\\YawikInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/YawikInstaller.php',
119
+ 'Composer\\Installers\\ZendInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ZendInstaller.php',
120
+ 'Composer\\Installers\\ZikulaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ZikulaInstaller.php',
121
+ 'Routes' => $vendorDir . '/upstatement/routes/Routes.php',
122
+ 'Symfony\\Polyfill\\Ctype\\Ctype' => $vendorDir . '/symfony/polyfill-ctype/Ctype.php',
123
+ 'Timber\\Admin' => $baseDir . '/lib/Admin.php',
124
+ 'Timber\\Archives' => $baseDir . '/lib/Archives.php',
125
+ 'Timber\\Cache\\Cleaner' => $baseDir . '/lib/Cache/Cleaner.php',
126
+ 'Timber\\Cache\\KeyGenerator' => $baseDir . '/lib/Cache/KeyGenerator.php',
127
+ 'Timber\\Cache\\TimberKeyGeneratorInterface' => $baseDir . '/lib/Cache/TimberKeyGeneratorInterface.php',
128
+ 'Timber\\Cache\\WPObjectCacheAdapter' => $baseDir . '/lib/Cache/WPObjectCacheAdapter.php',
129
+ 'Timber\\Comment' => $baseDir . '/lib/Comment.php',
130
+ 'Timber\\CommentThread' => $baseDir . '/lib/CommentThread.php',
131
+ 'Timber\\Core' => $baseDir . '/lib/Core.php',
132
+ 'Timber\\CoreInterface' => $baseDir . '/lib/CoreInterface.php',
133
+ 'Timber\\FunctionWrapper' => $baseDir . '/lib/FunctionWrapper.php',
134
+ 'Timber\\Helper' => $baseDir . '/lib/Helper.php',
135
+ 'Timber\\Image' => $baseDir . '/lib/Image.php',
136
+ 'Timber\\ImageHelper' => $baseDir . '/lib/ImageHelper.php',
137
+ 'Timber\\Image\\Operation' => $baseDir . '/lib/Image/Operation.php',
138
+ 'Timber\\Image\\Operation\\Letterbox' => $baseDir . '/lib/Image/Operation/Letterbox.php',
139
+ 'Timber\\Image\\Operation\\Resize' => $baseDir . '/lib/Image/Operation/Resize.php',
140
+ 'Timber\\Image\\Operation\\Retina' => $baseDir . '/lib/Image/Operation/Retina.php',
141
+ 'Timber\\Image\\Operation\\ToJpg' => $baseDir . '/lib/Image/Operation/ToJpg.php',
142
+ 'Timber\\Image\\Operation\\ToWebp' => $baseDir . '/lib/Image/Operation/ToWebp.php',
143
+ 'Timber\\Integrations' => $baseDir . '/lib/Integrations.php',
144
+ 'Timber\\Integrations\\ACF' => $baseDir . '/lib/Integrations/ACF.php',
145
+ 'Timber\\Integrations\\CoAuthorsPlus' => $baseDir . '/lib/Integrations/CoAuthorsPlus.php',
146
+ 'Timber\\Integrations\\CoAuthorsPlusUser' => $baseDir . '/lib/Integrations/CoAuthorsPlusUser.php',
147
+ 'Timber\\Integrations\\Command' => $baseDir . '/lib/Integrations/Command.php',
148
+ 'Timber\\Integrations\\Timber_WP_CLI_Command' => $baseDir . '/lib/Integrations/Timber_WP_CLI_Command.php',
149
+ 'Timber\\Integrations\\WPML' => $baseDir . '/lib/Integrations/WPML.php',
150
+ 'Timber\\Loader' => $baseDir . '/lib/Loader.php',
151
+ 'Timber\\LocationManager' => $baseDir . '/lib/LocationManager.php',
152
+ 'Timber\\Menu' => $baseDir . '/lib/Menu.php',
153
+ 'Timber\\MenuItem' => $baseDir . '/lib/MenuItem.php',
154
+ 'Timber\\Pagination' => $baseDir . '/lib/Pagination.php',
155
+ 'Timber\\Post' => $baseDir . '/lib/Post.php',
156
+ 'Timber\\PostCollection' => $baseDir . '/lib/PostCollection.php',
157
+ 'Timber\\PostGetter' => $baseDir . '/lib/PostGetter.php',
158
+ 'Timber\\PostPreview' => $baseDir . '/lib/PostPreview.php',
159
+ 'Timber\\PostQuery' => $baseDir . '/lib/PostQuery.php',
160
+ 'Timber\\PostType' => $baseDir . '/lib/PostType.php',
161
+ 'Timber\\PostsIterator' => $baseDir . '/lib/PostsIterator.php',
162
+ 'Timber\\QueryIterator' => $baseDir . '/lib/QueryIterator.php',
163
+ 'Timber\\Request' => $baseDir . '/lib/Request.php',
164
+ 'Timber\\Site' => $baseDir . '/lib/Site.php',
165
+ 'Timber\\Term' => $baseDir . '/lib/Term.php',
166
+ 'Timber\\TermGetter' => $baseDir . '/lib/TermGetter.php',
167
+ 'Timber\\TextHelper' => $baseDir . '/lib/TextHelper.php',
168
+ 'Timber\\Theme' => $baseDir . '/lib/Theme.php',
169
+ 'Timber\\Timber' => $baseDir . '/lib/Timber.php',
170
+ 'Timber\\Twig' => $baseDir . '/lib/Twig.php',
171
+ 'Timber\\Twig_Filter' => $baseDir . '/lib/Twig_Filter.php',
172
+ 'Timber\\Twig_Function' => $baseDir . '/lib/Twig_Function.php',
173
+ 'Timber\\URLHelper' => $baseDir . '/lib/URLHelper.php',
174
+ 'Timber\\User' => $baseDir . '/lib/User.php',
175
+ 'Twig\\Cache\\CacheInterface' => $vendorDir . '/twig/twig/src/Cache/CacheInterface.php',
176
+ 'Twig\\Cache\\FilesystemCache' => $vendorDir . '/twig/twig/src/Cache/FilesystemCache.php',
177
+ 'Twig\\Cache\\NullCache' => $vendorDir . '/twig/twig/src/Cache/NullCache.php',
178
+ 'Twig\\Compiler' => $vendorDir . '/twig/twig/src/Compiler.php',
179
+ 'Twig\\Environment' => $vendorDir . '/twig/twig/src/Environment.php',
180
+ 'Twig\\Error\\Error' => $vendorDir . '/twig/twig/src/Error/Error.php',
181
+ 'Twig\\Error\\LoaderError' => $vendorDir . '/twig/twig/src/Error/LoaderError.php',
182
+ 'Twig\\Error\\RuntimeError' => $vendorDir . '/twig/twig/src/Error/RuntimeError.php',
183
+ 'Twig\\Error\\SyntaxError' => $vendorDir . '/twig/twig/src/Error/SyntaxError.php',
184
+ 'Twig\\ExpressionParser' => $vendorDir . '/twig/twig/src/ExpressionParser.php',
185
+ 'Twig\\Extension\\AbstractExtension' => $vendorDir . '/twig/twig/src/Extension/AbstractExtension.php',
186
+ 'Twig\\Extension\\CoreExtension' => $vendorDir . '/twig/twig/src/Extension/CoreExtension.php',
187
+ 'Twig\\Extension\\DebugExtension' => $vendorDir . '/twig/twig/src/Extension/DebugExtension.php',
188
+ 'Twig\\Extension\\EscaperExtension' => $vendorDir . '/twig/twig/src/Extension/EscaperExtension.php',
189
+ 'Twig\\Extension\\ExtensionInterface' => $vendorDir . '/twig/twig/src/Extension/ExtensionInterface.php',
190
+ 'Twig\\Extension\\GlobalsInterface' => $vendorDir . '/twig/twig/src/Extension/GlobalsInterface.php',
191
+ 'Twig\\Extension\\InitRuntimeInterface' => $vendorDir . '/twig/twig/src/Extension/InitRuntimeInterface.php',
192
+ 'Twig\\Extension\\OptimizerExtension' => $vendorDir . '/twig/twig/src/Extension/OptimizerExtension.php',
193
+ 'Twig\\Extension\\ProfilerExtension' => $vendorDir . '/twig/twig/src/Extension/ProfilerExtension.php',
194
+ 'Twig\\Extension\\RuntimeExtensionInterface' => $vendorDir . '/twig/twig/src/Extension/RuntimeExtensionInterface.php',
195
+ 'Twig\\Extension\\SandboxExtension' => $vendorDir . '/twig/twig/src/Extension/SandboxExtension.php',
196
+ 'Twig\\Extension\\StagingExtension' => $vendorDir . '/twig/twig/src/Extension/StagingExtension.php',
197
+ 'Twig\\Extension\\StringLoaderExtension' => $vendorDir . '/twig/twig/src/Extension/StringLoaderExtension.php',
198
+ 'Twig\\FileExtensionEscapingStrategy' => $vendorDir . '/twig/twig/src/FileExtensionEscapingStrategy.php',
199
+ 'Twig\\Lexer' => $vendorDir . '/twig/twig/src/Lexer.php',
200
+ 'Twig\\Loader\\ArrayLoader' => $vendorDir . '/twig/twig/src/Loader/ArrayLoader.php',
201
+ 'Twig\\Loader\\ChainLoader' => $vendorDir . '/twig/twig/src/Loader/ChainLoader.php',
202
+ 'Twig\\Loader\\ExistsLoaderInterface' => $vendorDir . '/twig/twig/src/Loader/ExistsLoaderInterface.php',
203
+ 'Twig\\Loader\\FilesystemLoader' => $vendorDir . '/twig/twig/src/Loader/FilesystemLoader.php',
204
+ 'Twig\\Loader\\LoaderInterface' => $vendorDir . '/twig/twig/src/Loader/LoaderInterface.php',
205
+ 'Twig\\Loader\\SourceContextLoaderInterface' => $vendorDir . '/twig/twig/src/Loader/SourceContextLoaderInterface.php',
206
+ 'Twig\\Markup' => $vendorDir . '/twig/twig/src/Markup.php',
207
+ 'Twig\\NodeTraverser' => $vendorDir . '/twig/twig/src/NodeTraverser.php',
208
+ 'Twig\\NodeVisitor\\AbstractNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php',
209
+ 'Twig\\NodeVisitor\\EscaperNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php',
210
+ 'Twig\\NodeVisitor\\NodeVisitorInterface' => $vendorDir . '/twig/twig/src/NodeVisitor/NodeVisitorInterface.php',
211
+ 'Twig\\NodeVisitor\\OptimizerNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php',
212
+ 'Twig\\NodeVisitor\\SafeAnalysisNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php',
213
+ 'Twig\\NodeVisitor\\SandboxNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php',
214
+ 'Twig\\Node\\AutoEscapeNode' => $vendorDir . '/twig/twig/src/Node/AutoEscapeNode.php',
215
+ 'Twig\\Node\\BlockNode' => $vendorDir . '/twig/twig/src/Node/BlockNode.php',
216
+ 'Twig\\Node\\BlockReferenceNode' => $vendorDir . '/twig/twig/src/Node/BlockReferenceNode.php',
217
+ 'Twig\\Node\\BodyNode' => $vendorDir . '/twig/twig/src/Node/BodyNode.php',
218
+ 'Twig\\Node\\CheckSecurityNode' => $vendorDir . '/twig/twig/src/Node/CheckSecurityNode.php',
219
+ 'Twig\\Node\\CheckToStringNode' => $vendorDir . '/twig/twig/src/Node/CheckToStringNode.php',
220
+ 'Twig\\Node\\DeprecatedNode' => $vendorDir . '/twig/twig/src/Node/DeprecatedNode.php',
221
+ 'Twig\\Node\\DoNode' => $vendorDir . '/twig/twig/src/Node/DoNode.php',
222
+ 'Twig\\Node\\EmbedNode' => $vendorDir . '/twig/twig/src/Node/EmbedNode.php',
223
+ 'Twig\\Node\\Expression\\AbstractExpression' => $vendorDir . '/twig/twig/src/Node/Expression/AbstractExpression.php',
224
+ 'Twig\\Node\\Expression\\ArrayExpression' => $vendorDir . '/twig/twig/src/Node/Expression/ArrayExpression.php',
225
+ 'Twig\\Node\\Expression\\ArrowFunctionExpression' => $vendorDir . '/twig/twig/src/Node/Expression/ArrowFunctionExpression.php',
226
+ 'Twig\\Node\\Expression\\AssignNameExpression' => $vendorDir . '/twig/twig/src/Node/Expression/AssignNameExpression.php',
227
+ 'Twig\\Node\\Expression\\Binary\\AbstractBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/AbstractBinary.php',
228
+ 'Twig\\Node\\Expression\\Binary\\AddBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/AddBinary.php',
229
+ 'Twig\\Node\\Expression\\Binary\\AndBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/AndBinary.php',
230
+ 'Twig\\Node\\Expression\\Binary\\BitwiseAndBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php',
231
+ 'Twig\\Node\\Expression\\Binary\\BitwiseOrBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php',
232
+ 'Twig\\Node\\Expression\\Binary\\BitwiseXorBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php',
233
+ 'Twig\\Node\\Expression\\Binary\\ConcatBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/ConcatBinary.php',
234
+ 'Twig\\Node\\Expression\\Binary\\DivBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/DivBinary.php',
235
+ 'Twig\\Node\\Expression\\Binary\\EndsWithBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php',
236
+ 'Twig\\Node\\Expression\\Binary\\EqualBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/EqualBinary.php',
237
+ 'Twig\\Node\\Expression\\Binary\\FloorDivBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php',
238
+ 'Twig\\Node\\Expression\\Binary\\GreaterBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/GreaterBinary.php',
239
+ 'Twig\\Node\\Expression\\Binary\\GreaterEqualBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php',
240
+ 'Twig\\Node\\Expression\\Binary\\InBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/InBinary.php',
241
+ 'Twig\\Node\\Expression\\Binary\\LessBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/LessBinary.php',
242
+ 'Twig\\Node\\Expression\\Binary\\LessEqualBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php',
243
+ 'Twig\\Node\\Expression\\Binary\\MatchesBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/MatchesBinary.php',
244
+ 'Twig\\Node\\Expression\\Binary\\ModBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/ModBinary.php',
245
+ 'Twig\\Node\\Expression\\Binary\\MulBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/MulBinary.php',
246
+ 'Twig\\Node\\Expression\\Binary\\NotEqualBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php',
247
+ 'Twig\\Node\\Expression\\Binary\\NotInBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/NotInBinary.php',
248
+ 'Twig\\Node\\Expression\\Binary\\OrBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/OrBinary.php',
249
+ 'Twig\\Node\\Expression\\Binary\\PowerBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/PowerBinary.php',
250
+ 'Twig\\Node\\Expression\\Binary\\RangeBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/RangeBinary.php',
251
+ 'Twig\\Node\\Expression\\Binary\\StartsWithBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php',
252
+ 'Twig\\Node\\Expression\\Binary\\SubBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/SubBinary.php',
253
+ 'Twig\\Node\\Expression\\BlockReferenceExpression' => $vendorDir . '/twig/twig/src/Node/Expression/BlockReferenceExpression.php',
254
+ 'Twig\\Node\\Expression\\CallExpression' => $vendorDir . '/twig/twig/src/Node/Expression/CallExpression.php',
255
+ 'Twig\\Node\\Expression\\ConditionalExpression' => $vendorDir . '/twig/twig/src/Node/Expression/ConditionalExpression.php',
256
+ 'Twig\\Node\\Expression\\ConstantExpression' => $vendorDir . '/twig/twig/src/Node/Expression/ConstantExpression.php',
257
+ 'Twig\\Node\\Expression\\FilterExpression' => $vendorDir . '/twig/twig/src/Node/Expression/FilterExpression.php',
258
+ 'Twig\\Node\\Expression\\Filter\\DefaultFilter' => $vendorDir . '/twig/twig/src/Node/Expression/Filter/DefaultFilter.php',
259
+ 'Twig\\Node\\Expression\\FunctionExpression' => $vendorDir . '/twig/twig/src/Node/Expression/FunctionExpression.php',
260
+ 'Twig\\Node\\Expression\\GetAttrExpression' => $vendorDir . '/twig/twig/src/Node/Expression/GetAttrExpression.php',
261
+ 'Twig\\Node\\Expression\\InlinePrint' => $vendorDir . '/twig/twig/src/Node/Expression/InlinePrint.php',
262
+ 'Twig\\Node\\Expression\\MethodCallExpression' => $vendorDir . '/twig/twig/src/Node/Expression/MethodCallExpression.php',
263
+ 'Twig\\Node\\Expression\\NameExpression' => $vendorDir . '/twig/twig/src/Node/Expression/NameExpression.php',
264
+ 'Twig\\Node\\Expression\\NullCoalesceExpression' => $vendorDir . '/twig/twig/src/Node/Expression/NullCoalesceExpression.php',
265
+ 'Twig\\Node\\Expression\\ParentExpression' => $vendorDir . '/twig/twig/src/Node/Expression/ParentExpression.php',
266
+ 'Twig\\Node\\Expression\\TempNameExpression' => $vendorDir . '/twig/twig/src/Node/Expression/TempNameExpression.php',
267
+ 'Twig\\Node\\Expression\\TestExpression' => $vendorDir . '/twig/twig/src/Node/Expression/TestExpression.php',
268
+ 'Twig\\Node\\Expression\\Test\\ConstantTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/ConstantTest.php',
269
+ 'Twig\\Node\\Expression\\Test\\DefinedTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/DefinedTest.php',
270
+ 'Twig\\Node\\Expression\\Test\\DivisiblebyTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php',
271
+ 'Twig\\Node\\Expression\\Test\\EvenTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/EvenTest.php',
272
+ 'Twig\\Node\\Expression\\Test\\NullTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/NullTest.php',
273
+ 'Twig\\Node\\Expression\\Test\\OddTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/OddTest.php',
274
+ 'Twig\\Node\\Expression\\Test\\SameasTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/SameasTest.php',
275
+ 'Twig\\Node\\Expression\\Unary\\AbstractUnary' => $vendorDir . '/twig/twig/src/Node/Expression/Unary/AbstractUnary.php',
276
+ 'Twig\\Node\\Expression\\Unary\\NegUnary' => $vendorDir . '/twig/twig/src/Node/Expression/Unary/NegUnary.php',
277
+ 'Twig\\Node\\Expression\\Unary\\NotUnary' => $vendorDir . '/twig/twig/src/Node/Expression/Unary/NotUnary.php',
278
+ 'Twig\\Node\\Expression\\Unary\\PosUnary' => $vendorDir . '/twig/twig/src/Node/Expression/Unary/PosUnary.php',
279
+ 'Twig\\Node\\FlushNode' => $vendorDir . '/twig/twig/src/Node/FlushNode.php',
280
+ 'Twig\\Node\\ForLoopNode' => $vendorDir . '/twig/twig/src/Node/ForLoopNode.php',
281
+ 'Twig\\Node\\ForNode' => $vendorDir . '/twig/twig/src/Node/ForNode.php',
282
+ 'Twig\\Node\\IfNode' => $vendorDir . '/twig/twig/src/Node/IfNode.php',
283
+ 'Twig\\Node\\ImportNode' => $vendorDir . '/twig/twig/src/Node/ImportNode.php',
284
+ 'Twig\\Node\\IncludeNode' => $vendorDir . '/twig/twig/src/Node/IncludeNode.php',
285
+ 'Twig\\Node\\MacroNode' => $vendorDir . '/twig/twig/src/Node/MacroNode.php',
286
+ 'Twig\\Node\\ModuleNode' => $vendorDir . '/twig/twig/src/Node/ModuleNode.php',
287
+ 'Twig\\Node\\Node' => $vendorDir . '/twig/twig/src/Node/Node.php',
288
+ 'Twig\\Node\\NodeCaptureInterface' => $vendorDir . '/twig/twig/src/Node/NodeCaptureInterface.php',
289
+ 'Twig\\Node\\NodeOutputInterface' => $vendorDir . '/twig/twig/src/Node/NodeOutputInterface.php',
290
+ 'Twig\\Node\\PrintNode' => $vendorDir . '/twig/twig/src/Node/PrintNode.php',
291
+ 'Twig\\Node\\SandboxNode' => $vendorDir . '/twig/twig/src/Node/SandboxNode.php',
292
+ 'Twig\\Node\\SandboxedPrintNode' => $vendorDir . '/twig/twig/src/Node/SandboxedPrintNode.php',
293
+ 'Twig\\Node\\SetNode' => $vendorDir . '/twig/twig/src/Node/SetNode.php',
294
+ 'Twig\\Node\\SetTempNode' => $vendorDir . '/twig/twig/src/Node/SetTempNode.php',
295
+ 'Twig\\Node\\SpacelessNode' => $vendorDir . '/twig/twig/src/Node/SpacelessNode.php',
296
+ 'Twig\\Node\\TextNode' => $vendorDir . '/twig/twig/src/Node/TextNode.php',
297
+ 'Twig\\Node\\WithNode' => $vendorDir . '/twig/twig/src/Node/WithNode.php',
298
+ 'Twig\\Parser' => $vendorDir . '/twig/twig/src/Parser.php',
299
+ 'Twig\\Profiler\\Dumper\\BaseDumper' => $vendorDir . '/twig/twig/src/Profiler/Dumper/BaseDumper.php',
300
+ 'Twig\\Profiler\\Dumper\\BlackfireDumper' => $vendorDir . '/twig/twig/src/Profiler/Dumper/BlackfireDumper.php',
301
+ 'Twig\\Profiler\\Dumper\\HtmlDumper' => $vendorDir . '/twig/twig/src/Profiler/Dumper/HtmlDumper.php',
302
+ 'Twig\\Profiler\\Dumper\\TextDumper' => $vendorDir . '/twig/twig/src/Profiler/Dumper/TextDumper.php',
303
+ 'Twig\\Profiler\\NodeVisitor\\ProfilerNodeVisitor' => $vendorDir . '/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php',
304
+ 'Twig\\Profiler\\Node\\EnterProfileNode' => $vendorDir . '/twig/twig/src/Profiler/Node/EnterProfileNode.php',
305
+ 'Twig\\Profiler\\Node\\LeaveProfileNode' => $vendorDir . '/twig/twig/src/Profiler/Node/LeaveProfileNode.php',
306
+ 'Twig\\Profiler\\Profile' => $vendorDir . '/twig/twig/src/Profiler/Profile.php',
307
+ 'Twig\\RuntimeLoader\\ContainerRuntimeLoader' => $vendorDir . '/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php',
308
+ 'Twig\\RuntimeLoader\\FactoryRuntimeLoader' => $vendorDir . '/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php',
309
+ 'Twig\\RuntimeLoader\\RuntimeLoaderInterface' => $vendorDir . '/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php',
310
+ 'Twig\\Sandbox\\SecurityError' => $vendorDir . '/twig/twig/src/Sandbox/SecurityError.php',
311
+ 'Twig\\Sandbox\\SecurityNotAllowedFilterError' => $vendorDir . '/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php',
312
+ 'Twig\\Sandbox\\SecurityNotAllowedFunctionError' => $vendorDir . '/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php',
313
+ 'Twig\\Sandbox\\SecurityNotAllowedMethodError' => $vendorDir . '/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php',
314
+ 'Twig\\Sandbox\\SecurityNotAllowedPropertyError' => $vendorDir . '/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php',
315
+ 'Twig\\Sandbox\\SecurityNotAllowedTagError' => $vendorDir . '/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php',
316
+ 'Twig\\Sandbox\\SecurityPolicy' => $vendorDir . '/twig/twig/src/Sandbox/SecurityPolicy.php',
317
+ 'Twig\\Sandbox\\SecurityPolicyInterface' => $vendorDir . '/twig/twig/src/Sandbox/SecurityPolicyInterface.php',
318
+ 'Twig\\Source' => $vendorDir . '/twig/twig/src/Source.php',
319
+ 'Twig\\Template' => $vendorDir . '/twig/twig/src/Template.php',
320
+ 'Twig\\TemplateWrapper' => $vendorDir . '/twig/twig/src/TemplateWrapper.php',
321
+ 'Twig\\Test\\IntegrationTestCase' => $vendorDir . '/twig/twig/src/Test/IntegrationTestCase.php',
322
+ 'Twig\\Test\\NodeTestCase' => $vendorDir . '/twig/twig/src/Test/NodeTestCase.php',
323
+ 'Twig\\Token' => $vendorDir . '/twig/twig/src/Token.php',
324
+ 'Twig\\TokenParser\\AbstractTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/AbstractTokenParser.php',
325
+ 'Twig\\TokenParser\\ApplyTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/ApplyTokenParser.php',
326
+ 'Twig\\TokenParser\\AutoEscapeTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/AutoEscapeTokenParser.php',
327
+ 'Twig\\TokenParser\\BlockTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/BlockTokenParser.php',
328
+ 'Twig\\TokenParser\\DeprecatedTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/DeprecatedTokenParser.php',
329
+ 'Twig\\TokenParser\\DoTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/DoTokenParser.php',
330
+ 'Twig\\TokenParser\\EmbedTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/EmbedTokenParser.php',
331
+ 'Twig\\TokenParser\\ExtendsTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/ExtendsTokenParser.php',
332
+ 'Twig\\TokenParser\\FilterTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/FilterTokenParser.php',
333
+ 'Twig\\TokenParser\\FlushTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/FlushTokenParser.php',
334
+ 'Twig\\TokenParser\\ForTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/ForTokenParser.php',
335
+ 'Twig\\TokenParser\\FromTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/FromTokenParser.php',
336
+ 'Twig\\TokenParser\\IfTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/IfTokenParser.php',
337
+ 'Twig\\TokenParser\\ImportTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/ImportTokenParser.php',
338
+ 'Twig\\TokenParser\\IncludeTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/IncludeTokenParser.php',
339
+ 'Twig\\TokenParser\\MacroTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/MacroTokenParser.php',
340
+ 'Twig\\TokenParser\\SandboxTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/SandboxTokenParser.php',
341
+ 'Twig\\TokenParser\\SetTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/SetTokenParser.php',
342
+ 'Twig\\TokenParser\\SpacelessTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/SpacelessTokenParser.php',
343
+ 'Twig\\TokenParser\\TokenParserInterface' => $vendorDir . '/twig/twig/src/TokenParser/TokenParserInterface.php',
344
+ 'Twig\\TokenParser\\UseTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/UseTokenParser.php',
345
+ 'Twig\\TokenParser\\WithTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/WithTokenParser.php',
346
+ 'Twig\\TokenStream' => $vendorDir . '/twig/twig/src/TokenStream.php',
347
+ 'Twig\\TwigFilter' => $vendorDir . '/twig/twig/src/TwigFilter.php',
348
+ 'Twig\\TwigFunction' => $vendorDir . '/twig/twig/src/TwigFunction.php',
349
+ 'Twig\\TwigTest' => $vendorDir . '/twig/twig/src/TwigTest.php',
350
+ 'Twig\\Util\\DeprecationCollector' => $vendorDir . '/twig/twig/src/Util/DeprecationCollector.php',
351
+ 'Twig\\Util\\TemplateDirIterator' => $vendorDir . '/twig/twig/src/Util/TemplateDirIterator.php',
352
+ 'Twig_Autoloader' => $vendorDir . '/twig/twig/lib/Twig/Autoloader.php',
353
+ 'Twig_BaseNodeVisitor' => $vendorDir . '/twig/twig/lib/Twig/BaseNodeVisitor.php',
354
+ 'Twig_CacheInterface' => $vendorDir . '/twig/twig/lib/Twig/CacheInterface.php',
355
+ 'Twig_Cache_Filesystem' => $vendorDir . '/twig/twig/lib/Twig/Cache/Filesystem.php',
356
+ 'Twig_Cache_Null' => $vendorDir . '/twig/twig/lib/Twig/Cache/Null.php',
357
+ 'Twig_Compiler' => $vendorDir . '/twig/twig/lib/Twig/Compiler.php',
358
+ 'Twig_CompilerInterface' => $vendorDir . '/twig/twig/lib/Twig/CompilerInterface.php',
359
+ 'Twig_ContainerRuntimeLoader' => $vendorDir . '/twig/twig/lib/Twig/ContainerRuntimeLoader.php',
360
+ 'Twig_Environment' => $vendorDir . '/twig/twig/lib/Twig/Environment.php',
361
+ 'Twig_Error' => $vendorDir . '/twig/twig/lib/Twig/Error.php',
362
+ 'Twig_Error_Loader' => $vendorDir . '/twig/twig/lib/Twig/Error/Loader.php',
363
+ 'Twig_Error_Runtime' => $vendorDir . '/twig/twig/lib/Twig/Error/Runtime.php',
364
+ 'Twig_Error_Syntax' => $vendorDir . '/twig/twig/lib/Twig/Error/Syntax.php',
365
+ 'Twig_ExistsLoaderInterface' => $vendorDir . '/twig/twig/lib/Twig/ExistsLoaderInterface.php',
366
+ 'Twig_ExpressionParser' => $vendorDir . '/twig/twig/lib/Twig/ExpressionParser.php',
367
+ 'Twig_Extension' => $vendorDir . '/twig/twig/lib/Twig/Extension.php',
368
+ 'Twig_ExtensionInterface' => $vendorDir . '/twig/twig/lib/Twig/ExtensionInterface.php',
369
+ 'Twig_Extension_Core' => $vendorDir . '/twig/twig/lib/Twig/Extension/Core.php',
370
+ 'Twig_Extension_Debug' => $vendorDir . '/twig/twig/lib/Twig/Extension/Debug.php',
371
+ 'Twig_Extension_Escaper' => $vendorDir . '/twig/twig/lib/Twig/Extension/Escaper.php',
372
+ 'Twig_Extension_GlobalsInterface' => $vendorDir . '/twig/twig/lib/Twig/Extension/GlobalsInterface.php',
373
+ 'Twig_Extension_InitRuntimeInterface' => $vendorDir . '/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php',
374
+ 'Twig_Extension_Optimizer' => $vendorDir . '/twig/twig/lib/Twig/Extension/Optimizer.php',
375
+ 'Twig_Extension_Profiler' => $vendorDir . '/twig/twig/lib/Twig/Extension/Profiler.php',
376
+ 'Twig_Extension_Sandbox' => $vendorDir . '/twig/twig/lib/Twig/Extension/Sandbox.php',
377
+ 'Twig_Extension_Staging' => $vendorDir . '/twig/twig/lib/Twig/Extension/Staging.php',
378
+ 'Twig_Extension_StringLoader' => $vendorDir . '/twig/twig/lib/Twig/Extension/StringLoader.php',
379
+ 'Twig_FactoryRuntimeLoader' => $vendorDir . '/twig/twig/lib/Twig/FactoryRuntimeLoader.php',
380
+ 'Twig_FileExtensionEscapingStrategy' => $vendorDir . '/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php',
381
+ 'Twig_Filter' => $vendorDir . '/twig/twig/lib/Twig/Filter.php',
382
+ 'Twig_FilterCallableInterface' => $vendorDir . '/twig/twig/lib/Twig/FilterCallableInterface.php',
383
+ 'Twig_FilterInterface' => $vendorDir . '/twig/twig/lib/Twig/FilterInterface.php',
384
+ 'Twig_Filter_Function' => $vendorDir . '/twig/twig/lib/Twig/Filter/Function.php',
385
+ 'Twig_Filter_Method' => $vendorDir . '/twig/twig/lib/Twig/Filter/Method.php',
386
+ 'Twig_Filter_Node' => $vendorDir . '/twig/twig/lib/Twig/Filter/Node.php',
387
+ 'Twig_Function' => $vendorDir . '/twig/twig/lib/Twig/Function.php',
388
+ 'Twig_FunctionCallableInterface' => $vendorDir . '/twig/twig/lib/Twig/FunctionCallableInterface.php',
389
+ 'Twig_FunctionInterface' => $vendorDir . '/twig/twig/lib/Twig/FunctionInterface.php',
390
+ 'Twig_Function_Function' => $vendorDir . '/twig/twig/lib/Twig/Function/Function.php',
391
+ 'Twig_Function_Method' => $vendorDir . '/twig/twig/lib/Twig/Function/Method.php',
392
+ 'Twig_Function_Node' => $vendorDir . '/twig/twig/lib/Twig/Function/Node.php',
393
+ 'Twig_Lexer' => $vendorDir . '/twig/twig/lib/Twig/Lexer.php',
394
+ 'Twig_LexerInterface' => $vendorDir . '/twig/twig/lib/Twig/LexerInterface.php',
395
+ 'Twig_LoaderInterface' => $vendorDir . '/twig/twig/lib/Twig/LoaderInterface.php',
396
+ 'Twig_Loader_Array' => $vendorDir . '/twig/twig/lib/Twig/Loader/Array.php',
397
+ 'Twig_Loader_Chain' => $vendorDir . '/twig/twig/lib/Twig/Loader/Chain.php',
398
+ 'Twig_Loader_Filesystem' => $vendorDir . '/twig/twig/lib/Twig/Loader/Filesystem.php',
399
+ 'Twig_Loader_String' => $vendorDir . '/twig/twig/lib/Twig/Loader/String.php',
400
+ 'Twig_Markup' => $vendorDir . '/twig/twig/lib/Twig/Markup.php',
401
+ 'Twig_Node' => $vendorDir . '/twig/twig/lib/Twig/Node.php',
402
+ 'Twig_NodeCaptureInterface' => $vendorDir . '/twig/twig/lib/Twig/NodeCaptureInterface.php',
403
+ 'Twig_NodeInterface' => $vendorDir . '/twig/twig/lib/Twig/NodeInterface.php',
404
+ 'Twig_NodeOutputInterface' => $vendorDir . '/twig/twig/lib/Twig/NodeOutputInterface.php',
405
+ 'Twig_NodeTraverser' => $vendorDir . '/twig/twig/lib/Twig/NodeTraverser.php',
406
+ 'Twig_NodeVisitorInterface' => $vendorDir . '/twig/twig/lib/Twig/NodeVisitorInterface.php',
407
+ 'Twig_NodeVisitor_Escaper' => $vendorDir . '/twig/twig/lib/Twig/NodeVisitor/Escaper.php',
408
+ 'Twig_NodeVisitor_Optimizer' => $vendorDir . '/twig/twig/lib/Twig/NodeVisitor/Optimizer.php',
409
+ 'Twig_NodeVisitor_SafeAnalysis' => $vendorDir . '/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php',
410
+ 'Twig_NodeVisitor_Sandbox' => $vendorDir . '/twig/twig/lib/Twig/NodeVisitor/Sandbox.php',
411
+ 'Twig_Node_AutoEscape' => $vendorDir . '/twig/twig/lib/Twig/Node/AutoEscape.php',
412
+ 'Twig_Node_Block' => $vendorDir . '/twig/twig/lib/Twig/Node/Block.php',
413
+ 'Twig_Node_BlockReference' => $vendorDir . '/twig/twig/lib/Twig/Node/BlockReference.php',
414
+ 'Twig_Node_Body' => $vendorDir . '/twig/twig/lib/Twig/Node/Body.php',
415
+ 'Twig_Node_CheckSecurity' => $vendorDir . '/twig/twig/lib/Twig/Node/CheckSecurity.php',
416
+ 'Twig_Node_Deprecated' => $vendorDir . '/twig/twig/lib/Twig/Node/Deprecated.php',
417
+ 'Twig_Node_Do' => $vendorDir . '/twig/twig/lib/Twig/Node/Do.php',
418
+ 'Twig_Node_Embed' => $vendorDir . '/twig/twig/lib/Twig/Node/Embed.php',
419
+ 'Twig_Node_Expression' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression.php',
420
+ 'Twig_Node_Expression_Array' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Array.php',
421
+ 'Twig_Node_Expression_AssignName' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/AssignName.php',
422
+ 'Twig_Node_Expression_Binary' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary.php',
423
+ 'Twig_Node_Expression_Binary_Add' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Add.php',
424
+ 'Twig_Node_Expression_Binary_And' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/And.php',
425
+ 'Twig_Node_Expression_Binary_BitwiseAnd' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php',
426
+ 'Twig_Node_Expression_Binary_BitwiseOr' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php',
427
+ 'Twig_Node_Expression_Binary_BitwiseXor' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php',
428
+ 'Twig_Node_Expression_Binary_Concat' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php',
429
+ 'Twig_Node_Expression_Binary_Div' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Div.php',
430
+ 'Twig_Node_Expression_Binary_EndsWith' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php',
431
+ 'Twig_Node_Expression_Binary_Equal' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php',
432
+ 'Twig_Node_Expression_Binary_FloorDiv' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php',
433
+ 'Twig_Node_Expression_Binary_Greater' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php',
434
+ 'Twig_Node_Expression_Binary_GreaterEqual' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php',
435
+ 'Twig_Node_Expression_Binary_In' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/In.php',
436
+ 'Twig_Node_Expression_Binary_Less' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Less.php',
437
+ 'Twig_Node_Expression_Binary_LessEqual' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php',
438
+ 'Twig_Node_Expression_Binary_Matches' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php',
439
+ 'Twig_Node_Expression_Binary_Mod' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php',
440
+ 'Twig_Node_Expression_Binary_Mul' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php',
441
+ 'Twig_Node_Expression_Binary_NotEqual' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php',
442
+ 'Twig_Node_Expression_Binary_NotIn' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php',
443
+ 'Twig_Node_Expression_Binary_Or' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Or.php',
444
+ 'Twig_Node_Expression_Binary_Power' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Power.php',
445
+ 'Twig_Node_Expression_Binary_Range' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Range.php',
446
+ 'Twig_Node_Expression_Binary_StartsWith' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php',
447
+ 'Twig_Node_Expression_Binary_Sub' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php',
448
+ 'Twig_Node_Expression_BlockReference' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/BlockReference.php',
449
+