diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4cf097f7..44af4b6d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,15 +21,16 @@ jobs: strategy: fail-fast: false matrix: - php: [8.0] - symfony: [^5.4, ^6.0] - sylius: [~1.11.0, ~1.12.0] - node: [14.18.x] - mysql: [5.7, 8.0] + php: [ "8.1" ] + symfony: [ "^5.4", "^6.0" ] + sylius: [ "~1.12.0", "~1.13.0" ] + node: [ "^14.17.x" ] + mysql: [ "8.0" ] + state_machine_adapter: [ "winzou_state_machine", "symfony_workflow" ] exclude: - - sylius: ~1.11.0 - symfony: ^6.0 + - sylius: ~1.12.0 + state_machine_adapter: "symfony_workflow" env: APP_ENV: test diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index 1e7170b6..bb037ac6 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -21,15 +21,16 @@ jobs: strategy: fail-fast: false matrix: - php: [8.0] - symfony: [ ^5.4, ^6.0] - sylius: [~1.11.0, ~1.12.0] - node: [14.x] - mysql: [5.7] + php: [ "8.1" ] + symfony: [ "^5.4", "^6.0" ] + sylius: [ "~1.12.0", "~1.13.0" ] + node: [ "^14.17.x" ] + mysql: [ "8.0" ] + state_machine_adapter: [ "winzou_state_machine", "symfony_workflow" ] exclude: - - sylius: ~1.11.0 - symfony: ^6.0 + - sylius: ~1.12.0 + state_machine_adapter: "symfony_workflow" env: APP_ENV: test @@ -93,4 +94,4 @@ jobs: SLACK_MESSAGE: ':x:' SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} - SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} \ No newline at end of file + SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} diff --git a/behat.yml.dist b/behat.yml.dist index 93a7fe49..f1b22985 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -7,9 +7,9 @@ default: DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~ FriendsOfBehat\MinkDebugExtension: - directory: etc/build - clean_start: false - screenshot: true + directory: etc/build + clean_start: false + screenshot: true Behat\MinkExtension: files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/" @@ -43,6 +43,7 @@ default: browser: firefox show_auto: false + FriendsOfBehat\SymfonyExtension: bootstrap: tests/Application/config/bootstrap.php kernel: diff --git a/composer.json b/composer.json index b0237884..4efdb997 100644 --- a/composer.json +++ b/composer.json @@ -6,13 +6,15 @@ "license": "MIT", "require": { "php": "^8.0", - "sylius/sylius": "~1.11.0 || ~1.12.0", + "sylius/sylius": "~1.12.0 || ~1.13.0", "symfony/webpack-encore-bundle": "^1.12" }, "require-dev": { "ext-json": "*", "behat/behat": "^3.6.1", "behat/mink-selenium2-driver": "^1.4", + "dbrekelmans/bdi": "^1.1", + "bitbag/coding-standard": "^3.0", "dmore/behat-chrome-extension": "^1.3", "dmore/chrome-mink-driver": "^2.7", "friends-of-behat/mink": "^1.8", @@ -25,10 +27,10 @@ "lakion/mink-debug-extension": "^2.0.0", "phpspec/phpspec": "^7.0", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "0.12.82", - "phpstan/phpstan-doctrine": "0.12.33", - "phpstan/phpstan-strict-rules": "^0.12.0", - "phpstan/phpstan-webmozart-assert": "0.12.12", + "phpstan/phpstan": "^1.8.1", + "phpstan/phpstan-doctrine": "^1.3", + "phpstan/phpstan-strict-rules": "^1.3.0", + "phpstan/phpstan-webmozart-assert": "^1.2.0", "phpunit/phpunit": "^9.5", "sylius-labs/coding-standard": "^4.0", "symfony/browser-kit": "^5.4 || ^6.0", @@ -39,17 +41,19 @@ "vimeo/psalm": "^4.12", "composer/xdebug-handler": "^2.0", "friendsofphp/php-cs-fixer": "^3.0", - "bitbag/coding-standard": "^1.0", "lchrusciel/api-test-case": "^5.1", "polishsymfonycommunity/symfony-mocker-container": "^1.0", - "php-http/message-factory": "^1.1" + "php-http/message-factory": "^1.1", + "robertfausk/behat-panther-extension": "^1.1" }, "conflict": { "symfony/symfony": "4.1.8", "symfony/browser-kit": "4.1.8", "symfony/dom-crawler": "4.1.8", "symfony/routing": "4.1.8", - "symfony/doctrine-bridge": "4.4.16" + "symfony/doctrine-bridge": "4.4.16", + "symfony/framework-bundle": "6.2.8", + "behat/mink-selenium2-driver": ">=1.7.0" }, "autoload": { "psr-4": { diff --git a/ecs.php b/ecs.php index b3c86bdc..abcfbcf8 100644 --- a/ecs.php +++ b/ecs.php @@ -2,15 +2,12 @@ declare(strict_types=1); -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/bitbag/coding-standard/ecs.php'); +return static function (ECSConfig $config): void { - $parameters = $containerConfigurator->parameters(); - $parameters->set(Option::PATHS, [ - __DIR__ . '/src', - __DIR__ . '/tests', - ]); -}; \ No newline at end of file + putenv('ALLOW_BITBAG_OS_HEADER=1'); + + $config->import('vendor/bitbag/coding-standard/ecs.php'); + $config->paths(['src', 'tests']); +}; diff --git a/phpstan.neon b/phpstan.neon index af854e06..0daf68c6 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -17,3 +17,5 @@ parameters: ignoreErrors: - '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./' + - '#missingType.iterableValue#' + - '#missingType.generics#' diff --git a/src/BitBagSyliusProductBundlePlugin.php b/src/BitBagSyliusProductBundlePlugin.php index cb2f680d..add4e915 100644 --- a/src/BitBagSyliusProductBundlePlugin.php +++ b/src/BitBagSyliusProductBundlePlugin.php @@ -1,10 +1,11 @@ productVariant = $productBundleItem->getProductVariant(); $this->quantity = $productBundleItem->getQuantity(); diff --git a/src/Command/AddProductBundleToCartCommand.php b/src/Command/AddProductBundleToCartCommand.php index 6e100b6b..88c83ae0 100644 --- a/src/Command/AddProductBundleToCartCommand.php +++ b/src/Command/AddProductBundleToCartCommand.php @@ -1,10 +1,11 @@ getFormFactory()->create( $configuration->getFormType(), $addProductBundleToCartDto, - $configuration->getFormOptions() + $configuration->getFormOptions(), ); if ($request->isMethod(Request::METHOD_POST) && $form->handleRequest($request)->isValid()) { @@ -113,7 +114,7 @@ public function addProductBundleAction(Request $request): ?Response 'configuration' => $configuration, $this->metadata->getName() => $orderItem, 'form' => $form->createView(), - ] + ], ); } @@ -121,7 +122,7 @@ private function handleForm( FormInterface $form, Controller\RequestConfiguration $configuration, OrderItemInterface $orderItem, - Request $request + Request $request, ): ?Response { /** @var AddProductBundleToCartDto $addProductBundleToCartDto */ $addProductBundleToCartDto = $form->getData(); diff --git a/src/DataTransformer/AddProductBundleToCartDtoDataTransformer.php b/src/DataTransformer/AddProductBundleToCartDtoDataTransformer.php index c7d70dc3..323a6b30 100644 --- a/src/DataTransformer/AddProductBundleToCartDtoDataTransformer.php +++ b/src/DataTransformer/AddProductBundleToCartDtoDataTransformer.php @@ -1,9 +1,10 @@ has('security.authentication_manager') - && + false === $container->has('security.authentication_manager') && true === $container->has('security.authentication.manager') ) { $container->setAlias('security.authentication_manager', 'security.authentication.manager'); diff --git a/src/Dto/AddProductBundleToCartDto.php b/src/Dto/AddProductBundleToCartDto.php index fb40c854..23e2b24f 100644 --- a/src/Dto/AddProductBundleToCartDto.php +++ b/src/Dto/AddProductBundleToCartDto.php @@ -1,9 +1,10 @@ productBundleItems = new ArrayCollection($productBundleItems); } diff --git a/src/Dto/AddProductBundleToCartDtoInterface.php b/src/Dto/AddProductBundleToCartDtoInterface.php index ffb8e23b..2a0163e9 100644 --- a/src/Dto/AddProductBundleToCartDtoInterface.php +++ b/src/Dto/AddProductBundleToCartDtoInterface.php @@ -1,9 +1,10 @@ getProductBundle(); diff --git a/src/Factory/AddProductBundleToCartDtoFactoryInterface.php b/src/Factory/AddProductBundleToCartDtoFactoryInterface.php index ef9846ab..c7a99b88 100644 --- a/src/Factory/AddProductBundleToCartDtoFactoryInterface.php +++ b/src/Factory/AddProductBundleToCartDtoFactoryInterface.php @@ -1,9 +1,10 @@ getEntityManager()->getExpressionBuilder(); @@ -27,7 +28,7 @@ public function findByPhrase( ->andWhere($expr->orX( 'translation.name LIKE :phrase', 'o.code LIKE :phrase', - 'product.code LIKE :phrase' + 'product.code LIKE :phrase', )) ->setParameter('phrase', '%' . $phrase . '%') ->setParameter('locale', $locale) diff --git a/src/Repository/ProductVariantRepositoryInterface.php b/src/Repository/ProductVariantRepositoryInterface.php index 802ab673..739c16f3 100644 --- a/src/Repository/ProductVariantRepositoryInterface.php +++ b/src/Repository/ProductVariantRepositoryInterface.php @@ -1,10 +1,11 @@ $productVariant->getCode(), - ] + ], ); } private function getCurrentProductVariantQuantityFromCart( OrderInterface $cart, - ProductVariantInterface $productVariant + ProductVariantInterface $productVariant, ): int { /** @var OrderItemInterface $item */ foreach ($cart->getItems() as $item) { diff --git a/src/Validator/HasExistingCart.php b/src/Validator/HasExistingCart.php index 0c5b48f6..13b2721e 100644 --- a/src/Validator/HasExistingCart.php +++ b/src/Validator/HasExistingCart.php @@ -1,9 +1,10 @@ getTokenValue()), [], [], - $this->authHeaders + $this->authHeaders, ); $response = $this->client->getResponse(); diff --git a/tests/Api/Admin/ProductBundleTest.php b/tests/Api/Admin/ProductBundleTest.php index c41f5255..9e919019 100644 --- a/tests/Api/Admin/ProductBundleTest.php +++ b/tests/Api/Admin/ProductBundleTest.php @@ -1,9 +1,10 @@ authHeaders + $this->authHeaders, ); $response = $this->client->getResponse(); @@ -62,7 +63,7 @@ public function it_gets_product_bundle(): void sprintf(self::ENDPOINT_PRODUCT_BUNDLES_ITEM, $productBundleId->getId()), [], [], - $this->authHeaders + $this->authHeaders, ); $response = $this->client->getResponse(); @@ -88,7 +89,7 @@ public function it_creates_product_bundle(): void $johnnyWalkerBlue, ], 'isPacked' => true, - ], \JSON_THROW_ON_ERROR) + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -106,7 +107,7 @@ public function it_updates_product_bundle(): void sprintf(self::ENDPOINT_PRODUCT_BUNDLES_ITEM, $productBundle->getId()), [], [], - $this->authHeaders + $this->authHeaders, ); /** @var string $baseResponseContent */ $baseResponseContent = $this->client->getResponse()->getContent(); @@ -128,7 +129,7 @@ public function it_updates_product_bundle(): void $johnnyWalkerGold, ], 'isPacked' => false, - ], \JSON_THROW_ON_ERROR) + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -164,7 +165,7 @@ public function it_deletes_product_bundle(): void sprintf(self::ENDPOINT_PRODUCT_BUNDLES_ITEM, $productBundle->getId()), [], [], - $this->authHeaders + $this->authHeaders, ); $response = $this->client->getResponse(); @@ -175,7 +176,7 @@ public function it_deletes_product_bundle(): void sprintf(self::ENDPOINT_PRODUCT_BUNDLES_ITEM, $productBundle->getId()), [], [], - $this->authHeaders + $this->authHeaders, ); $response = $this->client->getResponse(); diff --git a/tests/Api/AdminJsonApiTestCase.php b/tests/Api/AdminJsonApiTestCase.php index 3a9632af..bfd933b0 100644 --- a/tests/Api/AdminJsonApiTestCase.php +++ b/tests/Api/AdminJsonApiTestCase.php @@ -1,26 +1,37 @@ =')) { + $endpoint = '/api/v2/admin/administrators/token'; + } else { + $endpoint = '/api/v2/admin/authentication-token'; + } + $this->client->request( 'POST', - '/api/v2/admin/authentication-token', + $endpoint, [], [], ['CONTENT_TYPE' => 'application/json', 'HTTP_ACCEPT' => 'application/json'], - json_encode(['email' => $email, 'password' => $password]) + json_encode(['email' => $email, 'password' => $password]), ); return json_decode($this->client->getResponse()->getContent(), true)['token']; diff --git a/tests/Api/JsonApiTestCase.php b/tests/Api/JsonApiTestCase.php index 542e309e..efa17536 100644 --- a/tests/Api/JsonApiTestCase.php +++ b/tests/Api/JsonApiTestCase.php @@ -1,9 +1,10 @@ getTokenValue()), [], [], - self::DEFAULT_HEADER + self::DEFAULT_HEADER, ); $response = $this->client->getResponse(); @@ -73,7 +74,7 @@ public function it_adds_product_bundle_to_a_cart(): void self::PATCH_HEADER, json_encode([ 'productCode' => $productBundle->getProduct()->getCode(), - ], \JSON_THROW_ON_ERROR) + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); diff --git a/tests/Api/Shop/ProductTest.php b/tests/Api/Shop/ProductTest.php index 6f4f0405..36544c18 100644 --- a/tests/Api/Shop/ProductTest.php +++ b/tests/Api/Shop/ProductTest.php @@ -1,9 +1,10 @@ client->getResponse(); @@ -48,7 +49,7 @@ public function it_gets_not_bundled_product(): void sprintf(self::ENDPOINT_PRODUCTS_ITEM, 'JOHNNY_WALKER_BLACK'), [], [], - self::DEFAULT_HEADER + self::DEFAULT_HEADER, ); $response = $this->client->getResponse(); @@ -63,7 +64,7 @@ public function it_gets_product_bundle_as_a_subresource(): void sprintf(self::ENDPOINT_PRODUCTS_ITEM_PRODUCT_BUNDLE, 'WHISKEY_DOUBLE_PACK'), [], [], - self::DEFAULT_HEADER + self::DEFAULT_HEADER, ); $response = $this->client->getResponse(); diff --git a/tests/Api/Utils/CartHelperTrait.php b/tests/Api/Utils/CartHelperTrait.php index 51f826f7..af98d278 100644 --- a/tests/Api/Utils/CartHelperTrait.php +++ b/tests/Api/Utils/CartHelperTrait.php @@ -1,9 +1,10 @@ ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.11/packages/_sylius.yaml b/tests/Application/config/sylius/1.11/packages/_sylius.yaml deleted file mode 100644 index cd01aaf7..00000000 --- a/tests/Application/config/sylius/1.11/packages/_sylius.yaml +++ /dev/null @@ -1,2 +0,0 @@ -sylius_api: - enabled: true diff --git a/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml deleted file mode 100644 index f4380780..00000000 --- a/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - disable_delivery: true diff --git a/tests/Application/config/sylius/1.11/packages/security.yaml b/tests/Application/config/sylius/1.11/packages/security.yaml deleted file mode 100644 index 51a6ec9a..00000000 --- a/tests/Application/config/sylius/1.11/packages/security.yaml +++ /dev/null @@ -1,142 +0,0 @@ -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 - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - - encoders: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - anonymous: true - - new_api_admin_user: - pattern: "%sylius.security.new_api_admin_regex%/.*" - provider: sylius_api_admin_user_provider - stateless: true - anonymous: true - 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 - - new_api_shop_user: - pattern: "%sylius.security.new_api_shop_regex%/.*" - provider: sylius_api_shop_user_provider - stateless: true - anonymous: true - 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 - - shop: - switch_user: { role: ROLE_ALLOWED_TO_SWITCH } - context: shop - pattern: "%sylius.security.shop_regex%" - provider: sylius_shop_user_provider - form_login: - success_handler: sylius.authentication.success_handler - failure_handler: sylius.authentication.failure_handler - provider: sylius_shop_user_provider - login_path: sylius_shop_login - check_path: sylius_shop_login_check - failure_path: sylius_shop_login - default_target_path: sylius_shop_homepage - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_login - invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - image_resolver: - pattern: ^/media/cache/resolve - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { 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_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 } diff --git a/tests/Application/config/sylius/1.11/packages/staging/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/staging/swiftmailer.yaml deleted file mode 100644 index f4380780..00000000 --- a/tests/Application/config/sylius/1.11/packages/staging/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - disable_delivery: true diff --git a/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml deleted file mode 100644 index 3bab0d32..00000000 --- a/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - url: '%env(MAILER_URL)%' diff --git a/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml deleted file mode 100644 index c438f4b2..00000000 --- a/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swiftmailer: - disable_delivery: true - logging: true - spool: - type: file - path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml deleted file mode 100644 index c438f4b2..00000000 --- a/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swiftmailer: - disable_delivery: true - logging: true - spool: - type: file - path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/config/sylius/1.12/bundles.php b/tests/Application/config/sylius/1.12/bundles.php index 5f922a2d..a09c9152 100644 --- a/tests/Application/config/sylius/1.12/bundles.php +++ b/tests/Application/config/sylius/1.12/bundles.php @@ -1,5 +1,12 @@ ['all' => true], + Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class => ['all' => true], +]; diff --git a/tests/Application/config/sylius/1.13/packages/_sylius.yaml b/tests/Application/config/sylius/1.13/packages/_sylius.yaml new file mode 100644 index 00000000..259552d0 --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/_sylius.yaml @@ -0,0 +1,7 @@ +parameters: + test_default_state_machine_adapter: 'symfony_workflow' + test_sylius_state_machine_adapter: '%env(string:default:test_default_state_machine_adapter:TEST_SYLIUS_STATE_MACHINE_ADAPTER)%' + +sylius_state_machine_abstraction: + graphs_to_adapters_mapping: + sylius_refund_refund_payment: '%test_sylius_state_machine_adapter%' diff --git a/tests/Application/config/sylius/1.13/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.13/packages/jms_serializer.yaml new file mode 100644 index 00000000..ed7bc613 --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/jms_serializer.yaml @@ -0,0 +1,4 @@ +jms_serializer: + visitors: + xml_serialization: + format_output: '%kernel.debug%' diff --git a/tests/Application/config/sylius/1.13/packages/security.yaml b/tests/Application/config/sylius/1.13/packages/security.yaml new file mode 100644 index 00000000..7458c77a --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/security.yaml @@ -0,0 +1,124 @@ +security: + enable_authenticator_manager: true + providers: + sylius_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_api_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + sylius_api_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + + password_hashers: + Sylius\Component\User\Model\UserInterface: argon2i + firewalls: + admin: + switch_user: true + context: admin + pattern: "%sylius.security.admin_regex%" + provider: sylius_admin_user_provider + form_login: + provider: sylius_admin_user_provider + login_path: sylius_admin_login + check_path: sylius_admin_login_check + failure_path: sylius_admin_login + default_target_path: sylius_admin_dashboard + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_admin_security_token + csrf_token_id: admin_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + path: "/%sylius_admin.path_name%" + name: APP_ADMIN_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_admin_logout + target: sylius_admin_login + + new_api_admin_user: + pattern: "%sylius.security.new_api_admin_regex%/.*" + provider: sylius_api_admin_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_admin_route%/administrators/token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + new_api_shop_user: + pattern: "%sylius.security.new_api_shop_regex%/.*" + provider: sylius_api_shop_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_shop_route%/customers/token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + shop: + switch_user: { role: ROLE_ALLOWED_TO_SWITCH } + context: shop + pattern: "%sylius.security.shop_regex%" + provider: sylius_shop_user_provider + form_login: + success_handler: sylius.authentication.success_handler + failure_handler: sylius.authentication.failure_handler + provider: sylius_shop_user_provider + login_path: sylius_shop_login + check_path: sylius_shop_login_check + failure_path: sylius_shop_login + default_target_path: sylius_shop_homepage + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_shop_security_token + csrf_token_id: shop_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + name: APP_SHOP_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_shop_logout + target: sylius_shop_homepage + invalidate_session: false + + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + image_resolver: + pattern: ^/media/cache/resolve + security: false + + access_control: + - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } + - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } + + - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } + - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } + + - { path: "%sylius.security.new_api_admin_route%/administrators/reset-password", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } + - { path: "%sylius.security.new_api_admin_route%/administrators/token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } + - { path: "%sylius.security.new_api_shop_route%/customers/token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/sylius/1.13/packages/test/mailer.yaml b/tests/Application/config/sylius/1.13/packages/test/mailer.yaml new file mode 100644 index 00000000..56cc28f9 --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/test/mailer.yaml @@ -0,0 +1,7 @@ +framework: + mailer: + dsn: 'null://null' + cache: + pools: + test.mailer_pool: + adapter: cache.adapter.filesystem diff --git a/tests/Application/package.json.~1.11.0.dist b/tests/Application/package.json.~1.13.0.dist similarity index 73% rename from tests/Application/package.json.~1.11.0.dist rename to tests/Application/package.json.~1.13.0.dist index 36e6c1f0..16de6eea 100644 --- a/tests/Application/package.json.~1.11.0.dist +++ b/tests/Application/package.json.~1.13.0.dist @@ -1,12 +1,12 @@ { "dependencies": { - "@babel/polyfill": "^7.0.0", - "chart.js": "^3.7.1", - "jquery": "^3.5.0", + "babel-polyfill": "^6.26.0", + "jquery": "^3.4.0", "jquery.dirtyforms": "^2.0.0", "lightbox2": "^2.9.0", "semantic-ui-css": "^2.2.0", - "slick-carousel": "^1.8.1" + "slick-carousel": "^1.8.1", + "chart.js": "^3.7.1" }, "devDependencies": { "@symfony/webpack-encore": "^1.6.1", @@ -21,14 +21,17 @@ "eslint-config-airbnb-base": "^12.1.0", "eslint-import-resolver-babel-module": "^4.0.0", "eslint-plugin-import": "^2.11.0", + "fast-async": "^6.3.7", "merge-stream": "^1.0.0", - "sass": "^1.39.2", - "sass-loader": "^12.1.0" + "sass": "^1.50.0", + "sass-loader": "^7.0.1", + "upath": "^1.1.0", + "webpack": "^5.76.1", + "yargs": "^6.4.0" }, "scripts": { - "dev": "yarn encore dev", - "watch": "yarn encore dev --watch", - "prod": "yarn encore prod", + "build": "encore production", + "dev": "encore dev", "lint": "yarn lint:js", "lint:js": "eslint gulpfile.babel.js" }, diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php index 5207258d..386fe986 100644 --- a/tests/Application/public/index.php +++ b/tests/Application/public/index.php @@ -1,5 +1,12 @@ createProduct($productBundleName, $firstProductName, $secondProductName, $productBundlePrice); $this->saveProduct($product); @@ -101,7 +102,7 @@ private function createProduct( string $productBundleName, string $firstProductName, string $secondProductName, - int $productBundlePrice + int $productBundlePrice, ): ProductInterface { /** @var ProductInterface $product */ $product = $this->productFactory->createWithVariantAndBundle(); diff --git a/tests/Behat/Context/Ui/ProductBundleContext.php b/tests/Behat/Context/Ui/ProductBundleContext.php index 85f4429d..43058dc5 100644 --- a/tests/Behat/Context/Ui/ProductBundleContext.php +++ b/tests/Behat/Context/Ui/ProductBundleContext.php @@ -1,10 +1,11 @@ expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - sprintf(TypeExceptionMessage::EXPECTED_INSTANCE_OF_X_GOT_Y, AddProductBundleToCartDto::class, \stdClass::class) + sprintf(TypeExceptionMessage::EXPECTED_INSTANCE_OF_X_GOT_Y, AddProductBundleToCartDto::class, \stdClass::class), ); $object = new \stdClass(); diff --git a/tests/Unit/Factory/AddProductBundleItemToCartCommandFactoryTest.php b/tests/Unit/Factory/AddProductBundleItemToCartCommandFactoryTest.php index 211cf9af..2a3f0764 100644 --- a/tests/Unit/Factory/AddProductBundleItemToCartCommandFactoryTest.php +++ b/tests/Unit/Factory/AddProductBundleItemToCartCommandFactoryTest.php @@ -1,9 +1,10 @@ addProductBundleItemToCartCommandFactory = $this->createMock( - AddProductBundleItemToCartCommandFactoryInterface::class + AddProductBundleItemToCartCommandFactoryInterface::class, ); } diff --git a/tests/Unit/Factory/OrderItemFactoryTest.php b/tests/Unit/Factory/OrderItemFactoryTest.php index 7dc5bf6a..fa59b149 100644 --- a/tests/Unit/Factory/OrderItemFactoryTest.php +++ b/tests/Unit/Factory/OrderItemFactoryTest.php @@ -1,9 +1,10 @@ orderItemQuantityModifier, $this->productBundleOrderItemFactory, $this->orderModifier, - $this->cartItemFactory + $this->cartItemFactory, ); } diff --git a/tests/Unit/Handler/AddProductBundleToCartHandlerTest.php b/tests/Unit/Handler/AddProductBundleToCartHandlerTest.php index 60bbbf5b..922efa27 100644 --- a/tests/Unit/Handler/AddProductBundleToCartHandlerTest.php +++ b/tests/Unit/Handler/AddProductBundleToCartHandlerTest.php @@ -1,9 +1,10 @@ expectException(InvalidArgumentException::class); $this->expectExceptionMessage($exceptionMessage); @@ -157,7 +158,7 @@ private function createHandler(): AddProductBundleToCartHandler return new AddProductBundleToCartHandler( $this->orderRepository, $this->productRepository, - $this->cartProcessor + $this->cartProcessor, ); } } diff --git a/tests/Unit/MotherObject/AddProductBundleItemToCartCommandMother.php b/tests/Unit/MotherObject/AddProductBundleItemToCartCommandMother.php index 3e8ba122..6912c547 100644 --- a/tests/Unit/MotherObject/AddProductBundleItemToCartCommandMother.php +++ b/tests/Unit/MotherObject/AddProductBundleItemToCartCommandMother.php @@ -1,9 +1,10 @@ productRepository->method('findOneByCode') ->with(self::PRODUCT_CODE) @@ -142,7 +143,7 @@ private function getProductQuantityExceedsStockCaseData(): array $product = ProductMother::createWithChannelAndProductVariantAndCode( $channel, $productVariant, - self::PRODUCT_CODE + self::PRODUCT_CODE, ); $cart = OrderMother::createWithChannel($channel); @@ -160,7 +161,7 @@ protected function createValidator(): HasAvailableProductBundleValidator return new HasAvailableProductBundleValidator( $this->productRepository, $this->orderRepository, - $this->availabilityChecker + $this->availabilityChecker, ); } } diff --git a/tests/Unit/Validator/HasExistingCartValidatorTest.php b/tests/Unit/Validator/HasExistingCartValidatorTest.php index f8b951d8..3d62cfe6 100644 --- a/tests/Unit/Validator/HasExistingCartValidatorTest.php +++ b/tests/Unit/Validator/HasExistingCartValidatorTest.php @@ -1,9 +1,10 @@