From a49a3fc98c4211b0a04420a65e00c0df67746564 Mon Sep 17 00:00:00 2001 From: kuba-end Date: Thu, 31 Mar 2022 08:02:51 +0200 Subject: [PATCH 1/4] Add support for Sylius 1.11 and drop for 1.8 --- .github/workflows/build.yml | 25 ++++++++----------- composer.json | 7 +++--- tests/Application/.env | 8 ++++++ tests/Application/Kernel.php | 2 +- .../Application/config/api_platform/.gitkeep | 0 .../config/sylius/1.11/bundles.php | 8 ++++++ .../1.11/packages/dev/jms_serializer.yaml | 12 +++++++++ .../sylius/1.11/packages/jms_serializer.yaml | 4 +++ .../1.11/packages/prod/jms_serializer.yaml | 10 ++++++++ .../{1.8 => 1.11}/packages/security.yaml | 11 -------- .../Application/config/sylius/1.8/bundles.php | 8 ------ .../config/sylius/1.8/packages/_sylius.yaml | 2 -- .../sylius/1.8/routes/sylius_admin_api.yaml | 3 --- 13 files changed, 57 insertions(+), 43 deletions(-) create mode 100644 tests/Application/config/api_platform/.gitkeep create mode 100644 tests/Application/config/sylius/1.11/bundles.php create mode 100644 tests/Application/config/sylius/1.11/packages/dev/jms_serializer.yaml create mode 100644 tests/Application/config/sylius/1.11/packages/jms_serializer.yaml create mode 100644 tests/Application/config/sylius/1.11/packages/prod/jms_serializer.yaml rename tests/Application/config/sylius/{1.8 => 1.11}/packages/security.yaml (95%) delete mode 100644 tests/Application/config/sylius/1.8/bundles.php delete mode 100644 tests/Application/config/sylius/1.8/packages/_sylius.yaml delete mode 100644 tests/Application/config/sylius/1.8/routes/sylius_admin_api.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index abdbc56..1d06f95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,25 +18,20 @@ jobs: strategy: fail-fast: false matrix: - php: [7.4, 7.3, 8.0] + php: [7.4, 8.0] symfony: [^4.4, ^5.2] - sylius: [~1.8.0, ~1.9.0, ~1.10.0] + sylius: [~1.9, ~1.10, ~1.11] node: [14.x] - mysql: [5.7] + mysql: [8.0] exclude: - - - sylius: ~1.8.0 - symfony: ^5.2 - - + - sylius: ~1.9 php: 8.0 - sylius: ~1.8.0 - - - php: 8.0 - sylius: ~1.9.0 - - - php: 7.3 - sylius: ~1.10.0 + - sylius: ~1.10 + symfony: 4.4 + - sylius: ~1.11 + php: 7.4 + env: APP_ENV: test @@ -116,7 +111,7 @@ jobs: - name: Install PHP dependencies - run: composer install --no-interaction + run: composer install --no-interaction --no-scripts - name: Get Yarn cache directory diff --git a/composer.json b/composer.json index 0b93345..6c67138 100644 --- a/composer.json +++ b/composer.json @@ -5,9 +5,9 @@ "description": "MultiSafepay payment plugin for Sylius applications.", "license": "MIT", "require": { - "php": "^7.3 || ^8.0", + "php": "^7.4 || ^8.0", "multisafepay/api": "^2.0", - "sylius/sylius": "~1.8.0 || ~1.9.0 || ~1.10.0" + "sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0" }, "require-dev": { "behat/behat": "^3.6.1", @@ -38,7 +38,8 @@ "symfony/intl": "^4.4 || ^5.2", "symfony/web-profiler-bundle": "^4.4 || ^5.2", "symplify/easy-coding-standard": "^8.3", - "vimeo/psalm": "4.6.4" + "vimeo/psalm": "4.6.4", + "polishsymfonycommunity/symfony-mocker-container": "^1.0" }, "config": { "sort-packages": true diff --git a/tests/Application/.env b/tests/Application/.env index 4b49a96..ab99ad1 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -27,3 +27,11 @@ JWT_PASSPHRASE=acme_plugin_development # Delivery is disabled by default via "null://localhost" MAILER_URL=smtp://localhost ###< symfony/swiftmailer-bundle ### + +###> symfony/messenger ### +# Choose one of the transports below +# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages +# MESSENGER_TRANSPORT_DSN=doctrine://default +# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages +MESSENGER_TRANSPORT_DSN=sync:// +###< symfony/messenger ### diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index a9e400f..f993094 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -68,7 +68,7 @@ protected function configureRoutes(RouteCollectionBuilder $routes): void protected function getContainerBaseClass(): string { - if ($this->isTestEnvironment()) { + if ($this->isTestEnvironment() && class_exists(MockerContainer::class)) { return MockerContainer::class; } diff --git a/tests/Application/config/api_platform/.gitkeep b/tests/Application/config/api_platform/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/Application/config/sylius/1.11/bundles.php b/tests/Application/config/sylius/1.11/bundles.php new file mode 100644 index 0000000..40136dd --- /dev/null +++ b/tests/Application/config/sylius/1.11/bundles.php @@ -0,0 +1,8 @@ + ['all' => true], + Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], +]; diff --git a/tests/Application/config/sylius/1.11/packages/dev/jms_serializer.yaml b/tests/Application/config/sylius/1.11/packages/dev/jms_serializer.yaml new file mode 100644 index 0000000..2f32a9b --- /dev/null +++ b/tests/Application/config/sylius/1.11/packages/dev/jms_serializer.yaml @@ -0,0 +1,12 @@ +jms_serializer: + visitors: + json_serialization: + options: + - JSON_PRETTY_PRINT + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION + json_deserialization: + options: + - JSON_PRETTY_PRINT + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml new file mode 100644 index 0000000..ed7bc61 --- /dev/null +++ b/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml @@ -0,0 +1,4 @@ +jms_serializer: + visitors: + xml_serialization: + format_output: '%kernel.debug%' diff --git a/tests/Application/config/sylius/1.11/packages/prod/jms_serializer.yaml b/tests/Application/config/sylius/1.11/packages/prod/jms_serializer.yaml new file mode 100644 index 0000000..c288182 --- /dev/null +++ b/tests/Application/config/sylius/1.11/packages/prod/jms_serializer.yaml @@ -0,0 +1,10 @@ +jms_serializer: + visitors: + json_serialization: + options: + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION + json_deserialization: + options: + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/sylius/1.8/packages/security.yaml b/tests/Application/config/sylius/1.11/packages/security.yaml similarity index 95% rename from tests/Application/config/sylius/1.8/packages/security.yaml rename to tests/Application/config/sylius/1.11/packages/security.yaml index 8161bda..1062810 100644 --- a/tests/Application/config/sylius/1.8/packages/security.yaml +++ b/tests/Application/config/sylius/1.11/packages/security.yaml @@ -54,10 +54,6 @@ security: target: sylius_admin_login anonymous: true - oauth_token: - pattern: "%sylius.security.api_regex%/oauth/v2/token" - security: false - new_api_admin_user: pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" provider: sylius_admin_user_provider @@ -97,13 +93,6 @@ security: authenticators: - lexik_jwt_authentication.jwt_token_authenticator - api: - pattern: "%sylius.security.api_regex%/.*" - provider: sylius_admin_user_provider - fos_oauth: true - stateless: true - anonymous: true - shop: switch_user: { role: ROLE_ALLOWED_TO_SWITCH } context: shop diff --git a/tests/Application/config/sylius/1.8/bundles.php b/tests/Application/config/sylius/1.8/bundles.php deleted file mode 100644 index c3c8ea4..0000000 --- a/tests/Application/config/sylius/1.8/bundles.php +++ /dev/null @@ -1,8 +0,0 @@ - ['all' => true], - WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true], - FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true], - Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.8/packages/_sylius.yaml b/tests/Application/config/sylius/1.8/packages/_sylius.yaml deleted file mode 100644 index 1674a97..0000000 --- a/tests/Application/config/sylius/1.8/packages/_sylius.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" } diff --git a/tests/Application/config/sylius/1.8/routes/sylius_admin_api.yaml b/tests/Application/config/sylius/1.8/routes/sylius_admin_api.yaml deleted file mode 100644 index 80aed45..0000000 --- a/tests/Application/config/sylius/1.8/routes/sylius_admin_api.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_admin_api: - resource: "@SyliusAdminApiBundle/Resources/config/routing.yml" - prefix: /api From 10b2a772289bef4309a3dcb232af7a8478f34857 Mon Sep 17 00:00:00 2001 From: kuba-end Date: Thu, 31 Mar 2022 16:01:20 +0200 Subject: [PATCH 2/4] Add babdev/pagerfanta-bundle --- behat.yml.dist | 1 + composer.json | 5 +++-- tests/Application/config/bundles.php | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/behat.yml.dist b/behat.yml.dist index 1f19bf0..317bf3c 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -21,6 +21,7 @@ default: symfony: ~ chrome_headless: chrome: + socket_timeout: 60 api_url: http://127.0.0.1:9222 validate_certificate: false chrome: diff --git a/composer.json b/composer.json index 6c67138..7df5a0e 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ "sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0" }, "require-dev": { + "babdev/pagerfanta-bundle": "^2.5", "behat/behat": "^3.6.1", "behat/mink-selenium2-driver": "^1.4", "dmore/behat-chrome-extension": "^1.3", @@ -30,6 +31,7 @@ "phpstan/phpstan-strict-rules": "^0.12.0", "phpstan/phpstan-webmozart-assert": "0.12.12", "phpunit/phpunit": "^9.5", + "polishsymfonycommunity/symfony-mocker-container": "^1.0", "sensiolabs/security-checker": "^6.0", "sylius-labs/coding-standard": "^4.0", "symfony/browser-kit": "^4.4 || ^5.2", @@ -38,8 +40,7 @@ "symfony/intl": "^4.4 || ^5.2", "symfony/web-profiler-bundle": "^4.4 || ^5.2", "symplify/easy-coding-standard": "^8.3", - "vimeo/psalm": "4.6.4", - "polishsymfonycommunity/symfony-mocker-container": "^1.0" + "vimeo/psalm": "4.6.4" }, "config": { "sort-packages": true diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index f7145ef..5258d4a 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -55,4 +55,5 @@ Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], Symplify\ConsoleColorDiff\ConsoleColorDiffBundle::class => ['dev' => true, 'test' => true], + BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], ]; From d6d1fcdbe3007d7315ca100f5fadd2021e2e7eb1 Mon Sep 17 00:00:00 2001 From: kuba-end Date: Fri, 1 Apr 2022 09:16:25 +0200 Subject: [PATCH 3/4] Fix bundles.php --- tests/Application/config/sylius/1.10/bundles.php | 1 - tests/Application/config/sylius/1.9/bundles.php | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/Application/config/sylius/1.10/bundles.php b/tests/Application/config/sylius/1.10/bundles.php index bd33f4a..f2aacd1 100644 --- a/tests/Application/config/sylius/1.10/bundles.php +++ b/tests/Application/config/sylius/1.10/bundles.php @@ -1,6 +1,5 @@ ['all' => true], SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/sylius/1.9/bundles.php b/tests/Application/config/sylius/1.9/bundles.php index 66f523d..645dcfe 100644 --- a/tests/Application/config/sylius/1.9/bundles.php +++ b/tests/Application/config/sylius/1.9/bundles.php @@ -1,7 +1,6 @@ ['all' => true], SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true], Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true], From 4ca1f8620b1e8b602f8e5cea37f89a236e8f3105 Mon Sep 17 00:00:00 2001 From: liszkapawel Date: Wed, 27 Apr 2022 11:42:49 +0200 Subject: [PATCH 4/4] Move BabDev\PagerfantaBundle to specific sylius versions bundles --- tests/Application/config/bundles.php | 1 - tests/Application/config/sylius/1.10/bundles.php | 1 + tests/Application/config/sylius/1.11/bundles.php | 1 + tests/Application/config/sylius/1.9/bundles.php | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index 5258d4a..f7145ef 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -55,5 +55,4 @@ Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], Symplify\ConsoleColorDiff\ConsoleColorDiffBundle::class => ['dev' => true, 'test' => true], - BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/sylius/1.10/bundles.php b/tests/Application/config/sylius/1.10/bundles.php index f2aacd1..bd33f4a 100644 --- a/tests/Application/config/sylius/1.10/bundles.php +++ b/tests/Application/config/sylius/1.10/bundles.php @@ -1,5 +1,6 @@ ['all' => true], SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/sylius/1.11/bundles.php b/tests/Application/config/sylius/1.11/bundles.php index 40136dd..400b877 100644 --- a/tests/Application/config/sylius/1.11/bundles.php +++ b/tests/Application/config/sylius/1.11/bundles.php @@ -3,6 +3,7 @@ declare(strict_types=1); return [ + BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/sylius/1.9/bundles.php b/tests/Application/config/sylius/1.9/bundles.php index 645dcfe..66f523d 100644 --- a/tests/Application/config/sylius/1.9/bundles.php +++ b/tests/Application/config/sylius/1.9/bundles.php @@ -1,6 +1,7 @@ ['all' => true], SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true], Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true],