From e336b6daeb00af1a2cfb970fde4d1a79da820069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20L=C3=B8vgaard?= Date: Wed, 24 Apr 2024 09:11:26 +0200 Subject: [PATCH] Upgrade test application and drop support for PHP 7.4 and PHP 8.0 --- .github/workflows/build.yaml | 117 ++++------------- behat.yml.dist | 2 +- composer.json | 123 ++++++------------ ecs.php | 18 +-- .../Command/CreateGiftCardConfiguration.php | 2 +- .../AddGiftCardToOrderHandler.php | 2 +- .../CommandHandler/AddItemToCartHandler.php | 2 +- ...AssociateConfigurationToChannelHandler.php | 2 +- .../CreateGiftCardConfigurationHandler.php | 2 +- .../RemoveGiftCardFromOrderHandler.php | 2 +- .../Action/DownloadGiftCardPdfAction.php | 2 +- .../Action/GiftCardBalanceAction.php | 2 +- ...UploadGiftCardConfigurationImageAction.php | 2 +- .../GiftCardsByLoggedInUserExtension.php | 2 +- src/Applicator/GiftCardApplicator.php | 2 +- .../Rule/IsNotGiftCardRule.php | 25 ---- .../Action/AddGiftCardToOrderAction.php | 2 +- .../Admin/GenerateEncodedExamplePdfAction.php | 2 +- .../Action/DownloadGiftCardPdfAction.php | 4 +- .../Action/GiftCardBalanceAction.php | 4 +- .../Action/RemoveGiftCardFromOrderAction.php | 2 +- .../Action/ResendGiftCardEmailAction.php | 2 +- .../Action/SearchGiftCardAction.php | 2 +- .../SetonoSyliusGiftCardExtension.php | 24 +--- src/Doctrine/ORM/GiftCardRepository.php | 2 +- src/Doctrine/ORM/OrderRepositoryTrait.php | 2 +- src/EmailManager/GiftCardEmailManager.php | 6 +- .../GiftCardDeletionSubscriber.php | 2 +- src/Exception/ChannelMismatchException.php | 2 +- src/Factory/GiftCardConfigurationFactory.php | 2 +- src/Factory/GiftCardFactory.php | 4 +- src/Factory/GiftCardFactoryInterface.php | 2 +- .../GiftCardConfigurationExampleFactory.php | 2 +- .../Factory/GiftCardExampleFactory.php | 6 +- .../GiftCardToCodeDataTransformer.php | 4 +- src/Form/Extension/AddToCartTypeExtension.php | 2 +- .../Type/AddToCartGiftCardInformationType.php | 2 +- src/Form/Type/GiftCardConfigurationType.php | 6 +- src/Form/Type/GiftCardType.php | 2 +- src/Grid/FieldTypes/StringFieldType.php | 1 + src/Model/GiftCard.php | 2 - src/Model/GiftCardConfiguration.php | 3 - src/Model/GiftCardConfigurationInterface.php | 1 - src/Model/GiftCardInterface.php | 1 - src/Model/OrderInterface.php | 1 - src/Model/OrderTrait.php | 1 + src/Operator/OrderGiftCardOperator.php | 2 +- src/Order/AddToCartCommand.php | 2 +- src/Order/Factory/AddToCartCommandFactory.php | 2 +- src/OrderProcessor/OrderGiftCardProcessor.php | 4 +- .../GiftCardConfigurationProvider.php | 2 +- src/Renderer/PdfRenderer.php | 4 +- src/Renderer/PdfRendererInterface.php | 2 +- src/Resolver/CustomerChannelResolver.php | 2 +- src/Resolver/LocaleResolver.php | 2 +- .../conditional/catalog_promotion_rule.xml | 15 --- .../GiftCardConfigurationNormalizer.php | 4 +- src/Twig/Extension/PdfRuntime.php | 2 +- tests/Application/.env | 30 ++++- tests/Application/.env.test | 2 +- .../Doctrine/ORM/CustomerRepository.php | 4 +- .../Doctrine/ORM/OrderRepository.php | 4 +- tests/Application/Kernel.php | 90 +++++-------- tests/Application/Model/ChannelPricing.php | 19 --- tests/Application/Model/Order.php | 3 +- tests/Application/Model/OrderItem.php | 3 +- tests/Application/Model/OrderItemUnit.php | 3 +- tests/Application/Model/Product.php | 3 +- .../Repository/ChannelPricingRepository.php | 14 -- .../Repository/ProductRepository.php | 14 -- .../Repository/ProductVariantRepository.php | 14 -- tests/Application/bin/console | 4 +- .../config/api_platform/.gitignore | 0 tests/Application/config/bootstrap.php | 10 +- tests/Application/config/bundles.php | 17 ++- tests/Application/config/jwt/private.pem | 80 ++++++++---- tests/Application/config/jwt/public.pem | 19 ++- .../Application/config/packages/_sylius.yaml | 27 ++-- .../config/packages/api_platform.yaml | 9 ++ .../config/packages/dev/jms_serializer.yaml | 12 ++ .../Application/config/packages/doctrine.yaml | 2 +- .../config/packages/doctrine_migrations.yaml | 2 - .../Application/config/packages/fos_rest.yaml | 2 +- .../config/packages/framework.yaml | 5 +- .../config/packages/jms_serializer.yaml | 4 + tests/Application/config/packages/mailer.yaml | 3 + .../config/packages/prod/jms_serializer.yaml | 6 +- .../Application/config/packages/security.yaml | 64 ++++----- .../setono_sylius_catalog_promotion.yaml | 4 - .../config/packages/staging/monolog.yaml | 10 -- .../config/packages/staging/swiftmailer.yaml | 2 - .../config/packages/swiftmailer.yaml | 2 - .../config/packages/test/framework.yaml | 2 +- .../config/packages/test/mailer.yaml | 7 + .../config/packages/test/security.yaml | 6 + .../config/packages/test/swiftmailer.yaml | 6 - .../config/packages/test_cached/doctrine.yaml | 16 --- .../config/packages/test_cached/fos_rest.yaml | 3 - .../packages/test_cached/framework.yaml | 4 - .../config/packages/test_cached/monolog.yaml | 6 - .../packages/test_cached/swiftmailer.yaml | 6 - .../packages/test_cached/sylius_channel.yaml | 2 - .../packages/test_cached/sylius_theme.yaml | 3 - .../config/packages/test_cached/twig.yaml | 2 - .../setono_sylius_catalog_promotion.yaml | 3 - .../config/routes/sylius_admin.yaml | 2 +- .../config/routes/sylius_shop.yaml | 13 +- .../Application/config/secrets/dev/.gitignore | 0 .../config/secrets/prod/.gitignore | 0 .../config/secrets/test/.gitignore | 0 .../config/secrets/test_cached/.gitignore | 0 .../config/serialization/.gitignore | 0 tests/Application/package.json | 2 +- tests/Application/public/index.php | 6 +- .../ManagingGiftCardConfigurationsContext.php | 10 +- .../Admin/ManagingGiftCardsBalanceContext.php | 4 +- .../Api/Admin/ManagingGiftCardsContext.php | 6 +- tests/Behat/Context/Api/Shop/CartContext.php | 4 +- .../Api/Shop/ManagingGiftCardsContext.php | 8 +- .../Setup/GiftCardConfigurationContext.php | 4 +- tests/Behat/Context/Setup/GiftCardContext.php | 8 +- .../GiftCardConfigurationContext.php | 2 +- .../Context/Transform/GiftCardContext.php | 2 +- .../Ui/Admin/ManagingGiftCardsContext.php | 6 +- tests/Behat/Context/Ui/EmailContext.php | 22 +--- tests/Behat/Context/Ui/Shop/CartContext.php | 6 +- .../Behat/Context/Ui/Shop/CheckoutContext.php | 4 +- .../Admin/Product/CreateSimpleProductPage.php | 2 +- .../CreateSimpleProductPageInterface.php | 2 +- tests/Behat/Page/Shop/Cart/SummaryPage.php | 2 +- .../Page/Shop/Cart/SummaryPageInterface.php | 2 +- tests/Behat/Page/Shop/Product/ShowPage.php | 2 +- .../Page/Shop/Product/ShowPageInterface.php | 2 +- tests/Behat/Resources/context/api.xml | 12 +- tests/Behat/Resources/context/setup.xml | 4 +- tests/Behat/Resources/context/transform.xml | 4 +- tests/Behat/Resources/context/ui.xml | 8 +- tests/Behat/Resources/page/admin.xml | 2 +- tests/Behat/Resources/page/shop.xml | 4 +- .../Api/Command/AddGiftCardToOrderTest.php | 2 +- tests/Unit/Api/Command/AddItemToCartTest.php | 2 +- .../AssociateConfigurationToChannelTest.php | 2 +- .../CreateGiftCardConfigurationTest.php | 2 +- .../Command/RemoveGiftCardFromOrderTest.php | 2 +- .../AddGiftCardToOrderHandlerTest.php | 12 +- .../AddItemToCartHandlerTest.php | 10 +- ...ciateConfigurationToChannelHandlerTest.php | 14 +- ...CreateGiftCardConfigurationHandlerTest.php | 6 +- .../RemoveGiftCardFromOrderHandlerTest.php | 12 +- .../Action/DownloadGiftCardPdfActionTest.php | 4 +- .../Action/GiftCardBalanceActionTest.php | 2 +- .../Action/ResendGiftCardEmailActionTest.php | 6 +- ...adGiftCardConfigurationImageActionTest.php | 12 +- .../GiftCardDataPersisterTest.php | 2 +- ...deAwareInputCommandDataTransformerTest.php | 4 +- .../GiftCardsByLoggedInUserExtensionTest.php | 2 +- .../GenerateEncodedExamplePdfActionTest.php | 4 +- .../DependencyInjection/ConfigurationTest.php | 2 +- .../SetonoSyliusGiftCardExtensionTest.php | 2 +- ...ultGiftCardConfigurationSubscriberTest.php | 2 +- ...ilWithGiftCardToCustomerSubscriberTest.php | 2 +- .../GiftCardConfigurationFactoryTest.php | 4 +- tests/Unit/Factory/GiftCardFactoryTest.php | 22 ++-- .../Extension/AddToCartTypeExtensionTest.php | 14 +- tests/Unit/Form/Type/DatePeriodTypeTest.php | 2 +- .../Generator/GiftCardCodeGeneratorTest.php | 2 +- .../Unit/Model/GiftCardConfigurationTest.php | 2 +- tests/Unit/Model/GiftCardTest.php | 4 +- tests/Unit/Model/OrderItemTraitTest.php | 6 +- tests/Unit/Model/ProductTraitTest.php | 4 +- tests/Unit/Operator/GiftCardOperatorTest.php | 18 +-- tests/Unit/Order/AddToCartCommandTest.php | 6 +- .../Factory/AddToCardCommandFactoryTest.php | 6 +- .../GiftCardInformationFactoryTest.php | 4 +- tests/Unit/Order/GiftCardInformationTest.php | 2 +- .../OrderGiftCardProcessorTest.php | 6 +- .../Provider/DatePeriodUnitProviderTest.php | 2 +- .../OrderEligibleTotalProviderTest.php | 4 +- .../PdfRenderingOptionProviderTest.php | 2 +- tests/Unit/Security/GiftCardVoterTest.php | 10 +- tests/Unit/Twig/Extension/PdfRuntimeTest.php | 4 +- .../Constraints/DatePeriodValidatorTest.php | 2 +- .../GiftCardIsNotExpiredValidatorTest.php | 2 +- .../HasBackgroundImageValidatorTest.php | 2 +- .../Pdf/ValidOrientationValidatorTest.php | 2 +- .../Pdf/ValidPageSizeValidatorTest.php | 2 +- 186 files changed, 575 insertions(+), 823 deletions(-) delete mode 100644 src/CatalogPromotion/Rule/IsNotGiftCardRule.php delete mode 100644 src/Resources/config/services/conditional/catalog_promotion_rule.xml delete mode 100644 tests/Application/Model/ChannelPricing.php delete mode 100644 tests/Application/Repository/ChannelPricingRepository.php delete mode 100644 tests/Application/Repository/ProductRepository.php delete mode 100644 tests/Application/Repository/ProductVariantRepository.php create mode 100644 tests/Application/config/api_platform/.gitignore create mode 100644 tests/Application/config/packages/api_platform.yaml create mode 100644 tests/Application/config/packages/dev/jms_serializer.yaml create mode 100644 tests/Application/config/packages/jms_serializer.yaml create mode 100644 tests/Application/config/packages/mailer.yaml delete mode 100644 tests/Application/config/packages/setono_sylius_catalog_promotion.yaml delete mode 100644 tests/Application/config/packages/staging/monolog.yaml delete mode 100644 tests/Application/config/packages/staging/swiftmailer.yaml delete mode 100644 tests/Application/config/packages/swiftmailer.yaml create mode 100644 tests/Application/config/packages/test/mailer.yaml create mode 100644 tests/Application/config/packages/test/security.yaml delete mode 100644 tests/Application/config/packages/test/swiftmailer.yaml delete mode 100644 tests/Application/config/packages/test_cached/doctrine.yaml delete mode 100644 tests/Application/config/packages/test_cached/fos_rest.yaml delete mode 100644 tests/Application/config/packages/test_cached/framework.yaml delete mode 100644 tests/Application/config/packages/test_cached/monolog.yaml delete mode 100644 tests/Application/config/packages/test_cached/swiftmailer.yaml delete mode 100644 tests/Application/config/packages/test_cached/sylius_channel.yaml delete mode 100644 tests/Application/config/packages/test_cached/sylius_theme.yaml delete mode 100644 tests/Application/config/packages/test_cached/twig.yaml delete mode 100644 tests/Application/config/routes/setono_sylius_catalog_promotion.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 create mode 100644 tests/Application/config/serialization/.gitignore diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 62c6fa00..4f085c8f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -24,14 +24,14 @@ jobs: strategy: matrix: php-version: - - "7.4" # Always use the lowest version of PHP since a higher version would create actual syntax errors in lower versions + - "8.1" # Always use the lowest version of PHP since a higher version would create actual syntax errors in lower versions dependencies: - "highest" steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: "Setup PHP, with composer and extensions" uses: "shivammathur/setup-php@v2" @@ -41,7 +41,7 @@ jobs: coverage: "none" - name: "Install composer dependencies" - uses: "ramsey/composer-install@v2" + uses: "ramsey/composer-install@v3" with: dependency-versions: "${{ matrix.dependencies }}" @@ -68,8 +68,6 @@ jobs: strategy: matrix: php-version: - - "7.4" - - "8.0" - "8.1" - "8.2" @@ -78,33 +76,12 @@ jobs: - "highest" symfony: - - "^5.4" - - "~6.0.0" - - "~6.1.0" - - "~6.2.0" - - "~6.3.0" - - exclude: - - php-version: "7.4" - symfony: "~6.0.0" - - php-version: "7.4" - symfony: "~6.1.0" - - php-version: "7.4" - symfony: "~6.2.0" - - php-version: "7.4" - symfony: "~6.3.0" - - php-version: "8.0" - symfony: "~6.0.0" - - php-version: "8.0" - symfony: "~6.1.0" - - php-version: "8.0" - symfony: "~6.2.0" - - php-version: "8.0" - symfony: "~6.3.0" + - "~5.4.0" + - "~6.4.0" steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: "Setup PHP, with composer and extensions" uses: "shivammathur/setup-php@v2" @@ -118,7 +95,7 @@ jobs: run: "composer config --unset require-dev" - name: "Install composer dependencies" - uses: "ramsey/composer-install@v2" + uses: "ramsey/composer-install@v3" env: SYMFONY_REQUIRE: "${{ matrix.symfony }}" with: @@ -138,8 +115,6 @@ jobs: strategy: matrix: php-version: - - "7.4" - - "8.0" - "8.1" - "8.2" @@ -148,33 +123,12 @@ jobs: - "highest" symfony: - - "^5.4" - - "~6.0.0" - - "~6.1.0" - - "~6.2.0" - - "~6.3.0" - - exclude: - - php-version: "7.4" - symfony: "~6.0.0" - - php-version: "7.4" - symfony: "~6.1.0" - - php-version: "7.4" - symfony: "~6.2.0" - - php-version: "7.4" - symfony: "~6.3.0" - - php-version: "8.0" - symfony: "~6.0.0" - - php-version: "8.0" - symfony: "~6.1.0" - - php-version: "8.0" - symfony: "~6.2.0" - - php-version: "8.0" - symfony: "~6.3.0" + - "~5.4.0" + - "~6.4.0" steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: "Setup PHP, with composer and extensions" uses: "shivammathur/setup-php@v2" @@ -188,7 +142,7 @@ jobs: run: "composer remove --dev --no-update --no-plugins --no-scripts sylius/sylius" - name: "Install composer dependencies" - uses: "ramsey/composer-install@v2" + uses: "ramsey/composer-install@v3" env: SYMFONY_REQUIRE: "${{ matrix.symfony }}" with: @@ -205,8 +159,6 @@ jobs: strategy: matrix: php-version: - - "7.4" - - "8.0" - "8.1" - "8.2" @@ -214,33 +166,12 @@ jobs: - "highest" symfony: - - "^5.4" - - "~6.0.0" - - "~6.1.0" - - "~6.2.0" - - "~6.3.0" - - exclude: - - php-version: "7.4" - symfony: "~6.0.0" - - php-version: "7.4" - symfony: "~6.1.0" - - php-version: "7.4" - symfony: "~6.2.0" - - php-version: "7.4" - symfony: "~6.3.0" - - php-version: "8.0" - symfony: "~6.0.0" - - php-version: "8.0" - symfony: "~6.1.0" - - php-version: "8.0" - symfony: "~6.2.0" - - php-version: "8.0" - symfony: "~6.3.0" + - "~5.4.0" + - "~6.4.0" steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: "Setup PHP, with composer and extensions" uses: "shivammathur/setup-php@v2" @@ -254,7 +185,7 @@ jobs: run: "composer remove --dev --no-update --no-plugins --no-scripts sylius/sylius" - name: "Install composer dependencies" - uses: "ramsey/composer-install@v2" + uses: "ramsey/composer-install@v3" env: SYMFONY_REQUIRE: "${{ matrix.symfony }}" with: @@ -271,8 +202,6 @@ jobs: strategy: matrix: php-version: - - "7.4" - - "8.0" - "8.1" - "8.2" @@ -280,14 +209,14 @@ jobs: - "highest" symfony: - - "^5.4" + - "~6.4" steps: - name: "Start MySQL" run: "sudo /etc/init.d/mysql start" - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: "Setup PHP, with composer and extensions" uses: "shivammathur/setup-php@v2" @@ -298,12 +227,12 @@ jobs: tools: "flex,symfony" - name: "Setup node" - uses: "actions/setup-node@v3" + uses: "actions/setup-node@v4" with: - node-version: "16" + node-version: "18" - name: "Install composer dependencies" - uses: "ramsey/composer-install@v2" + uses: "ramsey/composer-install@v3" env: SYMFONY_REQUIRE: "${{ matrix.symfony }}" with: @@ -374,7 +303,7 @@ jobs: 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" + uses: "actions/upload-artifact@v4" if: "failure()" with: name: "Behat logs" @@ -396,7 +325,7 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: "Setup PHP, with composer and extensions" uses: "shivammathur/setup-php@v2" @@ -406,7 +335,7 @@ jobs: php-version: "${{ matrix.php-version }}" - name: "Install composer dependencies" - uses: "ramsey/composer-install@v2" + uses: "ramsey/composer-install@v3" with: dependency-versions: "${{ matrix.dependencies }}" diff --git a/behat.yml.dist b/behat.yml.dist index e0cb2f72..3bfa4adf 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -40,7 +40,7 @@ default: FriendsOfBehat\SymfonyExtension: bootstrap: tests/Application/config/bootstrap.php kernel: - class: Tests\Setono\SyliusGiftCardPlugin\Application\Kernel + class: Setono\SyliusGiftCardPlugin\Tests\Application\Kernel FriendsOfBehat\VariadicExtension: ~ diff --git a/composer.json b/composer.json index 4b1dbd30..05832011 100644 --- a/composer.json +++ b/composer.json @@ -4,14 +4,14 @@ "license": "MIT", "type": "sylius-plugin", "require": { - "php": ">=7.4", + "php": ">=8.1", "ext-filter": "*", "ext-mbstring": "*", "api-platform/core": "^2.6", "doctrine/collections": "^1.8", "doctrine/dbal": "^2.13 || ^3.0", "doctrine/orm": "^2.7", - "doctrine/persistence": "^1.3 || ^2.5", + "doctrine/persistence": "^1.3 || ^2.5 || ^3.0", "fakerphp/faker": "^1.21", "knplabs/knp-menu": "^3.3", "knplabs/knp-snappy": "^1.4", @@ -38,46 +38,51 @@ "sylius/shipping-bundle": "^1.0", "sylius/ui-bundle": "^1.0", "sylius/user": "^1.0", - "symfony/config": "^5.4 || ^6.0", - "symfony/dependency-injection": "^5.4 || ^6.0", - "symfony/event-dispatcher": "^5.4 || ^6.0", - "symfony/form": "^5.4 || ^6.0", - "symfony/http-foundation": "^5.4 || ^6.0", - "symfony/http-kernel": "^5.4 || ^6.0", - "symfony/messenger": "^5.4 || ^6.0", - "symfony/options-resolver": "^5.4 || ^6.0", - "symfony/property-access": "^5.4 || ^6.0", - "symfony/routing": "^5.4 || ^6.0", - "symfony/security-core": "^5.4 || ^6.0", - "symfony/serializer": "^5.4 || ^6.0", + "symfony/config": "^5.4 || ^6.4", + "symfony/dependency-injection": "^5.4 || ^6.4", + "symfony/event-dispatcher": "^5.4 || ^6.4", + "symfony/form": "^5.4 || ^6.4", + "symfony/http-foundation": "^5.4 || ^6.4", + "symfony/http-kernel": "^5.4 || ^6.4", + "symfony/messenger": "^5.4 || ^6.4", + "symfony/options-resolver": "^5.4 || ^6.4", + "symfony/property-access": "^5.4 || ^6.4", + "symfony/routing": "^5.4 || ^6.4", + "symfony/security-core": "^5.4 || ^6.4", + "symfony/serializer": "^5.4 || ^6.4", "symfony/translation-contracts": "^2.4", - "symfony/validator": "^5.4 || ^6.0", + "symfony/validator": "^5.4 || ^6.4", "twig/twig": "^2.15 || ^3.5", "webimpress/safe-writer": "^2.2", "webmozart/assert": "^1.11" }, "require-dev": { - "lexik/jwt-authentication-bundle": "^2.19", - "matthiasnoback/symfony-config-test": "^4.3", - "matthiasnoback/symfony-dependency-injection-test": "^4.3", + "babdev/pagerfanta-bundle": "^3.8", + "behat/behat": "^3.14", + "doctrine/doctrine-bundle": "^2.7", + "infection/infection": "^0.27.10", + "jms/serializer-bundle": "^4.2", + "lexik/jwt-authentication-bundle": "^2.17", + "matthiasnoback/symfony-config-test": "^4.3 || ^5.1", + "matthiasnoback/symfony-dependency-injection-test": "^4.3 || ^5.1", "php-http/message-factory": "^1.1", "phpspec/phpspec": "^7.4", "phpspec/prophecy-phpunit": "^2.0.2", - "phpunit/phpunit": "^9.6.13", - "psalm/plugin-phpunit": "^0.18", + "phpunit/phpunit": "^9.6.17", + "polishsymfonycommunity/symfony-mocker-container": "^1.0.7", + "psalm/plugin-phpunit": "^0.18.4", "psalm/plugin-symfony": "^5.0", - "setono/code-quality-pack": "^2.6", + "setono/code-quality-pack": "^2.7", "setono/sylius-behat-pack": "^0.2.2", - "setono/sylius-catalog-promotion-plugin": "^0.4.8 || ^0.5", - "sylius/sylius": "~1.10.14", - "symfony/debug-bundle": "^5.4 || ^6.0", - "symfony/dotenv": "^5.4 || ^6.0", - "symfony/framework-bundle": "^5.4 || ^6.0", - "symfony/intl": "^5.4 || ^6.0", - "symfony/property-info": "^5.4 || ^6.0", - "symfony/web-profiler-bundle": "^5.4 || ^6.0", - "symfony/webpack-encore-bundle": "^1.17", - "weirdan/doctrine-psalm-plugin": "^2.9" + "sylius/sylius": "~1.12.13", + "symfony/debug-bundle": "^5.4 || ^6.4", + "symfony/dotenv": "^5.4 || ^6.4", + "symfony/intl": "^5.4 || ^6.4", + "symfony/property-info": "^5.4 || ^6.4", + "symfony/web-profiler-bundle": "^5.4 || ^6.4", + "symfony/webpack-encore-bundle": "^1.17.2", + "weirdan/doctrine-psalm-plugin": "^2.9", + "willdurand/negotiation": "^3.1" }, "prefer-stable": true, "autoload": { @@ -87,7 +92,7 @@ }, "autoload-dev": { "psr-4": { - "Tests\\Setono\\SyliusGiftCardPlugin\\": "tests/" + "Setono\\SyliusGiftCardPlugin\\Tests\\": "tests/" }, "classmap": [ "tests/Application/Kernel.php" @@ -95,65 +100,17 @@ }, "config": { "allow-plugins": { - "composer/package-versions-deprecated": true, "dealerdirect/phpcodesniffer-composer-installer": false, "ergebnis/composer-normalize": true, - "symfony/thanks": false, - "ocramius/package-versions": true + "infection/extension-installer": true, + "symfony/thanks": false }, "sort-packages": true }, "scripts": { - "all": [ - "@checks", - "@tests" - ], "analyse": "psalm", - "assets": [ - "@ensure-assets-installed", - "@ensure-assets-compiled" - ], - "behat": [ - "SYMFONY_ENV=test composer ensure-database-created", - "SYMFONY_ENV=test composer ensure-schema-updated", - "SYMFONY_ENV=test composer ensure-env-copied", - "php -d memory_limit=-1 vendor/bin/behat --tags=\"~@javascript\" --no-interaction --format=progress" - ], "check-style": "ecs check", - "checks": [ - "@check-style", - "@analyse" - ], - "ensure-assets-compiled": "[[ -d tests/Application/public/assets ]] || (cd tests/Application && yarn build && composer ensure-env-copied && bin/console assets:install public -e ${SYMFONY_ENV:-'dev'})", - "ensure-assets-installed": "[[ -d tests/Application/node_modules ]] || (cd tests/Application && yarn install)", - "ensure-database-created": "composer ensure-env-copied && (cd tests/Application && bin/console doctrine:database:create --if-not-exists -e ${SYMFONY_ENV:-'dev'})", - "ensure-env-copied": "([[ ${SYMFONY_ENV:-'dev'} == 'dev' ]] && composer ensure-env-dev-copied) || ([[ ${SYMFONY_ENV:-'dev'} == 'test' ]] && composer ensure-env-test-copied) || echo 'Unknown environment ${SYMFONY_ENV}'", - "ensure-env-dev-copied": "(cd tests/Application && ([[ -f .env.local ]] || cp .env .env.local))", - "ensure-env-test-copied": "(cd tests/Application && ([[ -f .env.test.local ]] || cp .env.test .env.test.local))", - "ensure-schema-updated": "composer ensure-env-copied && (cd tests/Application && bin/console doctrine:schema:update --force -e ${SYMFONY_ENV:-'dev'})", - "ensure-vendors-installed": "[[ -f vendor/autoload.php ]] || php -d memory_limit=-1 /usr/local/bin/composer install", "fix-style": "ecs check --fix", - "fixtures": [ - "@ensure-database-created", - "@ensure-schema-updated", - "(cd tests/Application && php -d memory_limit=-1 bin/console sylius:fixtures:load --no-interaction -e ${SYMFONY_ENV:-'dev'})" - ], - "phpspec": "phpspec run -vvv", - "phpunit": "phpunit", - "run": [ - "@ensure-env-copied", - "(cd tests/Application && bin/console server:run -d public -e ${SYMFONY_ENV:-'dev'})" - ], - "tests": [ - "@phpspec", - "@phpunit", - "@behat" - ], - "try": [ - "@ensure-vendors-installed", - "@assets", - "@fixtures", - "@run" - ] + "phpunit": "phpunit" } } diff --git a/ecs.php b/ecs.php index c0478b9d..6e01c257 100644 --- a/ecs.php +++ b/ecs.php @@ -2,16 +2,16 @@ declare(strict_types=1); -use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer; -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; -use Symplify\EasyCodingStandard\ValueObject\Option; +use Symplify\EasyCodingStandard\Config\ECSConfig; -return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php'); - $containerConfigurator->parameters()->set(Option::PATHS, [ - 'src', 'spec', 'tests' +return static function (ECSConfig $config): void { + $config->import('vendor/sylius-labs/coding-standard/ecs.php'); + $config->paths([ + 'src', + 'tests', ]); - $containerConfigurator->parameters()->set(Option::SKIP, [ - 'tests/Application/**', + $config->skip([ + 'tests/Application/node_modules/**', + 'tests/Application/var/**', ]); }; diff --git a/src/Api/Command/CreateGiftCardConfiguration.php b/src/Api/Command/CreateGiftCardConfiguration.php index 16dee357..bc4907dc 100644 --- a/src/Api/Command/CreateGiftCardConfiguration.php +++ b/src/Api/Command/CreateGiftCardConfiguration.php @@ -27,7 +27,7 @@ public function __construct( ?string $defaultValidityPeriod = null, ?string $pageSize = null, ?string $orientation = null, - ?string $template = null + ?string $template = null, ) { $this->code = $code; $this->default = $default; diff --git a/src/Api/CommandHandler/AddGiftCardToOrderHandler.php b/src/Api/CommandHandler/AddGiftCardToOrderHandler.php index 7f16fbac..6fca53ef 100644 --- a/src/Api/CommandHandler/AddGiftCardToOrderHandler.php +++ b/src/Api/CommandHandler/AddGiftCardToOrderHandler.php @@ -23,7 +23,7 @@ final class AddGiftCardToOrderHandler public function __construct( GiftCardRepositoryInterface $giftCardRepository, OrderRepositoryInterface $orderRepository, - GiftCardApplicatorInterface $giftCardApplicator + GiftCardApplicatorInterface $giftCardApplicator, ) { $this->giftCardRepository = $giftCardRepository; $this->orderRepository = $orderRepository; diff --git a/src/Api/CommandHandler/AddItemToCartHandler.php b/src/Api/CommandHandler/AddItemToCartHandler.php index 52721621..54535be5 100644 --- a/src/Api/CommandHandler/AddItemToCartHandler.php +++ b/src/Api/CommandHandler/AddItemToCartHandler.php @@ -43,7 +43,7 @@ public function __construct( CartItemFactoryInterface $cartItemFactory, OrderItemQuantityModifierInterface $orderItemQuantityModifier, GiftCardFactoryInterface $giftCardFactory, - EntityManagerInterface $giftCardManager + EntityManagerInterface $giftCardManager, ) { $this->orderRepository = $orderRepository; $this->productVariantRepository = $productVariantRepository; diff --git a/src/Api/CommandHandler/AssociateConfigurationToChannelHandler.php b/src/Api/CommandHandler/AssociateConfigurationToChannelHandler.php index cc4b4692..f8418c22 100644 --- a/src/Api/CommandHandler/AssociateConfigurationToChannelHandler.php +++ b/src/Api/CommandHandler/AssociateConfigurationToChannelHandler.php @@ -30,7 +30,7 @@ public function __construct( ChannelRepositoryInterface $channelRepository, RepositoryInterface $localeRepository, RepositoryInterface $giftCardChannelConfigurationRepository, - FactoryInterface $giftCardChannelConfigurationFactory + FactoryInterface $giftCardChannelConfigurationFactory, ) { $this->giftCardConfigurationRepository = $giftCardConfigurationRepository; $this->channelRepository = $channelRepository; diff --git a/src/Api/CommandHandler/CreateGiftCardConfigurationHandler.php b/src/Api/CommandHandler/CreateGiftCardConfigurationHandler.php index 501c7b2e..47fb3e63 100644 --- a/src/Api/CommandHandler/CreateGiftCardConfigurationHandler.php +++ b/src/Api/CommandHandler/CreateGiftCardConfigurationHandler.php @@ -17,7 +17,7 @@ final class CreateGiftCardConfigurationHandler public function __construct( GiftCardConfigurationFactoryInterface $giftCardConfigurationFactory, - ObjectManager $giftCardConfigurationManager + ObjectManager $giftCardConfigurationManager, ) { $this->giftCardConfigurationFactory = $giftCardConfigurationFactory; $this->giftCardConfigurationManager = $giftCardConfigurationManager; diff --git a/src/Api/CommandHandler/RemoveGiftCardFromOrderHandler.php b/src/Api/CommandHandler/RemoveGiftCardFromOrderHandler.php index 84f86b05..8487fa23 100644 --- a/src/Api/CommandHandler/RemoveGiftCardFromOrderHandler.php +++ b/src/Api/CommandHandler/RemoveGiftCardFromOrderHandler.php @@ -23,7 +23,7 @@ final class RemoveGiftCardFromOrderHandler public function __construct( GiftCardRepositoryInterface $giftCardRepository, OrderRepositoryInterface $orderRepository, - GiftCardApplicatorInterface $giftCardApplicator + GiftCardApplicatorInterface $giftCardApplicator, ) { $this->giftCardRepository = $giftCardRepository; $this->orderRepository = $orderRepository; diff --git a/src/Api/Controller/Action/DownloadGiftCardPdfAction.php b/src/Api/Controller/Action/DownloadGiftCardPdfAction.php index 7cbcbbc2..8f7ced89 100644 --- a/src/Api/Controller/Action/DownloadGiftCardPdfAction.php +++ b/src/Api/Controller/Action/DownloadGiftCardPdfAction.php @@ -19,7 +19,7 @@ final class DownloadGiftCardPdfAction public function __construct( GiftCardConfigurationProviderInterface $configurationProvider, - PdfRendererInterface $giftCardPDFRenderer + PdfRendererInterface $giftCardPDFRenderer, ) { $this->configurationProvider = $configurationProvider; $this->pdfRenderer = $giftCardPDFRenderer; diff --git a/src/Api/Controller/Action/GiftCardBalanceAction.php b/src/Api/Controller/Action/GiftCardBalanceAction.php index 8589f1cc..7b89460c 100644 --- a/src/Api/Controller/Action/GiftCardBalanceAction.php +++ b/src/Api/Controller/Action/GiftCardBalanceAction.php @@ -19,7 +19,7 @@ public function __construct(GiftCardRepositoryInterface $giftCardRepository) public function __invoke(): GiftCardBalanceCollection { return GiftCardBalanceCollection::createFromGiftCards( - $this->giftCardRepository->findEnabled() + $this->giftCardRepository->findEnabled(), ); } } diff --git a/src/Api/Controller/Action/UploadGiftCardConfigurationImageAction.php b/src/Api/Controller/Action/UploadGiftCardConfigurationImageAction.php index 73c7aec0..79c47634 100644 --- a/src/Api/Controller/Action/UploadGiftCardConfigurationImageAction.php +++ b/src/Api/Controller/Action/UploadGiftCardConfigurationImageAction.php @@ -33,7 +33,7 @@ public function __construct( FactoryInterface $giftCardConfigurationImageFactory, RepositoryInterface $giftCardConfigurationImageRepository, ImageUploaderInterface $imageUploader, - $iriConverter + $iriConverter, ) { $this->giftCardConfigurationImageFactory = $giftCardConfigurationImageFactory; $this->giftCardConfigurationImageRepository = $giftCardConfigurationImageRepository; diff --git a/src/Api/Doctrine/QueryCollectionExtension/GiftCardsByLoggedInUserExtension.php b/src/Api/Doctrine/QueryCollectionExtension/GiftCardsByLoggedInUserExtension.php index bf885ae0..41b62e32 100644 --- a/src/Api/Doctrine/QueryCollectionExtension/GiftCardsByLoggedInUserExtension.php +++ b/src/Api/Doctrine/QueryCollectionExtension/GiftCardsByLoggedInUserExtension.php @@ -29,7 +29,7 @@ public function applyToCollection( QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null, - array $context = [] + array $context = [], ): void { if (!is_a($resourceClass, GiftCardInterface::class, true)) { return; diff --git a/src/Applicator/GiftCardApplicator.php b/src/Applicator/GiftCardApplicator.php index 644a32b2..b6770512 100644 --- a/src/Applicator/GiftCardApplicator.php +++ b/src/Applicator/GiftCardApplicator.php @@ -20,7 +20,7 @@ final class GiftCardApplicator implements GiftCardApplicatorInterface public function __construct( GiftCardRepositoryInterface $giftCardRepository, - OrderProcessorInterface $orderProcessor + OrderProcessorInterface $orderProcessor, ) { $this->giftCardRepository = $giftCardRepository; $this->orderProcessor = $orderProcessor; diff --git a/src/CatalogPromotion/Rule/IsNotGiftCardRule.php b/src/CatalogPromotion/Rule/IsNotGiftCardRule.php deleted file mode 100644 index 6ae976e4..00000000 --- a/src/CatalogPromotion/Rule/IsNotGiftCardRule.php +++ /dev/null @@ -1,25 +0,0 @@ -getRootAlias($queryBuilder); - $productAlias = self::generateAlias('product'); - - $queryBuilder - ->join(sprintf('%s.product', $rootAlias), $productAlias) - ->andWhere(sprintf('%s.giftCard = false', $productAlias)) - ; - } -} diff --git a/src/Controller/Action/AddGiftCardToOrderAction.php b/src/Controller/Action/AddGiftCardToOrderAction.php index 65aab0a1..c6d8f6fd 100644 --- a/src/Controller/Action/AddGiftCardToOrderAction.php +++ b/src/Controller/Action/AddGiftCardToOrderAction.php @@ -40,7 +40,7 @@ public function __construct( GiftCardApplicatorInterface $giftCardApplicator, RedirectUrlResolverInterface $redirectRouteResolver, Environment $twig, - ManagerRegistry $managerRegistry + ManagerRegistry $managerRegistry, ) { $this->formFactory = $formFactory; $this->cartContext = $cartContext; diff --git a/src/Controller/Action/Admin/GenerateEncodedExamplePdfAction.php b/src/Controller/Action/Admin/GenerateEncodedExamplePdfAction.php index dc73f506..80d95580 100644 --- a/src/Controller/Action/Admin/GenerateEncodedExamplePdfAction.php +++ b/src/Controller/Action/Admin/GenerateEncodedExamplePdfAction.php @@ -28,7 +28,7 @@ public function __construct( GiftCardFactoryInterface $giftCardFactory, GiftCardConfigurationRepositoryInterface $giftCardConfigurationRepository, PdfRendererInterface $giftCardPDFRenderer, - FormFactoryInterface $formFactory + FormFactoryInterface $formFactory, ) { $this->giftCardFactory = $giftCardFactory; $this->giftCardConfigurationRepository = $giftCardConfigurationRepository; diff --git a/src/Controller/Action/DownloadGiftCardPdfAction.php b/src/Controller/Action/DownloadGiftCardPdfAction.php index 70933a24..9646be7f 100644 --- a/src/Controller/Action/DownloadGiftCardPdfAction.php +++ b/src/Controller/Action/DownloadGiftCardPdfAction.php @@ -35,7 +35,7 @@ public function __construct( AuthorizationCheckerInterface $authChecker, GiftCardConfigurationProviderInterface $configurationProvider, PdfRendererInterface $giftCardPDFRenderer, - UrlGeneratorInterface $urlGenerator + UrlGeneratorInterface $urlGenerator, ) { $this->giftCardRepository = $giftCardRepository; $this->authChecker = $authChecker; @@ -63,7 +63,7 @@ public function __invoke(Request $request, int $id): Response return $this->sendErrorResponse( $request, $redirectUrl, - 'Configuration not found for this gift card. Create one by going to the gift card configuration.' + 'Configuration not found for this gift card. Create one by going to the gift card configuration.', ); } diff --git a/src/Controller/Action/GiftCardBalanceAction.php b/src/Controller/Action/GiftCardBalanceAction.php index 8becdad3..828cd210 100644 --- a/src/Controller/Action/GiftCardBalanceAction.php +++ b/src/Controller/Action/GiftCardBalanceAction.php @@ -21,7 +21,7 @@ final class GiftCardBalanceAction public function __construct( GiftCardRepositoryInterface $giftCardRepository, - Environment $twig + Environment $twig, ) { $this->giftCardRepository = $giftCardRepository; $this->twig = $twig; @@ -30,7 +30,7 @@ public function __construct( public function __invoke(Request $request): Response { $giftCardBalanceCollection = GiftCardBalanceCollection::createFromGiftCards( - $this->giftCardRepository->findEnabled() + $this->giftCardRepository->findEnabled(), ); return new Response($this->twig->render('@SetonoSyliusGiftCardPlugin/Admin/giftCardBalance.html.twig', [ diff --git a/src/Controller/Action/RemoveGiftCardFromOrderAction.php b/src/Controller/Action/RemoveGiftCardFromOrderAction.php index a5130a1c..c0cc8e25 100644 --- a/src/Controller/Action/RemoveGiftCardFromOrderAction.php +++ b/src/Controller/Action/RemoveGiftCardFromOrderAction.php @@ -31,7 +31,7 @@ public function __construct( CartContextInterface $cartContext, GiftCardApplicatorInterface $giftCardApplicator, RedirectUrlResolverInterface $redirectRouteResolver, - ManagerRegistry $managerRegistry + ManagerRegistry $managerRegistry, ) { $this->cartContext = $cartContext; $this->giftCardApplicator = $giftCardApplicator; diff --git a/src/Controller/Action/ResendGiftCardEmailAction.php b/src/Controller/Action/ResendGiftCardEmailAction.php index 9cb94acc..e8533710 100644 --- a/src/Controller/Action/ResendGiftCardEmailAction.php +++ b/src/Controller/Action/ResendGiftCardEmailAction.php @@ -28,7 +28,7 @@ final class ResendGiftCardEmailAction public function __construct( GiftCardEmailManagerInterface $giftCardEmailManager, GiftCardRepositoryInterface $giftCardRepository, - UrlGeneratorInterface $router + UrlGeneratorInterface $router, ) { $this->giftCardEmailManager = $giftCardEmailManager; $this->giftCardRepository = $giftCardRepository; diff --git a/src/Controller/Action/SearchGiftCardAction.php b/src/Controller/Action/SearchGiftCardAction.php index 5a77c96d..c4b542ab 100644 --- a/src/Controller/Action/SearchGiftCardAction.php +++ b/src/Controller/Action/SearchGiftCardAction.php @@ -18,7 +18,7 @@ final class SearchGiftCardAction public function __construct( FormFactoryInterface $formFactory, - Environment $twig + Environment $twig, ) { $this->formFactory = $formFactory; $this->twig = $twig; diff --git a/src/DependencyInjection/SetonoSyliusGiftCardExtension.php b/src/DependencyInjection/SetonoSyliusGiftCardExtension.php index 5d77169a..5d603e8d 100644 --- a/src/DependencyInjection/SetonoSyliusGiftCardExtension.php +++ b/src/DependencyInjection/SetonoSyliusGiftCardExtension.php @@ -4,12 +4,10 @@ namespace Setono\SyliusGiftCardPlugin\DependencyInjection; -use function array_key_exists; use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Webmozart\Assert\Assert; final class SetonoSyliusGiftCardExtension extends AbstractResourceExtension { @@ -28,6 +26,7 @@ public function load(array $configs, ContainerBuilder $container): void * driver: string, * resources: array * } $config + * * @psalm-suppress PossiblyNullArgument */ $config = $this->processConfiguration($this->getConfiguration([], $container), $configs); @@ -36,42 +35,33 @@ public function load(array $configs, ContainerBuilder $container): void $container->setParameter('setono_sylius_gift_card.code_length', $config['code_length']); $container->setParameter( 'setono_sylius_gift_card.pdf_rendering.default_orientation', - $config['pdf_rendering']['default_orientation'] + $config['pdf_rendering']['default_orientation'], ); $container->setParameter( 'setono_sylius_gift_card.pdf_rendering.available_orientations', - $config['pdf_rendering']['available_orientations'] + $config['pdf_rendering']['available_orientations'], ); $container->setParameter( 'setono_sylius_gift_card.pdf_rendering.default_page_size', - $config['pdf_rendering']['default_page_size'] + $config['pdf_rendering']['default_page_size'], ); $container->setParameter( 'setono_sylius_gift_card.pdf_rendering.available_page_sizes', - $config['pdf_rendering']['available_page_sizes'] + $config['pdf_rendering']['available_page_sizes'], ); $container->setParameter( 'setono_sylius_gift_card.pdf_rendering.preferred_page_sizes', - $config['pdf_rendering']['preferred_page_sizes'] + $config['pdf_rendering']['preferred_page_sizes'], ); // Load default CSS file $container->setParameter( 'setono_sylius_gift_card.default_css_file', - '@SetonoSyliusGiftCardPlugin/Shop/GiftCard/defaultGiftCardConfiguration.css.twig' + '@SetonoSyliusGiftCardPlugin/Shop/GiftCard/defaultGiftCardConfiguration.css.twig', ); $this->registerResources('setono_sylius_gift_card', $config['driver'], $config['resources'], $container); $loader->load('services.xml'); - - if ($container->hasParameter('kernel.bundles')) { - $bundles = $container->getParameter('kernel.bundles'); - Assert::isArray($bundles); - - if (array_key_exists('SetonoSyliusCatalogPromotionPlugin', $bundles)) { - $loader->load('services/conditional/catalog_promotion_rule.xml'); - } - } } } diff --git a/src/Doctrine/ORM/GiftCardRepository.php b/src/Doctrine/ORM/GiftCardRepository.php index cdd4fc39..baf41728 100644 --- a/src/Doctrine/ORM/GiftCardRepository.php +++ b/src/Doctrine/ORM/GiftCardRepository.php @@ -20,7 +20,7 @@ public function createListQueryBuilder(): QueryBuilder return $this->createQueryBuilder('o') ->addSelect('customer') ->leftJoin('o.customer', 'customer') - ; + ; } public function findOneEnabledByCodeAndChannel(string $code, ChannelInterface $channel): ?GiftCardInterface diff --git a/src/Doctrine/ORM/OrderRepositoryTrait.php b/src/Doctrine/ORM/OrderRepositoryTrait.php index 1ba5acb4..8613e9ec 100644 --- a/src/Doctrine/ORM/OrderRepositoryTrait.php +++ b/src/Doctrine/ORM/OrderRepositoryTrait.php @@ -44,6 +44,6 @@ public function createCompletedQueryBuilderByGiftCard(string $giftCardId): Query return $this->createQueryBuilderByGiftCard($giftCardId) ->andWhere('o.checkoutState = :checkoutState') ->setParameter('checkoutState', OrderCheckoutStates::STATE_COMPLETED) - ; + ; } } diff --git a/src/EmailManager/GiftCardEmailManager.php b/src/EmailManager/GiftCardEmailManager.php index d1dacae7..2bafce64 100644 --- a/src/EmailManager/GiftCardEmailManager.php +++ b/src/EmailManager/GiftCardEmailManager.php @@ -35,7 +35,7 @@ public function __construct( CustomerChannelResolverInterface $customerChannelResolver, LocaleResolverInterface $customerLocaleResolver, PdfRendererInterface $pdfRenderer, - string $cacheDir + string $cacheDir, ) { $this->sender = $sender; $this->translator = $translator; @@ -67,7 +67,7 @@ public function sendEmailToCustomerWithGiftCard(CustomerInterface $customer, Gif // We still need to inject locale to templates because layout is using it 'localeCode' => $localeCode, ], - $this->generateAttachments($giftCard) + $this->generateAttachments($giftCard), ); }); } @@ -103,7 +103,7 @@ public function sendEmailWithGiftCardsFromOrder(OrderInterface $order, array $gi // We still need to inject locale to templates because layout is using it 'localeCode' => $localeCode, ], - $this->generateAttachments($giftCards) + $this->generateAttachments($giftCards), ); }); } diff --git a/src/EventSubscriber/GiftCardDeletionSubscriber.php b/src/EventSubscriber/GiftCardDeletionSubscriber.php index 65536fb6..5978e751 100644 --- a/src/EventSubscriber/GiftCardDeletionSubscriber.php +++ b/src/EventSubscriber/GiftCardDeletionSubscriber.php @@ -28,7 +28,7 @@ public function onGiftCardPreDelete(ResourceControllerEvent $event): void if (!$giftCard instanceof GiftCardInterface) { throw new UnexpectedTypeException( $giftCard, - GiftCardInterface::class + GiftCardInterface::class, ); } diff --git a/src/Exception/ChannelMismatchException.php b/src/Exception/ChannelMismatchException.php index 499202ac..385bc17d 100644 --- a/src/Exception/ChannelMismatchException.php +++ b/src/Exception/ChannelMismatchException.php @@ -19,7 +19,7 @@ public function __construct(ChannelInterface $actualChannel, ChannelInterface $e parent::__construct(sprintf( 'Expected channel was "%s", given "%s"', (string) $expectedChannel->getName(), - (string) $actualChannel->getName() + (string) $actualChannel->getName(), )); $this->actualChannel = $actualChannel; $this->expectedChannel = $expectedChannel; diff --git a/src/Factory/GiftCardConfigurationFactory.php b/src/Factory/GiftCardConfigurationFactory.php index 1193bd33..f51fc279 100644 --- a/src/Factory/GiftCardConfigurationFactory.php +++ b/src/Factory/GiftCardConfigurationFactory.php @@ -22,7 +22,7 @@ public function __construct( FactoryInterface $decoratedFactory, DefaultGiftCardTemplateContentProviderInterface $defaultGiftCardTemplateContentProvider, string $defaultOrientation, - string $defaultPageSize + string $defaultPageSize, ) { $this->decoratedFactory = $decoratedFactory; $this->defaultGiftCardTemplateContentProvider = $defaultGiftCardTemplateContentProvider; diff --git a/src/Factory/GiftCardFactory.php b/src/Factory/GiftCardFactory.php index 18ce44a1..ed3c8cfc 100644 --- a/src/Factory/GiftCardFactory.php +++ b/src/Factory/GiftCardFactory.php @@ -35,7 +35,7 @@ public function __construct( GiftCardCodeGeneratorInterface $giftCardCodeGenerator, GiftCardConfigurationProviderInterface $giftCardConfigurationProvider, DateTimeProvider $dateTimeProvider, - CurrencyContextInterface $currencyContext + CurrencyContextInterface $currencyContext, ) { $this->decoratedFactory = $decoratedFactory; $this->giftCardCodeGenerator = $giftCardCodeGenerator; @@ -100,7 +100,7 @@ public function createFromOrderItemUnit(OrderItemUnitInterface $orderItemUnit): public function createFromOrderItemUnitAndCart( OrderItemUnitInterface $orderItemUnit, - OrderInterface $cart + OrderInterface $cart, ): GiftCardInterface { $channel = $cart->getChannel(); Assert::isInstanceOf($channel, ChannelInterface::class); diff --git a/src/Factory/GiftCardFactoryInterface.php b/src/Factory/GiftCardFactoryInterface.php index ca6efd9d..7ac4bb3b 100644 --- a/src/Factory/GiftCardFactoryInterface.php +++ b/src/Factory/GiftCardFactoryInterface.php @@ -22,7 +22,7 @@ public function createFromOrderItemUnit(OrderItemUnitInterface $orderItemUnit): public function createFromOrderItemUnitAndCart( OrderItemUnitInterface $orderItemUnit, - OrderInterface $cart + OrderInterface $cart, ): GiftCardInterface; /** diff --git a/src/Fixture/Factory/GiftCardConfigurationExampleFactory.php b/src/Fixture/Factory/GiftCardConfigurationExampleFactory.php index 191de3cf..1fb08a61 100644 --- a/src/Fixture/Factory/GiftCardConfigurationExampleFactory.php +++ b/src/Fixture/Factory/GiftCardConfigurationExampleFactory.php @@ -35,7 +35,7 @@ public function __construct( GiftCardConfigurationFactoryInterface $giftCardConfigurationFactory, FactoryInterface $imageFactory, ImageUploaderInterface $imageUploader, - FileLocatorInterface $fileLocator + FileLocatorInterface $fileLocator, ) { $this->giftCardConfigurationRepository = $giftCardConfigurationRepository; $this->giftCardConfigurationFactory = $giftCardConfigurationFactory; diff --git a/src/Fixture/Factory/GiftCardExampleFactory.php b/src/Fixture/Factory/GiftCardExampleFactory.php index d41a7996..795dbf59 100644 --- a/src/Fixture/Factory/GiftCardExampleFactory.php +++ b/src/Fixture/Factory/GiftCardExampleFactory.php @@ -41,7 +41,7 @@ public function __construct( FactoryInterface $giftCardFactory, GiftCardCodeGeneratorInterface $giftCardCodeGenerator, ChannelRepositoryInterface $channelRepository, - RepositoryInterface $currencyRepository + RepositoryInterface $currencyRepository, ) { $this->giftCardRepository = $giftCardRepository; $this->giftCardFactory = $giftCardFactory; @@ -130,7 +130,7 @@ protected function configureOptions(OptionsResolver $resolver): void Assert::notNull($currency, sprintf( 'Currency %s was not found. Use one of: %s', $currencyCode, - implode(', ', $channelCurrenciesCodes) + implode(', ', $channelCurrenciesCodes), )); Assert::isInstanceOf($channel, ChannelInterface::class); @@ -138,7 +138,7 @@ protected function configureOptions(OptionsResolver $resolver): void Assert::oneOf($currency, $channel->getCurrencies()->toArray(), sprintf( 'Expecting one of %s currencies, got: %s', implode(', ', $channelCurrenciesCodes), - $currencyCode + $currencyCode, )); return $currency; diff --git a/src/Form/DataTransformer/GiftCardToCodeDataTransformer.php b/src/Form/DataTransformer/GiftCardToCodeDataTransformer.php index 88a22496..932312b8 100644 --- a/src/Form/DataTransformer/GiftCardToCodeDataTransformer.php +++ b/src/Form/DataTransformer/GiftCardToCodeDataTransformer.php @@ -19,7 +19,7 @@ final class GiftCardToCodeDataTransformer implements DataTransformerInterface public function __construct( GiftCardRepositoryInterface $giftCardRepository, - ChannelContextInterface $channelContext + ChannelContextInterface $channelContext, ) { $this->giftCardRepository = $giftCardRepository; $this->channelContext = $channelContext; @@ -51,7 +51,7 @@ public function reverseTransform($value): ?GiftCardInterface $giftCard = $this->giftCardRepository->findOneEnabledByCodeAndChannel( $value, - $this->channelContext->getChannel() + $this->channelContext->getChannel(), ); if (null !== $giftCard) { diff --git a/src/Form/Extension/AddToCartTypeExtension.php b/src/Form/Extension/AddToCartTypeExtension.php index 7bebfcee..cfaebe80 100644 --- a/src/Form/Extension/AddToCartTypeExtension.php +++ b/src/Form/Extension/AddToCartTypeExtension.php @@ -25,7 +25,7 @@ final class AddToCartTypeExtension extends AbstractTypeExtension public function __construct( GiftCardFactoryInterface $giftCardFactory, - EntityManagerInterface $giftCardManager + EntityManagerInterface $giftCardManager, ) { $this->giftCardFactory = $giftCardFactory; $this->giftCardManager = $giftCardManager; diff --git a/src/Form/Type/AddToCartGiftCardInformationType.php b/src/Form/Type/AddToCartGiftCardInformationType.php index 1404c181..79291439 100644 --- a/src/Form/Type/AddToCartGiftCardInformationType.php +++ b/src/Form/Type/AddToCartGiftCardInformationType.php @@ -36,7 +36,7 @@ public function __construct( array $validationGroups, CurrencyContextInterface $currencyContext, ProductVariantResolverInterface $productVariantResolver, - ChannelContextInterface $channelContext + ChannelContextInterface $channelContext, ) { $this->dataClass = $dataClass; $this->validationGroups = $validationGroups; diff --git a/src/Form/Type/GiftCardConfigurationType.php b/src/Form/Type/GiftCardConfigurationType.php index f67b4c92..bc58f366 100644 --- a/src/Form/Type/GiftCardConfigurationType.php +++ b/src/Form/Type/GiftCardConfigurationType.php @@ -35,7 +35,7 @@ public function __construct( array $availablePageSizes, array $preferredPageSizes, string $dataClass, - array $validationGroups = [] + array $validationGroups = [], ) { parent::__construct($dataClass, $validationGroups); @@ -114,8 +114,8 @@ function (array $data): ?string { /** @psalm-suppress MixedArgumentTypeCoercion */ return \implode(' ', $data); - } - ) + }, + ), ); } diff --git a/src/Form/Type/GiftCardType.php b/src/Form/Type/GiftCardType.php index eb77201b..9557acfa 100644 --- a/src/Form/Type/GiftCardType.php +++ b/src/Form/Type/GiftCardType.php @@ -34,7 +34,7 @@ public function __construct( string $dataClass, RepositoryInterface $currencyRepository, GiftCardCodeGeneratorInterface $giftCardCodeGenerator, - array $validationGroups = [] + array $validationGroups = [], ) { parent::__construct($dataClass, $validationGroups); diff --git a/src/Grid/FieldTypes/StringFieldType.php b/src/Grid/FieldTypes/StringFieldType.php index 6686ef33..56876464 100644 --- a/src/Grid/FieldTypes/StringFieldType.php +++ b/src/Grid/FieldTypes/StringFieldType.php @@ -44,6 +44,7 @@ public function configureOptions(OptionsResolver $resolver): void /** * @param mixed $value + * * @psalm-assert-if-true null|scalar|object $value */ private static function isStringable($value): bool diff --git a/src/Model/GiftCard.php b/src/Model/GiftCard.php index 92c99521..9bbf37b2 100644 --- a/src/Model/GiftCard.php +++ b/src/Model/GiftCard.php @@ -18,7 +18,6 @@ class GiftCard implements GiftCardInterface { use TimestampableTrait; - use ToggleableTrait; protected ?int $id = null; @@ -29,7 +28,6 @@ class GiftCard implements GiftCardInterface /** * @var Collection|OrderInterface[] - * * @psalm-var Collection */ protected Collection $appliedOrders; diff --git a/src/Model/GiftCardConfiguration.php b/src/Model/GiftCardConfiguration.php index 5596535f..48bb2322 100644 --- a/src/Model/GiftCardConfiguration.php +++ b/src/Model/GiftCardConfiguration.php @@ -13,7 +13,6 @@ class GiftCardConfiguration implements GiftCardConfigurationInterface { use TimestampableTrait; - use ToggleableTrait; protected ?int $id = null; @@ -22,14 +21,12 @@ class GiftCardConfiguration implements GiftCardConfigurationInterface /** * @var ImageInterface[]|Collection - * * @psalm-var Collection */ protected Collection $images; /** * @var GiftCardChannelConfigurationInterface[]|Collection - * * @psalm-var Collection */ protected Collection $channelConfigurations; diff --git a/src/Model/GiftCardConfigurationInterface.php b/src/Model/GiftCardConfigurationInterface.php index d7e5d516..86f4db61 100644 --- a/src/Model/GiftCardConfigurationInterface.php +++ b/src/Model/GiftCardConfigurationInterface.php @@ -24,7 +24,6 @@ public function setBackgroundImage(?GiftCardConfigurationImageInterface $image): /** * @return Collection|GiftCardChannelConfigurationInterface[] - * * @psalm-return Collection */ public function getChannelConfigurations(): Collection; diff --git a/src/Model/GiftCardInterface.php b/src/Model/GiftCardInterface.php index 372be0b6..770dde2e 100644 --- a/src/Model/GiftCardInterface.php +++ b/src/Model/GiftCardInterface.php @@ -80,7 +80,6 @@ public function setCurrencyCode(string $currencyCode): void; * Orders where this gift card was applied * * @return Collection|OrderInterface[] - * * @psalm-return Collection */ public function getAppliedOrders(): Collection; diff --git a/src/Model/OrderInterface.php b/src/Model/OrderInterface.php index 9193521b..c69ad249 100644 --- a/src/Model/OrderInterface.php +++ b/src/Model/OrderInterface.php @@ -11,7 +11,6 @@ interface OrderInterface extends BaseOrderInterface { /** * @psalm-return Collection - * * @return Collection|GiftCardInterface[] */ public function getGiftCards(): Collection; diff --git a/src/Model/OrderTrait.php b/src/Model/OrderTrait.php index 04ccceda..e28519a2 100644 --- a/src/Model/OrderTrait.php +++ b/src/Model/OrderTrait.php @@ -19,6 +19,7 @@ trait OrderTrait * @var Collection|GiftCardInterface[] * * @ORM\ManyToMany(targetEntity="Setono\SyliusGiftCardPlugin\Model\GiftCardInterface", inversedBy="appliedOrders") + * * @ORM\JoinTable(name="setono_sylius_gift_card__order_gift_cards", * joinColumns={@ORM\JoinColumn(name="order_id", referencedColumnName="id", onDelete="CASCADE")}, * inverseJoinColumns={@ORM\JoinColumn(name="gift_card_id", referencedColumnName="id", onDelete="CASCADE")} diff --git a/src/Operator/OrderGiftCardOperator.php b/src/Operator/OrderGiftCardOperator.php index d80a0e01..5cdc3a2e 100644 --- a/src/Operator/OrderGiftCardOperator.php +++ b/src/Operator/OrderGiftCardOperator.php @@ -27,7 +27,7 @@ final class OrderGiftCardOperator implements OrderGiftCardOperatorInterface public function __construct( EntityManagerInterface $giftCardManager, - GiftCardEmailManagerInterface $giftCardOrderEmailManager + GiftCardEmailManagerInterface $giftCardOrderEmailManager, ) { $this->giftCardManager = $giftCardManager; $this->giftCardOrderEmailManager = $giftCardOrderEmailManager; diff --git a/src/Order/AddToCartCommand.php b/src/Order/AddToCartCommand.php index bccd0154..6a815e46 100644 --- a/src/Order/AddToCartCommand.php +++ b/src/Order/AddToCartCommand.php @@ -18,7 +18,7 @@ class AddToCartCommand implements AddToCartCommandInterface public function __construct( OrderInterface $cart, OrderItemInterface $cartItem, - GiftCardInformationInterface $giftCardInformation + GiftCardInformationInterface $giftCardInformation, ) { $this->cart = $cart; $this->cartItem = $cartItem; diff --git a/src/Order/Factory/AddToCartCommandFactory.php b/src/Order/Factory/AddToCartCommandFactory.php index f2f1a61b..b257073b 100644 --- a/src/Order/Factory/AddToCartCommandFactory.php +++ b/src/Order/Factory/AddToCartCommandFactory.php @@ -21,7 +21,7 @@ final class AddToCartCommandFactory implements AddToCartCommandFactoryInterface */ public function __construct( string $className, - GiftCardInformationFactoryInterface $giftCardInformationFactory + GiftCardInformationFactoryInterface $giftCardInformationFactory, ) { $this->className = $className; $this->giftCardInformationFactory = $giftCardInformationFactory; diff --git a/src/OrderProcessor/OrderGiftCardProcessor.php b/src/OrderProcessor/OrderGiftCardProcessor.php index dd3ab917..f31ff588 100644 --- a/src/OrderProcessor/OrderGiftCardProcessor.php +++ b/src/OrderProcessor/OrderGiftCardProcessor.php @@ -24,7 +24,7 @@ final class OrderGiftCardProcessor implements OrderProcessorInterface public function __construct( TranslatorInterface $translator, AdjustmentFactoryInterface $adjustmentFactory, - OrderEligibleTotalProviderInterface $orderEligibleTotalProvider + OrderEligibleTotalProviderInterface $orderEligibleTotalProvider, ) { $this->translator = $translator; $this->adjustmentFactory = $adjustmentFactory; @@ -61,7 +61,7 @@ public function process(BaseOrderInterface $order): void $adjustment = $this->adjustmentFactory->createWithData( AdjustmentInterface::ORDER_GIFT_CARD_ADJUSTMENT, $this->translator->trans('setono_sylius_gift_card.ui.gift_card'), - -1 * $amount + -1 * $amount, ); $adjustment->setOriginCode($giftCard->getCode()); diff --git a/src/Provider/GiftCardConfigurationProvider.php b/src/Provider/GiftCardConfigurationProvider.php index 50681658..d0c71d85 100644 --- a/src/Provider/GiftCardConfigurationProvider.php +++ b/src/Provider/GiftCardConfigurationProvider.php @@ -36,7 +36,7 @@ public function __construct( GiftCardConfigurationFactoryInterface $giftCardConfigurationFactory, LocaleContextInterface $localeContext, RepositoryInterface $localeRepository, - ManagerRegistry $managerRegistry + ManagerRegistry $managerRegistry, ) { $this->giftCardConfigurationRepository = $giftCardConfigurationRepository; $this->giftCardConfigurationFactory = $giftCardConfigurationFactory; diff --git a/src/Renderer/PdfRenderer.php b/src/Renderer/PdfRenderer.php index 8c91b015..06e6b7cf 100644 --- a/src/Renderer/PdfRenderer.php +++ b/src/Renderer/PdfRenderer.php @@ -39,7 +39,7 @@ public function __construct( LocaleContextInterface $localeContext, GeneratorInterface $snappy, PdfRenderingOptionsProviderInterface $renderingOptionsProvider, - NormalizerInterface $normalizer + NormalizerInterface $normalizer, ) { $this->twig = $twig; $this->configurationProvider = $configurationProvider; @@ -54,7 +54,7 @@ public function render( GiftCardInterface $giftCard, GiftCardConfigurationInterface $giftCardConfiguration = null, ChannelInterface $channel = null, - string $localeCode = null + string $localeCode = null, ): PdfResponse { if (null === $channel) { $order = $giftCard->getOrder(); diff --git a/src/Renderer/PdfRendererInterface.php b/src/Renderer/PdfRendererInterface.php index 23ec3911..e33aefaa 100644 --- a/src/Renderer/PdfRendererInterface.php +++ b/src/Renderer/PdfRendererInterface.php @@ -19,6 +19,6 @@ public function render( GiftCardInterface $giftCard, GiftCardConfigurationInterface $giftCardConfiguration = null, ChannelInterface $channel = null, - string $localeCode = null + string $localeCode = null, ): PdfResponse; } diff --git a/src/Resolver/CustomerChannelResolver.php b/src/Resolver/CustomerChannelResolver.php index f8a7a426..559135ce 100644 --- a/src/Resolver/CustomerChannelResolver.php +++ b/src/Resolver/CustomerChannelResolver.php @@ -17,7 +17,7 @@ final class CustomerChannelResolver implements CustomerChannelResolverInterface public function __construct( OrderRepositoryInterface $orderRepository, - ChannelRepositoryInterface $channelRepository + ChannelRepositoryInterface $channelRepository, ) { $this->orderRepository = $orderRepository; $this->channelRepository = $channelRepository; diff --git a/src/Resolver/LocaleResolver.php b/src/Resolver/LocaleResolver.php index 5130451b..602c6949 100644 --- a/src/Resolver/LocaleResolver.php +++ b/src/Resolver/LocaleResolver.php @@ -18,7 +18,7 @@ final class LocaleResolver implements LocaleResolverInterface public function __construct( OrderRepositoryInterface $orderRepository, - ChannelRepositoryInterface $channelRepository + ChannelRepositoryInterface $channelRepository, ) { $this->orderRepository = $orderRepository; $this->channelRepository = $channelRepository; diff --git a/src/Resources/config/services/conditional/catalog_promotion_rule.xml b/src/Resources/config/services/conditional/catalog_promotion_rule.xml deleted file mode 100644 index ae71a936..00000000 --- a/src/Resources/config/services/conditional/catalog_promotion_rule.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/src/Serializer/Normalizer/GiftCardConfigurationNormalizer.php b/src/Serializer/Normalizer/GiftCardConfigurationNormalizer.php index 987e28f1..042630ba 100644 --- a/src/Serializer/Normalizer/GiftCardConfigurationNormalizer.php +++ b/src/Serializer/Normalizer/GiftCardConfigurationNormalizer.php @@ -23,7 +23,7 @@ final class GiftCardConfigurationNormalizer implements ContextAwareNormalizerInt public function __construct( ObjectNormalizer $objectNormalizer, RequestStack $requestStack, - string $publicMediaDirectory + string $publicMediaDirectory, ) { $this->objectNormalizer = $objectNormalizer; $this->requestStack = $requestStack; @@ -78,7 +78,7 @@ public function supportsNormalization($data, $format = null, array $context = [] return $data instanceof GiftCardConfigurationInterface && in_array( 'setono:sylius-gift-card:render', $groups, - true + true, ); } } diff --git a/src/Twig/Extension/PdfRuntime.php b/src/Twig/Extension/PdfRuntime.php index 0a7a07f2..689b339f 100644 --- a/src/Twig/Extension/PdfRuntime.php +++ b/src/Twig/Extension/PdfRuntime.php @@ -17,7 +17,7 @@ final class PdfRuntime implements RuntimeExtensionInterface public function __construct( PdfRendererInterface $giftCardPDFRenderer, - GiftCardFactoryInterface $giftCardFactory + GiftCardFactoryInterface $giftCardFactory, ) { $this->PDFRenderer = $giftCardPDFRenderer; $this->giftCardFactory = $giftCardFactory; diff --git a/tests/Application/.env b/tests/Application/.env index dff1da0e..d251157a 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -1,5 +1,16 @@ -# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file -# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production. +# In all environments, the following files are loaded if they exist, +# the later taking precedence over the former: +# +# * .env contains default values for the environment variables needed by the app +# * .env.local uncommitted file with local overrides +# * .env.$APP_ENV committed environment-specific defaults +# * .env.$APP_ENV.local uncommitted environment-specific overrides +# +# Real environment variables win over .env files. +# +# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES. +# +# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). # https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration ###> symfony/framework-bundle ### @@ -9,21 +20,28 @@ APP_SECRET=EDITME ###< symfony/framework-bundle ### ###> doctrine/doctrine-bundle ### -# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +# Format described at https://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/setono_sylius_gift_card_%kernel.environment%?serverVersion=5.5 +DATABASE_URL=mysql://root@127.0.0.1/acme_sylius_example_%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=setono_sylius_gift_card_plugin_development +JWT_PASSPHRASE=acme_plugin_development ###< lexik/jwt-authentication-bundle ### +###> symfony/messenger ### +# Choose one of the transports below +# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages +MESSENGER_TRANSPORT_DSN=doctrine://default +# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages +###< symfony/messenger ### + ###> 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=" # Delivery is disabled by default via "null://localhost" -MAILER_URL=null://localhost +MAILER_DSN=null://localhost ###< symfony/swiftmailer-bundle ### diff --git a/tests/Application/.env.test b/tests/Application/.env.test index 124b8ebe..85259611 100644 --- a/tests/Application/.env.test +++ b/tests/Application/.env.test @@ -1,3 +1,3 @@ APP_SECRET='ch4mb3r0f5ecr3ts' -KERNEL_CLASS='Tests\Setono\SyliusGiftCardPlugin\Application\Kernel' +KERNEL_CLASS='Setono\SyliusGiftCardPlugin\Tests\Application\Kernel' diff --git a/tests/Application/Doctrine/ORM/CustomerRepository.php b/tests/Application/Doctrine/ORM/CustomerRepository.php index 9a35d0e6..e5dcf397 100644 --- a/tests/Application/Doctrine/ORM/CustomerRepository.php +++ b/tests/Application/Doctrine/ORM/CustomerRepository.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Application\Doctrine\ORM; +namespace Setono\SyliusGiftCardPlugin\Tests\Application\Doctrine\ORM; -use Setono\SyliusGiftCardPlugin\Repository\CustomerRepositoryInterface as SetonoSyliusGiftCardPluginCustomerRepositoryInterface; use Setono\SyliusGiftCardPlugin\Doctrine\ORM\CustomerRepositoryTrait as SetonoSyliusGiftCardPluginCustomerRepositoryTrait; +use Setono\SyliusGiftCardPlugin\Repository\CustomerRepositoryInterface as SetonoSyliusGiftCardPluginCustomerRepositoryInterface; use Sylius\Bundle\CoreBundle\Doctrine\ORM\CustomerRepository as BaseCustomerRepository; class CustomerRepository extends BaseCustomerRepository implements SetonoSyliusGiftCardPluginCustomerRepositoryInterface diff --git a/tests/Application/Doctrine/ORM/OrderRepository.php b/tests/Application/Doctrine/ORM/OrderRepository.php index 80f226c6..45faa96c 100644 --- a/tests/Application/Doctrine/ORM/OrderRepository.php +++ b/tests/Application/Doctrine/ORM/OrderRepository.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Application\Doctrine\ORM; +namespace Setono\SyliusGiftCardPlugin\Tests\Application\Doctrine\ORM; -use Setono\SyliusGiftCardPlugin\Repository\OrderRepositoryInterface as SetonoSyliusGiftCardPluginOrderRepositoryInterface; use Setono\SyliusGiftCardPlugin\Doctrine\ORM\OrderRepositoryTrait as SetonoSyliusGiftCardPluginOrderRepositoryTrait; +use Setono\SyliusGiftCardPlugin\Repository\OrderRepositoryInterface as SetonoSyliusGiftCardPluginOrderRepositoryInterface; use Sylius\Bundle\CoreBundle\Doctrine\ORM\OrderRepository as BaseOrderRepository; class OrderRepository extends BaseOrderRepository implements SetonoSyliusGiftCardPluginOrderRepositoryInterface diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index 37793cc7..2ba30b4f 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -2,29 +2,13 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Application; +namespace Setono\SyliusGiftCardPlugin\Tests\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; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; final class Kernel extends BaseKernel { @@ -44,33 +28,20 @@ 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 + protected function configureRoutes(RoutingConfigurator $routes): void { - $container->addResource(new FileResource($this->getProjectDir() . '/config/bundles.php')); - $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'); - } - - 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 @@ -82,27 +53,36 @@ protected function getContainerBaseClass(): string return parent::getContainerBaseClass(); } - protected function getContainerLoader(ContainerInterface $container): LoaderInterface + private function loadRoutesConfiguration(RoutingConfigurator $routes, string $confDir): void { - /** @var ContainerBuilder $container */ - Assert::isInstanceOf($container, ContainerBuilder::class); + $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS); + $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS); + $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS); + } - $locator = new FileLocator($this, $this->getProjectDir() . '/Resources'); - $resolver = new LoaderResolver(array( - 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 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 new DelegatingLoader($resolver); + /** + * @return string[] + */ + private function getConfigurationDirectories(): iterable + { + yield $this->getProjectDir() . '/config'; } private function isTestEnvironment(): bool { - return 0 === strpos($this->getEnvironment(), 'test'); + return str_starts_with($this->getEnvironment(), 'test'); } } diff --git a/tests/Application/Model/ChannelPricing.php b/tests/Application/Model/ChannelPricing.php deleted file mode 100644 index a4297c6b..00000000 --- a/tests/Application/Model/ChannelPricing.php +++ /dev/null @@ -1,19 +0,0 @@ -=1.2) -if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) { +if (is_array($env = @include dirname(__DIR__) . '/.env.local.php')) { $_SERVER += $env; $_ENV += $env; } elseif (!class_exists(Dotenv::class)) { throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); } else { // load all the .env files - (new Dotenv(true))->loadEnv(dirname(__DIR__).'/.env'); + (new Dotenv())->loadEnv(dirname(__DIR__) . '/.env'); } $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; $_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; -$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; +$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], \FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index 2c7b875e..fdf32a28 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -1,10 +1,11 @@ ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], - Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true], @@ -28,14 +29,14 @@ Sylius\Bundle\ReviewBundle\SyliusReviewBundle::class => ['all' => true], Sylius\Bundle\CoreBundle\SyliusCoreBundle::class => ['all' => true], Sylius\Bundle\ResourceBundle\SyliusResourceBundle::class => ['all' => true], + // Begin: In test app, those 3 needs to be loaded before our plugin or the Api Resource override won't work Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], // End: In test app, those 3 needs to be loaded before our plugin or the Api Resource override won't work + Setono\SyliusGiftCardPlugin\SetonoSyliusGiftCardPlugin::class => ['all' => true], - Setono\JobStatusBundle\SetonoJobStatusBundle::class => ['all' => true], - Setono\SyliusCatalogPromotionPlugin\SetonoSyliusCatalogPromotionPlugin::class => ['all' => true], Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true], Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true], @@ -44,6 +45,7 @@ FOS\RestBundle\FOSRestBundle::class => ['all' => true], Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true], Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true], + League\FlysystemBundle\FlysystemBundle::class => ['all' => true], Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true], Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true], Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], @@ -53,12 +55,13 @@ Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true], Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true], Sylius\Bundle\ShopBundle\SyliusShopBundle::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], + Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], + Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], + FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true], Knp\Bundle\SnappyBundle\KnpSnappyBundle::class => ['all' => true], + SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], + Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/jwt/private.pem b/tests/Application/config/jwt/private.pem index aff67443..2bcf0230 100644 --- a/tests/Application/config/jwt/private.pem +++ b/tests/Application/config/jwt/private.pem @@ -1,30 +1,54 @@ -----BEGIN ENCRYPTED PRIVATE KEY----- -MIIFHDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQI7J4kVJ2hSU0CAggA -MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECM6FVWBZGst+BIIEyM+OBAsfm9Be -nZF7MLF2fIk/JIiMDnRi9vhX6b20iMbMW4CRzZOO0FzuaAi8ajg2yMVErkbVRyFz -XY+PrIdKZjaJmOSR03u5oRUH8Q//m3PJOttfNVQr+Tb/jnbp+wKy+2SEEI8zHitn -OJ98k1cjR8D0SrRAfguQph1wKZ4LHpYFOGwesZxYx0aiUYGCflq7Agbhak/hunDU -7Z+h29PXhv3Hh1gVSuxlJ6uaPxyqUUa7yL9uaBgx7tw/N2KICmvFqKlLQ7su7bmh -iuBJUYrBLmqdQfOJN2DTC3C92lsacEcATEMKUIG7M8a0vhWqPkFIbyrSkYpgK2Iy -Ww0AOzcGmr1IzWBw8mQD7I9ySnEmRIP0yCPOTLk+r9m8+xHKvRwKJ+BimTWsT6pN -puNXjsHT+/BD5tVavizODVCKNsw1eIubSapVoG4teASjMLdN7+skMJfIz6fbtIOI -bYidZk0zggYpW/7oGJTQ7SuWUXv+evkP8/MZLA5OpaDeld09sXrHOmjXn9Dc8vjs -IknwMO685cwKpjlVQjgXFXAOGcaNH97GbT1iMd+d5WQY+c6KOWhNt6ZILQNd44/i -wjmQ9Cbsze5VRCODm7HjUWwXEoxWlHPiNpy+ZzbKsJax6po61oBShbavQTYorkC4 -pVrnzlhIslvar08aT0qpI8dE6Awqs8Clhhx+QoZUYg99Nmdj79UQoY8vLmNEOPUy -z7En1O0QbRZBnR4LlwgJE70dvkl5oWLr8GtGpWhRKZa/twtPDOsgwLaU0+BYF20c -objChcCpnUShnyRwFux8g6qhaLRq8Djgdinm3x+1RHYCjQ6K5B1xqi9iVZgcNzRn -MOf/QPLzJuctUV6G/r5Wz1y6MZkzJHwhSRAsf2mQ8SFMVupVH1usde96SpY0CqeN -LLOZZ5HJHlWfMgkjm9xzo6d8dVI0jtpF8wpNLYTYUXZ0SDmxt88od3xfxhwsCqI3 -PRtZbveGTSH3SU7ZCJSCv3IxiNCKPwQwWU7iELBy3XgF0sfc5SABWxij/Zd7iuxe -1jsGm3htskQem9yrB9lzTfwAZJ1OryfbhURRuO08XC9q+WjTbQHexd+5GcG/3voF -DsS8rQx4bmyoiMLJYoxbKgtp+fvM0R53v0uNdUl0/QcENSRGRs0T0cY/I0ZnoMAy -4fTEWpdFOp/4JT8B+kp2vdVJ7nVWv/dcgwvGuN0JGBeygp1AsFsRDfGHeyMuDdUc -b5nVQHkfkYY44w/gVu0oDkNFvnhvWA3MD9dVAMyU3KyMhuayRIDuQOohNEED014z -dwbz3VlnzZ7BWGy0uNjysD+oP+t2cw45e/jX34XVFT7gEmEjE+31HsfPT5dDK1N9 -dhXPpGPVdP0MqHsG3+ccwuN3rh+gT1KJl4zf5UHNUWql/93Pcbi+Ezx4KoANPU+I -w4kXsaxie6IsuxFDwTRv8jIbPbz2+68GMUMyKYRp/2xo4GqWlPXILuwtQZb/hfja -r+vD7BCM7YSJO3JYcyx9NwHYJbEl0ZXPgpt5/1bqwoqOHGvCAkWjryKCU3qj3JJN -cDnOkDSfwEqGicX2Y1/V5uoDNwPrYS80VLXF3SJvsYfCARM8qDjGwioxy56rLo7d -yh2ReP9gxutGsJXnWrSrCQ== +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 index a8c9d54b..cb4e13da 100644 --- a/tests/Application/config/jwt/public.pem +++ b/tests/Application/config/jwt/public.pem @@ -1,9 +1,14 @@ -----BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8nJVPtj4sRy0LPUafuol -EMwVjrbl7KBdknbrsp5l/JD3XwBVEqJXil+H0RxYwVawZgpYvkMFji3NbLCPpdI8 -8gFjn/RYOkJK76SVqHmIHyGfY06WySqFaY9xa7q1p98auK2l4DNMxDU7CJMe9311 -0XrBAjvww1mlsErom4w0JqYpcrsgXi1KzsgYgjIzZnqsYqYJ6jzjb/ZjM++23BMT -YSqmgD4UJ/sNrigeeJBVz/lDMnSUlouixrArHPqw3LIo4IAtu8V337t9Yzemqvol -C6BJSpaMOJG0CtR4BEs1Oq1qmp8T0m4gGRVAslY7S7LR2izoHxnKwwzAA/K3uhPu -pwIDAQAB +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 index c1b59141..872717f0 100644 --- a/tests/Application/config/packages/_sylius.yaml +++ b/tests/Application/config/packages/_sylius.yaml @@ -11,39 +11,30 @@ sylius_shop: product_grid: include_all_descendants: true -sylius_core: - resources: - channel_pricing: - classes: - model: Tests\Setono\SyliusGiftCardPlugin\Application\Model\ChannelPricing - repository: Tests\Setono\SyliusGiftCardPlugin\Application\Repository\ChannelPricingRepository +sylius_api: + enabled: true sylius_customer: resources: customer: classes: - repository: Tests\Setono\SyliusGiftCardPlugin\Application\Doctrine\ORM\CustomerRepository + repository: Setono\SyliusGiftCardPlugin\Tests\Application\Doctrine\ORM\CustomerRepository sylius_order: resources: order: classes: - model: Tests\Setono\SyliusGiftCardPlugin\Application\Model\Order - repository: Tests\Setono\SyliusGiftCardPlugin\Application\Doctrine\ORM\OrderRepository + model: Setono\SyliusGiftCardPlugin\Tests\Application\Model\Order + repository: Setono\SyliusGiftCardPlugin\Tests\Application\Doctrine\ORM\OrderRepository order_item: classes: - model: Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItem + model: Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItem order_item_unit: classes: - model: Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItemUnit - + model: Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItemUnit + sylius_product: resources: product: classes: - model: Tests\Setono\SyliusGiftCardPlugin\Application\Model\Product - repository: Tests\Setono\SyliusGiftCardPlugin\Application\Repository\ProductRepository - product_variant: - classes: - repository: Tests\Setono\SyliusGiftCardPlugin\Application\Repository\ProductVariantRepository - + model: Setono\SyliusGiftCardPlugin\Tests\Application\Model\Product diff --git a/tests/Application/config/packages/api_platform.yaml b/tests/Application/config/packages/api_platform.yaml new file mode 100644 index 00000000..26def491 --- /dev/null +++ b/tests/Application/config/packages/api_platform.yaml @@ -0,0 +1,9 @@ +api_platform: + mapping: + paths: + - '%kernel.project_dir%/../../vendor/sylius/sylius/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources' + - '%kernel.project_dir%/config/api_platform' + patch_formats: + json: ['application/merge-patch+json'] + swagger: + versions: [3] diff --git a/tests/Application/config/packages/dev/jms_serializer.yaml b/tests/Application/config/packages/dev/jms_serializer.yaml new file mode 100644 index 00000000..2f32a9b1 --- /dev/null +++ b/tests/Application/config/packages/dev/jms_serializer.yaml @@ -0,0 +1,12 @@ +jms_serializer: + visitors: + json_serialization: + options: + - JSON_PRETTY_PRINT + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION + json_deserialization: + options: + - JSON_PRETTY_PRINT + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/packages/doctrine.yaml b/tests/Application/config/packages/doctrine.yaml index 56ad39d1..dc76b940 100644 --- a/tests/Application/config/packages/doctrine.yaml +++ b/tests/Application/config/packages/doctrine.yaml @@ -21,5 +21,5 @@ doctrine: is_bundle: false type: annotation dir: '%kernel.project_dir%/Model' - prefix: 'Tests\Setono\SyliusGiftCardPlugin\Application\Model' + prefix: 'Setono\SyliusGiftCardPlugin\Tests\Application\Model' alias: App diff --git a/tests/Application/config/packages/doctrine_migrations.yaml b/tests/Application/config/packages/doctrine_migrations.yaml index 08e83b8a..cdbc01ae 100644 --- a/tests/Application/config/packages/doctrine_migrations.yaml +++ b/tests/Application/config/packages/doctrine_migrations.yaml @@ -2,5 +2,3 @@ doctrine_migrations: storage: table_storage: table_name: sylius_migrations - migrations_paths: - 'App\Migrations': '%kernel.project_dir%/src/Migrations/' diff --git a/tests/Application/config/packages/fos_rest.yaml b/tests/Application/config/packages/fos_rest.yaml index a72eef7c..eaebb277 100644 --- a/tests/Application/config/packages/fos_rest.yaml +++ b/tests/Application/config/packages/fos_rest.yaml @@ -7,5 +7,5 @@ fos_rest: empty_content: 204 format_listener: rules: - - { path: '^/api/.*', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true } + - { path: '^/api/v1/.*', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true } - { path: '^/', stop: true } diff --git a/tests/Application/config/packages/framework.yaml b/tests/Application/config/packages/framework.yaml index 9b445011..3df2c0ad 100644 --- a/tests/Application/config/packages/framework.yaml +++ b/tests/Application/config/packages/framework.yaml @@ -1,6 +1,9 @@ framework: secret: '%env(APP_SECRET)%' - form: true + ide: phpstorm + form: + enabled: true + legacy_error_messages: false csrf_protection: true session: handler_id: ~ diff --git a/tests/Application/config/packages/jms_serializer.yaml b/tests/Application/config/packages/jms_serializer.yaml new file mode 100644 index 00000000..ed7bc613 --- /dev/null +++ b/tests/Application/config/packages/jms_serializer.yaml @@ -0,0 +1,4 @@ +jms_serializer: + visitors: + xml_serialization: + format_output: '%kernel.debug%' diff --git a/tests/Application/config/packages/mailer.yaml b/tests/Application/config/packages/mailer.yaml new file mode 100644 index 00000000..56a650d8 --- /dev/null +++ b/tests/Application/config/packages/mailer.yaml @@ -0,0 +1,3 @@ +framework: + mailer: + dsn: '%env(MAILER_DSN)%' diff --git a/tests/Application/config/packages/prod/jms_serializer.yaml b/tests/Application/config/packages/prod/jms_serializer.yaml index bc97faf1..c2881820 100644 --- a/tests/Application/config/packages/prod/jms_serializer.yaml +++ b/tests/Application/config/packages/prod/jms_serializer.yaml @@ -1,6 +1,10 @@ jms_serializer: visitors: - json: + 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/packages/security.yaml b/tests/Application/config/packages/security.yaml index 51a6ec9a..2f5c6875 100644 --- a/tests/Application/config/packages/security.yaml +++ b/tests/Application/config/packages/security.yaml @@ -1,17 +1,5 @@ -parameters: - sylius.security.admin_regex: "^/%sylius_admin.path_name%" - sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|api/.*|api$|media/.*)[^/]++" - sylius.security.new_api_route: "/api/v2" - 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%" - sylius.security.new_api_user_account_route: "%sylius.security.new_api_shop_route%/account" - sylius.security.new_api_user_account_regex: "^%sylius.security.new_api_user_account_route%" - security: - always_authenticate_before_granting: true + enable_authenticator_manager: true providers: sylius_admin_user_provider: id: sylius.admin_user_provider.email_or_name_based @@ -22,7 +10,7 @@ security: sylius_api_shop_user_provider: id: sylius.shop_user_provider.email_or_name_based - encoders: + password_hashers: Sylius\Component\User\Model\UserInterface: argon2i firewalls: admin: @@ -38,7 +26,7 @@ security: default_target_path: sylius_admin_dashboard use_forward: false use_referer: true - csrf_token_generator: security.csrf.token_manager + enable_csrf: true csrf_parameter: _csrf_admin_security_token csrf_token_id: admin_authenticate remember_me: @@ -50,37 +38,32 @@ security: logout: path: sylius_admin_logout target: sylius_admin_login - anonymous: true new_api_admin_user: pattern: "%sylius.security.new_api_admin_regex%/.*" provider: sylius_api_admin_user_provider stateless: true - anonymous: 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 - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator + jwt: true new_api_shop_user: pattern: "%sylius.security.new_api_shop_regex%/.*" provider: sylius_api_shop_user_provider stateless: true - anonymous: 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 - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator + jwt: true shop: switch_user: { role: ROLE_ALLOWED_TO_SWITCH } @@ -97,7 +80,7 @@ security: default_target_path: sylius_shop_homepage use_forward: false use_referer: true - csrf_token_generator: security.csrf.token_manager + enable_csrf: true csrf_parameter: _csrf_shop_security_token csrf_token_id: shop_authenticate remember_me: @@ -107,36 +90,33 @@ security: remember_me_parameter: _remember_me logout: path: sylius_shop_logout - target: sylius_shop_login + target: sylius_shop_homepage invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - image_resolver: - pattern: ^/media/cache/resolve + 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: 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: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } + - { 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%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { 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: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { 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: IS_AUTHENTICATED_ANONYMOUSLY } + - { 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: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { 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/packages/setono_sylius_catalog_promotion.yaml b/tests/Application/config/packages/setono_sylius_catalog_promotion.yaml deleted file mode 100644 index 77193210..00000000 --- a/tests/Application/config/packages/setono_sylius_catalog_promotion.yaml +++ /dev/null @@ -1,4 +0,0 @@ -imports: - - { resource: "@SetonoSyliusCatalogPromotionPlugin/Resources/config/app/config.yaml" } - # Uncomment if you want to add some catalog promotion fixtures to default suite - # - { resource: "@SetonoSyliusCatalogPromotionPlugin/Resources/config/app/fixtures.yaml" } diff --git a/tests/Application/config/packages/staging/monolog.yaml b/tests/Application/config/packages/staging/monolog.yaml deleted file mode 100644 index 64612114..00000000 --- a/tests/Application/config/packages/staging/monolog.yaml +++ /dev/null @@ -1,10 +0,0 @@ -monolog: - handlers: - main: - type: fingers_crossed - action_level: error - handler: nested - nested: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug diff --git a/tests/Application/config/packages/staging/swiftmailer.yaml b/tests/Application/config/packages/staging/swiftmailer.yaml deleted file mode 100644 index f4380780..00000000 --- a/tests/Application/config/packages/staging/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - disable_delivery: true diff --git a/tests/Application/config/packages/swiftmailer.yaml b/tests/Application/config/packages/swiftmailer.yaml deleted file mode 100644 index 3bab0d32..00000000 --- a/tests/Application/config/packages/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - url: '%env(MAILER_URL)%' diff --git a/tests/Application/config/packages/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml index 76d7e5e1..fc1d3c13 100644 --- a/tests/Application/config/packages/test/framework.yaml +++ b/tests/Application/config/packages/test/framework.yaml @@ -1,4 +1,4 @@ framework: test: ~ session: - storage_id: session.storage.mock_file + storage_factory_id: session.storage.factory.mock_file diff --git a/tests/Application/config/packages/test/mailer.yaml b/tests/Application/config/packages/test/mailer.yaml new file mode 100644 index 00000000..092eb288 --- /dev/null +++ b/tests/Application/config/packages/test/mailer.yaml @@ -0,0 +1,7 @@ +framework: + mailer: + dsn: 'null://null' + cache: + pools: + test.mailer_pool: + adapter: cache.adapter.filesystem diff --git a/tests/Application/config/packages/test/security.yaml b/tests/Application/config/packages/test/security.yaml new file mode 100644 index 00000000..4071d319 --- /dev/null +++ b/tests/Application/config/packages/test/security.yaml @@ -0,0 +1,6 @@ +security: + password_hashers: + Sylius\Component\User\Model\UserInterface: + algorithm: argon2i + time_cost: 3 + memory_cost: 10 diff --git a/tests/Application/config/packages/test/swiftmailer.yaml b/tests/Application/config/packages/test/swiftmailer.yaml deleted file mode 100644 index c438f4b2..00000000 --- a/tests/Application/config/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/packages/test_cached/doctrine.yaml b/tests/Application/config/packages/test_cached/doctrine.yaml deleted file mode 100644 index 49528606..00000000 --- a/tests/Application/config/packages/test_cached/doctrine.yaml +++ /dev/null @@ -1,16 +0,0 @@ -doctrine: - orm: - entity_managers: - default: - result_cache_driver: - type: memcached - host: localhost - port: 11211 - query_cache_driver: - type: memcached - host: localhost - port: 11211 - metadata_cache_driver: - type: memcached - host: localhost - port: 11211 diff --git a/tests/Application/config/packages/test_cached/fos_rest.yaml b/tests/Application/config/packages/test_cached/fos_rest.yaml deleted file mode 100644 index 2b4189da..00000000 --- a/tests/Application/config/packages/test_cached/fos_rest.yaml +++ /dev/null @@ -1,3 +0,0 @@ -fos_rest: - exception: - debug: true diff --git a/tests/Application/config/packages/test_cached/framework.yaml b/tests/Application/config/packages/test_cached/framework.yaml deleted file mode 100644 index 76d7e5e1..00000000 --- a/tests/Application/config/packages/test_cached/framework.yaml +++ /dev/null @@ -1,4 +0,0 @@ -framework: - test: ~ - session: - storage_id: session.storage.mock_file diff --git a/tests/Application/config/packages/test_cached/monolog.yaml b/tests/Application/config/packages/test_cached/monolog.yaml deleted file mode 100644 index 7e2b9e3a..00000000 --- a/tests/Application/config/packages/test_cached/monolog.yaml +++ /dev/null @@ -1,6 +0,0 @@ -monolog: - handlers: - main: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: error diff --git a/tests/Application/config/packages/test_cached/swiftmailer.yaml b/tests/Application/config/packages/test_cached/swiftmailer.yaml deleted file mode 100644 index c438f4b2..00000000 --- a/tests/Application/config/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/packages/test_cached/sylius_channel.yaml b/tests/Application/config/packages/test_cached/sylius_channel.yaml deleted file mode 100644 index bab83ef2..00000000 --- a/tests/Application/config/packages/test_cached/sylius_channel.yaml +++ /dev/null @@ -1,2 +0,0 @@ -sylius_channel: - debug: true diff --git a/tests/Application/config/packages/test_cached/sylius_theme.yaml b/tests/Application/config/packages/test_cached/sylius_theme.yaml deleted file mode 100644 index 4d34199f..00000000 --- a/tests/Application/config/packages/test_cached/sylius_theme.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_theme: - sources: - test: ~ diff --git a/tests/Application/config/packages/test_cached/twig.yaml b/tests/Application/config/packages/test_cached/twig.yaml deleted file mode 100644 index 8c6e0b40..00000000 --- a/tests/Application/config/packages/test_cached/twig.yaml +++ /dev/null @@ -1,2 +0,0 @@ -twig: - strict_variables: true diff --git a/tests/Application/config/routes/setono_sylius_catalog_promotion.yaml b/tests/Application/config/routes/setono_sylius_catalog_promotion.yaml deleted file mode 100644 index 4a11809d..00000000 --- a/tests/Application/config/routes/setono_sylius_catalog_promotion.yaml +++ /dev/null @@ -1,3 +0,0 @@ -setono_sylius_catalog_promotion_admin: - resource: "@SetonoSyliusCatalogPromotionPlugin/Resources/config/admin_routing.yaml" - prefix: /admin diff --git a/tests/Application/config/routes/sylius_admin.yaml b/tests/Application/config/routes/sylius_admin.yaml index 1ba48d6c..b9c12c22 100644 --- a/tests/Application/config/routes/sylius_admin.yaml +++ b/tests/Application/config/routes/sylius_admin.yaml @@ -1,3 +1,3 @@ sylius_admin: resource: "@SyliusAdminBundle/Resources/config/routing.yml" - prefix: /admin + prefix: '/%sylius_admin.path_name%' diff --git a/tests/Application/config/routes/sylius_shop.yaml b/tests/Application/config/routes/sylius_shop.yaml index 8818568b..22e7a4a9 100644 --- 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" @@ -11,4 +11,13 @@ sylius_shop_default_locale: path: / methods: [GET] defaults: - _controller: sylius.controller.shop.locale_switch:switchAction + _controller: sylius.controller.shop.locale_switch::switchAction + +# see https://web.dev/change-password-url/ +sylius_shop_request_password_reset_token_redirect: + path: /.well-known/change-password + methods: [GET] + controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction + defaults: + route: sylius_shop_request_password_reset_token + permanent: false diff --git a/tests/Application/config/secrets/dev/.gitignore b/tests/Application/config/secrets/dev/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/tests/Application/config/secrets/prod/.gitignore b/tests/Application/config/secrets/prod/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/tests/Application/config/secrets/test/.gitignore b/tests/Application/config/secrets/test/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/tests/Application/config/secrets/test_cached/.gitignore b/tests/Application/config/secrets/test_cached/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/tests/Application/config/serialization/.gitignore b/tests/Application/config/serialization/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/tests/Application/package.json b/tests/Application/package.json index e990ba42..8f62c4c7 100644 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "chart.js": "^2.9", + "chart.js": "^3.9", "jquery": "^3.6", "jquery.dirtyforms": "^2.0", "lightbox2": "^2.9", diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php index c9f724b3..b550b6a8 100644 --- a/tests/Application/public/index.php +++ b/tests/Application/public/index.php @@ -1,10 +1,12 @@ client = $client; $this->responseChecker = $responseChecker; @@ -62,14 +62,14 @@ public function iWantToUpdateGiftCardConfiguration(string $code): void public function iAssociateGiftCardConfigurationToChannelAndLocale( string $code, ChannelInterface $channel, - string $localeCode + string $localeCode, ): void { $request = Request::customItemAction( 'admin', 'gift-card-configurations', $code, HTTPRequest::METHOD_PATCH, - 'associate-channel' + 'associate-channel', ); $request->setContent([ @@ -123,7 +123,7 @@ public function iShouldNotSeeGiftCardConfiguration(string $code): void Assert::false( $this->responseChecker->hasItemWithValue($response, 'code', $code), - sprintf('Gift card configuration with code %s still exists, but it should not', $code) + sprintf('Gift card configuration with code %s still exists, but it should not', $code), ); } diff --git a/tests/Behat/Context/Api/Admin/ManagingGiftCardsBalanceContext.php b/tests/Behat/Context/Api/Admin/ManagingGiftCardsBalanceContext.php index e3beba5b..dfe97e19 100644 --- a/tests/Behat/Context/Api/Admin/ManagingGiftCardsBalanceContext.php +++ b/tests/Behat/Context/Api/Admin/ManagingGiftCardsBalanceContext.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Context\Api\Admin; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Api\Admin; use Behat\Behat\Context\Context; use Sylius\Behat\Client\ApiClientInterface; @@ -18,7 +18,7 @@ final class ManagingGiftCardsBalanceContext implements Context public function __construct( ApiClientInterface $client, - ResponseCheckerInterface $responseChecker + ResponseCheckerInterface $responseChecker, ) { $this->client = $client; $this->responseChecker = $responseChecker; diff --git a/tests/Behat/Context/Api/Admin/ManagingGiftCardsContext.php b/tests/Behat/Context/Api/Admin/ManagingGiftCardsContext.php index 891cb32e..4139c661 100644 --- a/tests/Behat/Context/Api/Admin/ManagingGiftCardsContext.php +++ b/tests/Behat/Context/Api/Admin/ManagingGiftCardsContext.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Context\Api\Admin; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Api\Admin; use ApiPlatform\Core\Api\IriConverterInterface; use Behat\Behat\Context\Context; @@ -25,7 +25,7 @@ final class ManagingGiftCardsContext implements Context public function __construct( ApiClientInterface $client, ResponseCheckerInterface $responseChecker, - IriConverterInterface $iriConverter + IriConverterInterface $iriConverter, ) { $this->client = $client; $this->responseChecker = $responseChecker; @@ -125,7 +125,7 @@ public function iShouldNotSeeGiftCard(string $code): void Assert::false( $this->responseChecker->hasItemWithValue($response, 'code', $code), - sprintf('Gift card with code %s still exists, but it should not', $code) + sprintf('Gift card with code %s still exists, but it should not', $code), ); } diff --git a/tests/Behat/Context/Api/Shop/CartContext.php b/tests/Behat/Context/Api/Shop/CartContext.php index a6d9075e..f4f9f05d 100644 --- a/tests/Behat/Context/Api/Shop/CartContext.php +++ b/tests/Behat/Context/Api/Shop/CartContext.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Context\Api\Shop; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Api\Shop; use ApiPlatform\Core\Api\IriConverterInterface; use Behat\Behat\Context\Context; @@ -31,7 +31,7 @@ public function __construct( ResponseCheckerInterface $responseChecker, SharedStorageInterface $sharedStorage, ProductVariantResolverInterface $productVariantResolver, - IriConverterInterface $iriConverter + IriConverterInterface $iriConverter, ) { $this->cartsClient = $cartsClient; $this->responseChecker = $responseChecker; diff --git a/tests/Behat/Context/Api/Shop/ManagingGiftCardsContext.php b/tests/Behat/Context/Api/Shop/ManagingGiftCardsContext.php index c6120753..ee4f8777 100644 --- a/tests/Behat/Context/Api/Shop/ManagingGiftCardsContext.php +++ b/tests/Behat/Context/Api/Shop/ManagingGiftCardsContext.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Context\Api\Shop; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Api\Shop; use Behat\Behat\Context\Context; use Sylius\Behat\Client\ApiClientInterface; @@ -24,7 +24,7 @@ final class ManagingGiftCardsContext implements Context public function __construct( ApiClientInterface $client, ResponseCheckerInterface $responseChecker, - SharedStorageInterface $sharedStorage + SharedStorageInterface $sharedStorage, ) { $this->client = $client; $this->responseChecker = $responseChecker; @@ -134,7 +134,7 @@ private function applyGiftCardToOrder(string $giftCardCode): void 'gift-cards', $giftCardCode, HTTPRequest::METHOD_PATCH, - 'add-to-order' + 'add-to-order', ); $request->setContent(['orderTokenValue' => $this->sharedStorage->get('cart_token')]); @@ -149,7 +149,7 @@ private function removeGiftCardFromOrder(string $giftCardCode): void 'gift-cards', $giftCardCode, HTTPRequest::METHOD_PATCH, - 'remove-from-order' + 'remove-from-order', ); $request->setContent(['orderTokenValue' => $this->sharedStorage->get('cart_token')]); diff --git a/tests/Behat/Context/Setup/GiftCardConfigurationContext.php b/tests/Behat/Context/Setup/GiftCardConfigurationContext.php index ab2356b0..aee505fd 100644 --- a/tests/Behat/Context/Setup/GiftCardConfigurationContext.php +++ b/tests/Behat/Context/Setup/GiftCardConfigurationContext.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Context\Setup; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Setup; use Behat\Behat\Context\Context; use Setono\SyliusGiftCardPlugin\Factory\GiftCardConfigurationFactoryInterface; @@ -16,7 +16,7 @@ final class GiftCardConfigurationContext implements Context public function __construct( RepositoryInterface $giftCardConfigurationRepository, - GiftCardConfigurationFactoryInterface $giftCardConfigurationFactory + GiftCardConfigurationFactoryInterface $giftCardConfigurationFactory, ) { $this->giftCardConfigurationRepository = $giftCardConfigurationRepository; $this->giftCardConfigurationFactory = $giftCardConfigurationFactory; diff --git a/tests/Behat/Context/Setup/GiftCardContext.php b/tests/Behat/Context/Setup/GiftCardContext.php index 6bac8a35..4c751f63 100644 --- a/tests/Behat/Context/Setup/GiftCardContext.php +++ b/tests/Behat/Context/Setup/GiftCardContext.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Context\Setup; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Setup; use Behat\Behat\Context\Context; use Doctrine\Persistence\ObjectManager; @@ -32,7 +32,7 @@ public function __construct( GiftCardRepositoryInterface $giftCardRepository, GiftCardFactoryInterface $giftCardFactory, ObjectManager $productManager, - MessageBusInterface $messageBus + MessageBusInterface $messageBus, ) { $this->sharedStorage = $sharedStorage; $this->giftCardRepository = $giftCardRepository; @@ -71,7 +71,7 @@ public function thisProductIsAConfigurableGiftCard(ProductInterface $product): v public function theStoreHasGiftCardWithCode( string $code, int $price, - ?ChannelInterface $channel = null + ?ChannelInterface $channel = null, ): void { if (null === $channel) { /** @var ChannelInterface $channel */ @@ -94,7 +94,7 @@ public function theStoreHasGiftCardWithCode( public function theStoreHasGiftCardWithCodeForCustomer( string $code, int $price, - CustomerInterface $customer + CustomerInterface $customer, ): void { /** @var ChannelInterface $channel */ $channel = $this->sharedStorage->get('channel'); diff --git a/tests/Behat/Context/Transform/GiftCardConfigurationContext.php b/tests/Behat/Context/Transform/GiftCardConfigurationContext.php index c0aa2daf..ccbef741 100644 --- a/tests/Behat/Context/Transform/GiftCardConfigurationContext.php +++ b/tests/Behat/Context/Transform/GiftCardConfigurationContext.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Context\Transform; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Transform; use Behat\Behat\Context\Context; use Setono\SyliusGiftCardPlugin\Model\GiftCardConfigurationInterface; diff --git a/tests/Behat/Context/Transform/GiftCardContext.php b/tests/Behat/Context/Transform/GiftCardContext.php index 5b82d540..a49b7ee6 100644 --- a/tests/Behat/Context/Transform/GiftCardContext.php +++ b/tests/Behat/Context/Transform/GiftCardContext.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Context\Transform; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Transform; use Behat\Behat\Context\Context; use Setono\SyliusGiftCardPlugin\Model\GiftCardInterface; diff --git a/tests/Behat/Context/Ui/Admin/ManagingGiftCardsContext.php b/tests/Behat/Context/Ui/Admin/ManagingGiftCardsContext.php index 5feda128..6815edc7 100644 --- a/tests/Behat/Context/Ui/Admin/ManagingGiftCardsContext.php +++ b/tests/Behat/Context/Ui/Admin/ManagingGiftCardsContext.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Context\Ui\Admin; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Ui\Admin; use Behat\Behat\Context\Context; use Setono\SyliusGiftCardPlugin\Model\ProductInterface; -use Tests\Setono\SyliusGiftCardPlugin\Behat\Page\Admin\Product\CreateSimpleProductPageInterface; +use Setono\SyliusGiftCardPlugin\Tests\Behat\Page\Admin\Product\CreateSimpleProductPageInterface; use Webmozart\Assert\Assert; final class ManagingGiftCardsContext implements Context @@ -15,7 +15,7 @@ final class ManagingGiftCardsContext implements Context private $createGiftCardPage; public function __construct( - CreateSimpleProductPageInterface $createGiftCardPage + CreateSimpleProductPageInterface $createGiftCardPage, ) { $this->createGiftCardPage = $createGiftCardPage; } diff --git a/tests/Behat/Context/Ui/EmailContext.php b/tests/Behat/Context/Ui/EmailContext.php index 119d3a92..3e2ac6ea 100644 --- a/tests/Behat/Context/Ui/EmailContext.php +++ b/tests/Behat/Context/Ui/EmailContext.php @@ -2,35 +2,23 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Context\Ui; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Ui; use Behat\Behat\Context\Context; use Setono\SyliusGiftCardPlugin\Doctrine\ORM\GiftCardRepository; use Setono\SyliusGiftCardPlugin\Model\ProductInterface; +use Sylius\Behat\Service\Checker\EmailChecker; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Repository\OrderRepositoryInterface; -use Sylius\Component\Core\Test\Services\EmailCheckerInterface; use Webmozart\Assert\Assert; final class EmailContext implements Context { - /** @var EmailCheckerInterface */ - private $emailChecker; - - /** @var OrderRepositoryInterface */ - private $orderRepository; - - /** @var GiftCardRepository */ - private $giftCardRepository; - public function __construct( - EmailCheckerInterface $emailChecker, - OrderRepositoryInterface $orderRepository, - GiftCardRepository $giftCardRepository + private readonly EmailChecker $emailChecker, + private readonly OrderRepositoryInterface $orderRepository, + private readonly GiftCardRepository $giftCardRepository, ) { - $this->emailChecker = $emailChecker; - $this->orderRepository = $orderRepository; - $this->giftCardRepository = $giftCardRepository; } /** diff --git a/tests/Behat/Context/Ui/Shop/CartContext.php b/tests/Behat/Context/Ui/Shop/CartContext.php index 7faa961a..486b6830 100644 --- a/tests/Behat/Context/Ui/Shop/CartContext.php +++ b/tests/Behat/Context/Ui/Shop/CartContext.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Context\Ui\Shop; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Ui\Shop; use Behat\Behat\Context\Context; use Setono\SyliusGiftCardPlugin\Model\ProductInterface; -use Tests\Setono\SyliusGiftCardPlugin\Behat\Page\Shop\Cart\SummaryPageInterface; -use Tests\Setono\SyliusGiftCardPlugin\Behat\Page\Shop\Product\ShowPageInterface; +use Setono\SyliusGiftCardPlugin\Tests\Behat\Page\Shop\Cart\SummaryPageInterface; +use Setono\SyliusGiftCardPlugin\Tests\Behat\Page\Shop\Product\ShowPageInterface; use Webmozart\Assert\Assert; final class CartContext implements Context diff --git a/tests/Behat/Context/Ui/Shop/CheckoutContext.php b/tests/Behat/Context/Ui/Shop/CheckoutContext.php index 996e8112..b72d0c72 100644 --- a/tests/Behat/Context/Ui/Shop/CheckoutContext.php +++ b/tests/Behat/Context/Ui/Shop/CheckoutContext.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Context\Ui\Shop; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Ui\Shop; use Behat\Behat\Context\Context; use Doctrine\ORM\EntityManagerInterface; @@ -31,7 +31,7 @@ public function __construct( CheckoutCompleteContext $checkoutCompleteContext, OrderContext $orderContext, OrderRepositoryInterface $orderRepository, - EntityManagerInterface $giftCardManager + EntityManagerInterface $giftCardManager, ) { $this->checkoutCompleteContext = $checkoutCompleteContext; $this->orderContext = $orderContext; diff --git a/tests/Behat/Page/Admin/Product/CreateSimpleProductPage.php b/tests/Behat/Page/Admin/Product/CreateSimpleProductPage.php index 228798a5..5cb66e32 100644 --- a/tests/Behat/Page/Admin/Product/CreateSimpleProductPage.php +++ b/tests/Behat/Page/Admin/Product/CreateSimpleProductPage.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Page\Admin\Product; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Page\Admin\Product; use Sylius\Behat\Page\Admin\Product\CreateSimpleProductPage as BaseCreateSimpleProductPage; diff --git a/tests/Behat/Page/Admin/Product/CreateSimpleProductPageInterface.php b/tests/Behat/Page/Admin/Product/CreateSimpleProductPageInterface.php index d1937543..c303d1ef 100644 --- a/tests/Behat/Page/Admin/Product/CreateSimpleProductPageInterface.php +++ b/tests/Behat/Page/Admin/Product/CreateSimpleProductPageInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Page\Admin\Product; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Page\Admin\Product; use Sylius\Behat\Page\Admin\Product\CreateSimpleProductPageInterface as BaseCreateSimpleProductPageInterface; diff --git a/tests/Behat/Page/Shop/Cart/SummaryPage.php b/tests/Behat/Page/Shop/Cart/SummaryPage.php index fc18bf2f..2e7872ea 100644 --- a/tests/Behat/Page/Shop/Cart/SummaryPage.php +++ b/tests/Behat/Page/Shop/Cart/SummaryPage.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Page\Shop\Cart; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Page\Shop\Cart; use Sylius\Behat\Page\Shop\Cart\SummaryPage as BaseSummaryPage; diff --git a/tests/Behat/Page/Shop/Cart/SummaryPageInterface.php b/tests/Behat/Page/Shop/Cart/SummaryPageInterface.php index c5bb3e10..2e5e3725 100644 --- a/tests/Behat/Page/Shop/Cart/SummaryPageInterface.php +++ b/tests/Behat/Page/Shop/Cart/SummaryPageInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Page\Shop\Cart; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Page\Shop\Cart; use Sylius\Behat\Page\Shop\Cart\SummaryPageInterface as BaseSummaryPageInterface; diff --git a/tests/Behat/Page/Shop/Product/ShowPage.php b/tests/Behat/Page/Shop/Product/ShowPage.php index 862e01b5..0fbad62b 100644 --- a/tests/Behat/Page/Shop/Product/ShowPage.php +++ b/tests/Behat/Page/Shop/Product/ShowPage.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Page\Shop\Product; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Page\Shop\Product; use Sylius\Behat\Page\Shop\Product\ShowPage as BaseShowPage; diff --git a/tests/Behat/Page/Shop/Product/ShowPageInterface.php b/tests/Behat/Page/Shop/Product/ShowPageInterface.php index 5e4ae773..bd1c9394 100644 --- a/tests/Behat/Page/Shop/Product/ShowPageInterface.php +++ b/tests/Behat/Page/Shop/Product/ShowPageInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Behat\Page\Shop\Product; +namespace Setono\SyliusGiftCardPlugin\Tests\Behat\Page\Shop\Product; use Sylius\Behat\Page\Shop\Product\ShowPageInterface as BaseShowPageInterface; diff --git a/tests/Behat/Resources/context/api.xml b/tests/Behat/Resources/context/api.xml index 410f3031..c288acde 100644 --- a/tests/Behat/Resources/context/api.xml +++ b/tests/Behat/Resources/context/api.xml @@ -7,29 +7,29 @@ + class="Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Api\Admin\ManagingGiftCardConfigurationsContext"> + class="Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Api\Admin\ManagingGiftCardsContext"> + class="Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Api\Admin\ManagingGiftCardsBalanceContext"> - + class="Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Api\Shop\CartContext"> + @@ -37,7 +37,7 @@ + class="Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Api\Shop\ManagingGiftCardsContext"> diff --git a/tests/Behat/Resources/context/setup.xml b/tests/Behat/Resources/context/setup.xml index f9de83fb..843ff317 100644 --- a/tests/Behat/Resources/context/setup.xml +++ b/tests/Behat/Resources/context/setup.xml @@ -6,13 +6,13 @@ + class="Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Setup\GiftCardConfigurationContext"> + class="Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Setup\GiftCardContext"> diff --git a/tests/Behat/Resources/context/transform.xml b/tests/Behat/Resources/context/transform.xml index 51326049..d9231cdb 100644 --- a/tests/Behat/Resources/context/transform.xml +++ b/tests/Behat/Resources/context/transform.xml @@ -6,12 +6,12 @@ + class="Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Transform\GiftCardConfigurationContext"> + class="Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Transform\GiftCardContext"> diff --git a/tests/Behat/Resources/context/ui.xml b/tests/Behat/Resources/context/ui.xml index 85c60e93..cd94308a 100644 --- a/tests/Behat/Resources/context/ui.xml +++ b/tests/Behat/Resources/context/ui.xml @@ -6,12 +6,12 @@ + class="Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Ui\Admin\ManagingGiftCardsContext"> + class="Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Ui\Shop\CheckoutContext"> @@ -19,13 +19,13 @@ + class="Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Ui\Shop\CartContext"> + class="Setono\SyliusGiftCardPlugin\Tests\Behat\Context\Ui\EmailContext"> diff --git a/tests/Behat/Resources/page/admin.xml b/tests/Behat/Resources/page/admin.xml index 929c5a10..64d973eb 100644 --- a/tests/Behat/Resources/page/admin.xml +++ b/tests/Behat/Resources/page/admin.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> setono_sylius_gift_card_admin_product_create_gift_card diff --git a/tests/Behat/Resources/page/shop.xml b/tests/Behat/Resources/page/shop.xml index f4e3068d..482092ae 100644 --- a/tests/Behat/Resources/page/shop.xml +++ b/tests/Behat/Resources/page/shop.xml @@ -4,11 +4,11 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> diff --git a/tests/Unit/Api/Command/AddGiftCardToOrderTest.php b/tests/Unit/Api/Command/AddGiftCardToOrderTest.php index cd087d96..eb9688ac 100644 --- a/tests/Unit/Api/Command/AddGiftCardToOrderTest.php +++ b/tests/Unit/Api/Command/AddGiftCardToOrderTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\Command; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\Command; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Api\Command\AddGiftCardToOrder; diff --git a/tests/Unit/Api/Command/AddItemToCartTest.php b/tests/Unit/Api/Command/AddItemToCartTest.php index 2e8dbc22..34f7e6db 100644 --- a/tests/Unit/Api/Command/AddItemToCartTest.php +++ b/tests/Unit/Api/Command/AddItemToCartTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\Command; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\Command; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Api\Command\AddItemToCart; diff --git a/tests/Unit/Api/Command/AssociateConfigurationToChannelTest.php b/tests/Unit/Api/Command/AssociateConfigurationToChannelTest.php index f71be8fe..85ba15e6 100644 --- a/tests/Unit/Api/Command/AssociateConfigurationToChannelTest.php +++ b/tests/Unit/Api/Command/AssociateConfigurationToChannelTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\Command; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\Command; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Api\Command\AssociateConfigurationToChannel; diff --git a/tests/Unit/Api/Command/CreateGiftCardConfigurationTest.php b/tests/Unit/Api/Command/CreateGiftCardConfigurationTest.php index 421b701d..adb52290 100644 --- a/tests/Unit/Api/Command/CreateGiftCardConfigurationTest.php +++ b/tests/Unit/Api/Command/CreateGiftCardConfigurationTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\Command; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\Command; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Api\Command\CreateGiftCardConfiguration; diff --git a/tests/Unit/Api/Command/RemoveGiftCardFromOrderTest.php b/tests/Unit/Api/Command/RemoveGiftCardFromOrderTest.php index 98b6f32e..b17422c1 100644 --- a/tests/Unit/Api/Command/RemoveGiftCardFromOrderTest.php +++ b/tests/Unit/Api/Command/RemoveGiftCardFromOrderTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\Command; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\Command; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Api\Command\GiftCardCodeAwareInterface; diff --git a/tests/Unit/Api/CommandHandler/AddGiftCardToOrderHandlerTest.php b/tests/Unit/Api/CommandHandler/AddGiftCardToOrderHandlerTest.php index ef3a3483..17abca48 100644 --- a/tests/Unit/Api/CommandHandler/AddGiftCardToOrderHandlerTest.php +++ b/tests/Unit/Api/CommandHandler/AddGiftCardToOrderHandlerTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\CommandHandler; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\CommandHandler; use InvalidArgumentException; use PHPUnit\Framework\TestCase; @@ -13,7 +13,7 @@ use Setono\SyliusGiftCardPlugin\Model\GiftCard; use Setono\SyliusGiftCardPlugin\Repository\GiftCardRepositoryInterface; use Setono\SyliusGiftCardPlugin\Repository\OrderRepositoryInterface; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Order; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Order; final class AddGiftCardToOrderHandlerTest extends TestCase { @@ -41,7 +41,7 @@ public function it_adds_gift_card_to_order(): void $addGiftCardToOrderHandler = new AddGiftCardToOrderHandler( $giftCardRepository->reveal(), $orderRepository->reveal(), - $giftCardApplicator->reveal() + $giftCardApplicator->reveal(), ); $addGiftCardToOrderHandler($command); } @@ -62,7 +62,7 @@ public function it_throws_error_if_gift_card_code_is_null(): void $addGiftCardToOrderHandler = new AddGiftCardToOrderHandler( $giftCardRepository->reveal(), $orderRepository->reveal(), - $giftCardApplicator->reveal() + $giftCardApplicator->reveal(), ); $addGiftCardToOrderHandler($command); } @@ -84,7 +84,7 @@ public function it_throws_error_if_gift_card_not_found(): void $addGiftCardToOrderHandler = new AddGiftCardToOrderHandler( $giftCardRepository->reveal(), $orderRepository->reveal(), - $giftCardApplicator->reveal() + $giftCardApplicator->reveal(), ); $addGiftCardToOrderHandler($command); } @@ -110,7 +110,7 @@ public function it_throws_exception_if_order_not_found(): void $addGiftCardToOrderHandler = new AddGiftCardToOrderHandler( $giftCardRepository->reveal(), $orderRepository->reveal(), - $giftCardApplicator->reveal() + $giftCardApplicator->reveal(), ); $addGiftCardToOrderHandler($command); } diff --git a/tests/Unit/Api/CommandHandler/AddItemToCartHandlerTest.php b/tests/Unit/Api/CommandHandler/AddItemToCartHandlerTest.php index 2169ca5a..ea9c923d 100644 --- a/tests/Unit/Api/CommandHandler/AddItemToCartHandlerTest.php +++ b/tests/Unit/Api/CommandHandler/AddItemToCartHandlerTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\CommandHandler; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\CommandHandler; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\EntityManagerInterface; @@ -14,16 +14,16 @@ use Setono\SyliusGiftCardPlugin\Factory\GiftCardFactoryInterface; use Setono\SyliusGiftCardPlugin\Model\GiftCard; use Setono\SyliusGiftCardPlugin\Repository\OrderRepositoryInterface; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Order; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItem; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItemUnit; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Product; use Sylius\Bundle\ApiBundle\Command\Cart\AddItemToCart as SyliusAddItemToCart; use Sylius\Component\Core\Factory\CartItemFactoryInterface; use Sylius\Component\Core\Model\ProductVariant; use Sylius\Component\Core\Repository\ProductVariantRepositoryInterface; use Sylius\Component\Order\Modifier\OrderItemQuantityModifierInterface; use Sylius\Component\Order\Modifier\OrderModifierInterface; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Order; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItem; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItemUnit; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Product; final class AddItemToCartHandlerTest extends TestCase { diff --git a/tests/Unit/Api/CommandHandler/AssociateConfigurationToChannelHandlerTest.php b/tests/Unit/Api/CommandHandler/AssociateConfigurationToChannelHandlerTest.php index 0a3ac680..54c0b619 100644 --- a/tests/Unit/Api/CommandHandler/AssociateConfigurationToChannelHandlerTest.php +++ b/tests/Unit/Api/CommandHandler/AssociateConfigurationToChannelHandlerTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\CommandHandler; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\CommandHandler; use Doctrine\Common\Collections\ArrayCollection; use InvalidArgumentException; @@ -66,7 +66,7 @@ public function it_associates_configuration_to_channel(): void $channelRepository->reveal(), $localeRepository->reveal(), $giftCardChannelConfigurationRepository->reveal(), - $giftCardChannelConfigurationFactory->reveal() + $giftCardChannelConfigurationFactory->reveal(), ); $returnedConfiguration = $handler($command); @@ -122,7 +122,7 @@ public function it_does_nothing_if_association_already_exists(): void $channelRepository->reveal(), $localeRepository->reveal(), $giftCardChannelConfigurationRepository->reveal(), - $giftCardChannelConfigurationFactory->reveal() + $giftCardChannelConfigurationFactory->reveal(), ); $returnedConfiguration = $handler($command); @@ -149,7 +149,7 @@ public function it_throws_exception_if_configuration_code_empty(): void $channelRepository->reveal(), $localeRepository->reveal(), $giftCardChannelConfigurationRepository->reveal(), - $giftCardChannelConfigurationFactory->reveal() + $giftCardChannelConfigurationFactory->reveal(), ); $handler($command); } @@ -175,7 +175,7 @@ public function it_throws_exception_if_configuration_not_found(): void $channelRepository->reveal(), $localeRepository->reveal(), $giftCardChannelConfigurationRepository->reveal(), - $giftCardChannelConfigurationFactory->reveal() + $giftCardChannelConfigurationFactory->reveal(), ); $handler($command); } @@ -207,7 +207,7 @@ public function it_throws_eception_if_channel_not_found(): void $channelRepository->reveal(), $localeRepository->reveal(), $giftCardChannelConfigurationRepository->reveal(), - $giftCardChannelConfigurationFactory->reveal() + $giftCardChannelConfigurationFactory->reveal(), ); $handler($command); } @@ -243,7 +243,7 @@ public function if_throws_exception_if_locale_not_found(): void $channelRepository->reveal(), $localeRepository->reveal(), $giftCardChannelConfigurationRepository->reveal(), - $giftCardChannelConfigurationFactory->reveal() + $giftCardChannelConfigurationFactory->reveal(), ); $handler($command); } diff --git a/tests/Unit/Api/CommandHandler/CreateGiftCardConfigurationHandlerTest.php b/tests/Unit/Api/CommandHandler/CreateGiftCardConfigurationHandlerTest.php index 1057bce5..2649006f 100644 --- a/tests/Unit/Api/CommandHandler/CreateGiftCardConfigurationHandlerTest.php +++ b/tests/Unit/Api/CommandHandler/CreateGiftCardConfigurationHandlerTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\CommandHandler; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\CommandHandler; use Doctrine\Persistence\ObjectManager; use PHPUnit\Framework\TestCase; @@ -44,7 +44,7 @@ public function it_creates_gift_card_configuration(): void $handler = new CreateGiftCardConfigurationHandler( $giftCardConfigurationFactory->reveal(), - $giftCardConfigurationManager->reveal() + $giftCardConfigurationManager->reveal(), ); $giftCardConfigurationManager->persist($giftCardConfiguration->reveal())->shouldBeCalled(); @@ -67,7 +67,7 @@ public function it_does_not_set_values_if_null(): void $handler = new CreateGiftCardConfigurationHandler( $giftCardConfigurationFactory->reveal(), - $giftCardConfigurationManager->reveal() + $giftCardConfigurationManager->reveal(), ); $giftCardConfigurationManager->persist($giftCardConfiguration->reveal())->shouldBeCalled(); diff --git a/tests/Unit/Api/CommandHandler/RemoveGiftCardFromOrderHandlerTest.php b/tests/Unit/Api/CommandHandler/RemoveGiftCardFromOrderHandlerTest.php index 18baa21e..5ec6209b 100644 --- a/tests/Unit/Api/CommandHandler/RemoveGiftCardFromOrderHandlerTest.php +++ b/tests/Unit/Api/CommandHandler/RemoveGiftCardFromOrderHandlerTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\CommandHandler; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\CommandHandler; use InvalidArgumentException; use PHPUnit\Framework\TestCase; @@ -13,7 +13,7 @@ use Setono\SyliusGiftCardPlugin\Model\GiftCard; use Setono\SyliusGiftCardPlugin\Repository\GiftCardRepositoryInterface; use Setono\SyliusGiftCardPlugin\Repository\OrderRepositoryInterface; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Order; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Order; final class RemoveGiftCardFromOrderHandlerTest extends TestCase { @@ -41,7 +41,7 @@ public function it_removes_gift_card_from_order(): void $removeGiftCardFromOrderHandler = new RemoveGiftCardFromOrderHandler( $giftCardRepository->reveal(), $orderRepository->reveal(), - $giftCardApplicator->reveal() + $giftCardApplicator->reveal(), ); $removeGiftCardFromOrderHandler($command); } @@ -62,7 +62,7 @@ public function it_throws_error_if_gift_card_code_is_null(): void $removeGiftCardFromOrderHandler = new RemoveGiftCardFromOrderHandler( $giftCardRepository->reveal(), $orderRepository->reveal(), - $giftCardApplicator->reveal() + $giftCardApplicator->reveal(), ); $removeGiftCardFromOrderHandler($command); } @@ -84,7 +84,7 @@ public function it_throws_error_if_gift_card_not_found(): void $removeGiftCardFromOrderHandler = new RemoveGiftCardFromOrderHandler( $giftCardRepository->reveal(), $orderRepository->reveal(), - $giftCardApplicator->reveal() + $giftCardApplicator->reveal(), ); $removeGiftCardFromOrderHandler($command); } @@ -110,7 +110,7 @@ public function it_throws_exception_if_order_not_found(): void $removeGiftCardFromOrderHandler = new RemoveGiftCardFromOrderHandler( $giftCardRepository->reveal(), $orderRepository->reveal(), - $giftCardApplicator->reveal() + $giftCardApplicator->reveal(), ); $removeGiftCardFromOrderHandler($command); } diff --git a/tests/Unit/Api/Controller/Action/DownloadGiftCardPdfActionTest.php b/tests/Unit/Api/Controller/Action/DownloadGiftCardPdfActionTest.php index 32055ad7..5ae20137 100644 --- a/tests/Unit/Api/Controller/Action/DownloadGiftCardPdfActionTest.php +++ b/tests/Unit/Api/Controller/Action/DownloadGiftCardPdfActionTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\Controller\Action; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\Controller\Action; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; @@ -36,7 +36,7 @@ public function it_downloads_associated_pdf(): void $downloadGiftCardPdfAction = new DownloadGiftCardPdfAction( $configurationProvider->reveal(), - $giftCardPDFRenderer->reveal() + $giftCardPDFRenderer->reveal(), ); $response = $downloadGiftCardPdfAction($giftCard); diff --git a/tests/Unit/Api/Controller/Action/GiftCardBalanceActionTest.php b/tests/Unit/Api/Controller/Action/GiftCardBalanceActionTest.php index c08352ce..0d5f0e91 100644 --- a/tests/Unit/Api/Controller/Action/GiftCardBalanceActionTest.php +++ b/tests/Unit/Api/Controller/Action/GiftCardBalanceActionTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\Controller\Action; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\Controller\Action; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; diff --git a/tests/Unit/Api/Controller/Action/ResendGiftCardEmailActionTest.php b/tests/Unit/Api/Controller/Action/ResendGiftCardEmailActionTest.php index 6a731fc3..9e6178f0 100644 --- a/tests/Unit/Api/Controller/Action/ResendGiftCardEmailActionTest.php +++ b/tests/Unit/Api/Controller/Action/ResendGiftCardEmailActionTest.php @@ -2,19 +2,19 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\Controller\Action; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\Controller\Action; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; use Setono\SyliusGiftCardPlugin\Api\Controller\Action\ResendGiftCardEmailAction; use Setono\SyliusGiftCardPlugin\EmailManager\GiftCardEmailManagerInterface; use Setono\SyliusGiftCardPlugin\Model\GiftCard; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Order; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItemUnit; use Sylius\Component\Core\Model\Customer; use Sylius\Component\Core\Model\OrderItem; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Order; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItemUnit; final class ResendGiftCardEmailActionTest extends TestCase { diff --git a/tests/Unit/Api/Controller/Action/UploadGiftCardConfigurationImageActionTest.php b/tests/Unit/Api/Controller/Action/UploadGiftCardConfigurationImageActionTest.php index e671446f..69f90985 100644 --- a/tests/Unit/Api/Controller/Action/UploadGiftCardConfigurationImageActionTest.php +++ b/tests/Unit/Api/Controller/Action/UploadGiftCardConfigurationImageActionTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\Controller\Action; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\Controller\Action; use ApiPlatform\Core\Api\IriConverterInterface; use InvalidArgumentException; @@ -53,7 +53,7 @@ public function it_uploads_gift_card_configuration_image(): void $giftCardConfigurationImageFactory->reveal(), $giftCardConfigurationImageRepository->reveal(), $imageUploader->reveal(), - $iriConverter->reveal() + $iriConverter->reveal(), ); $returnedImage = $uploadGiftCardConfigurationImageAction($request); @@ -88,7 +88,7 @@ public function it_throws_error_if_image_empty(): void $giftCardConfigurationImageFactory->reveal(), $giftCardConfigurationImageRepository->reveal(), $imageUploader->reveal(), - $iriConverter->reveal() + $iriConverter->reveal(), ); $uploadGiftCardConfigurationImageAction($request); } @@ -122,7 +122,7 @@ public function it_throws_error_if_owner_iri_empty(): void $giftCardConfigurationImageFactory->reveal(), $giftCardConfigurationImageRepository->reveal(), $imageUploader->reveal(), - $iriConverter->reveal() + $iriConverter->reveal(), ); $uploadGiftCardConfigurationImageAction($request); } @@ -160,7 +160,7 @@ public function it_throws_error_if_owner_not_found(): void $giftCardConfigurationImageFactory->reveal(), $giftCardConfigurationImageRepository->reveal(), $imageUploader->reveal(), - $iriConverter->reveal() + $iriConverter->reveal(), ); $uploadGiftCardConfigurationImageAction($request); } @@ -203,7 +203,7 @@ public function it_deletes_old_image_of_same_type(): void $giftCardConfigurationImageFactory->reveal(), $giftCardConfigurationImageRepository->reveal(), $imageUploader->reveal(), - $iriConverter->reveal() + $iriConverter->reveal(), ); $returnedImage = $uploadGiftCardConfigurationImageAction($request); diff --git a/tests/Unit/Api/DataPersister/GiftCardDataPersisterTest.php b/tests/Unit/Api/DataPersister/GiftCardDataPersisterTest.php index c2e4f373..69eb4b6b 100644 --- a/tests/Unit/Api/DataPersister/GiftCardDataPersisterTest.php +++ b/tests/Unit/Api/DataPersister/GiftCardDataPersisterTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\DataPersister; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\DataPersister; use ApiPlatform\Core\DataPersister\ContextAwareDataPersisterInterface; use PHPUnit\Framework\TestCase; diff --git a/tests/Unit/Api/DataTransformer/GiftCardCodeAwareInputCommandDataTransformerTest.php b/tests/Unit/Api/DataTransformer/GiftCardCodeAwareInputCommandDataTransformerTest.php index 33a1c0a3..324be62e 100644 --- a/tests/Unit/Api/DataTransformer/GiftCardCodeAwareInputCommandDataTransformerTest.php +++ b/tests/Unit/Api/DataTransformer/GiftCardCodeAwareInputCommandDataTransformerTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\DataTransformer; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\DataTransformer; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Api\Command\AddGiftCardToOrder; @@ -37,7 +37,7 @@ public function it_adds_gift_card_code_to_object(): void $transformedCommand = $dataTransformer->transform( $addGiftCardToOrder, GiftCardCodeAwareInterface::class, - ['object_to_populate' => $giftCard] + ['object_to_populate' => $giftCard], ); self::assertEquals('gc_code', $transformedCommand->getGiftCardCode()); } diff --git a/tests/Unit/Api/Doctrine/QueryCollectionExtension/GiftCardsByLoggedInUserExtensionTest.php b/tests/Unit/Api/Doctrine/QueryCollectionExtension/GiftCardsByLoggedInUserExtensionTest.php index 5cbdb01e..83c3e657 100644 --- a/tests/Unit/Api/Doctrine/QueryCollectionExtension/GiftCardsByLoggedInUserExtensionTest.php +++ b/tests/Unit/Api/Doctrine/QueryCollectionExtension/GiftCardsByLoggedInUserExtensionTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Api\Doctrine\QueryCollectionExtension; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Api\Doctrine\QueryCollectionExtension; use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface; use Doctrine\DBAL\Types\Types; diff --git a/tests/Unit/Controller/Action/Admin/GenerateEncodedExamplePdfActionTest.php b/tests/Unit/Controller/Action/Admin/GenerateEncodedExamplePdfActionTest.php index 7084e7e3..970599df 100644 --- a/tests/Unit/Controller/Action/Admin/GenerateEncodedExamplePdfActionTest.php +++ b/tests/Unit/Controller/Action/Admin/GenerateEncodedExamplePdfActionTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Controller\Action\Admin; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Controller\Action\Admin; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; @@ -50,7 +50,7 @@ public function it_generates_encoded_pdf(): void $exampleGiftCardFactory->reveal(), $giftCardConfigurationRepository->reveal(), $giftCardPDFRenderer->reveal(), - $formFactory->reveal() + $formFactory->reveal(), ); $response = $action($request, $id); $this->assertEquals(\base64_encode($pdfContent), $response->getContent()); diff --git a/tests/Unit/DependencyInjection/ConfigurationTest.php b/tests/Unit/DependencyInjection/ConfigurationTest.php index b75b0a6a..8d92e2d5 100644 --- a/tests/Unit/DependencyInjection/ConfigurationTest.php +++ b/tests/Unit/DependencyInjection/ConfigurationTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\DependencyInjection; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\DependencyInjection; use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait; use PHPUnit\Framework\TestCase; diff --git a/tests/Unit/DependencyInjection/SetonoSyliusGiftCardExtensionTest.php b/tests/Unit/DependencyInjection/SetonoSyliusGiftCardExtensionTest.php index ff92b243..0f91419f 100644 --- a/tests/Unit/DependencyInjection/SetonoSyliusGiftCardExtensionTest.php +++ b/tests/Unit/DependencyInjection/SetonoSyliusGiftCardExtensionTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\DependencyInjection; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\DependencyInjection; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; use Setono\SyliusGiftCardPlugin\DependencyInjection\SetonoSyliusGiftCardExtension; diff --git a/tests/Unit/EventSubscriber/DefaultGiftCardConfigurationSubscriberTest.php b/tests/Unit/EventSubscriber/DefaultGiftCardConfigurationSubscriberTest.php index 92cfa67b..bb758820 100644 --- a/tests/Unit/EventSubscriber/DefaultGiftCardConfigurationSubscriberTest.php +++ b/tests/Unit/EventSubscriber/DefaultGiftCardConfigurationSubscriberTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\EventSubscriber; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\EventSubscriber; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; diff --git a/tests/Unit/EventSubscriber/SendEmailWithGiftCardToCustomerSubscriberTest.php b/tests/Unit/EventSubscriber/SendEmailWithGiftCardToCustomerSubscriberTest.php index 4b30f306..9fdc4beb 100644 --- a/tests/Unit/EventSubscriber/SendEmailWithGiftCardToCustomerSubscriberTest.php +++ b/tests/Unit/EventSubscriber/SendEmailWithGiftCardToCustomerSubscriberTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\EventSubscriber; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\EventSubscriber; use PHPUnit\Framework\TestCase; use Prophecy\Argument; diff --git a/tests/Unit/Factory/GiftCardConfigurationFactoryTest.php b/tests/Unit/Factory/GiftCardConfigurationFactoryTest.php index 7d68deee..15a3d0f8 100644 --- a/tests/Unit/Factory/GiftCardConfigurationFactoryTest.php +++ b/tests/Unit/Factory/GiftCardConfigurationFactoryTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Factory; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Factory; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; @@ -35,7 +35,7 @@ public function it_creates_a_new_gift_card_configuration(): void $decoratedFactory->reveal(), $defaultGiftCardTemplateContentProvider->reveal(), $defaultOrientation, - $defaultPageSize + $defaultPageSize, ); $createdGiftCardConfiguration = $factory->createNew(); diff --git a/tests/Unit/Factory/GiftCardFactoryTest.php b/tests/Unit/Factory/GiftCardFactoryTest.php index cda91668..94031a27 100644 --- a/tests/Unit/Factory/GiftCardFactoryTest.php +++ b/tests/Unit/Factory/GiftCardFactoryTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Factory; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Factory; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; @@ -12,15 +12,15 @@ use Setono\SyliusGiftCardPlugin\Model\GiftCardConfiguration; use Setono\SyliusGiftCardPlugin\Model\GiftCardInterface; use Setono\SyliusGiftCardPlugin\Provider\GiftCardConfigurationProviderInterface; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Order; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItem; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItemUnit; use Sylius\Bundle\ShippingBundle\Provider\Calendar; use Sylius\Bundle\ShippingBundle\Provider\DateTimeProvider; use Sylius\Component\Core\Model\Channel; use Sylius\Component\Core\Model\Customer; use Sylius\Component\Currency\Context\CurrencyContextInterface; use Sylius\Component\Resource\Factory\FactoryInterface; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Order; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItem; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItemUnit; final class GiftCardFactoryTest extends TestCase { @@ -46,7 +46,7 @@ public function it_creates_a_new_gift_card_with_code(): void $giftCardCodeGenerator->reveal(), $configurationProvider->reveal(), new Calendar(), - $currencyContext->reveal() + $currencyContext->reveal(), ); $createdGiftCard = $factory->createNew(); @@ -76,7 +76,7 @@ public function it_creates_a_new_gift_card_for_channel(): void $giftCardCodeGenerator->reveal(), $configurationProvider->reveal(), new Calendar(), - $currencyContext->reveal() + $currencyContext->reveal(), ); $createdGiftCard = $factory->createForChannel($channel); @@ -112,7 +112,7 @@ public function it_creates_a_new_gift_card_for_channel_with_expiration_date(): v $giftCardCodeGenerator->reveal(), $configurationProvider->reveal(), $calendar->reveal(), - $currencyContext->reveal() + $currencyContext->reveal(), ); $createdGiftCard = $factory->createForChannel($channel); @@ -143,7 +143,7 @@ public function it_creates_a_new_gift_card_for_channel_from_admin(): void $giftCardCodeGenerator->reveal(), $configurationProvider->reveal(), new Calendar(), - $currencyContext->reveal() + $currencyContext->reveal(), ); $createdGiftCard = $factory->createForChannelFromAdmin($channel); @@ -180,7 +180,7 @@ public function it_creates_a_new_gift_card_for_order_item_unit_and_cart(): void $giftCardCodeGenerator->reveal(), $configurationProvider->reveal(), new Calendar(), - $currencyContext->reveal() + $currencyContext->reveal(), ); $createdGiftCard = $factory->createFromOrderItemUnitAndCart($orderItemUnit->reveal(), $cart); @@ -227,7 +227,7 @@ public function it_creates_a_new_gift_card_for_order_item_unit(): void $giftCardCodeGenerator->reveal(), $configurationProvider->reveal(), new Calendar(), - $currencyContext->reveal() + $currencyContext->reveal(), ); $createdGiftCard = $factory->createFromOrderItemUnit($orderItemUnit->reveal()); @@ -262,7 +262,7 @@ public function it_creates_example_gift_card(): void $giftCardCodeGenerator->reveal(), $configurationProvider->reveal(), new Calendar(), - $currencyContext->reveal() + $currencyContext->reveal(), ); $returnedGiftCard = $factory->createExample(); $this->assertEquals(1500, $returnedGiftCard->getAmount()); diff --git a/tests/Unit/Form/Extension/AddToCartTypeExtensionTest.php b/tests/Unit/Form/Extension/AddToCartTypeExtensionTest.php index 28c50647..f5d988bc 100644 --- a/tests/Unit/Form/Extension/AddToCartTypeExtensionTest.php +++ b/tests/Unit/Form/Extension/AddToCartTypeExtensionTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Form\Extension; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Form\Extension; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\EntityManagerInterface; @@ -13,14 +13,14 @@ use Setono\SyliusGiftCardPlugin\Model\GiftCardInterface; use Setono\SyliusGiftCardPlugin\Order\AddToCartCommand; use Setono\SyliusGiftCardPlugin\Order\GiftCardInformationInterface; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Order; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItem; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItemUnit; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Product; use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Model\ChannelPricingInterface; use Sylius\Component\Core\Model\ProductVariantInterface; use Symfony\Component\Form\FormEvent; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Order; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItem; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItemUnit; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Product; final class AddToCartTypeExtensionTest extends TestCase { @@ -52,7 +52,7 @@ public function it_populates_cart_item_for_configurable_gift_card(): void $formEvent->getData()->willReturn(new AddToCartCommand( $cart->reveal(), $orderItem->reveal(), - $giftCardInformation->reveal() + $giftCardInformation->reveal(), )); $giftCard = $this->prophesize(GiftCardInterface::class); @@ -97,7 +97,7 @@ public function it_populates_cart_item_for_not_configurable_gift_card(): void $formEvent->getData()->willReturn(new AddToCartCommand( $cart->reveal(), $orderItem->reveal(), - $giftCardInformation->reveal() + $giftCardInformation->reveal(), )); $giftCard = $this->prophesize(GiftCardInterface::class); diff --git a/tests/Unit/Form/Type/DatePeriodTypeTest.php b/tests/Unit/Form/Type/DatePeriodTypeTest.php index 7d0aae44..14b90063 100644 --- a/tests/Unit/Form/Type/DatePeriodTypeTest.php +++ b/tests/Unit/Form/Type/DatePeriodTypeTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Form\Type; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Form\Type; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; diff --git a/tests/Unit/Generator/GiftCardCodeGeneratorTest.php b/tests/Unit/Generator/GiftCardCodeGeneratorTest.php index 68dc19f5..80c950b5 100644 --- a/tests/Unit/Generator/GiftCardCodeGeneratorTest.php +++ b/tests/Unit/Generator/GiftCardCodeGeneratorTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Generator; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Generator; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; diff --git a/tests/Unit/Model/GiftCardConfigurationTest.php b/tests/Unit/Model/GiftCardConfigurationTest.php index 750a655e..2281a6cf 100644 --- a/tests/Unit/Model/GiftCardConfigurationTest.php +++ b/tests/Unit/Model/GiftCardConfigurationTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Model; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Model; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Model\GiftCardConfiguration; diff --git a/tests/Unit/Model/GiftCardTest.php b/tests/Unit/Model/GiftCardTest.php index 2663641b..f9b76d0e 100644 --- a/tests/Unit/Model/GiftCardTest.php +++ b/tests/Unit/Model/GiftCardTest.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Model; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Model; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; use Setono\SyliusGiftCardPlugin\Model\GiftCard; use Setono\SyliusGiftCardPlugin\Model\OrderItemUnitInterface; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItem; use Sylius\Component\Core\Model\Channel; use Sylius\Component\Core\Model\Customer; use Sylius\Component\Core\Model\Order; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItem; final class GiftCardTest extends TestCase { diff --git a/tests/Unit/Model/OrderItemTraitTest.php b/tests/Unit/Model/OrderItemTraitTest.php index 2fde6aba..336e314f 100644 --- a/tests/Unit/Model/OrderItemTraitTest.php +++ b/tests/Unit/Model/OrderItemTraitTest.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Model; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Model; use PHPUnit\Framework\TestCase; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItem; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Product; use Sylius\Component\Core\Model\ProductVariant; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItem; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Product; final class OrderItemTraitTest extends TestCase { diff --git a/tests/Unit/Model/ProductTraitTest.php b/tests/Unit/Model/ProductTraitTest.php index 7ee90463..a8148aac 100644 --- a/tests/Unit/Model/ProductTraitTest.php +++ b/tests/Unit/Model/ProductTraitTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Model; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Model; use PHPUnit\Framework\TestCase; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Product; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Product; final class ProductTraitTest extends TestCase { diff --git a/tests/Unit/Operator/GiftCardOperatorTest.php b/tests/Unit/Operator/GiftCardOperatorTest.php index d36cd3f2..06d42c9a 100644 --- a/tests/Unit/Operator/GiftCardOperatorTest.php +++ b/tests/Unit/Operator/GiftCardOperatorTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Operator; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Operator; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\EntityManagerInterface; @@ -11,12 +11,12 @@ use Setono\SyliusGiftCardPlugin\EmailManager\GiftCardEmailManagerInterface; use Setono\SyliusGiftCardPlugin\Model\GiftCard; use Setono\SyliusGiftCardPlugin\Operator\OrderGiftCardOperator; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Order; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItem; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItemUnit; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Product; use Sylius\Component\Core\Model\Customer; use Sylius\Component\Core\Model\ProductVariant; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Order; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItem; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItemUnit; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Product; final class GiftCardOperatorTest extends TestCase { @@ -52,7 +52,7 @@ public function it_associate_gift_card_to_customer(): void $orderGiftCardOperator = new OrderGiftCardOperator( $giftCardManager->reveal(), - $giftCardOrderEmailManager->reveal() + $giftCardOrderEmailManager->reveal(), ); $orderGiftCardOperator->associateToCustomer($order); @@ -72,7 +72,7 @@ public function it_returns_if_there_is_no_gift_card_item(): void $orderGiftCardOperator = new OrderGiftCardOperator( $giftCardManager->reveal(), - $giftCardOrderEmailManager->reveal() + $giftCardOrderEmailManager->reveal(), ); $orderGiftCardOperator->associateToCustomer($order->reveal()); @@ -110,7 +110,7 @@ public function it_enables_gift_card(): void $orderGiftCardOperator = new OrderGiftCardOperator( $giftCardManager->reveal(), - $giftCardOrderEmailManager->reveal() + $giftCardOrderEmailManager->reveal(), ); $orderGiftCardOperator->enable($order); @@ -148,7 +148,7 @@ public function it_disables_gift_card(): void $orderGiftCardOperator = new OrderGiftCardOperator( $giftCardManager->reveal(), - $giftCardOrderEmailManager->reveal() + $giftCardOrderEmailManager->reveal(), ); $orderGiftCardOperator->disable($order); diff --git a/tests/Unit/Order/AddToCartCommandTest.php b/tests/Unit/Order/AddToCartCommandTest.php index cedfef3b..f8be01ec 100644 --- a/tests/Unit/Order/AddToCartCommandTest.php +++ b/tests/Unit/Order/AddToCartCommandTest.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Order; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Order; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Order\AddToCartCommand; use Setono\SyliusGiftCardPlugin\Order\GiftCardInformation; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Order; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItem; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Order; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItem; final class AddToCartCommandTest extends TestCase { diff --git a/tests/Unit/Order/Factory/AddToCardCommandFactoryTest.php b/tests/Unit/Order/Factory/AddToCardCommandFactoryTest.php index 75255994..a7c4e725 100644 --- a/tests/Unit/Order/Factory/AddToCardCommandFactoryTest.php +++ b/tests/Unit/Order/Factory/AddToCardCommandFactoryTest.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Order\Factory; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Order\Factory; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Order\AddToCartCommand; use Setono\SyliusGiftCardPlugin\Order\Factory\AddToCartCommandFactory; use Setono\SyliusGiftCardPlugin\Order\Factory\GiftCardInformationFactory; use Setono\SyliusGiftCardPlugin\Order\GiftCardInformation; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Order; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItem; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Order; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItem; final class AddToCardCommandFactoryTest extends TestCase { diff --git a/tests/Unit/Order/Factory/GiftCardInformationFactoryTest.php b/tests/Unit/Order/Factory/GiftCardInformationFactoryTest.php index da8625b9..6d2ce10d 100644 --- a/tests/Unit/Order/Factory/GiftCardInformationFactoryTest.php +++ b/tests/Unit/Order/Factory/GiftCardInformationFactoryTest.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Order\Factory; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Order\Factory; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Order\Factory\GiftCardInformationFactory; use Setono\SyliusGiftCardPlugin\Order\GiftCardInformation; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\OrderItem; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\OrderItem; final class GiftCardInformationFactoryTest extends TestCase { diff --git a/tests/Unit/Order/GiftCardInformationTest.php b/tests/Unit/Order/GiftCardInformationTest.php index a94135c8..771550ff 100644 --- a/tests/Unit/Order/GiftCardInformationTest.php +++ b/tests/Unit/Order/GiftCardInformationTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Order; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Order; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Order\GiftCardInformation; diff --git a/tests/Unit/OrderProcessor/OrderGiftCardProcessorTest.php b/tests/Unit/OrderProcessor/OrderGiftCardProcessorTest.php index 47e11a23..34ee4ede 100644 --- a/tests/Unit/OrderProcessor/OrderGiftCardProcessorTest.php +++ b/tests/Unit/OrderProcessor/OrderGiftCardProcessorTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\OrderProcessor; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\OrderProcessor; use Doctrine\Common\Collections\ArrayCollection; use PHPUnit\Framework\TestCase; @@ -65,14 +65,14 @@ public function it_processes(): void $adjustmentFactory->createWithData( AdjustmentInterface::ORDER_GIFT_CARD_ADJUSTMENT, Argument::type('string'), - -50 + -50, )->willReturn($adjustment1); $adjustment2 = $this->prophesize(AdjustmentInterface::class); $adjustmentFactory->createWithData( AdjustmentInterface::ORDER_GIFT_CARD_ADJUSTMENT, Argument::type('string'), - -130 + -130, )->willReturn($adjustment2); $adjustment1->setOriginCode('gift-card-code-1')->shouldBeCalled(); diff --git a/tests/Unit/Provider/DatePeriodUnitProviderTest.php b/tests/Unit/Provider/DatePeriodUnitProviderTest.php index 44597362..c76569d1 100644 --- a/tests/Unit/Provider/DatePeriodUnitProviderTest.php +++ b/tests/Unit/Provider/DatePeriodUnitProviderTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Provider; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Provider; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Provider\DatePeriodUnitProvider; diff --git a/tests/Unit/Provider/OrderEligibleTotalProviderTest.php b/tests/Unit/Provider/OrderEligibleTotalProviderTest.php index 61a1ee19..d4e81726 100644 --- a/tests/Unit/Provider/OrderEligibleTotalProviderTest.php +++ b/tests/Unit/Provider/OrderEligibleTotalProviderTest.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Provider; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Provider; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; use Setono\SyliusGiftCardPlugin\Model\GiftCard; use Setono\SyliusGiftCardPlugin\Provider\OrderEligibleTotalProvider; -use Tests\Setono\SyliusGiftCardPlugin\Application\Model\Order; +use Setono\SyliusGiftCardPlugin\Tests\Application\Model\Order; final class OrderEligibleTotalProviderTest extends TestCase { diff --git a/tests/Unit/Provider/PdfRenderingOptionProviderTest.php b/tests/Unit/Provider/PdfRenderingOptionProviderTest.php index a4a1804c..c2f8f0a4 100644 --- a/tests/Unit/Provider/PdfRenderingOptionProviderTest.php +++ b/tests/Unit/Provider/PdfRenderingOptionProviderTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Provider; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Provider; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Model\GiftCardConfiguration; diff --git a/tests/Unit/Security/GiftCardVoterTest.php b/tests/Unit/Security/GiftCardVoterTest.php index 415647fc..4e92b357 100644 --- a/tests/Unit/Security/GiftCardVoterTest.php +++ b/tests/Unit/Security/GiftCardVoterTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Security; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Security; use PHPUnit\Framework\TestCase; use Setono\SyliusGiftCardPlugin\Model\GiftCard; @@ -24,7 +24,7 @@ public function testAdminCanSeeAllGiftCards(): void $this->assertSame( Voter::ACCESS_GRANTED, - $voter->vote($token, $giftCard, [GiftCardVoter::READ]) + $voter->vote($token, $giftCard, [GiftCardVoter::READ]), ); } @@ -42,7 +42,7 @@ public function testUsersCanSeeTheirGiftCards(): void $this->assertSame( Voter::ACCESS_GRANTED, - $voter->vote($token, $giftCard, [GiftCardVoter::READ]) + $voter->vote($token, $giftCard, [GiftCardVoter::READ]), ); } @@ -58,7 +58,7 @@ public function testUsersCanSeeAnonymousGiftCards(): void $this->assertSame( Voter::ACCESS_GRANTED, - $voter->vote($token, $giftCard, [GiftCardVoter::READ]) + $voter->vote($token, $giftCard, [GiftCardVoter::READ]), ); } @@ -77,7 +77,7 @@ public function testUsersCanNotSeeOtherGiftCards(): void $this->assertSame( Voter::ACCESS_DENIED, - $voter->vote($token, $giftCard, [GiftCardVoter::READ]) + $voter->vote($token, $giftCard, [GiftCardVoter::READ]), ); } } diff --git a/tests/Unit/Twig/Extension/PdfRuntimeTest.php b/tests/Unit/Twig/Extension/PdfRuntimeTest.php index 721a2db0..ad483138 100644 --- a/tests/Unit/Twig/Extension/PdfRuntimeTest.php +++ b/tests/Unit/Twig/Extension/PdfRuntimeTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Twig\Extension; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Twig\Extension; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; @@ -33,7 +33,7 @@ public function it_gets_base64_encoded_pdf_content(): void $runtime = new PdfRuntime( $giftCardPDFRenderer->reveal(), - $giftCardFactory->reveal() + $giftCardFactory->reveal(), ); $base64Content = $runtime->getBase64EncodedExamplePdfContent($giftCardConfiguration); diff --git a/tests/Unit/Validator/Constraints/DatePeriodValidatorTest.php b/tests/Unit/Validator/Constraints/DatePeriodValidatorTest.php index 8470b63b..3e6549a8 100644 --- a/tests/Unit/Validator/Constraints/DatePeriodValidatorTest.php +++ b/tests/Unit/Validator/Constraints/DatePeriodValidatorTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Validator\Constraints; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Validator\Constraints; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; diff --git a/tests/Unit/Validator/Constraints/GiftCardIsNotExpiredValidatorTest.php b/tests/Unit/Validator/Constraints/GiftCardIsNotExpiredValidatorTest.php index 8f36fe24..ada026fa 100644 --- a/tests/Unit/Validator/Constraints/GiftCardIsNotExpiredValidatorTest.php +++ b/tests/Unit/Validator/Constraints/GiftCardIsNotExpiredValidatorTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Validator\Constraints; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Validator\Constraints; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; diff --git a/tests/Unit/Validator/Constraints/HasBackgroundImageValidatorTest.php b/tests/Unit/Validator/Constraints/HasBackgroundImageValidatorTest.php index 5eab7725..daff61e5 100644 --- a/tests/Unit/Validator/Constraints/HasBackgroundImageValidatorTest.php +++ b/tests/Unit/Validator/Constraints/HasBackgroundImageValidatorTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Validator\Constraints; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Validator\Constraints; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; diff --git a/tests/Unit/Validator/Constraints/Pdf/ValidOrientationValidatorTest.php b/tests/Unit/Validator/Constraints/Pdf/ValidOrientationValidatorTest.php index 624f26bd..5d1c9010 100644 --- a/tests/Unit/Validator/Constraints/Pdf/ValidOrientationValidatorTest.php +++ b/tests/Unit/Validator/Constraints/Pdf/ValidOrientationValidatorTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Validator\Constraints\Pdf; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Validator\Constraints\Pdf; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; diff --git a/tests/Unit/Validator/Constraints/Pdf/ValidPageSizeValidatorTest.php b/tests/Unit/Validator/Constraints/Pdf/ValidPageSizeValidatorTest.php index b2bd67e6..7bb682c6 100644 --- a/tests/Unit/Validator/Constraints/Pdf/ValidPageSizeValidatorTest.php +++ b/tests/Unit/Validator/Constraints/Pdf/ValidPageSizeValidatorTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Setono\SyliusGiftCardPlugin\Unit\Validator\Constraints\Pdf; +namespace Setono\SyliusGiftCardPlugin\Tests\Unit\Validator\Constraints\Pdf; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait;