From 9fda0ecd1c9f5e42719d3f92f7ec8bb0b50d0798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?= Date: Tue, 19 Nov 2024 10:12:21 +0100 Subject: [PATCH 1/2] Regenerated PHPStan (#453) --- phpstan-baseline.neon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 668d9e640a..4b3dee324b 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -22642,7 +22642,7 @@ parameters: - message: "#^Cannot access offset 0 on array\\\\|bool\\|float\\|int\\|string\\.$#" - count: 2 + count: 1 path: src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsMainLocation.php - @@ -22702,7 +22702,7 @@ parameters: - message: "#^Cannot access offset 0 on array\\\\|bool\\|float\\|int\\|string\\.$#" - count: 2 + count: 1 path: src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Visibility.php - From 2e22cebee13794446744992a7d89b93c53c12075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?= Date: Tue, 19 Nov 2024 14:57:41 +0100 Subject: [PATCH 2/2] Fixed issues related to twig/twig 3.15 in tests --- phpstan-baseline.neon | 20 ----- .../Twig/Extension/ContentExtension.php | 44 +++-------- .../Extension/DataAttributesExtension.php | 17 +++-- .../Extension/DeprecationOptionsTrait.php | 46 ++++++++++++ .../Extension/FieldRenderingExtension.php | 28 ++++--- .../Twig/Extension/FileSizeExtension.php | 7 +- .../Twig/Extension/ImageExtension.php | 26 ++++--- .../Extension/QueryRenderingExtension.php | 24 +++--- .../Twig/Extension/RenderContentExtension.php | 13 ++-- .../Twig/Extension/RenderExtension.php | 13 ++-- .../Extension/RenderLocationExtension.php | 13 ++-- .../Twig/Extension/RoutingExtension.php | 29 ++++---- .../Extension/DataAttributesExtensionTest.php | 6 +- .../Twig/Extension/FileSizeExtensionTest.php | 11 +-- .../Twig/Extension/RoutingExtensionTest.php | 6 +- .../ez_data_attributes_serialize.test | 2 +- .../ibexa_data_attributes_serialize.test | 0 .../8.0/ez_data_attributes_serialize.test | 15 ++++ .../8.0/ibexa_data_attributes_serialize.test | 37 ++++++++++ .../ez_file_size/7.4/ez_file_size.test | 44 +++++++++++ .../{ => 7.4}/ibexa_file_size.test | 0 .../ez_file_size/8.0/ez_file_size.test | 44 +++++++++++ .../ez_file_size/8.0/ibexa_file_size.test | 65 ++++++++++++++++ .../functions/ez_file_size/ez_file_size.test | 44 ----------- .../routing_functions/{ => 7.4}/ez_path.test | 36 ++++----- .../routing_functions/{ => 7.4}/ez_route.test | 6 +- .../routing_functions/{ => 7.4}/ez_url.test | 36 ++++----- .../{ => 7.4}/ibexa_path.test | 0 .../{ => 7.4}/ibexa_route.test | 0 .../{ => 7.4}/ibexa_url.test | 0 .../routing_functions/8.0/ez_path.test | 74 +++++++++++++++++++ .../routing_functions/8.0/ez_route.test | 25 +++++++ .../routing_functions/8.0/ez_url.test | 74 +++++++++++++++++++ .../routing_functions/8.0/ibexa_path.test | 55 ++++++++++++++ .../routing_functions/8.0/ibexa_route.test | 21 ++++++ .../routing_functions/8.0/ibexa_url.test | 55 ++++++++++++++ 36 files changed, 719 insertions(+), 217 deletions(-) create mode 100644 src/lib/MVC/Symfony/Templating/Twig/Extension/DeprecationOptionsTrait.php rename tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/{ => 7.4}/ez_data_attributes_serialize.test (71%) rename tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/{ => 7.4}/ibexa_data_attributes_serialize.test (100%) create mode 100644 tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/8.0/ez_data_attributes_serialize.test create mode 100644 tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/8.0/ibexa_data_attributes_serialize.test create mode 100644 tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/7.4/ez_file_size.test rename tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/{ => 7.4}/ibexa_file_size.test (100%) create mode 100644 tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/8.0/ez_file_size.test create mode 100644 tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/8.0/ibexa_file_size.test delete mode 100644 tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/ez_file_size.test rename tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/{ => 7.4}/ez_path.test (57%) rename tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/{ => 7.4}/ez_route.test (61%) rename tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/{ => 7.4}/ez_url.test (57%) rename tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/{ => 7.4}/ibexa_path.test (100%) rename tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/{ => 7.4}/ibexa_route.test (100%) rename tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/{ => 7.4}/ibexa_url.test (100%) create mode 100644 tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ez_path.test create mode 100644 tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ez_route.test create mode 100644 tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ez_url.test create mode 100644 tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ibexa_path.test create mode 100644 tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ibexa_route.test create mode 100644 tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ibexa_url.test diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 4b3dee324b..64cf9f0188 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -12945,11 +12945,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\ContentExtension\\:\\:getFunctions\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\ContentExtension\\:\\:getTranslatedField\\(\\) should return Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Field but returns Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Field\\|null\\.$#" count: 1 @@ -12960,26 +12955,11 @@ parameters: count: 2 path: src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php - - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\ContentExtension\\:\\:\\$logger \\(Psr\\\\Log\\\\LoggerInterface\\) does not accept Psr\\\\Log\\\\LoggerInterface\\|null\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\CoreExtension\\:\\:getGlobals\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: src/lib/MVC/Symfony/Templating/Twig/Extension/CoreExtension.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\DataAttributesExtension\\:\\:getFilters\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtension.php - - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\DataAttributesExtension\\:\\:serializeDataAttributes\\(\\) has parameter \\$dataAttributes with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtension.php - - message: "#^Parameter \\#1 \\$string of function htmlspecialchars expects string, string\\|false given\\.$#" count: 1 diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php index 348a7cd7e4..578208acf0 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php @@ -16,6 +16,7 @@ use Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList; use Ibexa\Core\Helper\TranslationHelper; use Psr\Log\LoggerInterface; +use Psr\Log\NullLogger; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; @@ -25,6 +26,8 @@ */ class ContentExtension extends AbstractExtension { + use DeprecationOptionsTrait; + /** @var \Ibexa\Contracts\Core\Repository\Repository */ protected $repository; @@ -50,24 +53,19 @@ public function __construct( $this->translationHelper = $translationHelper; $this->fieldHelper = $fieldHelper; $this->fieldsGroupsList = $fieldsGroupsList; - $this->logger = $logger; + $this->logger = $logger ?? new NullLogger(); } /** * Returns a list of functions to add to the existing list. - * - * @return array */ - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction( 'ez_content_name', [$this, 'getTranslatedContentName'], - [ - 'deprecated' => '4.0', - 'alternative' => 'ibexa_content_name', - ] + $this->getDeprecationOptions('ibexa_content_name'), ), new TwigFunction( 'ibexa_content_name', @@ -76,10 +74,7 @@ public function getFunctions() new TwigFunction( 'ez_field_value', [$this, 'getTranslatedFieldValue'], - [ - 'deprecated' => '4.0', - 'alternative' => 'ibexa_field_value', - ] + $this->getDeprecationOptions('ibexa_field_value'), ), new TwigFunction( 'ibexa_field_value', @@ -88,10 +83,7 @@ public function getFunctions() new TwigFunction( 'ez_field', [$this, 'getTranslatedField'], - [ - 'deprecated' => '4.0', - 'alternative' => 'ibexa_field', - ] + $this->getDeprecationOptions('ibexa_field'), ), new TwigFunction( 'ibexa_field', @@ -100,10 +92,7 @@ public function getFunctions() new TwigFunction( 'ez_field_is_empty', [$this, 'isFieldEmpty'], - [ - 'deprecated' => '4.0', - 'alternative' => 'ibexa_field_is_empty', - ] + $this->getDeprecationOptions('ibexa_field_is_empty'), ), new TwigFunction( 'ibexa_has_field', @@ -116,10 +105,7 @@ public function getFunctions() new TwigFunction( 'ez_field_name', [$this, 'getTranslatedFieldDefinitionName'], - [ - 'deprecated' => '4.0', - 'alternative' => 'ibexa_field_name', - ] + $this->getDeprecationOptions('ibexa_field_name'), ), new TwigFunction( 'ibexa_field_name', @@ -128,10 +114,7 @@ public function getFunctions() new TwigFunction( 'ez_field_description', [$this, 'getTranslatedFieldDefinitionDescription'], - [ - 'deprecated' => '4.0', - 'alternative' => 'ibexa_field_description', - ] + $this->getDeprecationOptions('ibexa_field_description'), ), new TwigFunction( 'ibexa_field_description', @@ -144,10 +127,7 @@ public function getFunctions() new TwigFunction( 'ez_content_field_identifier_first_filled_image', [$this, 'getFirstFilledImageFieldIdentifier'], - [ - 'deprecated' => '4.0', - 'alternative' => 'ibexa_content_field_identifier_first_filled_image', - ] + $this->getDeprecationOptions('ibexa_content_field_identifier_first_filled_image'), ), new TwigFunction( 'ibexa_content_field_identifier_first_filled_image', diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtension.php index 4e6b1c170c..bef6946beb 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtension.php @@ -16,10 +16,10 @@ */ class DataAttributesExtension extends AbstractExtension { + use DeprecationOptionsTrait; + /** * Returns a list of functions to add to the existing list. - * - * @return array */ public function getFilters(): array { @@ -27,11 +27,12 @@ public function getFilters(): array new TwigFilter( 'ez_data_attributes_serialize', [$this, 'serializeDataAttributes'], - [ - 'is_safe' => ['html'], - 'deprecated' => '4.0', - 'alternative' => 'ibexa_data_attributes_serialize', - ] + array_merge( + [ + 'is_safe' => ['html'], + ], + $this->getDeprecationOptions('ibexa_data_attributes_serialize'), + ), ), new TwigFilter( 'ibexa_data_attributes_serialize', @@ -45,7 +46,7 @@ public function getFilters(): array * Processes an associative list of data attributes and returns them as HTML attributes list * in the form of data-="". * - * @param array $dataAttributes + * @param array $dataAttributes * * @return string */ diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/DeprecationOptionsTrait.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/DeprecationOptionsTrait.php new file mode 100644 index 0000000000..a7c4ca44df --- /dev/null +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/DeprecationOptionsTrait.php @@ -0,0 +1,46 @@ + new DeprecatedCallableInfo('ibexa/core', '4.0', $newFunction), + ]; + } + + // Compatibility with twig/twig prior to 3.15 + return [ + 'deprecated' => '4.0', + 'deprecating_package' => 'ibexa/core', + 'alternative' => $newFunction, + ]; + } +} diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtension.php index a63c6f8e1b..8a5767b3cb 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtension.php @@ -22,6 +22,8 @@ */ class FieldRenderingExtension extends AbstractExtension { + use DeprecationOptionsTrait; + /** @var \Ibexa\Core\MVC\Symfony\Templating\FieldBlockRendererInterface */ private $fieldBlockRenderer; @@ -66,12 +68,13 @@ public function getFunctions() new TwigFunction( 'ez_render_field', $renderFieldCallable, - [ - 'is_safe' => ['html'], - 'needs_environment' => true, - 'deprecated' => '4.0', - 'alternative' => 'ibexa_render_field', - ] + array_merge( + [ + 'is_safe' => ['html'], + 'needs_environment' => true, + ], + $this->getDeprecationOptions('ibexa_render_field'), + ), ), new TwigFunction( 'ibexa_render_field', @@ -81,12 +84,13 @@ public function getFunctions() new TwigFunction( 'ez_render_field_definition_settings', $renderFieldDefinitionSettingsCallable, - [ - 'is_safe' => ['html'], - 'needs_environment' => true, - 'deprecated' => '4.0', - 'alternative' => 'ibexa_render_field_definition_settings', - ] + array_merge( + [ + 'is_safe' => ['html'], + 'needs_environment' => true, + ], + $this->getDeprecationOptions('ibexa_render_field_definition_settings'), + ), ), new TwigFunction( 'ibexa_render_field_definition_settings', diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php index 9c0d700ec7..8198e60095 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php @@ -20,6 +20,8 @@ */ class FileSizeExtension extends AbstractExtension { + use DeprecationOptionsTrait; + /** * @param \Symfony\Contracts\Translation\TranslatorInterface $translator */ @@ -77,10 +79,7 @@ public function getFilters() new TwigFilter( 'ez_file_size', [$this, 'sizeFilter'], - [ - 'deprecated' => '4.0', - 'alternative' => 'ibexa_file_size', - ] + $this->getDeprecationOptions('ibexa_file_size'), ), new TwigFilter( 'ibexa_file_size', diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/ImageExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/ImageExtension.php index 0a85394329..c77507c52c 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/ImageExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/ImageExtension.php @@ -18,6 +18,8 @@ class ImageExtension extends AbstractExtension { + use DeprecationOptionsTrait; + /** @var \Ibexa\Contracts\Core\Variation\VariationHandler */ private $imageVariationService; @@ -30,17 +32,18 @@ public function __construct(VariationHandler $imageVariationService, AssetMapper $this->assetMapper = $assetMapper; } - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction( 'ez_image_alias', [$this, 'getImageVariation'], - [ - 'is_safe' => ['html'], - 'deprecated' => '4.0', - 'alternative' => 'ibexa_image_alias', - ] + array_merge( + [ + 'is_safe' => ['html'], + ], + $this->getDeprecationOptions('ibexa_image_alias'), + ), ), new TwigFunction( 'ibexa_image_alias', @@ -50,11 +53,12 @@ public function getFunctions() new TwigFunction( 'ez_content_field_identifier_image_asset', [$this, 'getImageAssetContentFieldIdentifier'], - [ - 'is_safe' => ['html'], - 'deprecated' => '4.0', - 'alternative' => 'ibexa_content_field_identifier_image_asset', - ] + array_merge( + [ + 'is_safe' => ['html'], + ], + $this->getDeprecationOptions('ibexa_content_field_identifier_image_asset'), + ), ), new TwigFunction( 'ibexa_content_field_identifier_image_asset', diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/QueryRenderingExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/QueryRenderingExtension.php index 989fdb568c..7695463533 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/QueryRenderingExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/QueryRenderingExtension.php @@ -16,6 +16,8 @@ class QueryRenderingExtension extends AbstractExtension { + use DeprecationOptionsTrait; + private const VALID_TYPES = ['content', 'location']; /** @var \Symfony\Component\HttpKernel\Fragment\FragmentHandler */ @@ -49,11 +51,12 @@ public function getFunctions(): array new TwigFunction( 'ez_render_*_query', $typeCallable, - [ - 'is_safe' => ['html'], - 'deprecated' => '4.0', - 'alternative' => 'ibexa_render_*_query', - ] + array_merge( + [ + 'is_safe' => ['html'], + ], + $this->getDeprecationOptions('ibexa_render_*_query'), + ), ), new TwigFunction( 'ibexa_render_*_query', @@ -63,11 +66,12 @@ public function getFunctions(): array new TwigFunction( 'ez_render_*_query_*', $typeAndRendererCallable, - [ - 'is_safe' => ['html'], - 'deprecated' => '4.0', - 'alternative' => 'ibexa_render_*_query_', - ] + array_merge( + [ + 'is_safe' => ['html'], + ], + $this->getDeprecationOptions('ibexa_render_*_query_*'), + ), ), new TwigFunction( 'ibexa_render_*_query_*', diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderContentExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderContentExtension.php index 9fa3ebaf9f..29143878bb 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderContentExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderContentExtension.php @@ -21,6 +21,8 @@ */ final class RenderContentExtension extends AbstractExtension { + use DeprecationOptionsTrait; + /** @var \Ibexa\Core\MVC\Symfony\Templating\RenderContentStrategy */ private $renderContentStrategy; @@ -41,11 +43,12 @@ public function getFunctions(): array new TwigFunction( 'ez_render_content', [$this, 'renderContent'], - [ - 'is_safe' => ['html'], - 'deprecated' => '4.0', - 'alternative' => 'ibexa_render_content', - ] + array_merge( + [ + 'is_safe' => ['html'], + ], + $this->getDeprecationOptions('ibexa_render_content'), + ), ), new TwigFunction( 'ibexa_render_content', diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderExtension.php index c441f8b13c..677b361594 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderExtension.php @@ -22,6 +22,8 @@ */ final class RenderExtension extends AbstractExtension { + use DeprecationOptionsTrait; + /** @var \Ibexa\Contracts\Core\MVC\Templating\RenderStrategy */ private $renderStrategy; @@ -42,11 +44,12 @@ public function getFunctions(): array new TwigFunction( 'ez_render', [$this, 'render'], - [ - 'is_safe' => ['html'], - 'deprecated' => '4.0', - 'alternative' => 'ibexa_render', - ] + array_merge( + [ + 'is_safe' => ['html'], + ], + $this->getDeprecationOptions('ibexa_render'), + ), ), new TwigFunction( 'ibexa_render', diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderLocationExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderLocationExtension.php index ef7f24cd4b..3bcb835bec 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderLocationExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderLocationExtension.php @@ -21,6 +21,8 @@ */ final class RenderLocationExtension extends AbstractExtension { + use DeprecationOptionsTrait; + /** @var \Ibexa\Core\MVC\Symfony\Templating\RenderLocationStrategy */ private $renderLocationStrategy; @@ -41,11 +43,12 @@ public function getFunctions(): array new TwigFunction( 'ez_render_location', [$this, 'renderLocation'], - [ - 'is_safe' => ['html'], - 'deprecated' => '4.0', - 'alternative' => 'ibexa_render_location', - ] + array_merge( + [ + 'is_safe' => ['html'], + ], + $this->getDeprecationOptions('ibexa_render_location'), + ), ), new TwigFunction( 'ibexa_render_location', diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/RoutingExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/RoutingExtension.php index ac5f0dfffd..475e70bfc7 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/RoutingExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/RoutingExtension.php @@ -26,6 +26,8 @@ class RoutingExtension extends AbstractExtension { + use DeprecationOptionsTrait; + /** @var \Ibexa\Core\MVC\Symfony\Routing\Generator\RouteReferenceGeneratorInterface */ private $routeReferenceGenerator; @@ -46,10 +48,7 @@ public function getFunctions(): array new TwigFunction( 'ez_route', [$this, 'getRouteReference'], - [ - 'deprecated' => '4.0', - 'alternative' => 'ibexa_route', - ] + $this->getDeprecationOptions('ibexa_route'), ), new TwigFunction( 'ibexa_route', @@ -58,11 +57,12 @@ public function getFunctions(): array new TwigFunction( 'ez_path', [$this, 'getPath'], - [ - 'is_safe_callback' => [$this, 'isUrlGenerationSafe'], - 'deprecated' => '4.0', - 'alternative' => 'ibexa_path', - ] + array_merge( + [ + 'is_safe_callback' => [$this, 'isUrlGenerationSafe'], + ], + $this->getDeprecationOptions('ibexa_path'), + ), ), new TwigFunction( 'ibexa_path', @@ -74,11 +74,12 @@ public function getFunctions(): array new TwigFunction( 'ez_url', [$this, 'getUrl'], - [ - 'is_safe_callback' => [$this, 'isUrlGenerationSafe'], - 'deprecated' => '4.0', - 'alternative' => 'ibexa_url', - ] + array_merge( + [ + 'is_safe_callback' => [$this, 'isUrlGenerationSafe'], + ], + $this->getDeprecationOptions('ibexa_url'), + ), ), new TwigFunction( 'ibexa_url', diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtensionTest.php b/tests/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtensionTest.php index 6311fdaf57..95fc219d96 100644 --- a/tests/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtensionTest.php +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtensionTest.php @@ -22,7 +22,11 @@ public function getExtensions(): array protected function getFixturesDir(): string { - return __DIR__ . '/_fixtures/filters'; + if (\PHP_VERSION_ID < 8_00_00) { + return __DIR__ . '/_fixtures/filters/7.4'; + } + + return __DIR__ . '/_fixtures/filters/8.0'; } } diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtensionTest.php b/tests/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtensionTest.php index b526e49d6f..4506cd4970 100644 --- a/tests/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtensionTest.php +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtensionTest.php @@ -70,12 +70,13 @@ protected function getExtensions() ]; } - /** - * @return string - */ - protected function getFixturesDir() + protected function getFixturesDir(): string { - return __DIR__ . '/_fixtures/functions/ez_file_size'; + if (\PHP_VERSION_ID < 8_00_00) { + return __DIR__ . '/_fixtures/functions/ez_file_size/7.4'; + } + + return __DIR__ . '/_fixtures/functions/ez_file_size/8.0'; } /** diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/RoutingExtensionTest.php b/tests/lib/MVC/Symfony/Templating/Twig/Extension/RoutingExtensionTest.php index a5b6324f71..164f750200 100644 --- a/tests/lib/MVC/Symfony/Templating/Twig/Extension/RoutingExtensionTest.php +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/RoutingExtensionTest.php @@ -40,7 +40,11 @@ protected function getExtensions(): array protected function getFixturesDir(): string { - return __DIR__ . '/_fixtures/routing_functions'; + if (\PHP_VERSION_ID < 8_00_00) { + return __DIR__ . '/_fixtures/routing_functions/7.4'; + } + + return __DIR__ . '/_fixtures/routing_functions/8.0'; } protected function getExampleContent(int $id): APIContent diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/ez_data_attributes_serialize.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/7.4/ez_data_attributes_serialize.test similarity index 71% rename from tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/ez_data_attributes_serialize.test rename to tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/7.4/ez_data_attributes_serialize.test index ec2eefd0f6..4b8b69ec7e 100644 --- a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/ez_data_attributes_serialize.test +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/7.4/ez_data_attributes_serialize.test @@ -1,7 +1,7 @@ --TEST-- "ez_data_attributes_serialize" filter --DEPRECATION-- -Since 4.0: Twig Filter "ez_data_attributes_serialize" is deprecated. Use "ibexa_data_attributes_serialize" instead in index.twig at line 2. +Since ibexa/core 4.0: Twig Filter "ez_data_attributes_serialize" is deprecated. Use "ibexa_data_attributes_serialize" instead in index.twig at line 2. --TEMPLATE-- Article --DATA-- diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/ibexa_data_attributes_serialize.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/7.4/ibexa_data_attributes_serialize.test similarity index 100% rename from tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/ibexa_data_attributes_serialize.test rename to tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/7.4/ibexa_data_attributes_serialize.test diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/8.0/ez_data_attributes_serialize.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/8.0/ez_data_attributes_serialize.test new file mode 100644 index 0000000000..89b44c15db --- /dev/null +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/8.0/ez_data_attributes_serialize.test @@ -0,0 +1,15 @@ +--TEST-- +"ez_data_attributes_serialize" filter +--DEPRECATION-- +Since ibexa/core 4.0: Twig Filter "ez_data_attributes_serialize" is deprecated; use "ibexa_data_attributes_serialize" instead in index.twig at line 2. +--TEMPLATE-- +Article +--DATA-- +return [ + 'data_attributes' => [ + 'my-attr1' => 'value1', + 'my-attr2' => 'value2,value3', + ] +]; +--EXPECT-- +Article diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/8.0/ibexa_data_attributes_serialize.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/8.0/ibexa_data_attributes_serialize.test new file mode 100644 index 0000000000..6681e0066d --- /dev/null +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/filters/8.0/ibexa_data_attributes_serialize.test @@ -0,0 +1,37 @@ +--TEST-- +"ibexa_data_attributes_serialize" filter +--TEMPLATE-- +Article +--DATA-- +return [ + 'data_attributes' => [ + 'my-attr1' => 'value1', + 'my-attr2' => 'value2,value3', + ] +]; +--EXPECT-- +Article +--DATA-- +return [ + 'data_attributes' => [ + 'attr' => 'foo" style="background: red', + ] +]; +--EXPECT-- +Article +--DATA-- +return [ + 'data_attributes' => [ + 'attr' => true, + ] +]; +--EXPECT-- +Article +--DATA-- +return [ + 'data_attributes' => [ + 'attr' => ['key1' => 'value1', 'key2' => 'value2'], + ] +]; +--EXPECT-- +Article diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/7.4/ez_file_size.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/7.4/ez_file_size.test new file mode 100644 index 0000000000..2c41efd928 --- /dev/null +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/7.4/ez_file_size.test @@ -0,0 +1,44 @@ +--TEST-- +"twig" filter +--DEPRECATION-- +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 2. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 3. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 4. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 5. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 6. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 7. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 8. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 9. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 10. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 11. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 12. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 13. +--TEMPLATE-- +{{ 10|ez_file_size( 2 ) }} +{{ 1024|ez_file_size( 0 ) }} +{{ 5120|ez_file_size( 3 ) }} +{{ 12288|ez_file_size( 1 ) }} +{{ 155648|ez_file_size( 0 ) }} +{{ 27421583|ez_file_size( 5 ) }} +{{ 129103927|ez_file_size( 4 ) }} +{{ 490163142656|ez_file_size( 1 ) }} +{{ 868383057603765|ez_file_size( 6 ) }} +{{ 889224250749591400|ez_file_size( 10 ) }} +{{ 910565875123441600000|ez_file_size( 2 ) }} +{{ 910565632767581700000000000|ez_file_size( 4 ) }} +--DATA-- +$this->setConfigurationLocale( array( 'wrong local' ), 'eng-GB' ); +return array() +--EXPECT-- +10 B wrong local so we take the default one which is en-GB here +1 kB wrong local so we take the default one which is en-GB here +5 kB wrong local so we take the default one which is en-GB here +12 kB wrong local so we take the default one which is en-GB here +152 kB wrong local so we take the default one which is en-GB here +26.15126 MB wrong local so we take the default one which is en-GB here +123.1231 MB wrong local so we take the default one which is en-GB here +456.5 GB wrong local so we take the default one which is en-GB here +789.78979 TB wrong local so we take the default one which is en-GB here +789.7897897898 PB wrong local so we take the default one which is en-GB here +789.79 EB wrong local so we take the default one which is en-GB here +789789789.7898 EB wrong local so we take the default one which is en-GB here diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/ibexa_file_size.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/7.4/ibexa_file_size.test similarity index 100% rename from tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/ibexa_file_size.test rename to tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/7.4/ibexa_file_size.test diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/8.0/ez_file_size.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/8.0/ez_file_size.test new file mode 100644 index 0000000000..a431ea5548 --- /dev/null +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/8.0/ez_file_size.test @@ -0,0 +1,44 @@ +--TEST-- +"twig" filter +--DEPRECATION-- +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated; use "ibexa_file_size" instead in index.twig at line 2. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated; use "ibexa_file_size" instead in index.twig at line 3. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated; use "ibexa_file_size" instead in index.twig at line 4. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated; use "ibexa_file_size" instead in index.twig at line 5. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated; use "ibexa_file_size" instead in index.twig at line 6. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated; use "ibexa_file_size" instead in index.twig at line 7. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated; use "ibexa_file_size" instead in index.twig at line 8. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated; use "ibexa_file_size" instead in index.twig at line 9. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated; use "ibexa_file_size" instead in index.twig at line 10. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated; use "ibexa_file_size" instead in index.twig at line 11. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated; use "ibexa_file_size" instead in index.twig at line 12. +Since ibexa/core 4.0: Twig Filter "ez_file_size" is deprecated; use "ibexa_file_size" instead in index.twig at line 13. +--TEMPLATE-- +{{ 10|ez_file_size( 2 ) }} +{{ 1024|ez_file_size( 0 ) }} +{{ 5120|ez_file_size( 3 ) }} +{{ 12288|ez_file_size( 1 ) }} +{{ 155648|ez_file_size( 0 ) }} +{{ 27421583|ez_file_size( 5 ) }} +{{ 129103927|ez_file_size( 4 ) }} +{{ 490163142656|ez_file_size( 1 ) }} +{{ 868383057603765|ez_file_size( 6 ) }} +{{ 889224250749591400|ez_file_size( 10 ) }} +{{ 910565875123441600000|ez_file_size( 2 ) }} +{{ 910565632767581700000000000|ez_file_size( 4 ) }} +--DATA-- +$this->setConfigurationLocale( array( 'wrong local' ), 'eng-GB' ); +return array() +--EXPECT-- +10 B wrong local so we take the default one which is en-GB here +1 kB wrong local so we take the default one which is en-GB here +5 kB wrong local so we take the default one which is en-GB here +12 kB wrong local so we take the default one which is en-GB here +152 kB wrong local so we take the default one which is en-GB here +26.15126 MB wrong local so we take the default one which is en-GB here +123.1231 MB wrong local so we take the default one which is en-GB here +456.5 GB wrong local so we take the default one which is en-GB here +789.78979 TB wrong local so we take the default one which is en-GB here +789.7897897898 PB wrong local so we take the default one which is en-GB here +789.79 EB wrong local so we take the default one which is en-GB here +789789789.7898 EB wrong local so we take the default one which is en-GB here diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/8.0/ibexa_file_size.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/8.0/ibexa_file_size.test new file mode 100644 index 0000000000..e8000014ec --- /dev/null +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/8.0/ibexa_file_size.test @@ -0,0 +1,65 @@ +--TEST-- +"twig" filter +--TEMPLATE-- +{{ 10|ibexa_file_size( 2 ) }} +{{ 1024|ibexa_file_size( 0 ) }} +{{ 5120|ibexa_file_size( 3 ) }} +{{ 12288|ibexa_file_size( 1 ) }} +{{ 155648|ibexa_file_size( 0 ) }} +{{ 27421583|ibexa_file_size( 5 ) }} +{{ 129103927|ibexa_file_size( 4 ) }} +{{ 490163142656|ibexa_file_size( 1 ) }} +{{ 868383057603765|ibexa_file_size( 6 ) }} +{{ 889224250749591400|ibexa_file_size( 10 ) }} +{{ 910565875123441600000|ibexa_file_size( 2 ) }} +{{ 910565632767581700000000000|ibexa_file_size( 4 ) }} +--DATA-- +$this->setConfigurationLocale( array( 'wrong local' ), 'eng-GB' ); +return array() +--EXPECT-- +10 B wrong local so we take the default one which is en-GB here +1 kB wrong local so we take the default one which is en-GB here +5 kB wrong local so we take the default one which is en-GB here +12 kB wrong local so we take the default one which is en-GB here +152 kB wrong local so we take the default one which is en-GB here +26.15126 MB wrong local so we take the default one which is en-GB here +123.1231 MB wrong local so we take the default one which is en-GB here +456.5 GB wrong local so we take the default one which is en-GB here +789.78979 TB wrong local so we take the default one which is en-GB here +789.7897897898 PB wrong local so we take the default one which is en-GB here +789.79 EB wrong local so we take the default one which is en-GB here +789789789.7898 EB wrong local so we take the default one which is en-GB here +--DATA-- +return array() +--CONFIG-- +$this->locale = "fre-FR"; return array(); +--EXPECT-- +10 B French version +1 kB French version +5 kB French version +12 kB French version +152 kB French version +26,15126 MB French version +123,1231 MB French version +456,5 GB French version +789,78979 TB French version +789,7897897898 PB French version +789,79 EB French version +789789789,7898 EB French version +--DATA-- +return array() +--CONFIG-- +$this->locale = "eng-GB"; return array(); +--EXPECT-- +10 B English version +1 kB English version +5 kB English version +12 kB English version +152 kB English version +26.15126 MB English version +123.1231 MB English version +456.5 GB English version +789.78979 TB English version +789.7897897898 PB English version +789.79 EB English version +789789789.7898 EB English version diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/ez_file_size.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/ez_file_size.test deleted file mode 100644 index 726e6b2c7c..0000000000 --- a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/functions/ez_file_size/ez_file_size.test +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -"twig" filter ---DEPRECATION-- -Since 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 2. -Since 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 3. -Since 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 4. -Since 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 5. -Since 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 6. -Since 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 7. -Since 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 8. -Since 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 9. -Since 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 10. -Since 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 11. -Since 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 12. -Since 4.0: Twig Filter "ez_file_size" is deprecated. Use "ibexa_file_size" instead in index.twig at line 13. ---TEMPLATE-- -{{ 10|ez_file_size( 2 ) }} -{{ 1024|ez_file_size( 0 ) }} -{{ 5120|ez_file_size( 3 ) }} -{{ 12288|ez_file_size( 1 ) }} -{{ 155648|ez_file_size( 0 ) }} -{{ 27421583|ez_file_size( 5 ) }} -{{ 129103927|ez_file_size( 4 ) }} -{{ 490163142656|ez_file_size( 1 ) }} -{{ 868383057603765|ez_file_size( 6 ) }} -{{ 889224250749591400|ez_file_size( 10 ) }} -{{ 910565875123441600000|ez_file_size( 2 ) }} -{{ 910565632767581700000000000|ez_file_size( 4 ) }} ---DATA-- -$this->setConfigurationLocale( array( 'wrong local' ), 'eng-GB' ); -return array() ---EXPECT-- -10 B wrong local so we take the default one which is en-GB here -1 kB wrong local so we take the default one which is en-GB here -5 kB wrong local so we take the default one which is en-GB here -12 kB wrong local so we take the default one which is en-GB here -152 kB wrong local so we take the default one which is en-GB here -26.15126 MB wrong local so we take the default one which is en-GB here -123.1231 MB wrong local so we take the default one which is en-GB here -456.5 GB wrong local so we take the default one which is en-GB here -789.78979 TB wrong local so we take the default one which is en-GB here -789.7897897898 PB wrong local so we take the default one which is en-GB here -789.79 EB wrong local so we take the default one which is en-GB here -789789789.7898 EB wrong local so we take the default one which is en-GB here diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ez_path.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ez_path.test similarity index 57% rename from tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ez_path.test rename to tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ez_path.test index 3a26493fc4..3f14a34393 100644 --- a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ez_path.test +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ez_path.test @@ -1,24 +1,24 @@ --TEST-- "ez_path" function --DEPRECATION-- -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 2. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 3. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 4. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 5. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 6. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 7. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 8. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 9. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 10. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 11. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 12. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 13. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 14. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 15. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 16. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 17. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 18. -Since 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 19. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 2. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 3. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 4. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 5. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 6. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 7. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 8. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 9. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 10. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 11. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 12. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 13. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 14. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 15. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 16. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 17. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 18. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated. Use "ibexa_path" instead in index.twig at line 19. --TEMPLATE-- {{ ez_path(location) }} {{ ez_path(location, {}, true) }} diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ez_route.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ez_route.test similarity index 61% rename from tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ez_route.test rename to tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ez_route.test index 084741ded6..107dba20c5 100644 --- a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ez_route.test +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ez_route.test @@ -1,9 +1,9 @@ --TEST-- "twig" filter --DEPRECATION-- -Since 4.0: Twig Function "ez_route" is deprecated. Use "ibexa_route" instead in index.twig at line 2. -Since 4.0: Twig Function "ez_route" is deprecated. Use "ibexa_route" instead in index.twig at line 3. -Since 4.0: Twig Function "ez_route" is deprecated. Use "ibexa_route" instead in index.twig at line 4. +Since ibexa/core 4.0: Twig Function "ez_route" is deprecated. Use "ibexa_route" instead in index.twig at line 2. +Since ibexa/core 4.0: Twig Function "ez_route" is deprecated. Use "ibexa_route" instead in index.twig at line 3. +Since ibexa/core 4.0: Twig Function "ez_route" is deprecated. Use "ibexa_route" instead in index.twig at line 4. --TEMPLATE-- {% set route_ref1 = ez_route( "foo_route" ) %} {% set route_ref2 = ez_route( "bar_route", {"some": "thing"} ) %} diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ez_url.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ez_url.test similarity index 57% rename from tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ez_url.test rename to tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ez_url.test index b63e601cb6..9444e6b7d2 100644 --- a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ez_url.test +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ez_url.test @@ -1,24 +1,24 @@ --TEST-- "ez_url" function --DEPRECATION-- -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 2. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 3. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 4. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 5. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 6. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 7. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 8. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 9. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 10. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 11. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 12. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 13. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 14. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 15. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 16. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 17. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 18. -Since 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 19. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 2. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 3. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 4. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 5. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 6. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 7. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 8. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 9. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 10. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 11. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 12. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 13. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 14. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 15. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 16. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 17. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 18. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated. Use "ibexa_url" instead in index.twig at line 19. --TEMPLATE-- {{ ez_url(location) }} {{ ez_url(location, {}, true) }} diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ibexa_path.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ibexa_path.test similarity index 100% rename from tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ibexa_path.test rename to tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ibexa_path.test diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ibexa_route.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ibexa_route.test similarity index 100% rename from tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ibexa_route.test rename to tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ibexa_route.test diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ibexa_url.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ibexa_url.test similarity index 100% rename from tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/ibexa_url.test rename to tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/7.4/ibexa_url.test diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ez_path.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ez_path.test new file mode 100644 index 0000000000..bc848e675a --- /dev/null +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ez_path.test @@ -0,0 +1,74 @@ +--TEST-- +"ez_path" function +--DEPRECATION-- +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 2. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 3. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 4. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 5. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 6. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 7. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 8. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 9. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 10. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 11. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 12. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 13. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 14. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 15. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 16. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 17. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 18. +Since ibexa/core 4.0: Twig Function "ez_path" is deprecated; use "ibexa_path" instead in index.twig at line 19. +--TEMPLATE-- +{{ ez_path(location) }} +{{ ez_path(location, {}, true) }} +{{ ez_path(location, {'foo': 'foo'}) }} +{{ ez_path(content) }} +{{ ez_path(content, {}, true) }} +{{ ez_path(content, {'foo': 'foo'}) }} +{{ ez_path(content_info) }} +{{ ez_path(content_info, {}, true) }} +{{ ez_path(content_info, {'foo': 'foo'}) }} +{{ ez_path(content_aware) }} +{{ ez_path(content_aware, {}, true) }} +{{ ez_path(content_aware, {'foo': 'foo'}) }} +{{ ez_path(route_ref) }} +{{ ez_path(route_ref, {}, true) }} +{{ ez_path(route_ref, {'baz': 'baz'}) }} +{{ ez_path(unsupported_object) }} +{{ ez_path(unsupported_object, {}, true) }} +{{ ez_path(unsupported_object, {'baz': 'baz'}) }} +--DATA-- +return [ + 'location' => $this->getExampleLocation(54), + 'content' => $this->getExampleContent(2), + 'content_info' => $this->getExampleContentInfo(2), + 'content_aware' => $this->getExampleContentAware(64), + 'route_ref' => $this->getExampleRouteReference( + 'example_route', + [ + 'foo' => 'foo', + 'bar' => 'bar' + ] + ), + 'unsupported_object' => $this->getExampleUnsupportedObject(), +]; +--EXPECT-- +{"$name":"ibexa.url.alias","$parameters":{"locationId":54},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"locationId":54},"$referenceType":2} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","locationId":54},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":2} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","contentId":2},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":2} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","contentId":2},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"contentId":64},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"contentId":64},"$referenceType":2} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","contentId":64},"$referenceType":1} +{"$name":"example_route","$parameters":{"foo":"foo","bar":"bar"},"$referenceType":1} +{"$name":"example_route","$parameters":{"foo":"foo","bar":"bar"},"$referenceType":2} +{"$name":"example_route","$parameters":{"baz":"baz","foo":"foo","bar":"bar"},"$referenceType":1} +{"$name":"","$parameters":{"_route_object":{"foo":"foo","bar":"bar"}},"$referenceType":1} +{"$name":"","$parameters":{"_route_object":{"foo":"foo","bar":"bar"}},"$referenceType":2} +{"$name":"","$parameters":{"baz":"baz","_route_object":{"foo":"foo","bar":"bar"}},"$referenceType":1} diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ez_route.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ez_route.test new file mode 100644 index 0000000000..c264f86f9f --- /dev/null +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ez_route.test @@ -0,0 +1,25 @@ +--TEST-- +"twig" filter +--DEPRECATION-- +Since ibexa/core 4.0: Twig Function "ez_route" is deprecated; use "ibexa_route" instead in index.twig at line 2. +Since ibexa/core 4.0: Twig Function "ez_route" is deprecated; use "ibexa_route" instead in index.twig at line 3. +Since ibexa/core 4.0: Twig Function "ez_route" is deprecated; use "ibexa_route" instead in index.twig at line 4. +--TEMPLATE-- +{% set route_ref1 = ez_route( "foo_route" ) %} +{% set route_ref2 = ez_route( "bar_route", {"some": "thing"} ) %} +{% set route_ref3 = ez_route( "route_66", {"direction": "highway to hell"} ) %} +{{ route_ref1.route }} +{{ route_ref1.get( "param", "test" ) }} +{{ route_ref2.route }} +{{ route_ref2.get( "some" ) }} +{{ route_ref3.route }} +{{ route_ref3.get( "direction", "highway to hell" ) }} +--DATA-- +return array(); +--EXPECT-- +foo_route +test +bar_route +thing +route_66 +highway to hell diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ez_url.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ez_url.test new file mode 100644 index 0000000000..3dd6fdabbb --- /dev/null +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ez_url.test @@ -0,0 +1,74 @@ +--TEST-- +"ez_url" function +--DEPRECATION-- +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 2. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 3. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 4. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 5. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 6. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 7. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 8. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 9. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 10. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 11. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 12. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 13. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 14. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 15. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 16. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 17. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 18. +Since ibexa/core 4.0: Twig Function "ez_url" is deprecated; use "ibexa_url" instead in index.twig at line 19. +--TEMPLATE-- +{{ ez_url(location) }} +{{ ez_url(location, {}, true) }} +{{ ez_url(location, {'foo': 'foo'}) }} +{{ ez_url(content) }} +{{ ez_url(content, {}, true) }} +{{ ez_url(content, {'foo': 'foo'}) }} +{{ ez_url(content_info) }} +{{ ez_url(content_info, {}, true) }} +{{ ez_url(content_info, {'foo': 'foo'}) }} +{{ ez_url(content_aware) }} +{{ ez_url(content_aware, {}, true) }} +{{ ez_url(content_aware, {'foo': 'foo'}) }} +{{ ez_url(route_ref) }} +{{ ez_url(route_ref, {}, true) }} +{{ ez_url(route_ref, {'baz': 'baz'}) }} +{{ ez_url(unsupported_object) }} +{{ ez_url(unsupported_object, {}, true) }} +{{ ez_url(unsupported_object, {'baz': 'baz'}) }} +--DATA-- +return [ + 'location' => $this->getExampleLocation(54), + 'content' => $this->getExampleContent(2), + 'content_info' => $this->getExampleContentInfo(2), + 'content_aware' => $this->getExampleContentAware(64), + 'route_ref' => $this->getExampleRouteReference( + 'example_route', + [ + 'foo' => 'foo', + 'bar' => 'bar' + ] + ), + 'unsupported_object' => $this->getExampleUnsupportedObject(), +]; +--EXPECT-- +{"$name":"ibexa.url.alias","$parameters":{"locationId":54},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"locationId":54},"$referenceType":3} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","locationId":54},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":3} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","contentId":2},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":3} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","contentId":2},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"contentId":64},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"contentId":64},"$referenceType":3} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","contentId":64},"$referenceType":0} +{"$name":"example_route","$parameters":{"foo":"foo","bar":"bar"},"$referenceType":0} +{"$name":"example_route","$parameters":{"foo":"foo","bar":"bar"},"$referenceType":3} +{"$name":"example_route","$parameters":{"baz":"baz","foo":"foo","bar":"bar"},"$referenceType":0} +{"$name":"","$parameters":{"_route_object":{"foo":"foo","bar":"bar"}},"$referenceType":0} +{"$name":"","$parameters":{"_route_object":{"foo":"foo","bar":"bar"}},"$referenceType":3} +{"$name":"","$parameters":{"baz":"baz","_route_object":{"foo":"foo","bar":"bar"}},"$referenceType":0} diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ibexa_path.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ibexa_path.test new file mode 100644 index 0000000000..c23a9a9676 --- /dev/null +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ibexa_path.test @@ -0,0 +1,55 @@ +--TEST-- +"ibexa_path" function +--TEMPLATE-- +{{ ibexa_path(location) }} +{{ ibexa_path(location, {}, true) }} +{{ ibexa_path(location, {'foo': 'foo'}) }} +{{ ibexa_path(content) }} +{{ ibexa_path(content, {}, true) }} +{{ ibexa_path(content, {'foo': 'foo'}) }} +{{ ibexa_path(content_info) }} +{{ ibexa_path(content_info, {}, true) }} +{{ ibexa_path(content_info, {'foo': 'foo'}) }} +{{ ibexa_path(content_aware) }} +{{ ibexa_path(content_aware, {}, true) }} +{{ ibexa_path(content_aware, {'foo': 'foo'}) }} +{{ ibexa_path(route_ref) }} +{{ ibexa_path(route_ref, {}, true) }} +{{ ibexa_path(route_ref, {'baz': 'baz'}) }} +{{ ibexa_path(unsupported_object) }} +{{ ibexa_path(unsupported_object, {}, true) }} +{{ ibexa_path(unsupported_object, {'baz': 'baz'}) }} +--DATA-- +return [ + 'location' => $this->getExampleLocation(54), + 'content' => $this->getExampleContent(2), + 'content_info' => $this->getExampleContentInfo(2), + 'content_aware' => $this->getExampleContentAware(64), + 'route_ref' => $this->getExampleRouteReference( + 'example_route', + [ + 'foo' => 'foo', + 'bar' => 'bar' + ] + ), + 'unsupported_object' => $this->getExampleUnsupportedObject(), +]; +--EXPECT-- +{"$name":"ibexa.url.alias","$parameters":{"locationId":54},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"locationId":54},"$referenceType":2} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","locationId":54},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":2} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","contentId":2},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":2} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","contentId":2},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"contentId":64},"$referenceType":1} +{"$name":"ibexa.url.alias","$parameters":{"contentId":64},"$referenceType":2} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","contentId":64},"$referenceType":1} +{"$name":"example_route","$parameters":{"foo":"foo","bar":"bar"},"$referenceType":1} +{"$name":"example_route","$parameters":{"foo":"foo","bar":"bar"},"$referenceType":2} +{"$name":"example_route","$parameters":{"baz":"baz","foo":"foo","bar":"bar"},"$referenceType":1} +{"$name":"","$parameters":{"_route_object":{"foo":"foo","bar":"bar"}},"$referenceType":1} +{"$name":"","$parameters":{"_route_object":{"foo":"foo","bar":"bar"}},"$referenceType":2} +{"$name":"","$parameters":{"baz":"baz","_route_object":{"foo":"foo","bar":"bar"}},"$referenceType":1} diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ibexa_route.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ibexa_route.test new file mode 100644 index 0000000000..f03cc5af17 --- /dev/null +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ibexa_route.test @@ -0,0 +1,21 @@ +--TEST-- +"twig" filter +--TEMPLATE-- +{% set route_ref1 = ibexa_route( "foo_route" ) %} +{% set route_ref2 = ibexa_route( "bar_route", {"some": "thing"} ) %} +{% set route_ref3 = ibexa_route( "route_66", {"direction": "highway to hell"} ) %} +{{ route_ref1.route }} +{{ route_ref1.get( "param", "test" ) }} +{{ route_ref2.route }} +{{ route_ref2.get( "some" ) }} +{{ route_ref3.route }} +{{ route_ref3.get( "direction", "highway to hell" ) }} +--DATA-- +return array(); +--EXPECT-- +foo_route +test +bar_route +thing +route_66 +highway to hell diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ibexa_url.test b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ibexa_url.test new file mode 100644 index 0000000000..f737c8d3ab --- /dev/null +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/_fixtures/routing_functions/8.0/ibexa_url.test @@ -0,0 +1,55 @@ +--TEST-- +"ibexa_url" function +--TEMPLATE-- +{{ ibexa_url(location) }} +{{ ibexa_url(location, {}, true) }} +{{ ibexa_url(location, {'foo': 'foo'}) }} +{{ ibexa_url(content) }} +{{ ibexa_url(content, {}, true) }} +{{ ibexa_url(content, {'foo': 'foo'}) }} +{{ ibexa_url(content_info) }} +{{ ibexa_url(content_info, {}, true) }} +{{ ibexa_url(content_info, {'foo': 'foo'}) }} +{{ ibexa_url(content_aware) }} +{{ ibexa_url(content_aware, {}, true) }} +{{ ibexa_url(content_aware, {'foo': 'foo'}) }} +{{ ibexa_url(route_ref) }} +{{ ibexa_url(route_ref, {}, true) }} +{{ ibexa_url(route_ref, {'baz': 'baz'}) }} +{{ ibexa_url(unsupported_object) }} +{{ ibexa_url(unsupported_object, {}, true) }} +{{ ibexa_url(unsupported_object, {'baz': 'baz'}) }} +--DATA-- +return [ + 'location' => $this->getExampleLocation(54), + 'content' => $this->getExampleContent(2), + 'content_info' => $this->getExampleContentInfo(2), + 'content_aware' => $this->getExampleContentAware(64), + 'route_ref' => $this->getExampleRouteReference( + 'example_route', + [ + 'foo' => 'foo', + 'bar' => 'bar' + ] + ), + 'unsupported_object' => $this->getExampleUnsupportedObject(), +]; +--EXPECT-- +{"$name":"ibexa.url.alias","$parameters":{"locationId":54},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"locationId":54},"$referenceType":3} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","locationId":54},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":3} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","contentId":2},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"contentId":2},"$referenceType":3} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","contentId":2},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"contentId":64},"$referenceType":0} +{"$name":"ibexa.url.alias","$parameters":{"contentId":64},"$referenceType":3} +{"$name":"ibexa.url.alias","$parameters":{"foo":"foo","contentId":64},"$referenceType":0} +{"$name":"example_route","$parameters":{"foo":"foo","bar":"bar"},"$referenceType":0} +{"$name":"example_route","$parameters":{"foo":"foo","bar":"bar"},"$referenceType":3} +{"$name":"example_route","$parameters":{"baz":"baz","foo":"foo","bar":"bar"},"$referenceType":0} +{"$name":"","$parameters":{"_route_object":{"foo":"foo","bar":"bar"}},"$referenceType":0} +{"$name":"","$parameters":{"_route_object":{"foo":"foo","bar":"bar"}},"$referenceType":3} +{"$name":"","$parameters":{"baz":"baz","_route_object":{"foo":"foo","bar":"bar"}},"$referenceType":0}