From d18229483d7ae740aaec548a21989fbff3c2b17e Mon Sep 17 00:00:00 2001 From: Kevin Wenger Date: Tue, 20 Feb 2024 14:48:27 +0100 Subject: [PATCH 1/5] add official support of drupal 11.x-dev --- CHANGELOG.md | 1 + bamboo_twig.info.yml | 2 +- bamboo_twig_config/bamboo_twig_config.info.yml | 2 +- bamboo_twig_extensions/bamboo_twig_extensions.info.yml | 2 +- bamboo_twig_file/bamboo_twig_file.info.yml | 2 +- bamboo_twig_i18n/bamboo_twig_i18n.info.yml | 2 +- bamboo_twig_loader/bamboo_twig_loader.info.yml | 2 +- bamboo_twig_path/bamboo_twig_path.info.yml | 2 +- bamboo_twig_security/bamboo_twig_security.info.yml | 2 +- bamboo_twig_token/bamboo_twig_token.info.yml | 2 +- tests/modules/bamboo_twig_test/bamboo_twig_test.info.yml | 2 +- 11 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3beab0..d02907d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - add `bamboo_load_entity_revision` loading of entity revision - Issue #3254160 by dibix, wengerk - add support of optional `alt` parameter on `bamboo_render_image` - Issue #3355084 by Ranjit1032002, thatlotnextdoor, wengerk - add Drupal GitlabCI - #3417699 #3350583 +- add official support of drupal 11.x-dev ### Fixed - fix tests template discovery using 'path' property diff --git a/bamboo_twig.info.yml b/bamboo_twig.info.yml index ae95f0b..7e4cd7f 100644 --- a/bamboo_twig.info.yml +++ b/bamboo_twig.info.yml @@ -2,4 +2,4 @@ name: Bamboo Twig description: 'Several Twig extensions with some useful functions and filters that can improve development experience.' package: Bamboo Twig type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^9.3 || ^10 || ^11 diff --git a/bamboo_twig_config/bamboo_twig_config.info.yml b/bamboo_twig_config/bamboo_twig_config.info.yml index dadea8a..37e1e04 100644 --- a/bamboo_twig_config/bamboo_twig_config.info.yml +++ b/bamboo_twig_config/bamboo_twig_config.info.yml @@ -2,7 +2,7 @@ name: Bamboo Twig - Config description: 'Several "Config" Twig extensions.' package: Bamboo Twig type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^9.3 || ^10 || ^11 dependencies: - bamboo_twig:bamboo_twig diff --git a/bamboo_twig_extensions/bamboo_twig_extensions.info.yml b/bamboo_twig_extensions/bamboo_twig_extensions.info.yml index cb959a8..ff7828e 100644 --- a/bamboo_twig_extensions/bamboo_twig_extensions.info.yml +++ b/bamboo_twig_extensions/bamboo_twig_extensions.info.yml @@ -2,7 +2,7 @@ name: Bamboo Twig - Extensions description: 'Twig extensions (Text, Date & Array) from http://twig-extensions.readthedocs.io/en/latest/index.html.' package: Bamboo Twig type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^9.3 || ^10 || ^11 dependencies: - bamboo_twig:bamboo_twig diff --git a/bamboo_twig_file/bamboo_twig_file.info.yml b/bamboo_twig_file/bamboo_twig_file.info.yml index 0b8480c..6b7301e 100644 --- a/bamboo_twig_file/bamboo_twig_file.info.yml +++ b/bamboo_twig_file/bamboo_twig_file.info.yml @@ -2,7 +2,7 @@ name: Bamboo Twig - File description: 'Several "File" Twig extensions.' package: Bamboo Twig type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^9.3 || ^10 || ^11 dependencies: - bamboo_twig:bamboo_twig diff --git a/bamboo_twig_i18n/bamboo_twig_i18n.info.yml b/bamboo_twig_i18n/bamboo_twig_i18n.info.yml index 89e74eb..aa10d1e 100644 --- a/bamboo_twig_i18n/bamboo_twig_i18n.info.yml +++ b/bamboo_twig_i18n/bamboo_twig_i18n.info.yml @@ -2,7 +2,7 @@ name: Bamboo Twig - Internationalization description: 'Several "i18n" Twig extensions.' package: Bamboo Twig type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^9.3 || ^10 || ^11 dependencies: - bamboo_twig:bamboo_twig diff --git a/bamboo_twig_loader/bamboo_twig_loader.info.yml b/bamboo_twig_loader/bamboo_twig_loader.info.yml index 5e2dcd2..16d6e53 100644 --- a/bamboo_twig_loader/bamboo_twig_loader.info.yml +++ b/bamboo_twig_loader/bamboo_twig_loader.info.yml @@ -2,7 +2,7 @@ name: Bamboo Twig - Loaders description: 'Several "Loaders & Render" Twig extensions.' package: Bamboo Twig type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^9.3 || ^10 || ^11 dependencies: - bamboo_twig:bamboo_twig diff --git a/bamboo_twig_path/bamboo_twig_path.info.yml b/bamboo_twig_path/bamboo_twig_path.info.yml index d99b6fe..63a1bab 100644 --- a/bamboo_twig_path/bamboo_twig_path.info.yml +++ b/bamboo_twig_path/bamboo_twig_path.info.yml @@ -2,7 +2,7 @@ name: Bamboo Twig - Path & Url description: 'Several "Path & Url" Twig extensions.' package: Bamboo Twig type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^9.3 || ^10 || ^11 dependencies: - bamboo_twig:bamboo_twig diff --git a/bamboo_twig_security/bamboo_twig_security.info.yml b/bamboo_twig_security/bamboo_twig_security.info.yml index 21f6f34..b9bd11f 100644 --- a/bamboo_twig_security/bamboo_twig_security.info.yml +++ b/bamboo_twig_security/bamboo_twig_security.info.yml @@ -2,7 +2,7 @@ name: Bamboo Twig - Security description: 'Several "Security" Twig extensions.' package: Bamboo Twig type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^9.3 || ^10 || ^11 dependencies: - bamboo_twig:bamboo_twig diff --git a/bamboo_twig_token/bamboo_twig_token.info.yml b/bamboo_twig_token/bamboo_twig_token.info.yml index d677b03..4a57d2e 100644 --- a/bamboo_twig_token/bamboo_twig_token.info.yml +++ b/bamboo_twig_token/bamboo_twig_token.info.yml @@ -2,7 +2,7 @@ name: Bamboo Twig - Token description: 'Several "Token" Twig extensions.' package: Bamboo Twig type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^9.3 || ^10 || ^11 dependencies: - bamboo_twig:bamboo_twig diff --git a/tests/modules/bamboo_twig_test/bamboo_twig_test.info.yml b/tests/modules/bamboo_twig_test/bamboo_twig_test.info.yml index d08c45f..b6d0e8b 100644 --- a/tests/modules/bamboo_twig_test/bamboo_twig_test.info.yml +++ b/tests/modules/bamboo_twig_test/bamboo_twig_test.info.yml @@ -2,7 +2,7 @@ name: Bamboo Twig test description: Support module for Bamboo Twig testing. package: Testing type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^9.3 || ^10 || ^11 dependencies: - drupal:bamboo_twig From 1af83df61a4a94916329e958955417478670c458 Mon Sep 17 00:00:00 2001 From: Kevin Wenger Date: Tue, 20 Feb 2024 15:42:49 +0100 Subject: [PATCH 2/5] fix testing for Drupal 11.0-dev --- .github/workflows/ci.yml | 12 +++- tests/src/Kernel/BambooTwigSecurityTest.php | 7 ++- tests/src/Kernel/Render/ImageTest.php | 62 ++++++++++++++++++--- 3 files changed, 71 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71f9387..2b3e572 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,13 @@ jobs: strategy: matrix: - drupal_version: ['9.5', '10.0', '10.1'] + drupal_version: ['9.5', '10.0', '10.1', '10.2', '11.0'] module: ['bamboo_twig'] experimental: [false] + include: + - drupal_version: '11.0' + module: 'bamboo_twig' + experimental: true steps: - uses: actions/checkout@v3 @@ -37,9 +41,13 @@ jobs: strategy: matrix: - drupal_version: ['9.5', '10.0', '10.1'] + drupal_version: ['9.5', '10.0', '10.1', '10.2', '11.0'] module: ['bamboo_twig'] experimental: [false] + include: + - drupal_version: '11.0' + module: 'bamboo_twig' + experimental: true steps: - uses: actions/checkout@v3 diff --git a/tests/src/Kernel/BambooTwigSecurityTest.php b/tests/src/Kernel/BambooTwigSecurityTest.php index db81fb6..d696b1c 100644 --- a/tests/src/Kernel/BambooTwigSecurityTest.php +++ b/tests/src/Kernel/BambooTwigSecurityTest.php @@ -45,7 +45,12 @@ protected function setUp(): void { parent::setUp(); $this->installEntitySchema('user'); - $this->installSchema('system', ['sequences']); + + // Since Drupal 10.2.0 installing the table sequences with the + // method KernelTestBase::installSchema() is deprecated. + if (version_compare(\Drupal::VERSION, '10.2.0', '<')) { + $this->installSchema('system', ['sequences']); + } $this->entityTypeManager = $this->container->get('entity_type.manager'); $this->securityExtension = $this->container->get('bamboo_twig_security.twig.security'); diff --git a/tests/src/Kernel/Render/ImageTest.php b/tests/src/Kernel/Render/ImageTest.php index 326f6fa..331091f 100644 --- a/tests/src/Kernel/Render/ImageTest.php +++ b/tests/src/Kernel/Render/ImageTest.php @@ -54,7 +54,13 @@ protected function setUp(): void { $this->installEntitySchema('user'); $this->installEntitySchema('file'); $this->installSchema('file', 'file_usage'); - $this->installSchema('system', 'sequences'); + + // Since Drupal 10.2.0 installing the table sequences with the + // method KernelTestBase::installSchema() is deprecated. + if (version_compare(\Drupal::VERSION, '10.2.0', '<')) { + $this->installSchema('system', ['sequences']); + } + $this->installEntitySchema('media'); $this->installConfig(['field', 'system', 'image', 'file', 'media']); @@ -134,7 +140,14 @@ public function testRenderImageFile() { $markup = $this->renderer->renderRoot($renderer); $this->assertInstanceOf(Markup::class, $markup); - $this->assertMatchesRegularExpression('/^/', $markup->__toString()); + + // Since Drupal 11.x the image styles are rendered as webp. + if (version_compare(\Drupal::VERSION, '11', '>=')) { + $this->assertMatchesRegularExpression('/^/', $markup->__toString()); + } + else { + $this->assertMatchesRegularExpression('/^/', $markup->__toString()); + } // Ensure {{ bamboo_render_image(1, 'thumbnail', '') }}. $renderer = $this->renderExtension->renderImage($file->id(), 'thumbnail', ''); @@ -147,7 +160,14 @@ public function testRenderImageFile() { $markup = $this->renderer->renderRoot($renderer); $this->assertInstanceOf(Markup::class, $markup); - $this->assertMatchesRegularExpression('/^/', $markup->__toString()); + + // Since Drupal 11.x the image styles are rendered as webp. + if (version_compare(\Drupal::VERSION, '11', '>=')) { + $this->assertMatchesRegularExpression('/^/', $markup->__toString()); + } + else { + $this->assertMatchesRegularExpression('/^/', $markup->__toString()); + } // Ensure {{ bamboo_render_image(1, 'thumbnail', 'Dignissim ... primis') }}. $renderer = $this->renderExtension->renderImage($file->id(), 'thumbnail', 'Dignissim dui dolor ipsum sapien habitant primis'); @@ -160,7 +180,14 @@ public function testRenderImageFile() { $markup = $this->renderer->renderRoot($renderer); $this->assertInstanceOf(Markup::class, $markup); - $this->assertMatchesRegularExpression('/^Dignissim dui dolor ipsum sapien habitant primis/', $markup->__toString()); + + // Since Drupal 11.x the image styles are rendered as webp. + if (version_compare(\Drupal::VERSION, '11', '>=')) { + $this->assertMatchesRegularExpression('/^Dignissim dui dolor ipsum sapien habitant primis/', $markup->__toString()); + } + else { + $this->assertMatchesRegularExpression('/^Dignissim dui dolor ipsum sapien habitant primis/', $markup->__toString()); + } } /** @@ -185,7 +212,14 @@ public function testRenderImageMedia() { $markup = $this->renderer->renderRoot($renderer); $this->assertInstanceOf(Markup::class, $markup); - $this->assertMatchesRegularExpression('/^/', $markup->__toString()); + + // Since Drupal 11.x the image styles are rendered as webp. + if (version_compare(\Drupal::VERSION, '11', '>=')) { + $this->assertMatchesRegularExpression('/^/', $markup->__toString()); + } + else { + $this->assertMatchesRegularExpression('/^/', $markup->__toString()); + } // Ensure {{ bamboo_render_image(1, 'thumbnail', '') }}. $renderer = $this->renderExtension->renderImage($media->field_media_image->target_id, 'thumbnail', ''); @@ -198,7 +232,14 @@ public function testRenderImageMedia() { $markup = $this->renderer->renderRoot($renderer); $this->assertInstanceOf(Markup::class, $markup); - $this->assertMatchesRegularExpression('/^/', $markup->__toString()); + + // Since Drupal 11.x the image styles are rendered as webp. + if (version_compare(\Drupal::VERSION, '11', '>=')) { + $this->assertMatchesRegularExpression('/^/', $markup->__toString()); + } + else { + $this->assertMatchesRegularExpression('/^/', $markup->__toString()); + } // Ensure {{ bamboo_render_image(1, 'thumbnail', 'Dignissim ... primis') }}. $renderer = $this->renderExtension->renderImage($media->field_media_image->target_id, 'thumbnail', 'Dignissim dui dolor ipsum sapien habitant primis'); @@ -211,7 +252,14 @@ public function testRenderImageMedia() { $markup = $this->renderer->renderRoot($renderer); $this->assertInstanceOf(Markup::class, $markup); - $this->assertMatchesRegularExpression('/^Dignissim dui dolor ipsum sapien habitant primis/', $markup->__toString()); + + // Since Drupal 11.x the image styles are rendered as webp. + if (version_compare(\Drupal::VERSION, '11', '>=')) { + $this->assertMatchesRegularExpression('/^Dignissim dui dolor ipsum sapien habitant primis/', $markup->__toString()); + } + else { + $this->assertMatchesRegularExpression('/^Dignissim dui dolor ipsum sapien habitant primis/', $markup->__toString()); + } } } From 8c9cb2c1fa820b10e3cdd464d59834e36e7e7f95 Mon Sep 17 00:00:00 2001 From: Kevin Wenger Date: Tue, 20 Feb 2024 17:09:33 +0100 Subject: [PATCH 3/5] disable PHPUnit Symfony Deprecation notice since Drupal 10.2 --- CHANGELOG.md | 1 + Dockerfile | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d02907d..3026deb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - update codebase to be compliant PHP8.2 - rework tests by using a custom theme "bamboo_twig" in order of overriding *.html.twig template for tests purpose - change Blocks rendered via bamboo_render_block do not use the block theme hook - Issue #3110310 by wengerk, rattusrattus, sahaj, interdruper, gido +- disable PHPUnit Symfony Deprecation notice since Drupal 10.2 ### Added - add coverage of Drupal 10.1.x diff --git a/Dockerfile b/Dockerfile index c159a97..72975d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,9 @@ FROM wengerk/drupal-for-contrib:${BASE_IMAGE_TAG} ARG BASE_IMAGE_TAG ENV BASE_IMAGE_TAG=${BASE_IMAGE_TAG} -# Disable deprecation notice since PHPUnit 9 with Drupal 9.1 and lower. -# @see https://www.drupal.org/project/drupal/issues/3259744 -# ENV SYMFONY_DEPRECATIONS_HELPER=weak +# Disable deprecation notice since PHPUnit 10 with Drupal 10.2 and upper. +# @see https://www.drupal.org/project/drupal/issues/3403491 +ENV SYMFONY_DEPRECATIONS_HELPER=weak # Install symfony/mime as required by bamboo_twig_extensions. ENV COMPOSER_ALLOW_SUPERUSER=1 From a3cad86b4fd38035d97601a5ac973f3bbd32b6d0 Mon Sep 17 00:00:00 2001 From: Kevin Wenger Date: Tue, 20 Feb 2024 17:21:39 +0100 Subject: [PATCH 4/5] bump README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a2dad85..d2a3d3e 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,9 @@ for each topic he provides Twigs. ## Bamboo Twig versions -Bamboo Twig is available for Drupal 8, Drupal 9 & Drupal 10! +Bamboo Twig is available for Drupal 8, Drupal 9, Drupal 10 & Drupal 11 (dev)! +- If you are running Drupal `11.x`, use Bamboo Twig `6.0.x`. - If you are running Drupal `10.x`, use Bamboo Twig `6.0.x`. - If you are running Drupal `9.x`, use Bamboo Twig `5.x`. - If you are running Drupal `8.8.x`, use Bamboo Twig `5.0`. @@ -79,6 +80,7 @@ must upgrade to `8.x-3.x` version of **Bamboo Twig**. | 8.9.x | 5.0 | | 9.x | 5.x | | 10.x | 6.0.x | +| 11.x-dev | 6.0.x | ## Dependencies From 4b7922e6ea8863661c39ab605ab2da51f123b4ea Mon Sep 17 00:00:00 2001 From: Kevin Wenger <44711-wengerk@users.noreply.drupalcode.org> Date: Tue, 20 Feb 2024 19:30:08 +0000 Subject: [PATCH 5/5] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3026deb..1495702 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - fix tests template discovery using 'path' property - fix Issue #3417699 by apaderno: Tests failing on Drupal 10 because Tests module has same name as Test Theme -- fix Issue #3350583 by urvashi_vora, mukesh88, mahtab_alam: Fix the errors/warnings reported by PHP_CodeSniffer' --author="Mahtab Alam <25208-mahtab_alam@users.noreply.drupalcode.org>" +- fix Issue #3350583 by urvashi_vora, mukesh88, mahtab_alam: Fix the errors/warnings reported by PHP_CodeSniffer ### Removed - drop tests support on Drupal < 9.4