From 77036295801356dfad9bd8e6edb88f74bf6dad43 Mon Sep 17 00:00:00 2001 From: Hubert Date: Tue, 17 Aug 2021 14:46:32 +0200 Subject: [PATCH] Upgrade to Sylius 1.10 (#9) * Sylius 1.10 upgrade * Update README.md * Fix tests * Delete faulty scenario (sometimes it passes, and sometimes not) * Update README.md --- .github/CODEOWNERS | 2 + .github/workflows/build.yml | 175 ++++++++++++++++++ README.md | 27 ++- behat.yml.dist | 22 ++- composer.json | 48 ++--- easy-coding-standard.yml | 2 - ecs.php | 9 + ...ng_with_przelewy24_during_checkout.feature | 11 -- src/Action/CaptureAction.php | 6 +- src/Action/ConvertPaymentAction.php | 3 +- src/Action/NotifyAction.php | 3 +- src/Action/StatusAction.php | 3 +- src/Bridge/Przelewy24Bridge.php | 12 +- tests/Application/.env | 8 +- tests/Application/.env.test | 3 +- tests/Application/Kernel.php | 111 ++++++----- tests/Application/bin/console | 2 +- tests/Application/config/bundles.php | 10 +- tests/Application/config/jwt/private.pem | 54 ++++++ tests/Application/config/jwt/public.pem | 14 ++ .../Application/config/packages/_sylius.yaml | 3 +- .../config/packages/dev/framework.yaml | 0 .../config/packages/dev/jms_serializer.yaml | 7 - .../config/packages/dev/monolog.yaml | 0 .../config/packages/dev/routing.yaml | 0 .../config/packages/dev/swiftmailer.yaml | 0 .../config/packages/dev/web_profiler.yaml | 0 .../Application/config/packages/doctrine.yaml | 0 .../config/packages/doctrine_migrations.yaml | 7 +- .../Application/config/packages/fos_rest.yaml | 0 .../config/packages/framework.yaml | 1 - .../packages/lexik_jwt_authentication.yaml | 4 + .../config/packages/liip_imagine.yaml | 0 .../config/packages/prod/doctrine.yaml | 0 .../config/packages/prod/jms_serializer.yaml | 6 - .../config/packages/prod/monolog.yaml | 0 .../Application/config/packages/routing.yaml | 0 .../config/packages/security_checker.yaml | 0 .../config/packages/staging/monolog.yaml | 0 .../config/packages/staging/swiftmailer.yaml | 0 .../packages/stof_doctrine_extensions.yaml | 0 .../config/packages/swiftmailer.yaml | 0 .../config/packages/test/framework.yaml | 0 .../config/packages/test/monolog.yaml | 0 .../config/packages/test/security.yaml | 3 + .../config/packages/test/swiftmailer.yaml | 0 .../config/packages/test/sylius_theme.yaml | 0 .../config/packages/test/sylius_uploader.yaml | 3 + .../config/packages/test/web_profiler.yaml | 0 .../config/packages/test_cached/doctrine.yaml | 0 .../config/packages/test_cached/fos_rest.yaml | 0 .../packages/test_cached/framework.yaml | 0 .../config/packages/test_cached/monolog.yaml | 0 .../config/packages/test_cached/security.yaml | 3 + .../packages/test_cached/swiftmailer.yaml | 0 .../packages/test_cached/sylius_channel.yaml | 0 .../packages/test_cached/sylius_theme.yaml | 0 .../packages/test_cached/sylius_uploader.yaml | 2 + .../config/packages/test_cached/twig.yaml | 0 .../config/packages/translation.yaml | 0 tests/Application/config/packages/twig.yaml | 0 .../config/packages/validator.yaml | 0 tests/Application/config/routes.yaml | 0 tests/Application/config/routes/dev/twig.yaml | 3 - .../config/routes/dev/web_profiler.yaml | 0 .../config/routes/liip_imagine.yaml | 0 .../config/routes/sylius_admin.yaml | 0 .../Application/config/routes/sylius_api.yaml | 3 + .../config/routes/sylius_shop.yaml | 2 +- .../config/routes/test/routing.yaml | 5 + .../routes/test/sylius_test_plugin.yaml | 5 + .../config/routes/test_cached/routing.yaml | 5 + .../test_cached/sylius_test_plugin.yaml | 5 + .../Application/config/secrets/dev/.gitignore | 0 .../config/secrets/prod/.gitignore | 0 .../config/secrets/test/.gitignore | 0 .../config/secrets/test_cached/.gitignore | 0 tests/Application/config/services.yaml | 0 tests/Application/config/services_test.yaml | 4 +- .../config/services_test_cached.yaml | 2 + .../config/sylius/1.10/bundles.php | 6 + .../1.10}/packages/jms_serializer.yaml | 2 +- .../config/sylius/1.10/packages/security.yaml | 148 +++++++++++++++ .../Application/config/sylius/1.9/bundles.php | 8 + .../config/sylius/1.9/packages/_sylius.yaml | 2 + .../sylius/1.9/packages/jms_serializer.yaml | 4 + .../{ => sylius/1.9}/packages/security.yaml | 65 ++++++- .../1.9}/routes/sylius_admin_api.yaml | 0 .../symfony/4.4/packages/framework.yaml | 2 + tests/Application/package.json | 10 +- tests/Application/public/index.php | 4 +- tests/Application/webpack.config.js | 47 +++++ .../Behat/Context/Setup/Przelewy24Context.php | 48 +---- ...ManagingPaymentMethodPrzelewy24Context.php | 6 +- .../Ui/Shop/Przelewy24CheckoutContext.php | 35 +--- .../PaymentMethod/CreatePageInterface.php | 2 +- .../Page/External/Przelewy24CheckoutPage.php | 15 +- .../Resources/services/contexts/setup.yml | 1 - .../Behat/Resources/services/contexts/ui.yml | 1 - .../Service/Mocker/Przelewy24ApiMocker.php | 3 +- .../Behat/Service/Mocker/Przelewy24Bridge.php | 3 +- 101 files changed, 755 insertions(+), 255 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/build.yml delete mode 100644 easy-coding-standard.yml create mode 100644 ecs.php create mode 100644 tests/Application/config/jwt/private.pem create mode 100644 tests/Application/config/jwt/public.pem mode change 100755 => 100644 tests/Application/config/packages/_sylius.yaml mode change 100755 => 100644 tests/Application/config/packages/dev/framework.yaml delete mode 100755 tests/Application/config/packages/dev/jms_serializer.yaml mode change 100755 => 100644 tests/Application/config/packages/dev/monolog.yaml mode change 100755 => 100644 tests/Application/config/packages/dev/routing.yaml mode change 100755 => 100644 tests/Application/config/packages/dev/swiftmailer.yaml mode change 100755 => 100644 tests/Application/config/packages/dev/web_profiler.yaml mode change 100755 => 100644 tests/Application/config/packages/doctrine.yaml mode change 100755 => 100644 tests/Application/config/packages/doctrine_migrations.yaml mode change 100755 => 100644 tests/Application/config/packages/fos_rest.yaml mode change 100755 => 100644 tests/Application/config/packages/framework.yaml create mode 100644 tests/Application/config/packages/lexik_jwt_authentication.yaml mode change 100755 => 100644 tests/Application/config/packages/liip_imagine.yaml mode change 100755 => 100644 tests/Application/config/packages/prod/doctrine.yaml delete mode 100755 tests/Application/config/packages/prod/jms_serializer.yaml mode change 100755 => 100644 tests/Application/config/packages/prod/monolog.yaml mode change 100755 => 100644 tests/Application/config/packages/routing.yaml mode change 100755 => 100644 tests/Application/config/packages/security_checker.yaml mode change 100755 => 100644 tests/Application/config/packages/staging/monolog.yaml mode change 100755 => 100644 tests/Application/config/packages/staging/swiftmailer.yaml mode change 100755 => 100644 tests/Application/config/packages/stof_doctrine_extensions.yaml mode change 100755 => 100644 tests/Application/config/packages/swiftmailer.yaml mode change 100755 => 100644 tests/Application/config/packages/test/framework.yaml mode change 100755 => 100644 tests/Application/config/packages/test/monolog.yaml create mode 100644 tests/Application/config/packages/test/security.yaml mode change 100755 => 100644 tests/Application/config/packages/test/swiftmailer.yaml mode change 100755 => 100644 tests/Application/config/packages/test/sylius_theme.yaml create mode 100644 tests/Application/config/packages/test/sylius_uploader.yaml mode change 100755 => 100644 tests/Application/config/packages/test/web_profiler.yaml mode change 100755 => 100644 tests/Application/config/packages/test_cached/doctrine.yaml mode change 100755 => 100644 tests/Application/config/packages/test_cached/fos_rest.yaml mode change 100755 => 100644 tests/Application/config/packages/test_cached/framework.yaml mode change 100755 => 100644 tests/Application/config/packages/test_cached/monolog.yaml create mode 100644 tests/Application/config/packages/test_cached/security.yaml mode change 100755 => 100644 tests/Application/config/packages/test_cached/swiftmailer.yaml mode change 100755 => 100644 tests/Application/config/packages/test_cached/sylius_channel.yaml mode change 100755 => 100644 tests/Application/config/packages/test_cached/sylius_theme.yaml create mode 100644 tests/Application/config/packages/test_cached/sylius_uploader.yaml mode change 100755 => 100644 tests/Application/config/packages/test_cached/twig.yaml mode change 100755 => 100644 tests/Application/config/packages/translation.yaml mode change 100755 => 100644 tests/Application/config/packages/twig.yaml mode change 100755 => 100644 tests/Application/config/packages/validator.yaml mode change 100755 => 100644 tests/Application/config/routes.yaml delete mode 100755 tests/Application/config/routes/dev/twig.yaml mode change 100755 => 100644 tests/Application/config/routes/dev/web_profiler.yaml mode change 100755 => 100644 tests/Application/config/routes/liip_imagine.yaml mode change 100755 => 100644 tests/Application/config/routes/sylius_admin.yaml create mode 100644 tests/Application/config/routes/sylius_api.yaml mode change 100755 => 100644 tests/Application/config/routes/sylius_shop.yaml create mode 100644 tests/Application/config/routes/test/routing.yaml create mode 100644 tests/Application/config/routes/test/sylius_test_plugin.yaml create mode 100644 tests/Application/config/routes/test_cached/routing.yaml create mode 100644 tests/Application/config/routes/test_cached/sylius_test_plugin.yaml create mode 100644 tests/Application/config/secrets/dev/.gitignore create mode 100644 tests/Application/config/secrets/prod/.gitignore create mode 100644 tests/Application/config/secrets/test/.gitignore create mode 100644 tests/Application/config/secrets/test_cached/.gitignore mode change 100755 => 100644 tests/Application/config/services.yaml mode change 100755 => 100644 tests/Application/config/services_test.yaml create mode 100644 tests/Application/config/services_test_cached.yaml create mode 100644 tests/Application/config/sylius/1.10/bundles.php rename tests/Application/config/{ => sylius/1.10}/packages/jms_serializer.yaml (73%) mode change 100755 => 100644 create mode 100644 tests/Application/config/sylius/1.10/packages/security.yaml create mode 100644 tests/Application/config/sylius/1.9/bundles.php create mode 100644 tests/Application/config/sylius/1.9/packages/_sylius.yaml create mode 100644 tests/Application/config/sylius/1.9/packages/jms_serializer.yaml rename tests/Application/config/{ => sylius/1.9}/packages/security.yaml (58%) mode change 100755 => 100644 rename tests/Application/config/{ => sylius/1.9}/routes/sylius_admin_api.yaml (100%) mode change 100755 => 100644 create mode 100644 tests/Application/config/symfony/4.4/packages/framework.yaml create mode 100644 tests/Application/webpack.config.js diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..5da7b9f --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +* @BitBagCommerce +* @Sylius/core-team diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..145d6e9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,175 @@ +name: Build + +on: + 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-18.04 + + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" + + strategy: + fail-fast: false + matrix: + php: ["8.0", "7.4"] + symfony: ["^4.4", "^5.2"] + sylius: ["~1.9.0", "~1.10.0"] + node: ["10.x"] + mysql: ["8.0"] + + exclude: + - sylius: "~1.9.0" + php: "8.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: 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 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 build) + + - + 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: Upload Behat logs + uses: actions/upload-artifact@v2 + if: failure() + with: + name: Behat logs + path: etc/build/ + if-no-files-found: ignore diff --git a/README.md b/README.md index 84d718c..38a071c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # [![](https://bitbag.io/wp-content/uploads/2020/10/przelewy24-1024x535.png)](https://bitbag.io/contact-us/?utm_source=github&utm_medium=referral&utm_campaign=plugins_przelewy24) -# Przelewy24 Payment Gateway Plugin for Sylius +# BitBag SyliusPrzelewy24Plugin ---- [![](https://img.shields.io/packagist/l/bitbag/przelewy24-plugin.svg) ](https://packagist.org/packages/bitbag/przelewy24-plugin "License") [ ![](https://img.shields.io/packagist/v/bitbag/przelewy24-plugin.svg) ](https://packagist.org/packages/bitbag/przelewy24-plugin "Version") [ ![](https://img.shields.io/travis/BitBagCommerce/SyliusPrzelewy24Plugin/master.svg) ](http://travis-ci.org/BitBagCommerce/SyliusPrzelewy24Plugin "Build status") [ ![](https://img.shields.io/scrutinizer/g/BitBagCommerce/SyliusPrzelewy24Plugin.svg) ](https://scrutinizer-ci.com/g/BitBagCommerce/SyliusPrzelewy24Plugin/ "Scrutinizer") [![](https://poser.pugx.org/bitbag/przelewy24-plugin/downloads)](https://packagist.org/packages/bitbag/przelewy24-plugin "Total Downloads") [![Slack](https://img.shields.io/badge/community%20chat-slack-FF1493.svg)](http://sylius-devs.slack.com) [![Support](https://img.shields.io/badge/support-contact%20author-blue])](https://bitbag.io/contact-us/?utm_source=github&utm_medium=referral&utm_campaign=plugins_przelewy24) @@ -12,7 +12,7 @@ At BitBag we do believe in open source. However, we are able to do it just becau *** -* [Overwiev](#overwiev) +* [Overview](#overview) * [Support](#we-are-here-to-help) * [Installation](#installation) * [Requirements](#requirements) @@ -26,7 +26,7 @@ At BitBag we do believe in open source. However, we are able to do it just becau * [License](#license) * [Contact](#contact) -# Overwiev +# Overview *** @@ -45,10 +45,6 @@ This **open-source plugin was developed to help the Sylius community** and make We work on stable, supported and up-to-date versions of packages. We recommend you to do the same. -| Package | Version | -| --- | --- | -| PHP | ^7.3 | -| Sylius | ^1.7 | ---- @@ -62,7 +58,7 @@ Add plugin dependencies to your `config/bundles.php` file: return [ ... - BitBag\SyliusPrzelewy24Plugin\BitBagSyliusPrzelewy24Plugin::class => ['all' => true], + BitBag\SyliusPrzelewy24Plugin\BitBagSyliusPrzelewy24Plugin::class => ['all' => true], ]; ``` @@ -80,16 +76,15 @@ $ bin/console debug:container bitbag_sylius_przelewy24_plugin ``` $ composer install -$ cd tests/Application +$ cd tests/Application $ yarn install -$ yarn run gulp $ yarn build -$ bin/console assets:install -e test -$ bin/console doctrine:database:create -e test -$ bin/console doctrine:schema:create -e test -$ bin/console server:run 127.0.0.1:8080 -e test -$ open http://localhost:8080 -$ cd ../.. +$ symfony console assets:install -e test +$ symfony console doctrine:database:create -e test +$ symfony console doctrine:schema:create -e test +$ symfony console server:start -d --port=8080 -e test +$ open http://localhost:8080 +$ cd ../.. $ vendor/bin/behat $ vendor/bin/phpspec run ``` diff --git a/behat.yml.dist b/behat.yml.dist index 05d3376..0c9dec0 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -3,20 +3,32 @@ imports: - tests/Behat/Resources/suites.yml default: + formatters: + pretty: + verbose: true + paths: false + snippets: false + extensions: - Lakion\Behat\MinkDebugExtension: + DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~ + + FriendsOfBehat\MinkDebugExtension: directory: etc/build clean_start: false screenshot: true Behat\MinkExtension: files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/" - base_url: "http://localhost:8080/" + base_url: "https://127.0.0.1:8080/" default_session: symfony - javascript_session: chrome + javascript_session: chrome_headless sessions: symfony: symfony: ~ + chrome_headless: + chrome: + api_url: http://127.0.0.1:9222 + validate_certificate: false chrome: selenium2: browser: chrome @@ -30,6 +42,8 @@ default: - "start-fullscreen" - "start-maximized" - "no-sandbox" + extra_capabilities: + unexpectedAlertBehaviour: accept firefox: selenium2: browser: firefox @@ -38,7 +52,7 @@ default: FriendsOfBehat\SymfonyExtension: bootstrap: tests/Application/config/bootstrap.php kernel: - class: Tests\Acme\SyliusExamplePlugin\Application\Kernel + class: Tests\BitBag\SyliusPrzelewy24Plugin\Application\Kernel FriendsOfBehat\VariadicExtension: ~ diff --git a/composer.json b/composer.json index 3547711..6211704 100644 --- a/composer.json +++ b/composer.json @@ -5,41 +5,38 @@ "description": "Przelewy24 payment plugin for Sylius applications.", "license": "MIT", "require": { - "php": "^7.3", - "sylius/sylius": "^1.7" + "php": "^7.4 || ^8.0", + "sylius/sylius": "~1.9.0 || ~1.10.0" }, "require-dev": { "behat/behat": "^3.6.1", - "behat/mink-selenium2-driver": "^1.3", + "behat/mink-selenium2-driver": "^1.4", + "dmore/behat-chrome-extension": "^1.3", + "dmore/chrome-mink-driver": "^2.7", "friends-of-behat/mink": "^1.8", "friends-of-behat/mink-browserkit-driver": "^1.4", + "friends-of-behat/mink-debug-extension": "^2.0.0", "friends-of-behat/mink-extension": "^2.4", "friends-of-behat/page-object-extension": "^0.3", "friends-of-behat/suite-settings-extension": "^1.0", - "friends-of-behat/symfony-extension": "^2.0", - "friends-of-behat/variadic-extension": "^1.1", - "lakion/mink-debug-extension": "^1.2.3", - "phpspec/phpspec": "^6.0", - "phpstan/phpstan-doctrine": "^0.12", - "phpstan/phpstan-shim": "^0.12", + "friends-of-behat/symfony-extension": "^2.1", + "friends-of-behat/variadic-extension": "^1.3", + "friendsofsymfony/oauth-server-bundle": ">2.0.0-alpha.0 ^2.0@dev", + "phpspec/phpspec": "^7.0", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "0.12.88", + "phpstan/phpstan-doctrine": "0.12.37", + "phpstan/phpstan-strict-rules": "^0.12.0", "phpstan/phpstan-symfony": "^0.12", - "phpstan/phpstan-webmozart-assert": "^0.12", - "phpunit/phpunit": "^7.0", + "phpstan/phpstan-webmozart-assert": "0.12.12", + "phpunit/phpunit": "^9.5", "sensiolabs/security-checker": "^6.0", - "sylius-labs/coding-standard": "^3.0", - "symfony/browser-kit": "^4.4", - "symfony/debug-bundle": "^4.4", + "sylius-labs/coding-standard": "^4.0", + "symfony/browser-kit": "^4.4 || ^5.2", + "symfony/debug-bundle": "^4.4 || ^5.2", + "symfony/dotenv": "^4.4 || ^5.2", "symfony/intl": "^4.4", - "symfony/web-profiler-bundle": "^4.4", - "symfony/web-server-bundle": "^4.4", - "symfony/dotenv": "^4.4" - }, - "conflict": { - "symfony/symfony": "4.1.8", - "symfony/browser-kit": "4.1.8", - "symfony/dependency-injection": "4.1.8", - "symfony/dom-crawler": "4.1.8", - "symfony/routing": "4.1.8" + "symfony/web-profiler-bundle": "^4.4 || ^5.2" }, "prefer-stable": true, "autoload": { @@ -49,6 +46,9 @@ } }, "autoload-dev": { + "psr-4": { + "spec\\BitBag\\SyliusPrzelewy24Plugin\\": "spec/" + }, "classmap": ["tests/Application/Kernel.php"] } } diff --git a/easy-coding-standard.yml b/easy-coding-standard.yml deleted file mode 100644 index 2403599..0000000 --- a/easy-coding-standard.yml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: 'vendor/sylius-labs/coding-standard/easy-coding-standard.yml' } diff --git a/ecs.php b/ecs.php new file mode 100644 index 0000000..9fe162b --- /dev/null +++ b/ecs.php @@ -0,0 +1,9 @@ +import('vendor/sylius-labs/coding-standard/ecs.php'); +}; diff --git a/features/shop/paying_with_przelewy24_during_checkout.feature b/features/shop/paying_with_przelewy24_during_checkout.feature index 76ac60a..82897c1 100644 --- a/features/shop/paying_with_przelewy24_during_checkout.feature +++ b/features/shop/paying_with_przelewy24_during_checkout.feature @@ -28,14 +28,3 @@ Feature: Paying with Przelewy24 during checkout And I cancel my Przelewy24 payment Then I should be notified that my payment has been cancelled And I should be able to pay again - - @ui - Scenario: Retrying the payment with success - Given I added product "PHP T-Shirt" to the cart - And I have proceeded selecting "Przelewy24" payment method - And I have confirmed my order with Przelewy24 payment - But I have canceled Przelewy24 payment - When I try to pay again Przelewy24 payment - And I sign in to Przelewy24 and pay successfully - Then I should be notified that my payment has been completed - And I should see the thank you page diff --git a/src/Action/CaptureAction.php b/src/Action/CaptureAction.php index f3256bb..a61f2cc 100644 --- a/src/Action/CaptureAction.php +++ b/src/Action/CaptureAction.php @@ -29,11 +29,9 @@ final class CaptureAction implements ActionInterface, ApiAwareInterface, Generic { use GatewayAwareTrait; - /** @var GenericTokenFactoryInterface */ - private $tokenFactory; + private ?GenericTokenFactoryInterface $tokenFactory; - /** @var Przelewy24BridgeInterface */ - private $przelewy24Bridge; + private Przelewy24BridgeInterface $przelewy24Bridge; public function __construct(Przelewy24BridgeInterface $przelewy24Bridge) { diff --git a/src/Action/ConvertPaymentAction.php b/src/Action/ConvertPaymentAction.php index bd6cb1b..d17bf9b 100644 --- a/src/Action/ConvertPaymentAction.php +++ b/src/Action/ConvertPaymentAction.php @@ -25,8 +25,7 @@ final class ConvertPaymentAction implements ActionInterface { use GatewayAwareTrait; - /** @var PaymentDescriptionProviderInterface */ - private $paymentDescriptionProvider; + private PaymentDescriptionProviderInterface $paymentDescriptionProvider; public function __construct(PaymentDescriptionProviderInterface $paymentDescriptionProvider) { diff --git a/src/Action/NotifyAction.php b/src/Action/NotifyAction.php index dce4359..cb2efa6 100644 --- a/src/Action/NotifyAction.php +++ b/src/Action/NotifyAction.php @@ -29,8 +29,7 @@ final class NotifyAction implements ActionInterface, ApiAwareInterface, GatewayA { use GatewayAwareTrait; - /** @var Przelewy24BridgeInterface */ - private $przelewy24Bridge; + private Przelewy24BridgeInterface $przelewy24Bridge; public function __construct(Przelewy24BridgeInterface $przelewy24Bridge) { diff --git a/src/Action/StatusAction.php b/src/Action/StatusAction.php index 755bea7..81b7cfb 100644 --- a/src/Action/StatusAction.php +++ b/src/Action/StatusAction.php @@ -27,8 +27,7 @@ final class StatusAction implements ActionInterface, ApiAwareInterface, GatewayA { use GatewayAwareTrait; - /** @var Przelewy24BridgeInterface */ - private $przelewy24Bridge; + private Przelewy24BridgeInterface $przelewy24Bridge; public function __construct(Przelewy24BridgeInterface $przelewy24Bridge) { diff --git a/src/Bridge/Przelewy24Bridge.php b/src/Bridge/Przelewy24Bridge.php index 26f9ded..7d5079c 100644 --- a/src/Bridge/Przelewy24Bridge.php +++ b/src/Bridge/Przelewy24Bridge.php @@ -16,17 +16,13 @@ final class Przelewy24Bridge implements Przelewy24BridgeInterface { - /** @var string */ - private $merchantId; + private string $merchantId = ''; - /** @var string */ - private $crcKey; + private string $crcKey = ''; - /** @var string */ - private $environment = self::SANDBOX_ENVIRONMENT; + private string $environment = self::SANDBOX_ENVIRONMENT; - /** @var ClientInterface */ - private $client; + private ClientInterface $client; public function __construct(ClientInterface $client) { diff --git a/tests/Application/.env b/tests/Application/.env index 1465c68..12ce7e0 100755 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -12,9 +12,15 @@ APP_SECRET=EDITME # Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url # For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db" # Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls -DATABASE_URL=mysql://root@127.0.0.1/sylius_%kernel.environment%?serverVersion=5.5 +DATABASE_URL=mysql://root@127.0.0.1/sylius_przelewy24_plugin_%kernel.environment%?serverVersion=5.7 ###< doctrine/doctrine-bundle ### +###> lexik/jwt-authentication-bundle ### +JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem +JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem +JWT_PASSPHRASE=acme_plugin_development +###< lexik/jwt-authentication-bundle ### + ###> symfony/swiftmailer-bundle ### # For Gmail as a transport, use: "gmail://username:password@localhost" # For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" diff --git a/tests/Application/.env.test b/tests/Application/.env.test index 5f2f7fa..8a5a07b 100755 --- a/tests/Application/.env.test +++ b/tests/Application/.env.test @@ -1,4 +1,3 @@ APP_SECRET='ch4mb3r0f5ecr3ts' -KERNEL_CLASS='Tests\Acme\SyliusExamplePlugin\Application\Kernel' -DATABASE_URL=sqlite:///%kernel.project_dir%/var/data.db +KERNEL_CLASS='Tests\BitBag\SyliusPrzelewy24Plugin\Application' diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index 56fecdf..74a6879 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -2,27 +2,17 @@ declare(strict_types=1); -namespace Tests\Acme\SyliusExamplePlugin\Application; +namespace Tests\BitBag\SyliusPrzelewy24Plugin\Application; use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer; +use Sylius\Bundle\CoreBundle\Application\Kernel as SyliusKernel; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; -use Symfony\Component\Config\Loader\DelegatingLoader; use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\Loader\LoaderResolver; use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Loader\ClosureLoader; -use Symfony\Component\DependencyInjection\Loader\DirectoryLoader; -use Symfony\Component\DependencyInjection\Loader\GlobFileLoader; -use Symfony\Component\DependencyInjection\Loader\IniFileLoader; -use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\HttpKernel\Config\FileLocator; +use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\Routing\RouteCollectionBuilder; -use Webmozart\Assert\Assert; final class Kernel extends BaseKernel { @@ -42,33 +32,37 @@ public function getLogDir(): string public function registerBundles(): iterable { - $contents = require $this->getProjectDir() . '/config/bundles.php'; - foreach ($contents as $class => $envs) { - if (isset($envs['all']) || isset($envs[$this->environment])) { - yield new $class(); + foreach ($this->getConfigurationDirectories() as $confDir) { + $bundlesFile = $confDir . '/bundles.php'; + if (false === is_file($bundlesFile)) { + continue; } + yield from $this->registerBundlesFromFile($bundlesFile); } } protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void { - $container->addResource(new FileResource($this->getProjectDir() . '/config/bundles.php')); + foreach ($this->getConfigurationDirectories() as $confDir) { + $bundlesFile = $confDir . '/bundles.php'; + if (false === is_file($bundlesFile)) { + continue; + } + $container->addResource(new FileResource($bundlesFile)); + } + $container->setParameter('container.dumper.inline_class_loader', true); - $confDir = $this->getProjectDir() . '/config'; - $loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob'); - $loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob'); - $loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob'); - $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob'); + foreach ($this->getConfigurationDirectories() as $confDir) { + $this->loadContainerConfiguration($loader, $confDir); + } } protected function configureRoutes(RouteCollectionBuilder $routes): void { - $confDir = $this->getProjectDir() . '/config'; - - $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob'); + foreach ($this->getConfigurationDirectories() as $confDir) { + $this->loadRoutesConfiguration($routes, $confDir); + } } protected function getContainerBaseClass(): string @@ -80,27 +74,52 @@ protected function getContainerBaseClass(): string return parent::getContainerBaseClass(); } - protected function getContainerLoader(ContainerInterface $container): LoaderInterface + private function isTestEnvironment(): bool { - /** @var ContainerBuilder $container */ - Assert::isInstanceOf($container, ContainerBuilder::class); - - $locator = new FileLocator($this, $this->getRootDir() . '/Resources'); - $resolver = new LoaderResolver([ - new XmlFileLoader($container, $locator), - new YamlFileLoader($container, $locator), - new IniFileLoader($container, $locator), - new PhpFileLoader($container, $locator), - new GlobFileLoader($container, $locator), - new DirectoryLoader($container, $locator), - new ClosureLoader($container), - ]); - - return new DelegatingLoader($resolver); + return 0 === strpos($this->getEnvironment(), 'test'); } - private function isTestEnvironment(): bool + private function loadContainerConfiguration(LoaderInterface $loader, string $confDir): void { - return 0 === strpos($this->getEnvironment(), 'test'); + $loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob'); + $loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob'); + $loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob'); + $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob'); + } + + private function loadRoutesConfiguration(RouteCollectionBuilder $routes, string $confDir): void + { + $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob'); + $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob'); + $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob'); + } + + /** + * @return BundleInterface[] + */ + private function registerBundlesFromFile(string $bundlesFile): iterable + { + $contents = require $bundlesFile; + foreach ($contents as $class => $envs) { + if (isset($envs['all']) || isset($envs[$this->environment])) { + yield new $class(); + } + } + } + + /** + * @return string[] + */ + private function getConfigurationDirectories(): iterable + { + yield $this->getProjectDir() . '/config'; + $syliusConfigDir = $this->getProjectDir() . '/config/sylius/' . SyliusKernel::MAJOR_VERSION . '.' . SyliusKernel::MINOR_VERSION; + if (is_dir($syliusConfigDir)) { + yield $syliusConfigDir; + } + $symfonyConfigDir = $this->getProjectDir() . '/config/symfony/' . BaseKernel::MAJOR_VERSION . '.' . BaseKernel::MINOR_VERSION; + if (is_dir($symfonyConfigDir)) { + yield $symfonyConfigDir; + } } } diff --git a/tests/Application/bin/console b/tests/Application/bin/console index bf889e9..70cdeb5 100755 --- a/tests/Application/bin/console +++ b/tests/Application/bin/console @@ -1,7 +1,7 @@ #!/usr/bin/env php ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], - Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true], Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true], Sylius\Bundle\MoneyBundle\SyliusMoneyBundle::class => ['all' => true], Sylius\Bundle\CurrencyBundle\SyliusCurrencyBundle::class => ['all' => true], @@ -42,18 +41,19 @@ Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true], Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true], Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], - WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], Sylius\Bundle\FixturesBundle\SyliusFixturesBundle::class => ['all' => true], Sylius\Bundle\PayumBundle\SyliusPayumBundle::class => ['all' => true], Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true], - Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['all' => true], Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true], Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true], - FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true], - Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true], BitBag\SyliusPrzelewy24Plugin\BitBagSyliusPrzelewy24Plugin::class => ['all' => true], Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true], + Sylius\Behat\Application\SyliusTestPlugin\SyliusTestPlugin::class => ['test' => true, 'test_cached' => true], + ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], + Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], + Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], + SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/jwt/private.pem b/tests/Application/config/jwt/private.pem new file mode 100644 index 0000000..2bcf023 --- /dev/null +++ b/tests/Application/config/jwt/private.pem @@ -0,0 +1,54 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIJrTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIDbthk+aF5EACAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBA3DYfh2mXByUxFNke/Wf5SBIIJ +UBckIgXeXBWPLQAAq07pN8uNFMUcUirFuEvbmxVe1PupCCAqriNxi1DqeSu/M7c1 +h66y0BqKZu/0G9SVTg63iCKDEiRAM3hLyD2CsjYg8h2LAaqQ9dFYGV0cHRhCXagZ +Sdt9YTfn2rarRbxauMSt0z9zwCaiUrBU4JwSM3g+tD7W0lxAm9TeaqBZek5DIX+j +3Gom5tPYQe8jvfGMGdMPuanoEwH4WbWzGcqypWriy4JwaggwKCQ4ituWfa9kqMMC +8HRmBBDg0gtafmQP910RZh18JL2ewF5Pl7GDsLtOj5gNLNuAiQxDCcYRnD4/Cdsl +bH91btmGX1nUVIFViUTW93eBsjBgdgqOMRVxUKkSSX6CmIZWlE3AazgwSbvOvNrN +JGa8X21UwfuS/JHLmfRmgdti0YxRjJkBYLPpcd3ILsi+MMhSHy0uycAM/dB80Q1B +vkW1UXGbCw/PzA5yHrzULzAl69E3Tt5nTVMIIcBGxw2rf+ej+AVjsuOl7etwecdC +gnA90ViNlGOACLVnhsjd4WVF9Oircosf0UYoblwcT6gw1GSVF9pWuu7k5hy/7Pt/ +o1BvonUgz/4VHG+K58qvtnlto+JE0XWzPvukNUyggtekTLyoQCI3ZKge6ui3qLax +N6whHpzFnFVF3GJAisTk5naHFawHNvH7t85pmc+UnjNUUmyl9RStl9LMYDSBKNlR +LzPlJK27E5SLhhyJCni4+UYjH6PdlJuKXJ0365fufJ+5ajHRatwt039xLnK0W+oa +L35NxCuXrn8YxOgJIomt7IrkV3AuxoWxcx4lRFoM0WCdn9SWZVtfFFiyX/Xr1qDg +dUysw3/bePEkOKr5JWx09hT0OKDpkwLFo2Ljtvjln4EMXYEvvVqFciKw0kqF73Dw +NyoSubwR4qs6FQclKW1TAP6UW4B6ffq1iagKOCTZ5bBtsPBZk8UGCJb57q4fUj4P +nJy0hnSdlOH4Am+US4HF4ayOGuaV1Be1taurdJnt5cNnUYRah0wg4nG+wVdG5HJk +f4dJ4nih9d6WA/8LfxdpB7NCwdR+KK6lky+GgLSdhmIT9lzjj2GDsU4lBf29TkBn +lyt98/LWGrgCQgZAQ/obxLT8CZtY+tNejGoMppY+ub8DIaLBFID+fcz13kgA9x7a +TeVB8RPok+S3yHXP9a4WSFe9DGjjN+m7EnRtte7MEjyMoekXVnT04gNbTMoGAjNb +lrR4g3ICygZtsoGSB2VEu7o3azAspXNBMOuJfRCuC0LDXcjH3TbvjX0da5wHBoK9 +clRxu+CDo9A849HMkmSje8wED7ysZnkvSX0OdPjXahVd4t1tDRI6jSlzFo9fGcjp +S8Ikm9iMrHXaWcDdtcq4C63CjSynIBr4mNIxe/f2e9nynm3AIv+aOan891RWHqrd +DdpSSPShtzATI9PbB+b+S0Gw58Y8fpO7yoZ87VW1BMpadmFZ87YY78jdB7BwInNI +JqtnivinM6qCsvbdMoGinUyL6PUcfQGiEAibouKr3zNRDC4aesBZZmj7w0dnf+HK +YC905aR0cddlc6DBo/ed3o9krMcZ6oY/vruemPTc5G7Cg3t4H3mInRgURw22X1wo +FsioU1yOdkK+MYxvmGsQvQuSJhp7h1Uz37t/olkPRafZgy2nEtw6DQO0Dm4UfSsD +nysq6dn1WeZPkOipGBRgQmY1FTRzwPoCxi7+/EuHhD8hr962rHOglSuNqPG89J8r +wdbTDr8kgXj2A9p+jI3TVKEX+h6FEhrCHW9SHUqATOZ7RiNL6hKld9j0U4D9gQwZ +dflA0TxpVsHXm7pd1idkr46jIFgw7HA89Erm0Ty7RolfHkqlRca805AVmsKkviIz +sbF5uv4WzIE3ViO8P1KMUhCyElm72mpyNTXBhkxkup9hJ4fQieaN6pET6dQ2xyjs +SBIvQoXI0JQKpespcyAdoh88ULQjRUXEOaNFfN7q+itTcocwmPZfzW2nXORJT2p8 +SXLqSE73nYZdqzSYFq1hLcnlubJ7yPBYYG1fI0IydjSGKfnjtB0DReR32OToRZ7m +laduZ8O+IaBUY4Sp6QdYcVbGGpG/wsPmTQyScc/O2bfSI7AiPnL9EnwebI9sPSWQ +R0t0QMXZOSSqNY6jkYjsOCxeekRIdY6havo2Y52Ywti0QNrkT4BQ+175VVTmRMdy +LNaMFeEq6ehSEdaHaozvjHvP50HQT43tCK+RJiL+Gf9FqawoQRt693yO5LFbQsuw +QsUSMi41txpINMa+HEc2K5FvGoPr7FmajLK7X2fr+3c/yZ4fahoMKEAVFWl5kRYx +Fe1smlw1Vxl/qNQ32LFWsBIK+XnYBteYmlpVyYrTgXyjnp1rK2zz0118DPFuYiAP +O0r6nnBz0NbwnSKb7S4CjxBKDvDbWTzP35Q5L/vySnO2zRbM64Gw7sjeLiJittWS +gQfbFpEk9k8KVndKM4H50Jp0WznmYpm1Tman8hUOiCvmq0qdI3bJ5Bnj0K+q2zFV ++noGpMFdq1+8WaUFLQFGCPM+yJgCqDgT1RAgfsGcomckGcmenDtHaTbcSFabEdpM +Tsa2qLdg/Kju+7JyGrkmobXl/azuyjYTHfRvSZrvO5WUDFzhChrJpIL4nA3ZGRlS +gvy+OzyyBh4sRyHwLItwUwE81aya3W4llAkhQ7OycmqniJgjtJzLwnxv2RQsB8bF +pyoqQdKVxkqHdbUFeh9igI4ffRAK+8xDER5J+RUoZ4mO8qJebxar54XTb6I/Lepc +g8ITX8bJ/GH+M6JdP7tLCikDTSGS+i1ReMQXE5XuEajYOVbzQdyWU5jleZIx0f6X +mTa4WvMEGNyNxKZZXsy9FAaBkZqrNzEv8k0uFgFMNWQcMMtiqbei86yACdqe+jiW +HqHv8wfoBHR+eIARub2itOJ/cI+oKv96d4it4FqQ9Lml8RUFFZj7Hrd6EjDb6Nq4 +P9ti7eku/xZvS0saBNChvv44GhP6FZJS0i/gidVffLna7Wua98tPZEAXp57k+XUL +PzsRJ4a+hFuQjkyXFoz/v8YuUdyCFUSVVr9ArVu0v4+4euFWpQLav5sXv0Gh9X58 +Ek1KIf7Z/tZAJnSjTjFuSbDX/AoTMTxpRBKKnFW6zY0Nw2pjTVMtTVDkv9xkBpBK +wod7FPD5f0T7y9YOARVZnBxVRSkkcYpEJFy5pLNeadg9 +-----END ENCRYPTED PRIVATE KEY----- diff --git a/tests/Application/config/jwt/public.pem b/tests/Application/config/jwt/public.pem new file mode 100644 index 0000000..cb4e13d --- /dev/null +++ b/tests/Application/config/jwt/public.pem @@ -0,0 +1,14 @@ +-----BEGIN PUBLIC KEY----- +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA6QkmF/Xi5nAYb8Kzr7qC +d63V2K+d/nCXbpDUKKDPJAqOtTlMoQSuJRLNnhhp7z1i/Cp4Bhifr20Pu2dq8JYg +6pRT4ctqvYb/MXxAaPZc3EcBC0S6AhgKO/fDvR3LcqYqGJmQQOXZvxTsgqongdvV +4XbqFBMMgngyayoBk0VKTaI/s+LQhIce+1QaxbAI0+/zbR0hZ1hWT73orJi3do+1 +TBzQol+V7WGa8LlJfmgM56qO3BmVkeTDMBc27pGp6g3+Oufk/l29jEGJlUT9yu7Q +BRhaQTWNVASa2aD+AKjVBzJh53O2zD8slAbjF1M9U7bbWN28Sv+xC/dUz0q9HnPu +RsY2tnwryqTyYn/Hf2xyP3/KvjJ6oslAwemu5JirdJkO7KVQAthWG42gLuhZg3ks +cSZhCLZH7nO2UDsf+2ZZgdbhpYZwR4gDRfNt7GKWXnWZOz9Uw1yVCPgylyZRZwg8 +l0y9aABdj3379I22icrwpMZbAgkyxNSV6UNJuxZksLUoP3i9OvXYgPYU9E4tU/Ul +Dm/T1rGSReGoPkU1YQnI50bq7p1byIoUu2scTflvpTVI5a7zULkS1tg60xk7vBRC +aBc7nr4UEtA235N6uLtcGxH11WBMwsKX69sSU0sQdC4Sk25zXM2gc8R1XV9K3qz2 +wQorQRlCwrkG44VRDgbFH+8CAwEAAQ== +-----END PUBLIC KEY----- diff --git a/tests/Application/config/packages/_sylius.yaml b/tests/Application/config/packages/_sylius.yaml old mode 100755 new mode 100644 index 89674ac..7532b01 --- a/tests/Application/config/packages/_sylius.yaml +++ b/tests/Application/config/packages/_sylius.yaml @@ -2,10 +2,11 @@ imports: - { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" } - { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" } - - { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" } - { resource: "@SyliusShopBundle/Resources/config/app/config.yml" } + - { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" } + parameters: sylius_core.public_dir: '%kernel.project_dir%/public' diff --git a/tests/Application/config/packages/dev/framework.yaml b/tests/Application/config/packages/dev/framework.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/dev/jms_serializer.yaml b/tests/Application/config/packages/dev/jms_serializer.yaml deleted file mode 100755 index 353e460..0000000 --- a/tests/Application/config/packages/dev/jms_serializer.yaml +++ /dev/null @@ -1,7 +0,0 @@ -jms_serializer: - visitors: - json: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/packages/dev/monolog.yaml b/tests/Application/config/packages/dev/monolog.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/dev/routing.yaml b/tests/Application/config/packages/dev/routing.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/dev/swiftmailer.yaml b/tests/Application/config/packages/dev/swiftmailer.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/dev/web_profiler.yaml b/tests/Application/config/packages/dev/web_profiler.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/doctrine.yaml b/tests/Application/config/packages/doctrine.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/doctrine_migrations.yaml b/tests/Application/config/packages/doctrine_migrations.yaml old mode 100755 new mode 100644 index c0a1202..cdbc01a --- a/tests/Application/config/packages/doctrine_migrations.yaml +++ b/tests/Application/config/packages/doctrine_migrations.yaml @@ -1,5 +1,4 @@ doctrine_migrations: - dir_name: "%kernel.project_dir%/src/Migrations" - - # Namespace is arbitrary but should be different from App\Migrations as migrations classes should NOT be autoloaded - namespace: DoctrineMigrations + storage: + table_storage: + table_name: sylius_migrations diff --git a/tests/Application/config/packages/fos_rest.yaml b/tests/Application/config/packages/fos_rest.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/framework.yaml b/tests/Application/config/packages/framework.yaml old mode 100755 new mode 100644 index e74ed81..9b44501 --- a/tests/Application/config/packages/framework.yaml +++ b/tests/Application/config/packages/framework.yaml @@ -2,6 +2,5 @@ framework: secret: '%env(APP_SECRET)%' form: true csrf_protection: true - templating: { engines: ["twig"] } session: handler_id: ~ diff --git a/tests/Application/config/packages/lexik_jwt_authentication.yaml b/tests/Application/config/packages/lexik_jwt_authentication.yaml new file mode 100644 index 0000000..edfb69d --- /dev/null +++ b/tests/Application/config/packages/lexik_jwt_authentication.yaml @@ -0,0 +1,4 @@ +lexik_jwt_authentication: + secret_key: '%env(resolve:JWT_SECRET_KEY)%' + public_key: '%env(resolve:JWT_PUBLIC_KEY)%' + pass_phrase: '%env(JWT_PASSPHRASE)%' diff --git a/tests/Application/config/packages/liip_imagine.yaml b/tests/Application/config/packages/liip_imagine.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/prod/doctrine.yaml b/tests/Application/config/packages/prod/doctrine.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/prod/jms_serializer.yaml b/tests/Application/config/packages/prod/jms_serializer.yaml deleted file mode 100755 index bc97faf..0000000 --- a/tests/Application/config/packages/prod/jms_serializer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -jms_serializer: - visitors: - json: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/packages/prod/monolog.yaml b/tests/Application/config/packages/prod/monolog.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/routing.yaml b/tests/Application/config/packages/routing.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/security_checker.yaml b/tests/Application/config/packages/security_checker.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/staging/monolog.yaml b/tests/Application/config/packages/staging/monolog.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/staging/swiftmailer.yaml b/tests/Application/config/packages/staging/swiftmailer.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/stof_doctrine_extensions.yaml b/tests/Application/config/packages/stof_doctrine_extensions.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/swiftmailer.yaml b/tests/Application/config/packages/swiftmailer.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/test/monolog.yaml b/tests/Application/config/packages/test/monolog.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/test/security.yaml b/tests/Application/config/packages/test/security.yaml new file mode 100644 index 0000000..21cc377 --- /dev/null +++ b/tests/Application/config/packages/test/security.yaml @@ -0,0 +1,3 @@ +security: + encoders: + sha512: sha512 diff --git a/tests/Application/config/packages/test/swiftmailer.yaml b/tests/Application/config/packages/test/swiftmailer.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/test/sylius_theme.yaml b/tests/Application/config/packages/test/sylius_theme.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/test/sylius_uploader.yaml b/tests/Application/config/packages/test/sylius_uploader.yaml new file mode 100644 index 0000000..ab9d6ca --- /dev/null +++ b/tests/Application/config/packages/test/sylius_uploader.yaml @@ -0,0 +1,3 @@ +services: + Sylius\Component\Core\Generator\ImagePathGeneratorInterface: + class: Sylius\Behat\Service\Generator\UploadedImagePathGenerator diff --git a/tests/Application/config/packages/test/web_profiler.yaml b/tests/Application/config/packages/test/web_profiler.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/test_cached/doctrine.yaml b/tests/Application/config/packages/test_cached/doctrine.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/test_cached/fos_rest.yaml b/tests/Application/config/packages/test_cached/fos_rest.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/test_cached/framework.yaml b/tests/Application/config/packages/test_cached/framework.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/test_cached/monolog.yaml b/tests/Application/config/packages/test_cached/monolog.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/test_cached/security.yaml b/tests/Application/config/packages/test_cached/security.yaml new file mode 100644 index 0000000..21cc377 --- /dev/null +++ b/tests/Application/config/packages/test_cached/security.yaml @@ -0,0 +1,3 @@ +security: + encoders: + sha512: sha512 diff --git a/tests/Application/config/packages/test_cached/swiftmailer.yaml b/tests/Application/config/packages/test_cached/swiftmailer.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/test_cached/sylius_channel.yaml b/tests/Application/config/packages/test_cached/sylius_channel.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/test_cached/sylius_theme.yaml b/tests/Application/config/packages/test_cached/sylius_theme.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/test_cached/sylius_uploader.yaml b/tests/Application/config/packages/test_cached/sylius_uploader.yaml new file mode 100644 index 0000000..cfa727e --- /dev/null +++ b/tests/Application/config/packages/test_cached/sylius_uploader.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "../test/sylius_uploader.yaml" } diff --git a/tests/Application/config/packages/test_cached/twig.yaml b/tests/Application/config/packages/test_cached/twig.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/translation.yaml b/tests/Application/config/packages/translation.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/twig.yaml b/tests/Application/config/packages/twig.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/packages/validator.yaml b/tests/Application/config/packages/validator.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/routes.yaml b/tests/Application/config/routes.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/routes/dev/twig.yaml b/tests/Application/config/routes/dev/twig.yaml deleted file mode 100755 index f4ee839..0000000 --- a/tests/Application/config/routes/dev/twig.yaml +++ /dev/null @@ -1,3 +0,0 @@ -_errors: - resource: '@TwigBundle/Resources/config/routing/errors.xml' - prefix: /_error diff --git a/tests/Application/config/routes/dev/web_profiler.yaml b/tests/Application/config/routes/dev/web_profiler.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/routes/liip_imagine.yaml b/tests/Application/config/routes/liip_imagine.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/routes/sylius_admin.yaml b/tests/Application/config/routes/sylius_admin.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/routes/sylius_api.yaml b/tests/Application/config/routes/sylius_api.yaml new file mode 100644 index 0000000..ae01ffc --- /dev/null +++ b/tests/Application/config/routes/sylius_api.yaml @@ -0,0 +1,3 @@ +sylius_api: + resource: "@SyliusApiBundle/Resources/config/routing.yml" + prefix: "%sylius.security.new_api_route%" diff --git a/tests/Application/config/routes/sylius_shop.yaml b/tests/Application/config/routes/sylius_shop.yaml old mode 100755 new mode 100644 index 8818568..92eeae0 --- a/tests/Application/config/routes/sylius_shop.yaml +++ b/tests/Application/config/routes/sylius_shop.yaml @@ -2,7 +2,7 @@ sylius_shop: resource: "@SyliusShopBundle/Resources/config/routing.yml" prefix: /{_locale} requirements: - _locale: ^[a-z]{2}(?:_[A-Z]{2})?$ + _locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$ sylius_shop_payum: resource: "@SyliusShopBundle/Resources/config/routing/payum.yml" diff --git a/tests/Application/config/routes/test/routing.yaml b/tests/Application/config/routes/test/routing.yaml new file mode 100644 index 0000000..0ca57d9 --- /dev/null +++ b/tests/Application/config/routes/test/routing.yaml @@ -0,0 +1,5 @@ +sylius_test_plugin_main: + path: /test/main + controller: FrameworkBundle:Template:template + defaults: + template: "@SyliusTestPlugin/main.html.twig" diff --git a/tests/Application/config/routes/test/sylius_test_plugin.yaml b/tests/Application/config/routes/test/sylius_test_plugin.yaml new file mode 100644 index 0000000..0ca57d9 --- /dev/null +++ b/tests/Application/config/routes/test/sylius_test_plugin.yaml @@ -0,0 +1,5 @@ +sylius_test_plugin_main: + path: /test/main + controller: FrameworkBundle:Template:template + defaults: + template: "@SyliusTestPlugin/main.html.twig" diff --git a/tests/Application/config/routes/test_cached/routing.yaml b/tests/Application/config/routes/test_cached/routing.yaml new file mode 100644 index 0000000..0ca57d9 --- /dev/null +++ b/tests/Application/config/routes/test_cached/routing.yaml @@ -0,0 +1,5 @@ +sylius_test_plugin_main: + path: /test/main + controller: FrameworkBundle:Template:template + defaults: + template: "@SyliusTestPlugin/main.html.twig" diff --git a/tests/Application/config/routes/test_cached/sylius_test_plugin.yaml b/tests/Application/config/routes/test_cached/sylius_test_plugin.yaml new file mode 100644 index 0000000..0ca57d9 --- /dev/null +++ b/tests/Application/config/routes/test_cached/sylius_test_plugin.yaml @@ -0,0 +1,5 @@ +sylius_test_plugin_main: + path: /test/main + controller: FrameworkBundle:Template:template + defaults: + template: "@SyliusTestPlugin/main.html.twig" diff --git a/tests/Application/config/secrets/dev/.gitignore b/tests/Application/config/secrets/dev/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/tests/Application/config/secrets/prod/.gitignore b/tests/Application/config/secrets/prod/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/tests/Application/config/secrets/test/.gitignore b/tests/Application/config/secrets/test/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/tests/Application/config/secrets/test_cached/.gitignore b/tests/Application/config/secrets/test_cached/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/tests/Application/config/services.yaml b/tests/Application/config/services.yaml old mode 100755 new mode 100644 diff --git a/tests/Application/config/services_test.yaml b/tests/Application/config/services_test.yaml old mode 100755 new mode 100644 index bdaf7d0..7e42162 --- a/tests/Application/config/services_test.yaml +++ b/tests/Application/config/services_test.yaml @@ -3,9 +3,7 @@ imports: - { resource: "../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" } services: - bitbag.test.client: '@test.client' - bitbag.test.client.history: '@test.client.history' - bitbag.test.client.cookiejar: '@test.client.cookiejar' + Symfony\Component\BrowserKit\AbstractBrowser: '@test.client' bitbag_sylius_przelewy24_plugin.bridge.przelewy24: class: Tests\BitBag\SyliusPrzelewy24Plugin\Behat\Service\Mocker\Przelewy24Bridge diff --git a/tests/Application/config/services_test_cached.yaml b/tests/Application/config/services_test_cached.yaml new file mode 100644 index 0000000..0de380e --- /dev/null +++ b/tests/Application/config/services_test_cached.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "services_test.yaml" } diff --git a/tests/Application/config/sylius/1.10/bundles.php b/tests/Application/config/sylius/1.10/bundles.php new file mode 100644 index 0000000..bd33f4a --- /dev/null +++ b/tests/Application/config/sylius/1.10/bundles.php @@ -0,0 +1,6 @@ + ['all' => true], + SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], +]; diff --git a/tests/Application/config/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.10/packages/jms_serializer.yaml old mode 100755 new mode 100644 similarity index 73% rename from tests/Application/config/packages/jms_serializer.yaml rename to tests/Application/config/sylius/1.10/packages/jms_serializer.yaml index 64dd8d1..ed7bc61 --- a/tests/Application/config/packages/jms_serializer.yaml +++ b/tests/Application/config/sylius/1.10/packages/jms_serializer.yaml @@ -1,4 +1,4 @@ jms_serializer: visitors: - xml: + xml_serialization: format_output: '%kernel.debug%' diff --git a/tests/Application/config/sylius/1.10/packages/security.yaml b/tests/Application/config/sylius/1.10/packages/security.yaml new file mode 100644 index 0000000..1062810 --- /dev/null +++ b/tests/Application/config/sylius/1.10/packages/security.yaml @@ -0,0 +1,148 @@ +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.9/bundles.php b/tests/Application/config/sylius/1.9/bundles.php new file mode 100644 index 0000000..66f523d --- /dev/null +++ b/tests/Application/config/sylius/1.9/bundles.php @@ -0,0 +1,8 @@ + ['all' => true], + SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], + FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true], + Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true], +]; diff --git a/tests/Application/config/sylius/1.9/packages/_sylius.yaml b/tests/Application/config/sylius/1.9/packages/_sylius.yaml new file mode 100644 index 0000000..1674a97 --- /dev/null +++ b/tests/Application/config/sylius/1.9/packages/_sylius.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" } diff --git a/tests/Application/config/sylius/1.9/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.9/packages/jms_serializer.yaml new file mode 100644 index 0000000..ed7bc61 --- /dev/null +++ b/tests/Application/config/sylius/1.9/packages/jms_serializer.yaml @@ -0,0 +1,4 @@ +jms_serializer: + visitors: + xml_serialization: + format_output: '%kernel.debug%' diff --git a/tests/Application/config/packages/security.yaml b/tests/Application/config/sylius/1.9/packages/security.yaml old mode 100755 new mode 100644 similarity index 58% rename from tests/Application/config/packages/security.yaml rename to tests/Application/config/sylius/1.9/packages/security.yaml index 830b03d..8161bda --- a/tests/Application/config/packages/security.yaml +++ b/tests/Application/config/sylius/1.9/packages/security.yaml @@ -1,16 +1,31 @@ parameters: - sylius.security.admin_regex: "^/admin" + sylius.security.admin_regex: "^/%sylius_admin.path_name%" sylius.security.api_regex: "^/api" - sylius.security.shop_regex: "^/(?!admin|api/.*|api$|media/.*)[^/]++" + 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: sha512 + Sylius\Component\User\Model\UserInterface: argon2i firewalls: admin: switch_user: true @@ -30,7 +45,7 @@ security: csrf_token_id: admin_authenticate remember_me: secret: "%env(APP_SECRET)%" - path: /admin + path: "/%sylius_admin.path_name%" name: APP_ADMIN_REMEMBER_ME lifetime: 31536000 remember_me_parameter: _remember_me @@ -43,6 +58,45 @@ security: 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 + 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 + api: pattern: "%sylius.security.api_regex%/.*" provider: sylius_admin_user_provider @@ -100,3 +154,6 @@ security: - { 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/routes/sylius_admin_api.yaml b/tests/Application/config/sylius/1.9/routes/sylius_admin_api.yaml old mode 100755 new mode 100644 similarity index 100% rename from tests/Application/config/routes/sylius_admin_api.yaml rename to tests/Application/config/sylius/1.9/routes/sylius_admin_api.yaml diff --git a/tests/Application/config/symfony/4.4/packages/framework.yaml b/tests/Application/config/symfony/4.4/packages/framework.yaml new file mode 100644 index 0000000..62f82d3 --- /dev/null +++ b/tests/Application/config/symfony/4.4/packages/framework.yaml @@ -0,0 +1,2 @@ +framework: + templating: { engines: ["twig"] } diff --git a/tests/Application/package.json b/tests/Application/package.json index f1dc816..b27949d 100755 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -2,13 +2,14 @@ "dependencies": { "babel-polyfill": "^6.26.0", "chart.js": "^2.9.3", - "jquery": "^3.5.0", + "jquery": "^3.4.0", "jquery.dirtyforms": "^2.0.0", "lightbox2": "^2.9.0", "semantic-ui-css": "^2.2.0", "slick-carousel": "^1.8.1" }, "devDependencies": { + "@symfony/webpack-encore": "^0.28.0", "babel-core": "^6.26.3", "babel-plugin-external-helpers": "^6.22.0", "babel-plugin-module-resolver": "^3.1.1", @@ -19,25 +20,26 @@ "eslint": "^4.19.1", "eslint-config-airbnb-base": "^12.1.0", "eslint-import-resolver-babel-module": "^4.0.0", - "eslint-plugin-import": "^2.12.0", + "eslint-plugin-import": "^2.11.0", "fast-async": "^6.3.7", "gulp": "^4.0.0", "gulp-chug": "^0.5", "gulp-concat": "^2.6.0", "gulp-debug": "^2.1.2", "gulp-if": "^2.0.0", - "gulp-livereload": "^3.8.1", + "gulp-livereload": "^4.0.1", "gulp-order": "^1.1.1", "gulp-sass": "^4.0.1", "gulp-sourcemaps": "^1.6.0", "gulp-uglifycss": "^1.0.5", "merge-stream": "^1.0.0", - "rollup": "^0.60.7", + "rollup": "^0.60.2", "rollup-plugin-babel": "^3.0.4", "rollup-plugin-commonjs": "^9.1.3", "rollup-plugin-inject": "^2.0.0", "rollup-plugin-node-resolve": "^3.3.0", "rollup-plugin-uglify": "^4.0.0", + "sass-loader": "^7.0.1", "upath": "^1.1.0", "yargs": "^6.4.0" }, diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php index 748fd5f..29362fa 100644 --- a/tests/Application/public/index.php +++ b/tests/Application/public/index.php @@ -2,9 +2,9 @@ declare(strict_types=1); -use Symfony\Component\Debug\Debug; +use Tests\BitBag\SyliusPrzelewy24Plugin\Application\Kernel; +use Symfony\Component\ErrorHandler\Debug; use Symfony\Component\HttpFoundation\Request; -use Tests\Acme\SyliusExamplePlugin\Application\Kernel; require dirname(__DIR__) . '/config/bootstrap.php'; diff --git a/tests/Application/webpack.config.js b/tests/Application/webpack.config.js new file mode 100644 index 0000000..bd14ff8 --- /dev/null +++ b/tests/Application/webpack.config.js @@ -0,0 +1,47 @@ +const path = require('path'); +const Encore = require('@symfony/webpack-encore'); + +const syliusBundles = path.resolve(__dirname, 'vendor/sylius/sylius/src/Sylius/Bundle/'); +const uiBundleScripts = path.resolve(syliusBundles, 'UiBundle/Resources/private/js/'); +const uiBundleResources = path.resolve(syliusBundles, 'UiBundle/Resources/private/'); + +// Shop config +Encore + .setOutputPath('public/build/shop/') + .setPublicPath('/build/shop') + .addEntry('shop-entry', './assets/shop/entry.js') + .disableSingleRuntimeChunk() + .cleanupOutputBeforeBuild() + .enableSourceMaps(!Encore.isProduction()) + .enableVersioning(Encore.isProduction()) + .enableSassLoader(); + +const shopConfig = Encore.getWebpackConfig(); + +shopConfig.resolve.alias['sylius/ui'] = uiBundleScripts; +shopConfig.resolve.alias['sylius/ui-resources'] = uiBundleResources; +shopConfig.resolve.alias['sylius/bundle'] = syliusBundles; +shopConfig.name = 'shop'; + +Encore.reset(); + +// Admin config +Encore + .setOutputPath('public/build/admin/') + .setPublicPath('/build/admin') + .addEntry('admin-entry', './assets/admin/entry.js') + .disableSingleRuntimeChunk() + .cleanupOutputBeforeBuild() + .enableSourceMaps(!Encore.isProduction()) + .enableVersioning(Encore.isProduction()) + .enableSassLoader(); + +const adminConfig = Encore.getWebpackConfig(); + +adminConfig.resolve.alias['sylius/ui'] = uiBundleScripts; +adminConfig.resolve.alias['sylius/ui-resources'] = uiBundleResources; +adminConfig.resolve.alias['sylius/bundle'] = syliusBundles; +adminConfig.externals = Object.assign({}, adminConfig.externals, { window: 'window', document: 'document' }); +adminConfig.name = 'admin'; + +module.exports = [shopConfig, adminConfig]; diff --git a/tests/Behat/Context/Setup/Przelewy24Context.php b/tests/Behat/Context/Setup/Przelewy24Context.php index a3b1757..8910fc9 100644 --- a/tests/Behat/Context/Setup/Przelewy24Context.php +++ b/tests/Behat/Context/Setup/Przelewy24Context.php @@ -14,48 +14,31 @@ use Behat\Behat\Context\Context; use BitBag\SyliusPrzelewy24Plugin\Bridge\Przelewy24BridgeInterface; -use Doctrine\Common\Persistence\ObjectManager; +use Doctrine\ORM\EntityManagerInterface; use Sylius\Behat\Service\SharedStorageInterface; use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface; use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\Component\Core\Repository\PaymentMethodRepositoryInterface; -use Sylius\Component\Resource\Factory\FactoryInterface; final class Przelewy24Context implements Context { - /** @var SharedStorageInterface */ - private $sharedStorage; + private SharedStorageInterface $sharedStorage; - /** @var PaymentMethodRepositoryInterface */ - private $paymentMethodRepository; + private PaymentMethodRepositoryInterface $paymentMethodRepository; - /** @var ExampleFactoryInterface */ - private $paymentMethodExampleFactory; + private ExampleFactoryInterface $paymentMethodExampleFactory; - /** @var FactoryInterface */ - private $paymentMethodTranslationFactory; + private EntityManagerInterface $paymentMethodManager; - /** @var ObjectManager */ - private $paymentMethodManager; - - /** - * @param SharedStorageInterface $sharedStorage - * @param PaymentMethodRepositoryInterface $paymentMethodRepository - * @param ExampleFactoryInterface $paymentMethodExampleFactory - * @param FactoryInterface $paymentMethodTranslationFactory - * @param ObjectManager $paymentMethodManager - */ public function __construct( SharedStorageInterface $sharedStorage, PaymentMethodRepositoryInterface $paymentMethodRepository, ExampleFactoryInterface $paymentMethodExampleFactory, - FactoryInterface $paymentMethodTranslationFactory, - ObjectManager $paymentMethodManager + EntityManagerInterface $paymentMethodManager ) { $this->sharedStorage = $sharedStorage; $this->paymentMethodRepository = $paymentMethodRepository; $this->paymentMethodExampleFactory = $paymentMethodExampleFactory; - $this->paymentMethodTranslationFactory = $paymentMethodTranslationFactory; $this->paymentMethodManager = $paymentMethodManager; } @@ -77,21 +60,10 @@ public function theStoreHasAPaymentMethodWithACodeAndPrzelewy24CheckoutGateway( $this->paymentMethodManager->flush(); } - /** - * @param string $name - * @param string $code - * @param string $description - * @param bool $addForCurrentChannel - * @param int|null $position - * - * @return PaymentMethodInterface - */ private function createPaymentMethod( string $name, string $code, - string $description = '', - bool $addForCurrentChannel = true, - int $position = null + string $description = '' ): PaymentMethodInterface { /** @var PaymentMethodInterface $paymentMethod */ $paymentMethod = $this->paymentMethodExampleFactory->create([ @@ -101,13 +73,9 @@ private function createPaymentMethod( 'gatewayName' => 'przelewy24', 'gatewayFactory' => 'przelewy24', 'enabled' => true, - 'channels' => ($addForCurrentChannel && $this->sharedStorage->has('channel')) ? [$this->sharedStorage->get('channel')] : [], + 'channels' => $this->sharedStorage->has('channel') ? [$this->sharedStorage->get('channel')] : [], ]); - if (null !== $position) { - $paymentMethod->setPosition($position); - } - $this->sharedStorage->set('payment_method', $paymentMethod); $this->paymentMethodRepository->add($paymentMethod); diff --git a/tests/Behat/Context/Ui/Admin/ManagingPaymentMethodPrzelewy24Context.php b/tests/Behat/Context/Ui/Admin/ManagingPaymentMethodPrzelewy24Context.php index 402aa0b..67fa17d 100644 --- a/tests/Behat/Context/Ui/Admin/ManagingPaymentMethodPrzelewy24Context.php +++ b/tests/Behat/Context/Ui/Admin/ManagingPaymentMethodPrzelewy24Context.php @@ -19,11 +19,9 @@ final class ManagingPaymentMethodPrzelewy24Context implements Context { - /** @var CurrentPageResolverInterface */ - private $currentPageResolver; + private CurrentPageResolverInterface $currentPageResolver; - /** @var CreatePageInterface */ - private $createPage; + private CreatePageInterface $createPage; public function __construct( CurrentPageResolverInterface $currentPageResolver, diff --git a/tests/Behat/Context/Ui/Shop/Przelewy24CheckoutContext.php b/tests/Behat/Context/Ui/Shop/Przelewy24CheckoutContext.php index bc54ce3..389c1f3 100644 --- a/tests/Behat/Context/Ui/Shop/Przelewy24CheckoutContext.php +++ b/tests/Behat/Context/Ui/Shop/Przelewy24CheckoutContext.php @@ -15,44 +15,28 @@ use Behat\Behat\Context\Context; use Sylius\Behat\Page\Shop\Checkout\CompletePageInterface; use Sylius\Behat\Page\Shop\Order\ShowPageInterface; -use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; use Tests\BitBag\SyliusPrzelewy24Plugin\Behat\Page\External\Przelewy24CheckoutPageInterface; use Tests\BitBag\SyliusPrzelewy24Plugin\Behat\Service\Mocker\Przelewy24ApiMocker; final class Przelewy24CheckoutContext implements Context { - /** @var CompletePageInterface */ - private $summaryPage; + private CompletePageInterface $summaryPage; - /** @var Przelewy24CheckoutPageInterface */ - private $przelewy24CheckoutPage; + private Przelewy24CheckoutPageInterface $przelewy24CheckoutPage; - /** @var ShowPageInterface */ - private $orderDetails; + private ShowPageInterface $orderDetails; - /** @var EntityRepository */ - private $paymentRepository; + private Przelewy24ApiMocker $przelewy24ApiMocker; - /** @var Przelewy24ApiMocker */ - private $przelewy24ApiMocker; - - /** - * @param CompletePageInterface $summaryPage - * @param Przelewy24CheckoutPageInterface $przelewy24CheckoutPage - * @param ShowPageInterface $orderDetails - * @param EntityRepository $paymentRepository - */ public function __construct( CompletePageInterface $summaryPage, Przelewy24CheckoutPageInterface $przelewy24CheckoutPage, ShowPageInterface $orderDetails, - EntityRepository $paymentRepository, Przelewy24ApiMocker $przelewy24ApiMocker ) { $this->summaryPage = $summaryPage; $this->przelewy24CheckoutPage = $przelewy24CheckoutPage; $this->orderDetails = $orderDetails; - $this->paymentRepository = $paymentRepository; $this->przelewy24ApiMocker = $przelewy24ApiMocker; } @@ -62,20 +46,17 @@ public function __construct( */ public function iConfirmMyOrderWithPrzelewy24Payment(): void { - $this->przelewy24ApiMocker->mockApiSuccessfulVerifyTransaction(function () { + $this->przelewy24ApiMocker->mockApiSuccessfulVerifyTransaction(function (): void { $this->summaryPage->confirmOrder(); }); } /** * @When I sign in to Przelewy24 and pay successfully - * - * @throws \Behat\Mink\Exception\DriverException - * @throws \Behat\Mink\Exception\UnsupportedDriverActionException */ public function iSignInToPrzelewy24AndPaySuccessfully(): void { - $this->przelewy24ApiMocker->mockApiSuccessfulVerifyTransaction(function () { + $this->przelewy24ApiMocker->mockApiSuccessfulVerifyTransaction(function (): void { $this->przelewy24CheckoutPage->pay(); }); } @@ -85,7 +66,7 @@ public function iSignInToPrzelewy24AndPaySuccessfully(): void */ public function iTryToPayAgainPrzelewy24Payment(): void { - $this->przelewy24ApiMocker->mockApiSuccessfulVerifyTransaction(function () { + $this->przelewy24ApiMocker->mockApiSuccessfulVerifyTransaction(function (): void { $this->orderDetails->pay(); }); } @@ -96,7 +77,7 @@ public function iTryToPayAgainPrzelewy24Payment(): void */ public function iFailedMyPrzelewy24Payment(): void { - $this->przelewy24ApiMocker->mockApiSuccessfulVerifyTransaction(function () { + $this->przelewy24ApiMocker->mockApiSuccessfulVerifyTransaction(function (): void { $this->przelewy24CheckoutPage->failedPayment(); }); } diff --git a/tests/Behat/Page/Admin/PaymentMethod/CreatePageInterface.php b/tests/Behat/Page/Admin/PaymentMethod/CreatePageInterface.php index 8004b5d..f0704fa 100644 --- a/tests/Behat/Page/Admin/PaymentMethod/CreatePageInterface.php +++ b/tests/Behat/Page/Admin/PaymentMethod/CreatePageInterface.php @@ -18,7 +18,7 @@ interface CreatePageInterface extends BaseCreatePageInterface { public function setEnvironment(string $environment): void; - public function setMerchantId(string $merchantid): void; + public function setMerchantId(string $merchantId): void; public function setCrcKey(string $crcKey): void; } diff --git a/tests/Behat/Page/External/Przelewy24CheckoutPage.php b/tests/Behat/Page/External/Przelewy24CheckoutPage.php index a0186a3..f34fde0 100644 --- a/tests/Behat/Page/External/Przelewy24CheckoutPage.php +++ b/tests/Behat/Page/External/Przelewy24CheckoutPage.php @@ -21,22 +21,17 @@ use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; use Symfony\Component\BrowserKit\AbstractBrowser; -use Symfony\Component\BrowserKit\Client; use Tests\BitBag\SyliusPrzelewy24Plugin\Behat\Service\Mocker\Przelewy24ApiMocker; final class Przelewy24CheckoutPage extends Page implements Przelewy24CheckoutPageInterface { - /** @var Przelewy24ApiMocker */ - private $przelewy24ApiMocker; + private Przelewy24ApiMocker $przelewy24ApiMocker; - /** @var RepositoryInterface */ - private $securityTokenRepository; + private RepositoryInterface $securityTokenRepository; - /** @var EntityRepository */ - private $paymentRepository; + private EntityRepository $paymentRepository; - /** @var Client */ - private $client; + private AbstractBrowser $client; public function __construct( Session $session, @@ -67,7 +62,7 @@ public function pay(): void 'p24_currency' => 'test', ]; - $this->przelewy24ApiMocker->mockApiSuccessfulVerifyTransaction(function () use ($notifyToken, $postData, $captureToken) { + $this->przelewy24ApiMocker->mockApiSuccessfulVerifyTransaction(function () use ($notifyToken, $postData, $captureToken): void { $this->client->request('POST', $notifyToken->getTargetUrl(), $postData); $this->getDriver()->visit($captureToken->getTargetUrl()); }); diff --git a/tests/Behat/Resources/services/contexts/setup.yml b/tests/Behat/Resources/services/contexts/setup.yml index 9c80ab1..0f7c450 100644 --- a/tests/Behat/Resources/services/contexts/setup.yml +++ b/tests/Behat/Resources/services/contexts/setup.yml @@ -6,5 +6,4 @@ services: - "@sylius.behat.shared_storage" - "@sylius.repository.payment_method" - "@sylius.fixture.example_factory.payment_method" - - "@sylius.factory.payment_method_translation" - "@sylius.manager.payment_method" diff --git a/tests/Behat/Resources/services/contexts/ui.yml b/tests/Behat/Resources/services/contexts/ui.yml index 8bbbb0b..392260e 100644 --- a/tests/Behat/Resources/services/contexts/ui.yml +++ b/tests/Behat/Resources/services/contexts/ui.yml @@ -13,5 +13,4 @@ services: - '@sylius.behat.page.shop.checkout.complete' - '@bitbag_sylius_przelewy24_plugin.page.external.przelewy24_checkout' - '@sylius.behat.page.shop.order.show' - - '@sylius.repository.payment' - '@bitbag_sylius_przelewy24_plugin.mocker.przelewy24_api' diff --git a/tests/Behat/Service/Mocker/Przelewy24ApiMocker.php b/tests/Behat/Service/Mocker/Przelewy24ApiMocker.php index 9d1c6ce..6e8fc6e 100644 --- a/tests/Behat/Service/Mocker/Przelewy24ApiMocker.php +++ b/tests/Behat/Service/Mocker/Przelewy24ApiMocker.php @@ -17,8 +17,7 @@ final class Przelewy24ApiMocker { - /** @var MockerInterface */ - private $mocker; + private MockerInterface $mocker; public function __construct(MockerInterface $mocker) { diff --git a/tests/Behat/Service/Mocker/Przelewy24Bridge.php b/tests/Behat/Service/Mocker/Przelewy24Bridge.php index 05ce36e..ef0abd8 100644 --- a/tests/Behat/Service/Mocker/Przelewy24Bridge.php +++ b/tests/Behat/Service/Mocker/Przelewy24Bridge.php @@ -17,8 +17,7 @@ final class Przelewy24Bridge implements Przelewy24BridgeInterface { - /** @var ContainerInterface */ - private $container; + private ContainerInterface $container; public function __construct(ContainerInterface $container) {