diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2b259d6..79ca7ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,16 +21,12 @@ jobs: strategy: fail-fast: false matrix: - php: [8.0 ] - symfony: [^5.4, ^6.0] - sylius: [~1.11.0, ~1.12.0] - node: [14.19] - mysql: [5.7, 8.0] + php: ["8.1", "8.2", "8.3"] + symfony: ["^5.4", "^6.0"] + sylius: ["~1.12.0", "~1.13.0"] + node: ["18.x", "20.x"] + mysql: ["5.7", "8.0"] - exclude: - - - sylius: ~1.11.0 - symfony: ^6.0 env: APP_ENV: test @@ -38,7 +34,7 @@ jobs: steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP @@ -51,7 +47,7 @@ jobs: - name: Setup Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: "${{ matrix.node }}" @@ -89,7 +85,7 @@ jobs: - name: Cache Composer - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} @@ -114,7 +110,7 @@ jobs: - name: Get Yarn cache directory id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Cache Yarn @@ -154,6 +150,10 @@ jobs: name: Validate database schema run: (cd tests/Application && bin/console doctrine:schema:validate) + - + name: Run ECS + run: vendor/bin/ecs check src + - name: Run PHPStan run: vendor/bin/phpstan analyse -c phpstan.neon -l 7 src/ @@ -166,20 +166,20 @@ jobs: - name: Run Behat env: - MAIL_CHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_TOKEN }} - MAIL_CHIMP_LIST_ID: ${{ secrets.MAIL_CHIMP_LIST_ID }} + MAIL_CHIMP_API_KEY: "mailchimp-api-key" + MAIL_CHIMP_LIST_ID: "mailchimp-list-id" MAIL_CHIMP_WEBHOOK_SECRET: ${{ secrets.MAIL_CHIMP_WEBHOOK_SECRET }} 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@v3 if: failure() with: name: Behat logs path: etc/build/ if-no-files-found: ignore - + - name: Failed build Slack notification uses: rtCamp/action-slack-notify@v2 diff --git a/composer.json b/composer.json index 7c2da85..7787e2f 100644 --- a/composer.json +++ b/composer.json @@ -5,15 +5,15 @@ "description": "MailChimp plugin for Sylius.", "license": "MIT", "require": { - "php": " ^8.0", - "sylius/sylius": "~1.11.0 || ~1.12.0", - "drewm/mailchimp-api": "^v2.5.4", + "php": " ^8.1", + "sylius/sylius": "~1.12.0 || ~1.13.0", + "drewm/mailchimp-api": "^2.5.4", "ext-json": "*", "symfony/webpack-encore-bundle": "^1.16" }, "require-dev": { - "behat/behat": "^3.6.1", - "behat/mink-selenium2-driver": "^1.4", + "behat/behat": "^3.7", + "behat/mink-selenium2-driver": "~1.6.0", "dmore/behat-chrome-extension": "^1.3", "dmore/chrome-mink-driver": "^2.7", "friends-of-behat/mink": "^1.8", @@ -39,8 +39,8 @@ "bitbag/coding-standard": "^1.0.0 || ^2.0.0" }, "conflict": { - "doctrine/orm": ">=2.15.2" - }, + "doctrine/orm": ">=2.15.2" + }, "prefer-stable": true, "autoload": { "psr-4": { diff --git a/doc/installation.md b/doc/installation.md index 1702b1a..9508a37 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -105,7 +105,7 @@ Add these javascripts to the layout template that includes your subscription for Clear project cache: ```php -bin/console cache:clear +bin/console cache:clear # if there is an issue with translations displaying correctly, clear the cache again. ``` Update your webpack build: diff --git a/ecs.php b/ecs.php index 9fe162b..abcfbcf 100644 --- a/ecs.php +++ b/ecs.php @@ -2,8 +2,12 @@ declare(strict_types=1); -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; +use Symplify\EasyCodingStandard\Config\ECSConfig; -return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php'); +return static function (ECSConfig $config): void { + + putenv('ALLOW_BITBAG_OS_HEADER=1'); + + $config->import('vendor/bitbag/coding-standard/ecs.php'); + $config->paths(['src', 'tests']); }; diff --git a/src/Controller/MailchimpController.php b/src/Controller/MailchimpController.php index 10f3e3b..82be373 100644 --- a/src/Controller/MailchimpController.php +++ b/src/Controller/MailchimpController.php @@ -31,8 +31,8 @@ final class MailchimpController public function __construct( WebhookValidator $validator, NewsletterSubscriptionInterface $handler, - TranslatorInterface $translator - ) { + TranslatorInterface $translator, + ) { $this->validator = $validator; $this->handler = $handler; $this->translator = $translator; @@ -43,7 +43,7 @@ public function webhookAction(Request $request): JsonResponse $webhookData = WebhookData::createFromRequest($request); $errors = $this->validateRequest($webhookData, $request); - if (count($errors) === 0) { + if (0 === count($errors)) { $this->handler->unsubscribeCustomerFromLocalDatabase($webhookData->getData()['email']); return new JsonResponse([ diff --git a/src/Controller/NewsletterController.php b/src/Controller/NewsletterController.php index bfe5343..dbc13e5 100644 --- a/src/Controller/NewsletterController.php +++ b/src/Controller/NewsletterController.php @@ -38,8 +38,8 @@ public function __construct( NewsletterValidator $validator, TranslatorInterface $translator, NewsletterSubscriptionInterface $handler, - CsrfTokenManager $tokenManager - ) { + CsrfTokenManager $tokenManager, + ) { $this->validator = $validator; $this->translator = $translator; $this->handler = $handler; @@ -65,7 +65,7 @@ public function subscribeAction(Request $request): JsonResponse $errors[] = $this->translator->trans('bitbag_sylius_mailchimp_plugin.ui.invalid_csrf_token'); } - if (count($errors) === 0) { + if (0 === count($errors)) { $this->handler->subscribe($email); return new JsonResponse([ diff --git a/src/EventListener/CustomerNewsletterListener.php b/src/EventListener/CustomerNewsletterListener.php index f559f0c..ce52075 100644 --- a/src/EventListener/CustomerNewsletterListener.php +++ b/src/EventListener/CustomerNewsletterListener.php @@ -39,11 +39,11 @@ public function customerCreateEvent(GenericEvent $event): void if (!$customer instanceof CustomerInterface) { throw new UnexpectedTypeException( $customer, - CustomerInterface::class + CustomerInterface::class, ); } - $customer->isSubscribedToNewsletter() === false ? $this->unsubscribe($customer) : $this->subscribe($customer); + false === $customer->isSubscribedToNewsletter() ? $this->unsubscribe($customer) : $this->subscribe($customer); } public function customerPostUpdateEvent(GenericEvent $event): void @@ -62,7 +62,7 @@ public function customerPreUpdateEvent(GenericEvent $event): void if (!$customer instanceof CustomerInterface) { throw new UnexpectedTypeException( $customer, - CustomerInterface::class + CustomerInterface::class, ); } diff --git a/src/Handler/NewsletterSubscriptionHandler.php b/src/Handler/NewsletterSubscriptionHandler.php index 394cec1..352ea11 100644 --- a/src/Handler/NewsletterSubscriptionHandler.php +++ b/src/Handler/NewsletterSubscriptionHandler.php @@ -46,8 +46,8 @@ public function __construct( FactoryInterface $customerFactory, EntityManagerInterface $customerManager, MailChimp $mailChimp, - string $listId - ) { + string $listId, + ) { $this->customerRepository = $customerRepository; $this->customerFactory = $customerFactory; $this->customerManager = $customerManager; @@ -128,14 +128,14 @@ private function exportNewEmail(string $email): void throw new BadRequestHttpException( sprintf( 'Mailchimp returned false instead of response array, last error : %s', - $this->mailChimp->getLastError() - ) + $this->mailChimp->getLastError(), + ), ); } Assert::keyExists($response, 'status'); - if ($response['status'] === Response::HTTP_NOT_FOUND) { + if (Response::HTTP_NOT_FOUND === $response['status']) { $validListIds = $this->getValidMailchimpListIds(); $concatenatedList = implode(',', $validListIds); @@ -144,13 +144,13 @@ private function exportNewEmail(string $email): void 'Mailchimp returned %1$d code, is the MAIL_CHIMP_LIST_ID [ %2$s ] one of available ones: [ %3$s ] ?', Response::HTTP_NOT_FOUND, $this->listId, - $concatenatedList - ) + $concatenatedList, + ), ); } - if ($response['status'] !== 'subscribed') { + if ('subscribed' !== $response['status']) { throw new BadRequestHttpException( - sprintf('Response status is %s instead of %s', $response['status'], 'subscribed') + sprintf('Response status is %s instead of %s', $response['status'], 'subscribed'), ); } } @@ -174,8 +174,8 @@ protected function addMailchimpData(string $email): void throw new BadRequestHttpException( sprintf( 'Mailchimp returned false instead of response array, last error : %s', - $this->mailChimp->getLastError() - ) + $this->mailChimp->getLastError(), + ), ); } diff --git a/src/Model/WebhookData.php b/src/Model/WebhookData.php index 27e477d..f10b649 100644 --- a/src/Model/WebhookData.php +++ b/src/Model/WebhookData.php @@ -41,8 +41,8 @@ final class WebhookData public function __construct( string $type, string $firedAt, - array $data - ) { + array $data, + ) { $this->type = $type; $this->firedAt = $firedAt; $this->data = $data; @@ -55,7 +55,7 @@ public static function createFromRequest(Request $request): self return new self( $request->get('type', self::TYPE_UNSUBSCRIBE), $request->get('fired_at', $dateString), - $request->get('data', []) + $request->get('data', []), ); } diff --git a/src/Validator/Constraints/UniqueNewsletterEmailValidator.php b/src/Validator/Constraints/UniqueNewsletterEmailValidator.php index 7d2c2e9..4e30c27 100644 --- a/src/Validator/Constraints/UniqueNewsletterEmailValidator.php +++ b/src/Validator/Constraints/UniqueNewsletterEmailValidator.php @@ -34,7 +34,7 @@ public function validate($value, Constraint $constraint): void { Assert::isInstanceOf($constraint, UniqueNewsletterEmail::class); - if ($this->isEmailValid($value) === false) { + if (false === $this->isEmailValid($value)) { $this->context->addViolation($constraint->message); } } @@ -43,11 +43,11 @@ private function isEmailValid(?string $email): bool { $customer = $this->customerRepository->findOneBy(['email' => $email]); - if ($customer instanceof CustomerInterface === false) { + if (false === $customer instanceof CustomerInterface) { return true; } - if ($customer->isSubscribedToNewsletter() === true) { + if (true === $customer->isSubscribedToNewsletter()) { return false; } diff --git a/src/Validator/NewsletterValidator.php b/src/Validator/NewsletterValidator.php index f108aa3..d11bebd 100644 --- a/src/Validator/NewsletterValidator.php +++ b/src/Validator/NewsletterValidator.php @@ -36,7 +36,7 @@ public function validate(?string $email): array $errors = []; - if (count($violations) === 0) { + if (0 === count($violations)) { return $errors; } diff --git a/src/Validator/WebhookValidator.php b/src/Validator/WebhookValidator.php index 98fb4c3..24e0c87 100644 --- a/src/Validator/WebhookValidator.php +++ b/src/Validator/WebhookValidator.php @@ -29,8 +29,11 @@ final class WebhookValidator /** @var string */ private $webhookSecret; - public function __construct(ValidatorInterface $validator, string $listId, string $webhookSecret) - { + public function __construct( + ValidatorInterface $validator, + string $listId, + string $webhookSecret + ) { $this->validator = $validator; $this->listId = $listId; $this->webhookSecret = $webhookSecret; @@ -66,7 +69,7 @@ public function validate(WebhookData $webhookData): array $errors = []; - if (count($violations) === 0) { + if (0 === count($violations)) { return $errors; } diff --git a/tests/Application/.env.test b/tests/Application/.env.test new file mode 100644 index 0000000..9db5577 --- /dev/null +++ b/tests/Application/.env.test @@ -0,0 +1,11 @@ +APP_ENV=test +APP_SECRET='ch4mb3r0f5ecr3ts' + +DATABASE_URL=sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db + +JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem +JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem +JWT_PASSPHRASE=acme_plugin_development + +MAIL_CHIMP_API_KEY="mailchimp-api-key" +MAIL_CHIMP_LIST_ID="mailchimp-list-id" diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index bae5d11..8c4f575 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -61,5 +61,9 @@ Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], - Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true] + Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], + Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], + League\FlysystemBundle\FlysystemBundle::class => ['all' => true], + BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], + SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/sylius/1.11/bundles.php b/tests/Application/config/sylius/1.11/bundles.php deleted file mode 100644 index d216ac1..0000000 --- a/tests/Application/config/sylius/1.11/bundles.php +++ /dev/null @@ -1,16 +0,0 @@ - ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], - Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => 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 f438078..0000000 --- a/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - disable_delivery: true diff --git a/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml deleted file mode 100644 index ed7bc61..0000000 --- a/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -jms_serializer: - visitors: - xml_serialization: - format_output: '%kernel.debug%' diff --git a/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml deleted file mode 100644 index 3bab0d3..0000000 --- a/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - url: '%env(MAILER_URL)%' diff --git a/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml deleted file mode 100644 index c438f4b..0000000 --- a/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swiftmailer: - disable_delivery: true - logging: true - spool: - type: file - path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml deleted file mode 100644 index c438f4b..0000000 --- a/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swiftmailer: - disable_delivery: true - logging: true - spool: - type: file - path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/config/sylius/1.12/bundles.php b/tests/Application/config/sylius/1.13/bundles.php similarity index 51% rename from tests/Application/config/sylius/1.12/bundles.php rename to tests/Application/config/sylius/1.13/bundles.php index c157876..fe08cf1 100644 --- a/tests/Application/config/sylius/1.12/bundles.php +++ b/tests/Application/config/sylius/1.13/bundles.php @@ -9,8 +9,5 @@ declare(strict_types=1); return [ - BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], - League\FlysystemBundle\FlysystemBundle::class => ['all' => true], + Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/sylius/1.11/packages/dev/jms_serializer.yaml b/tests/Application/config/sylius/1.13/packages/dev/jms_serializer.yaml similarity index 100% rename from tests/Application/config/sylius/1.11/packages/dev/jms_serializer.yaml rename to tests/Application/config/sylius/1.13/packages/dev/jms_serializer.yaml diff --git a/tests/Application/config/sylius/1.11/packages/prod/jms_serializer.yaml b/tests/Application/config/sylius/1.13/packages/prod/jms_serializer.yaml similarity index 100% rename from tests/Application/config/sylius/1.11/packages/prod/jms_serializer.yaml rename to tests/Application/config/sylius/1.13/packages/prod/jms_serializer.yaml diff --git a/tests/Application/config/sylius/1.11/packages/security.yaml b/tests/Application/config/sylius/1.13/packages/security.yaml similarity index 57% rename from tests/Application/config/sylius/1.11/packages/security.yaml rename to tests/Application/config/sylius/1.13/packages/security.yaml index b2e0632..7458c77 100644 --- a/tests/Application/config/sylius/1.11/packages/security.yaml +++ b/tests/Application/config/sylius/1.13/packages/security.yaml @@ -1,11 +1,5 @@ -parameters: - sylius.security.admin_regex: "^/admin" - sylius.security.shop_regex: "^/(?!admin|new-api|api/.*|api$|media/.*)[^/]++" - sylius.security.new_api_route: "/api/v2" - sylius.security.new_api_regex: "^%sylius.security.new_api_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 @@ -15,11 +9,8 @@ security: id: sylius.shop_user_provider.email_or_name_based sylius_api_shop_user_provider: id: sylius.shop_user_provider.email_or_name_based - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - encoders: + password_hashers: Sylius\Component\User\Model\UserInterface: argon2i firewalls: admin: @@ -35,58 +26,44 @@ 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: secret: "%env(APP_SECRET)%" - path: /admin + path: "/%sylius_admin.path_name%" name: APP_ADMIN_REMEMBER_ME lifetime: 31536000 remember_me_parameter: _remember_me logout: path: sylius_admin_logout target: sylius_admin_login - anonymous: true new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider + 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_route%/admin-user-authentication-token" + 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 - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator + jwt: true new_api_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider + 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_route%/shop-user-authentication-token" + 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 - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api: - pattern: "%sylius.security.new_api_regex%/*" - provider: sylius_api_chain_provider - stateless: true - anonymous: lazy - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator + jwt: true shop: switch_user: { role: ROLE_ALLOWED_TO_SWITCH } @@ -103,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: @@ -113,26 +90,35 @@ 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)/ + 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: 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%/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%/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 0000000..56cc28f --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/test/mailer.yaml @@ -0,0 +1,7 @@ +framework: + mailer: + dsn: 'null://null' + cache: + pools: + test.mailer_pool: + adapter: cache.adapter.filesystem diff --git a/tests/Application/config/sylius/1.11/packages/test/security.yaml b/tests/Application/config/sylius/1.13/packages/test/security.yaml similarity index 60% rename from tests/Application/config/sylius/1.11/packages/test/security.yaml rename to tests/Application/config/sylius/1.13/packages/test/security.yaml index 21cc377..8ccd542 100644 --- a/tests/Application/config/sylius/1.11/packages/test/security.yaml +++ b/tests/Application/config/sylius/1.13/packages/test/security.yaml @@ -1,3 +1,3 @@ security: - encoders: + password_hashers: sha512: sha512 diff --git a/tests/Behat/Context/Ui/Shop/MailChimpContext.php b/tests/Behat/Context/Ui/Shop/MailChimpContext.php index a4ac1a6..36ab382 100644 --- a/tests/Behat/Context/Ui/Shop/MailChimpContext.php +++ b/tests/Behat/Context/Ui/Shop/MailChimpContext.php @@ -1,5 +1,11 @@ sharedStorage = $sharedStorage; $this->mailChimp = new AlwaysSuccessMailChimpClient($apiKey); $this->listId = $listId; diff --git a/tests/Behat/Context/Ui/Shop/NewsletterContext.php b/tests/Behat/Context/Ui/Shop/NewsletterContext.php index 0150ce0..5a001f6 100644 --- a/tests/Behat/Context/Ui/Shop/NewsletterContext.php +++ b/tests/Behat/Context/Ui/Shop/NewsletterContext.php @@ -1,5 +1,11 @@ 'subscribed']; } - public function get($method, $args = [], $timeout = self::TIMEOUT) - { + public function get( + $method, + $args = [], + $timeout = self::TIMEOUT + ) { return ['status' => 'subscribed']; } + + public function getLastError(): bool + { + return false; + } } diff --git a/tests/Behat/Page/Shop/NewsletterPage.php b/tests/Behat/Page/Shop/NewsletterPage.php index ad54a31..7ec0d9f 100644 --- a/tests/Behat/Page/Shop/NewsletterPage.php +++ b/tests/Behat/Page/Shop/NewsletterPage.php @@ -1,5 +1,11 @@