From de3a4ce5c7e96650ed08a32cf78cd020936ef6cb Mon Sep 17 00:00:00 2001 From: Christian Raue Date: Tue, 22 Aug 2023 10:09:20 +0200 Subject: [PATCH 1/3] fixed tests with Symfony 6.4 dev --- .../SettingsControllerIntegrationTest.php | 7 ++++++- Tests/config/config_hacks.php | 21 +++++++++++++++++-- composer.json | 1 + 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Tests/Controller/SettingsControllerIntegrationTest.php b/Tests/Controller/SettingsControllerIntegrationTest.php index 4e29908..373e3af 100644 --- a/Tests/Controller/SettingsControllerIntegrationTest.php +++ b/Tests/Controller/SettingsControllerIntegrationTest.php @@ -5,6 +5,8 @@ use Craue\ConfigBundle\Entity\Setting; use Craue\ConfigBundle\Tests\IntegrationTestBundle\Entity\CustomSetting; use Craue\ConfigBundle\Tests\IntegrationTestCase; +use Composer\InstalledVersions; +use Composer\Semver\VersionParser; /** * @group integration @@ -40,7 +42,10 @@ public function testModifyAction_noChanges($platform, $config, $requiredExtensio $this->assertSame(200, static::$client->getResponse()->getStatusCode(), $content); $this->assertMatchesRegularExpression('/
/', $content); $this->assertStringContainsString('', $content); - $this->assertStringContainsString('', $content); + // TODO clean up as soon as Symfony >= 6.4 is required, see https://github.com/symfony/symfony/pull/47715 + // (and remove composer/semver dependency) + $this->assertStringContainsString(sprintf('', + InstalledVersions::satisfies(new VersionParser(), 'symfony/form', '<6.4') ? ' /' : ''), $content); $this->assertStringContainsString('', $content); $form = $crawler->selectButton('apply')->form(); diff --git a/Tests/config/config_hacks.php b/Tests/config/config_hacks.php index df54641..dcd8670 100644 --- a/Tests/config/config_hacks.php +++ b/Tests/config/config_hacks.php @@ -15,7 +15,7 @@ ]); } -// TODO put back into config.yml as soon as Symfony >= 5.3 is required, see https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.3.md#frameworkbundle +// TODO put back into config.yml as soon as Symfony >= 5.3 is required, see https://github.com/symfony/symfony/blob/5.3/UPGRADE-5.3.md#frameworkbundle $container->loadFromExtension('framework', [ 'session' => Kernel::VERSION_ID >= 50300 ? [ 'storage_factory_id' => 'session.storage.factory.mock_file', @@ -33,7 +33,24 @@ ]); } -// TODO remove as soon as Symfony >= 7 is required +// TODO remove as soon as Symfony >= 7 is required, see https://github.com/symfony/symfony/blob/6.4/UPGRADE-6.4.md#frameworkbundle +if (Kernel::VERSION_ID >= 60400 && Kernel::VERSION_ID < 70000) { + $container->loadFromExtension('framework', [ + 'handle_all_throwables' => true, + 'php_errors' => [ + 'log' => true, + ], + 'session' => [ + 'cookie_secure' => 'auto', + 'cookie_samesite' => 'lax', + ], + 'validation' => [ + 'email_validation_mode' => 'html5', + ], + ]); +} + +// TODO remove as soon as Symfony >= 7 is required, see https://github.com/symfony/symfony/blob/6.1/UPGRADE-6.1.md#frameworkbundle if (Kernel::VERSION_ID < 70000) { $container->loadFromExtension('framework', [ 'http_method_override' => false, diff --git a/composer.json b/composer.json index 860b7f7..25db0ca 100644 --- a/composer.json +++ b/composer.json @@ -33,6 +33,7 @@ "symfony/validator": "^4.4 || ^5.4 || ^6.3" }, "require-dev": { + "composer/semver": "^3.0", "craue/translations-tests": "^1.0", "doctrine/orm": "^2.5.14", "phpstan/extension-installer": "^1.1", From 868a9023e394aaea157d63921c58089fe7289dfe Mon Sep 17 00:00:00 2001 From: Christian Raue Date: Tue, 22 Aug 2023 10:38:09 +0200 Subject: [PATCH 2/3] fixed running Coveralls with Symfony 6.4 dev --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 429e33a..ba0c473 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -114,5 +114,6 @@ jobs: env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + unset SYMFONY_REQUIRE composer global require php-coveralls/php-coveralls php-coveralls --coverage_clover=build/logs/clover.xml -v From 5e80694bb5c4c7e80472cfd7dee251b16914c471 Mon Sep 17 00:00:00 2001 From: Christian Raue Date: Tue, 22 Aug 2023 10:54:01 +0200 Subject: [PATCH 3/3] use nicer names for Coveralls jobs --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ba0c473..09f2292 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -113,6 +113,7 @@ jobs: if: github.repository == 'craue/CraueConfigBundle' env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_FLAG_NAME: PHP ${{ matrix.php }} - ${{ matrix.dependencies || format('Symfony {0}', matrix.symfony) }} run: | unset SYMFONY_REQUIRE composer global require php-coveralls/php-coveralls