From 4f1d11d15ea5c928e02c7d53f22e019101dc0005 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Wed, 4 Sep 2024 10:30:16 +0200 Subject: [PATCH 1/6] Update test matrix and dependencies to use supported Symfony versions only --- .github/workflows/tests.yml | 7 +++---- composer.json | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1dca769..8bbf943 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,10 +17,9 @@ jobs: fail-fast: false matrix: include: - - { php-version: 7.2, symfony-locked-version: none, dependency-version: prefer-lowest } - - { php-version: 7.4, symfony-locked-version: 5.3.*, dependency-version: prefer-stable } - - { php-version: 8.1, symfony-locked-version: none, dependency-version: prefer-stable } - - { php-version: 8.2, symfony-locked-version: none, dependency-version: prefer-stable } + - { php-version: 8.1, symfony-locked-version: none, dependency-version: prefer-lowest } + - { php-version: 8.1, symfony-locked-version: 5.4.*, dependency-version: prefer-stable } + - { php-version: 8.2, symfony-locked-version: 6.4.*, dependency-version: prefer-stable } - { php-version: 8.3, symfony-locked-version: none, dependency-version: prefer-stable } name: PHPUnit (PHP ${{matrix.php-version}}, Symfony Version Lock ${{ matrix.symfony-locked-version }}, ${{ matrix.dependency-version }}) steps: diff --git a/composer.json b/composer.json index ff5afe7..058e7f0 100644 --- a/composer.json +++ b/composer.json @@ -4,29 +4,29 @@ "license": "MIT", "require": { - "php": ">=7.2", + "php": ">=8.1", "ext-json": "*", "ext-mbstring": "*", "psr/log": "^1.0.2", - "symfony/config": "^4.4|^5.0|^6.0|^7.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0|^7.0", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", "symfony/deprecation-contracts": "^2.5|^3.0", - "symfony/form": "^4.4|^5.0|^6.0|^7.0", - "symfony/http-foundation": "^5.3|^6.0|^7.0", - "symfony/http-kernel": "^4.4|^5.0|^6.0|^7.0", + "symfony/form": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", "thunderer/shortcode": "^0.6.5|^0.7", - "twig/twig": "^1.34|^2.0|^3.0" + "twig/twig": "^2.0|^3.0" }, "require-dev": { - "phpunit/phpunit": "^8.5|^9.5", - "symfony/browser-kit": "^4.4|^5.4|^6.0|^7.0", - "symfony/expression-language": "^4.4|^5.0|^6.0|^7.0", - "symfony/framework-bundle": "^5.3|^6.0|^7.0", + "phpunit/phpunit": "^10.5", + "symfony/browser-kit": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/framework-bundle": "^5.4|^6.0|^7.0", "symfony/phpunit-bridge": ">= 6.0", - "symfony/routing": "^4.4|^5.0|^6.0|^7.0", - "symfony/twig-bundle": "^4.4|^5.0|^6.0|^7.0", - "symfony/yaml": "^4.4|^5.0|^6.0|^7.0" + "symfony/routing": "^5.4|^6.0|^7.0", + "symfony/twig-bundle": "^5.4|^6.0|^7.0", + "symfony/yaml": "^5.4|^6.0|^7.0" }, "autoload": { From 7318eb5b6e84cc83ba8d73f5d546d65b22b4e1f2 Mon Sep 17 00:00:00 2001 From: mpdude Date: Wed, 4 Sep 2024 08:30:43 +0000 Subject: [PATCH 2/6] Fix CS with PHP-CS-Fixer --- tests/DependencyInjection/Compiler/ShortcodeCompilerPassTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/DependencyInjection/Compiler/ShortcodeCompilerPassTest.php b/tests/DependencyInjection/Compiler/ShortcodeCompilerPassTest.php index cad3925..845e8f9 100644 --- a/tests/DependencyInjection/Compiler/ShortcodeCompilerPassTest.php +++ b/tests/DependencyInjection/Compiler/ShortcodeCompilerPassTest.php @@ -51,6 +51,7 @@ public function tagged_services_are_added_as_handlers_to_handler_container(): vo ->with('add', $this->callback(function (array $argument) { static $count = 0; ++$count; + return 'shortcode'.$count === $argument[0] && $argument[1] instanceof Reference; })); From c49653e09b3c318db93df835c58c83ea5f87255e Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Wed, 4 Sep 2024 12:06:44 +0200 Subject: [PATCH 3/6] Address PHPUnit warnings/deprecations --- phpunit.xml.dist | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6235921..bc345cf 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,24 +1,13 @@ - - + - tests + tests/Functional/ShortcodeTest.php - - - - src - - - From 867bdc236077c885e14cf9d1930d8b3c46f59867 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Wed, 4 Sep 2024 12:09:38 +0200 Subject: [PATCH 4/6] Update phpunit config --- phpunit.xml.dist | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index bc345cf..6d88312 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -3,6 +3,9 @@ + + + From 246eff9da33bffeb9e68634fe7a968bde8f0c5d7 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Wed, 4 Sep 2024 12:27:04 +0200 Subject: [PATCH 5/6] =?UTF-8?q?Nutze=20den=20DebugClassLoader,=20um=20fehl?= =?UTF-8?q?ende=20Return=20Types=20aufzusp=C3=BCren?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 1 + phpunit.xml.dist | 4 ++-- .../Compiler/ShortcodeCompilerPass.php | 2 +- src/DependencyInjection/WebfactoryShortcodeExtension.php | 2 +- tests/Fixtures/TestKernel.php | 2 +- tests/bootstrap.php | 8 ++++++++ 6 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 tests/bootstrap.php diff --git a/composer.json b/composer.json index 058e7f0..9d2eea7 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,7 @@ "require-dev": { "phpunit/phpunit": "^10.5", "symfony/browser-kit": "^5.4|^6.0|^7.0", + "symfony/error-handler": "^5.4|^6.0|^7.1", "symfony/expression-language": "^5.4|^6.0|^7.0", "symfony/framework-bundle": "^5.4|^6.0|^7.0", "symfony/phpunit-bridge": ">= 6.0", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6d88312..813d07a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,11 +1,11 @@ - + - + diff --git a/src/DependencyInjection/Compiler/ShortcodeCompilerPass.php b/src/DependencyInjection/Compiler/ShortcodeCompilerPass.php index 847b995..43d1f70 100644 --- a/src/DependencyInjection/Compiler/ShortcodeCompilerPass.php +++ b/src/DependencyInjection/Compiler/ShortcodeCompilerPass.php @@ -13,7 +13,7 @@ */ class ShortcodeCompilerPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $shortcodeServices = $container->findTaggedServiceIds('webfactory.shortcode'); diff --git a/src/DependencyInjection/WebfactoryShortcodeExtension.php b/src/DependencyInjection/WebfactoryShortcodeExtension.php index e35e9cb..91fdf2b 100644 --- a/src/DependencyInjection/WebfactoryShortcodeExtension.php +++ b/src/DependencyInjection/WebfactoryShortcodeExtension.php @@ -13,7 +13,7 @@ */ final class WebfactoryShortcodeExtension extends Extension { - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('shortcodes.xml'); diff --git a/tests/Fixtures/TestKernel.php b/tests/Fixtures/TestKernel.php index 4afecbc..873cc33 100644 --- a/tests/Fixtures/TestKernel.php +++ b/tests/Fixtures/TestKernel.php @@ -19,7 +19,7 @@ public function registerBundles(): array ]; } - public function registerContainerConfiguration(LoaderInterface $loader) + public function registerContainerConfiguration(LoaderInterface $loader): void { $loader->load(__DIR__.'/config/config.yml'); $loader->load(__DIR__.'/config/test_shortcodes.xml'); diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..24f1e2f --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,8 @@ + Date: Wed, 4 Sep 2024 10:28:34 +0000 Subject: [PATCH 6/6] Fix CS with PHP-CS-Fixer --- tests/bootstrap.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 24f1e2f..204a443 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,6 +1,5 @@