From 35d6c5805df6ea7059ac5a762e1e89e02d73a002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kali=C5=84ski?= Date: Mon, 15 Jul 2024 08:21:49 +0200 Subject: [PATCH 1/4] OP-367 Added Sylius 1.13 support --- .gitignore | 2 + composer.json | 12 +- .../1.11/packages/dev/jms_serializer.yaml | 12 -- .../sylius/1.11/packages/dev/swiftmailer.yaml | 2 - .../sylius/1.11/packages/jms_serializer.yaml | 4 - .../1.11/packages/prod/jms_serializer.yaml | 10 -- .../config/sylius/1.11/packages/security.yaml | 148 ------------------ .../sylius/1.11/packages/swiftmailer.yaml | 2 - .../1.11/packages/test/swiftmailer.yaml | 6 - .../packages/test_cached/swiftmailer.yaml | 6 - .../config/sylius/{1.11 => 1.13}/bundles.php | 3 +- .../sylius/1.13/packages/jms_serializer.yaml | 4 + .../config/sylius/1.13/packages/mailer.yaml | 4 + .../config/sylius/1.13/packages/security.yaml | 122 +++++++++++++++ .../sylius/1.13/packages/test/mailer.yaml | 7 + 15 files changed, 143 insertions(+), 201 deletions(-) delete mode 100644 tests/Application/config/sylius/1.11/packages/dev/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/prod/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/security.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/swiftmailer.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml rename tests/Application/config/sylius/{1.11 => 1.13}/bundles.php (76%) create mode 100644 tests/Application/config/sylius/1.13/packages/jms_serializer.yaml create mode 100644 tests/Application/config/sylius/1.13/packages/mailer.yaml create mode 100644 tests/Application/config/sylius/1.13/packages/security.yaml create mode 100644 tests/Application/config/sylius/1.13/packages/test/mailer.yaml diff --git a/.gitignore b/.gitignore index e6bb185..c68d75d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ /vendor +/node_modules/ +/composer.lock !tests/Application/web/app_test.php tests/Application/web/* diff --git a/composer.json b/composer.json index 7c70c06..570d458 100644 --- a/composer.json +++ b/composer.json @@ -15,14 +15,14 @@ ], "require": { "php": "^8.0", - "sylius/sylius": "~1.11.0 || ~1.12.0", + "sylius/sylius": "~1.12.0 || ~1.13.0", "openpayu/openpayu": "^2.2", "php-http/message-factory": "^1.1" }, "require-dev": { "symfony/webpack-encore-bundle": "^1.15", "behat/behat": "^3.7", - "behat/mink-selenium2-driver": "^1.4", + "behat/mink-selenium2-driver": "~1.6.0", "dmore/behat-chrome-extension": "^1.3", "dmore/chrome-mink-driver": "^2.7", "friends-of-behat/mink": "^1.8", @@ -42,17 +42,9 @@ "symfony/intl": "^5.4 || ^6.0", "symfony/web-profiler-bundle": "^6.0 || ^5.4", "vimeo/psalm": "4.16.1", - "symfony/dependency-injection": "<4.4.19 || ^5.2", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "bitbag/coding-standard": "^3.0" }, - "conflict": { - "symfony/symfony": "4.1.8", - "symfony/browser-kit": "4.1.8", - "symfony/dom-crawler": "4.1.8", - "symfony/routing": "4.1.8", - "symfony/doctrine-bridge": "4.4.16" - }, "prefer-stable": true, "autoload": { "psr-4": { 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 deleted file mode 100644 index 2f32a9b..0000000 --- a/tests/Application/config/sylius/1.11/packages/dev/jms_serializer.yaml +++ /dev/null @@ -1,12 +0,0 @@ -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/dev/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml deleted file mode 100644 index f438078..0000000 --- a/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - disable_delivery: true diff --git a/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml deleted file mode 100644 index ed7bc61..0000000 --- a/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index c288182..0000000 --- a/tests/Application/config/sylius/1.11/packages/prod/jms_serializer.yaml +++ /dev/null @@ -1,10 +0,0 @@ -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.11/packages/security.yaml b/tests/Application/config/sylius/1.11/packages/security.yaml deleted file mode 100644 index 1062810..0000000 --- a/tests/Application/config/sylius/1.11/packages/security.yaml +++ /dev/null @@ -1,148 +0,0 @@ -parameters: - sylius.security.admin_regex: "^/%sylius_admin.path_name%" - sylius.security.api_regex: "^/api" - sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|new-api|api/.*|api$|media/.*)[^/]++" - sylius.security.new_api_route: "/new-api" - sylius.security.new_api_regex: "^%sylius.security.new_api_route%" - sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin" - sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%" - sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop" - sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%" - -security: - always_authenticate_before_granting: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - - encoders: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - anonymous: true - - new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/admin-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/shop-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api: - pattern: "%sylius.security.new_api_regex%/*" - provider: sylius_api_chain_provider - stateless: true - anonymous: lazy - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - shop: - switch_user: { role: ROLE_ALLOWED_TO_SWITCH } - context: shop - pattern: "%sylius.security.shop_regex%" - provider: sylius_shop_user_provider - form_login: - success_handler: sylius.authentication.success_handler - failure_handler: sylius.authentication.failure_handler - provider: sylius_shop_user_provider - login_path: sylius_shop_login - check_path: sylius_shop_login_check - failure_path: sylius_shop_login - default_target_path: sylius_shop_homepage - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_login - invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.api_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml deleted file mode 100644 index 3bab0d3..0000000 --- a/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - url: '%env(MAILER_URL)%' diff --git a/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml deleted file mode 100644 index c438f4b..0000000 --- a/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swiftmailer: - disable_delivery: true - logging: true - spool: - type: file - path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml deleted file mode 100644 index c438f4b..0000000 --- a/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swiftmailer: - disable_delivery: true - logging: true - spool: - type: file - path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/config/sylius/1.11/bundles.php b/tests/Application/config/sylius/1.13/bundles.php similarity index 76% rename from tests/Application/config/sylius/1.11/bundles.php rename to tests/Application/config/sylius/1.13/bundles.php index 36ec962..c46220b 100644 --- a/tests/Application/config/sylius/1.11/bundles.php +++ b/tests/Application/config/sylius/1.13/bundles.php @@ -11,5 +11,6 @@ return [ SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], - Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], + League\FlysystemBundle\FlysystemBundle::class =>['all' => true], + Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/sylius/1.13/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.13/packages/jms_serializer.yaml new file mode 100644 index 0000000..fa43f5b --- /dev/null +++ b/tests/Application/config/sylius/1.13/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.13/packages/mailer.yaml b/tests/Application/config/sylius/1.13/packages/mailer.yaml new file mode 100644 index 0000000..225ed59 --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/mailer.yaml @@ -0,0 +1,4 @@ +framework: + mailer: + dsn: '%env(MAILER_DSN)%' + diff --git a/tests/Application/config/sylius/1.13/packages/security.yaml b/tests/Application/config/sylius/1.13/packages/security.yaml new file mode 100644 index 0000000..71d89cd --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/security.yaml @@ -0,0 +1,122 @@ +security: + enable_authenticator_manager: true + providers: + sylius_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_api_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + sylius_api_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + + password_hashers: + Sylius\Component\User\Model\UserInterface: argon2i + firewalls: + admin: + switch_user: true + context: admin + pattern: "%sylius.security.admin_regex%" + provider: sylius_admin_user_provider + form_login: + provider: sylius_admin_user_provider + login_path: sylius_admin_login + check_path: sylius_admin_login_check + failure_path: sylius_admin_login + default_target_path: sylius_admin_dashboard + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_admin_security_token + csrf_token_id: admin_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + path: "/%sylius_admin.path_name%" + name: APP_ADMIN_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_admin_logout + target: sylius_admin_login + + new_api_admin_user: + pattern: "%sylius.security.new_api_admin_regex%/.*" + provider: sylius_api_admin_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_admin_route%/authentication-token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + new_api_shop_user: + pattern: "%sylius.security.new_api_shop_regex%/.*" + provider: sylius_api_shop_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_shop_route%/authentication-token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + shop: + switch_user: { role: ROLE_ALLOWED_TO_SWITCH } + context: shop + pattern: "%sylius.security.shop_regex%" + provider: sylius_shop_user_provider + form_login: + success_handler: sylius.authentication.success_handler + failure_handler: sylius.authentication.failure_handler + provider: sylius_shop_user_provider + login_path: sylius_shop_login + check_path: sylius_shop_login_check + failure_path: sylius_shop_login + default_target_path: sylius_shop_homepage + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_shop_security_token + csrf_token_id: shop_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + name: APP_SHOP_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_shop_logout + target: sylius_shop_homepage + invalidate_session: false + + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + access_control: + - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } + - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } + + - { path: "%sylius.security.admin_regex%/forgotten-password", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } + - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } + + - { path: "%sylius.security.new_api_admin_route%/reset-password-requests", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } + - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } + - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/sylius/1.13/packages/test/mailer.yaml b/tests/Application/config/sylius/1.13/packages/test/mailer.yaml new file mode 100644 index 0000000..56cc28f --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/test/mailer.yaml @@ -0,0 +1,7 @@ +framework: + mailer: + dsn: 'null://null' + cache: + pools: + test.mailer_pool: + adapter: cache.adapter.filesystem From 92dddd1d7f138425bbdad53d35424f3a60fe1fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kali=C5=84ski?= Date: Mon, 15 Jul 2024 08:22:12 +0200 Subject: [PATCH 2/4] OP-367 Build has been updated --- .github/workflows/build.yml | 315 ++++++++++++++++++------------------ 1 file changed, 156 insertions(+), 159 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d79e63..0e3331a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,164 +1,161 @@ name: Build on: - push: - branches-ignore: - - 'dependabot/**' - pull_request: ~ - release: - types: [ created ] - schedule: - - cron: "0 1 * * 6" # Run at 1am every Saturday - workflow_dispatch: ~ + push: + branches-ignore: + - 'dependabot/**' + pull_request: ~ + release: + types: [ created ] + schedule: + - cron: "0 1 * * 6" # Run at 1am every Saturday + workflow_dispatch: ~ jobs: - tests: - runs-on: ubuntu-22.04 - - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" - - strategy: - fail-fast: false - matrix: - php: [ "8.0" ] - symfony: [ "^5.4", "^6.0" ] - sylius: [ "~1.11.0", "~1.12.0" ] - node: [ "^14.17.x" ] - mysql: [ "5.7", "8.0" ] - - exclude: - - sylius: ~1.11.0 - symfony: "^6.0" - env: - APP_ENV: test - DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" - - steps: - - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - extensions: intl - tools: symfony - coverage: none - - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: "${{ matrix.node }}" - - - name: Shutdown default MySQL - run: sudo service mysql stop - - - name: Setup MySQL - uses: mirromutth/mysql-action@v1.1 - with: - mysql version: "${{ matrix.mysql }}" - mysql root password: "root" - - - name: Configure sysctl limits - run: | - sudo swapoff -a - sudo sysctl -w vm.swappiness=1 - sudo sysctl -w fs.file-max=262144 - sudo sysctl -w vm.max_map_count=262144 - - - name: Runs Elasticsearch - uses: elastic/elastic-github-actions/elasticsearch@master - with: - stack-version: 7.16.3 - - - name: Output PHP version for Symfony CLI - run: php -v | head -n 1 | awk '{ print $2 }' > .php-version - - - name: Install certificates - run: symfony server:ca:install - - - name: Run Chrome Headless - run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 & - - - name: Run webserver - run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon) - - - name: Get Composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache Composer - uses: actions/cache@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-composer- - - - name: Restrict Symfony version - if: matrix.symfony != '' - run: | - composer global config --no-plugins allow-plugins.symfony/flex true - composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" - composer config extra.symfony.require "${{ matrix.symfony }}" - - - name: Restrict Sylius version - if: matrix.sylius != '' - run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction - - - name: Install PHP dependencies - run: composer install --no-interaction --no-scripts - - - name: Get Yarn cache directory - id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: Cache Yarn - uses: actions/cache@v2 - with: - path: ${{ steps.yarn-cache.outputs.dir }} - key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.node }}-yarn- - - - name: Install JS dependencies - run: (cd tests/Application && yarn install) - - - name: Prepare test application database - run: | - (cd tests/Application && bin/console doctrine:database:create -vvv) - (cd tests/Application && bin/console doctrine:schema:create -vvv) - - - name: Prepare test application assets - run: | - (cd tests/Application && bin/console assets:install public -vvv) - (cd tests/Application && yarn encore dev) - - - name: Prepare test application cache - run: (cd tests/Application && bin/console cache:warmup -vvv) - - - name: Load fixtures in test application - run: (cd tests/Application && bin/console sylius:fixtures:load -n) - - - name: Validate composer.json - run: composer validate --ansi --strict - - - name: Validate database schema - run: (cd tests/Application && bin/console doctrine:schema:validate) - - - name: Run PHPSpec - run: vendor/bin/phpspec run --ansi -f progress --no-interaction - - - name: Run Behat - run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun - - - name: Failed build Slack notification - uses: rtCamp/action-slack-notify@v2 - if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} - env: - SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }} - SLACK_COLOR: ${{ job.status }} - SLACK_ICON: https://github.com/rtCamp.png?size=48 - SLACK_MESSAGE: ':x:' - SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository - SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} - SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} + tests: + runs-on: ubuntu-22.04 + + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" + + strategy: + fail-fast: false + matrix: + php: [ "8.0", "8.1", "8.2", "8.3" ] + symfony: [ "^5.4", "^6.0" ] + sylius: [ "~1.12.0", "~1.13.0" ] + node: [ "^14.17.x" ] + mysql: [ "5.7", "8.0" ] + + env: + APP_ENV: test + DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" + + steps: + - uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php }}" + extensions: intl + tools: symfony + coverage: none + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "${{ matrix.node }}" + + - name: Shutdown default MySQL + run: sudo service mysql stop + + - name: Setup MySQL + uses: mirromutth/mysql-action@v1.1 + with: + mysql version: "${{ matrix.mysql }}" + mysql root password: "root" + + - name: Configure sysctl limits + run: | + sudo swapoff -a + sudo sysctl -w vm.swappiness=1 + sudo sysctl -w fs.file-max=262144 + sudo sysctl -w vm.max_map_count=262144 + + - name: Runs Elasticsearch + uses: elastic/elastic-github-actions/elasticsearch@master + with: + stack-version: 7.16.3 + + - name: Output PHP version for Symfony CLI + run: php -v | head -n 1 | awk '{ print $2 }' > .php-version + + - name: Install certificates + run: symfony server:ca:install + + - name: Run Chrome Headless + run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 & + + - name: Run webserver + run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon) + + - name: Get Composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-composer- + + - name: Restrict Symfony version + if: matrix.symfony != '' + run: | + composer global config --no-plugins allow-plugins.symfony/flex true + composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" + composer config extra.symfony.require "${{ matrix.symfony }}" + + - name: Restrict Sylius version + if: matrix.sylius != '' + run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction + + - name: Install PHP dependencies + run: composer install --no-interaction --no-scripts + + - name: Get Yarn cache directory + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Cache Yarn + uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node }}-yarn- + + - name: Install JS dependencies + run: (cd tests/Application && yarn install) + + - name: Prepare test application database + run: | + (cd tests/Application && bin/console doctrine:database:create -vvv) + (cd tests/Application && bin/console doctrine:schema:create -vvv) + + - name: Prepare test application assets + run: | + (cd tests/Application && bin/console assets:install public -vvv) + (cd tests/Application && yarn encore dev) + + - name: Prepare test application cache + run: (cd tests/Application && bin/console cache:warmup -vvv) + + - name: Load fixtures in test application + run: (cd tests/Application && bin/console sylius:fixtures:load -n) + + - name: Validate composer.json + run: composer validate --ansi --strict + + - name: Validate database schema + run: (cd tests/Application && bin/console doctrine:schema:validate) + + - name: Run PHPSpec + run: vendor/bin/phpspec run --ansi -f progress --no-interaction + + - name: Run Behat + run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun + + - name: Failed build Slack notification + uses: rtCamp/action-slack-notify@v2 + if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} + env: + SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }} + SLACK_COLOR: ${{ job.status }} + SLACK_ICON: https://github.com/rtCamp.png?size=48 + SLACK_MESSAGE: ':x:' + SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository + SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} + SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} From cfba60844caca7de7c7e1cbe1c8c3d9295b86ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kali=C5=84ski?= Date: Mon, 15 Jul 2024 08:25:05 +0200 Subject: [PATCH 3/4] OP-367 Added ECS fixes --- src/Exception/PayUResponseException.php | 2 -- tests/Behat/Context/Setup/PayUContext.php | 10 +++++----- tests/Behat/Context/Ui/PayUContext.php | 10 +++++----- tests/Behat/Mocker/OpenPyUBridge.php | 4 ++-- tests/Behat/Mocker/PayUApiMocker.php | 7 ++----- tests/Behat/Page/External/PayUCheckoutPage.php | 4 ++-- 6 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/Exception/PayUResponseException.php b/src/Exception/PayUResponseException.php index cdfe200..e79cca3 100644 --- a/src/Exception/PayUResponseException.php +++ b/src/Exception/PayUResponseException.php @@ -11,8 +11,6 @@ namespace BitBag\SyliusPayUPlugin\Exception; use Exception; -use Payum\Core\Exception\Http\HttpException; -use Symfony\Component\HttpKernel\Event\ExceptionEvent; final class PayUResponseException extends Exception { diff --git a/tests/Behat/Context/Setup/PayUContext.php b/tests/Behat/Context/Setup/PayUContext.php index 410fcab..7ba96ec 100644 --- a/tests/Behat/Context/Setup/PayUContext.php +++ b/tests/Behat/Context/Setup/PayUContext.php @@ -44,7 +44,7 @@ public function __construct( SharedStorageInterface $sharedStorage, PaymentMethodRepositoryInterface $paymentMethodRepository, ExampleFactoryInterface $paymentMethodExampleFactory, - ObjectManager $paymentMethodManager + ObjectManager $paymentMethodManager, ) { $this->sharedStorage = $sharedStorage; $this->paymentMethodRepository = $paymentMethodRepository; @@ -57,7 +57,7 @@ public function __construct( */ public function theStoreHasAPaymentMethodWithACodeAndPayuCheckoutGateway( string $paymentMethodName, - string $paymentMethodCode + string $paymentMethodCode, ): void { $paymentMethod = $this->createPaymentMethod($paymentMethodName, $paymentMethodCode, 'PayU Checkout'); $paymentMethod->getGatewayConfig()->setConfig( @@ -68,7 +68,7 @@ public function theStoreHasAPaymentMethodWithACodeAndPayuCheckoutGateway( 'oauth_client_id' => 'CLIENT_ID', 'oauth_client_secret' => 'SECRET', 'payum.http_client' => '@sylius.payum.http_client', - ] + ], ); $this->paymentMethodManager->persist($paymentMethod); $this->paymentMethodManager->flush(); @@ -79,7 +79,7 @@ private function createPaymentMethod( string $code, string $description = '', bool $addForCurrentChannel = true, - ?int $position = null + ?int $position = null, ): PaymentMethodInterface { /** @var PaymentMethodInterface $paymentMethod */ $paymentMethod = $this->paymentMethodExampleFactory->create( @@ -92,7 +92,7 @@ private function createPaymentMethod( 'enabled' => true, 'channels' => ($addForCurrentChannel && $this->sharedStorage->has('channel')) ? [$this->sharedStorage->get('channel')] : [], - ] + ], ); if (null !== $position) { diff --git a/tests/Behat/Context/Ui/PayUContext.php b/tests/Behat/Context/Ui/PayUContext.php index 7594af0..7f8bace 100644 --- a/tests/Behat/Context/Ui/PayUContext.php +++ b/tests/Behat/Context/Ui/PayUContext.php @@ -36,7 +36,7 @@ public function __construct( PayUApiMocker $payUApiMocker, ShowPageInterface $orderDetails, CompletePageInterface $summaryPage, - PayUCheckoutPageInterface $payUCheckoutPage + PayUCheckoutPageInterface $payUCheckoutPage, ) { $this->orderDetails = $orderDetails; $this->summaryPage = $summaryPage; @@ -53,7 +53,7 @@ public function iConfirmMyOrderWithPayUPayment(): void $this->payUApiMocker->mockApiSuccessfulPaymentResponse( function () { $this->summaryPage->confirmOrder(); - } + }, ); } @@ -65,7 +65,7 @@ public function iSignInToPayUAndPaySuccessfully(): void $this->payUApiMocker->completedPayment( function () { $this->payUCheckoutPage->pay(); - } + }, ); } @@ -78,7 +78,7 @@ public function iCancelMyPayUPayment(): void $this->payUApiMocker->canceledPayment( function () { $this->payUCheckoutPage->cancel(); - } + }, ); } @@ -90,7 +90,7 @@ public function iTryToPayAgainWithPayUPayment(): void $this->payUApiMocker->mockApiSuccessfulPaymentResponse( function () { $this->orderDetails->pay(); - } + }, ); } } diff --git a/tests/Behat/Mocker/OpenPyUBridge.php b/tests/Behat/Mocker/OpenPyUBridge.php index d1d5591..b8f5268 100644 --- a/tests/Behat/Mocker/OpenPyUBridge.php +++ b/tests/Behat/Mocker/OpenPyUBridge.php @@ -31,7 +31,7 @@ public function setAuthorizationData( string $signatureKey, string $posId, string $clientId, - string $clientSecret + string $clientSecret, ): void { $this->container ->get('bitbag.payu_plugin.bridge.open_payu') @@ -40,7 +40,7 @@ public function setAuthorizationData( $signatureKey, $posId, $clientId, - $clientSecret + $clientSecret, ) ; } diff --git a/tests/Behat/Mocker/PayUApiMocker.php b/tests/Behat/Mocker/PayUApiMocker.php index 5016a1b..fe67598 100644 --- a/tests/Behat/Mocker/PayUApiMocker.php +++ b/tests/Behat/Mocker/PayUApiMocker.php @@ -44,7 +44,7 @@ public function completedPayment(callable $action): void ->mockService('bitbag.payu_plugin.bridge.open_payu', OpenPayUBridgeInterface::class); $service->shouldReceive('retrieve')->andReturn( - $this->getDataRetrieve(OpenPayUBridge::COMPLETED_API_STATUS) + $this->getDataRetrieve(OpenPayUBridge::COMPLETED_API_STATUS), ); $service->shouldReceive('create')->andReturn($this->createResponseSuccessfulApi()); $service->shouldReceive('setAuthorizationData'); @@ -60,7 +60,7 @@ public function canceledPayment(callable $action): void ->mockService('bitbag.payu_plugin.bridge.open_payu', OpenPayUBridgeInterface::class); $service->shouldReceive('retrieve')->andReturn( - $this->getDataRetrieve(OpenPayUBridge::CANCELED_API_STATUS) + $this->getDataRetrieve(OpenPayUBridge::CANCELED_API_STATUS), ); $service->shouldReceive('create')->andReturn($this->createResponseSuccessfulApi()); $service->shouldReceive('setAuthorizationData'); @@ -70,9 +70,6 @@ public function canceledPayment(callable $action): void $this->mocker->unmockAll(); } - /** - * @param $statusPayment - */ private function getDataRetrieve($statusPayment): OpenPayU_Result { $openPayUResult = new OpenPayU_Result(); diff --git a/tests/Behat/Page/External/PayUCheckoutPage.php b/tests/Behat/Page/External/PayUCheckoutPage.php index bb074e8..ef71513 100644 --- a/tests/Behat/Page/External/PayUCheckoutPage.php +++ b/tests/Behat/Page/External/PayUCheckoutPage.php @@ -31,7 +31,7 @@ public function __construct(Session $session, $parameters, RepositoryInterface $ } /** - * {@inheritdoc} + * @inheritdoc */ public function pay() { @@ -39,7 +39,7 @@ public function pay() } /** - * {@inheritdoc} + * @inheritdoc */ public function cancel() { From 35c38b467a1739380f5407c1b96b30901cbb963b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kali=C5=84ski?= Date: Mon, 15 Jul 2024 11:20:41 +0200 Subject: [PATCH 4/4] OP-367 Added composer conflict --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 570d458..471e6f5 100644 --- a/composer.json +++ b/composer.json @@ -45,6 +45,9 @@ "polishsymfonycommunity/symfony-mocker-container": "^1.0", "bitbag/coding-standard": "^3.0" }, + "conflict": { + "doctrine/persistence": "<3.0" + }, "prefer-stable": true, "autoload": { "psr-4": {