From 877a733af25aadd2bf3e9510db338f9c4dde99d2 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 13:34:22 +0200 Subject: [PATCH 01/30] Remove old config files --- .../config/packages/dev/swiftmailer.yaml | 2 - .../config/packages/staging/swiftmailer.yaml | 2 - .../config/packages/swiftmailer.yaml | 2 - .../config/packages/test/swiftmailer.yaml | 6 - .../packages/test_cached/swiftmailer.yaml | 6 - .../config/sylius/1.10/bundles.php | 8 - .../1.10/packages/dev/jms_serializer.yaml | 12 -- .../sylius/1.10/packages/jms_serializer.yaml | 4 - .../1.10/packages/prod/jms_serializer.yaml | 10 -- .../config/sylius/1.10/packages/security.yaml | 148 ---------------- .../config/sylius/1.11/bundles.php | 9 - .../1.11/packages/dev/jms_serializer.yaml | 12 -- .../sylius/1.11/packages/jms_serializer.yaml | 4 - .../1.11/packages/prod/jms_serializer.yaml | 10 -- .../config/sylius/1.11/packages/security.yaml | 148 ---------------- .../Application/config/sylius/1.8/bundles.php | 10 -- .../config/sylius/1.8/packages/_sylius.yaml | 2 - .../1.8/packages/dev/jms_serializer.yaml | 7 - .../sylius/1.8/packages/jms_serializer.yaml | 4 - .../1.8/packages/prod/jms_serializer.yaml | 6 - .../config/sylius/1.8/packages/security.yaml | 159 ------------------ .../config/sylius/1.8/routes/dev/twig.yaml | 3 - .../sylius/1.8/routes/sylius_admin_api.yaml | 3 - .../Application/config/sylius/1.9/bundles.php | 10 -- .../config/sylius/1.9/packages/_sylius.yaml | 2 - .../1.9/packages/dev/jms_serializer.yaml | 12 -- .../sylius/1.9/packages/jms_serializer.yaml | 4 - .../1.9/packages/prod/jms_serializer.yaml | 10 -- .../config/sylius/1.9/packages/security.yaml | 159 ------------------ .../sylius/1.9/routes/sylius_admin_api.yaml | 3 - .../symfony/4.4/packages/framework.yaml | 2 - .../Application/public/media/image/.gitignore | 0 32 files changed, 779 deletions(-) delete mode 100644 tests/Application/config/packages/dev/swiftmailer.yaml delete mode 100644 tests/Application/config/packages/staging/swiftmailer.yaml delete mode 100644 tests/Application/config/packages/swiftmailer.yaml delete mode 100644 tests/Application/config/packages/test/swiftmailer.yaml delete mode 100644 tests/Application/config/packages/test_cached/swiftmailer.yaml delete mode 100644 tests/Application/config/sylius/1.10/bundles.php delete mode 100644 tests/Application/config/sylius/1.10/packages/dev/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.10/packages/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.10/packages/prod/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.10/packages/security.yaml delete mode 100644 tests/Application/config/sylius/1.11/bundles.php delete mode 100644 tests/Application/config/sylius/1.11/packages/dev/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/prod/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/security.yaml delete mode 100644 tests/Application/config/sylius/1.8/bundles.php delete mode 100644 tests/Application/config/sylius/1.8/packages/_sylius.yaml delete mode 100644 tests/Application/config/sylius/1.8/packages/dev/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.8/packages/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.8/packages/prod/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.8/packages/security.yaml delete mode 100644 tests/Application/config/sylius/1.8/routes/dev/twig.yaml delete mode 100644 tests/Application/config/sylius/1.8/routes/sylius_admin_api.yaml delete mode 100644 tests/Application/config/sylius/1.9/bundles.php delete mode 100644 tests/Application/config/sylius/1.9/packages/_sylius.yaml delete mode 100644 tests/Application/config/sylius/1.9/packages/dev/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.9/packages/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.9/packages/prod/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.9/packages/security.yaml delete mode 100644 tests/Application/config/sylius/1.9/routes/sylius_admin_api.yaml delete mode 100644 tests/Application/config/symfony/4.4/packages/framework.yaml delete mode 100644 tests/Application/public/media/image/.gitignore diff --git a/tests/Application/config/packages/dev/swiftmailer.yaml b/tests/Application/config/packages/dev/swiftmailer.yaml deleted file mode 100644 index 8ca953b..0000000 --- a/tests/Application/config/packages/dev/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - disable_delivery: false diff --git a/tests/Application/config/packages/staging/swiftmailer.yaml b/tests/Application/config/packages/staging/swiftmailer.yaml deleted file mode 100644 index f438078..0000000 --- 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 3bab0d3..0000000 --- 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/swiftmailer.yaml b/tests/Application/config/packages/test/swiftmailer.yaml deleted file mode 100644 index c438f4b..0000000 --- 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/swiftmailer.yaml b/tests/Application/config/packages/test_cached/swiftmailer.yaml deleted file mode 100644 index c438f4b..0000000 --- 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/sylius/1.10/bundles.php b/tests/Application/config/sylius/1.10/bundles.php deleted file mode 100644 index d50639f..0000000 --- a/tests/Application/config/sylius/1.10/bundles.php +++ /dev/null @@ -1,8 +0,0 @@ - ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.10/packages/dev/jms_serializer.yaml b/tests/Application/config/sylius/1.10/packages/dev/jms_serializer.yaml deleted file mode 100644 index 2f32a9b..0000000 --- a/tests/Application/config/sylius/1.10/packages/dev/jms_serializer.yaml +++ /dev/null @@ -1,12 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION - json_deserialization: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/sylius/1.10/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.10/packages/jms_serializer.yaml deleted file mode 100644 index ed7bc61..0000000 --- a/tests/Application/config/sylius/1.10/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.10/packages/prod/jms_serializer.yaml b/tests/Application/config/sylius/1.10/packages/prod/jms_serializer.yaml deleted file mode 100644 index c288182..0000000 --- a/tests/Application/config/sylius/1.10/packages/prod/jms_serializer.yaml +++ /dev/null @@ -1,10 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION - json_deserialization: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/sylius/1.10/packages/security.yaml b/tests/Application/config/sylius/1.10/packages/security.yaml deleted file mode 100644 index 1062810..0000000 --- a/tests/Application/config/sylius/1.10/packages/security.yaml +++ /dev/null @@ -1,148 +0,0 @@ -parameters: - sylius.security.admin_regex: "^/%sylius_admin.path_name%" - sylius.security.api_regex: "^/api" - sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|new-api|api/.*|api$|media/.*)[^/]++" - sylius.security.new_api_route: "/new-api" - sylius.security.new_api_regex: "^%sylius.security.new_api_route%" - sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin" - sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%" - sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop" - sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%" - -security: - always_authenticate_before_granting: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - - encoders: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - anonymous: true - - new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/admin-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/shop-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api: - pattern: "%sylius.security.new_api_regex%/*" - provider: sylius_api_chain_provider - stateless: true - anonymous: lazy - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - shop: - switch_user: { role: ROLE_ALLOWED_TO_SWITCH } - context: shop - pattern: "%sylius.security.shop_regex%" - provider: sylius_shop_user_provider - form_login: - success_handler: sylius.authentication.success_handler - failure_handler: sylius.authentication.failure_handler - provider: sylius_shop_user_provider - login_path: sylius_shop_login - check_path: sylius_shop_login_check - failure_path: sylius_shop_login - default_target_path: sylius_shop_homepage - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_login - invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.api_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/tests/Application/config/sylius/1.11/bundles.php b/tests/Application/config/sylius/1.11/bundles.php deleted file mode 100644 index 400b877..0000000 --- a/tests/Application/config/sylius/1.11/bundles.php +++ /dev/null @@ -1,9 +0,0 @@ - ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.11/packages/dev/jms_serializer.yaml b/tests/Application/config/sylius/1.11/packages/dev/jms_serializer.yaml deleted file mode 100644 index 2f32a9b..0000000 --- a/tests/Application/config/sylius/1.11/packages/dev/jms_serializer.yaml +++ /dev/null @@ -1,12 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION - json_deserialization: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml deleted file mode 100644 index ed7bc61..0000000 --- a/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -jms_serializer: - visitors: - xml_serialization: - format_output: '%kernel.debug%' diff --git a/tests/Application/config/sylius/1.11/packages/prod/jms_serializer.yaml b/tests/Application/config/sylius/1.11/packages/prod/jms_serializer.yaml deleted file mode 100644 index c288182..0000000 --- a/tests/Application/config/sylius/1.11/packages/prod/jms_serializer.yaml +++ /dev/null @@ -1,10 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION - json_deserialization: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/sylius/1.11/packages/security.yaml b/tests/Application/config/sylius/1.11/packages/security.yaml deleted file mode 100644 index 1062810..0000000 --- a/tests/Application/config/sylius/1.11/packages/security.yaml +++ /dev/null @@ -1,148 +0,0 @@ -parameters: - sylius.security.admin_regex: "^/%sylius_admin.path_name%" - sylius.security.api_regex: "^/api" - sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|new-api|api/.*|api$|media/.*)[^/]++" - sylius.security.new_api_route: "/new-api" - sylius.security.new_api_regex: "^%sylius.security.new_api_route%" - sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin" - sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%" - sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop" - sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%" - -security: - always_authenticate_before_granting: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - - encoders: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - anonymous: true - - new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/admin-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/shop-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api: - pattern: "%sylius.security.new_api_regex%/*" - provider: sylius_api_chain_provider - stateless: true - anonymous: lazy - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - shop: - switch_user: { role: ROLE_ALLOWED_TO_SWITCH } - context: shop - pattern: "%sylius.security.shop_regex%" - provider: sylius_shop_user_provider - form_login: - success_handler: sylius.authentication.success_handler - failure_handler: sylius.authentication.failure_handler - provider: sylius_shop_user_provider - login_path: sylius_shop_login - check_path: sylius_shop_login_check - failure_path: sylius_shop_login - default_target_path: sylius_shop_homepage - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_login - invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.api_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/tests/Application/config/sylius/1.8/bundles.php b/tests/Application/config/sylius/1.8/bundles.php deleted file mode 100644 index 161339d..0000000 --- a/tests/Application/config/sylius/1.8/bundles.php +++ /dev/null @@ -1,10 +0,0 @@ - ['all' => true], - WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true], - FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true], - Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.8/packages/_sylius.yaml b/tests/Application/config/sylius/1.8/packages/_sylius.yaml deleted file mode 100644 index 1674a97..0000000 --- a/tests/Application/config/sylius/1.8/packages/_sylius.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" } diff --git a/tests/Application/config/sylius/1.8/packages/dev/jms_serializer.yaml b/tests/Application/config/sylius/1.8/packages/dev/jms_serializer.yaml deleted file mode 100644 index 353e460..0000000 --- a/tests/Application/config/sylius/1.8/packages/dev/jms_serializer.yaml +++ /dev/null @@ -1,7 +0,0 @@ -jms_serializer: - visitors: - json: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/sylius/1.8/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.8/packages/jms_serializer.yaml deleted file mode 100644 index 64dd8d1..0000000 --- a/tests/Application/config/sylius/1.8/packages/jms_serializer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -jms_serializer: - visitors: - xml: - format_output: '%kernel.debug%' diff --git a/tests/Application/config/sylius/1.8/packages/prod/jms_serializer.yaml b/tests/Application/config/sylius/1.8/packages/prod/jms_serializer.yaml deleted file mode 100644 index bc97faf..0000000 --- a/tests/Application/config/sylius/1.8/packages/prod/jms_serializer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -jms_serializer: - visitors: - json: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/sylius/1.8/packages/security.yaml b/tests/Application/config/sylius/1.8/packages/security.yaml deleted file mode 100644 index 8161bda..0000000 --- a/tests/Application/config/sylius/1.8/packages/security.yaml +++ /dev/null @@ -1,159 +0,0 @@ -parameters: - sylius.security.admin_regex: "^/%sylius_admin.path_name%" - sylius.security.api_regex: "^/api" - sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|new-api|api/.*|api$|media/.*)[^/]++" - sylius.security.new_api_route: "/new-api" - sylius.security.new_api_regex: "^%sylius.security.new_api_route%" - sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin" - sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%" - sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop" - sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%" - -security: - always_authenticate_before_granting: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - - encoders: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - anonymous: true - - oauth_token: - pattern: "%sylius.security.api_regex%/oauth/v2/token" - security: false - - new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/admin-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/shop-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api: - pattern: "%sylius.security.new_api_regex%/*" - provider: sylius_api_chain_provider - stateless: true - anonymous: lazy - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - api: - pattern: "%sylius.security.api_regex%/.*" - provider: sylius_admin_user_provider - fos_oauth: true - stateless: true - anonymous: 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 - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_login - invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.api_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/tests/Application/config/sylius/1.8/routes/dev/twig.yaml b/tests/Application/config/sylius/1.8/routes/dev/twig.yaml deleted file mode 100644 index f4ee839..0000000 --- a/tests/Application/config/sylius/1.8/routes/dev/twig.yaml +++ /dev/null @@ -1,3 +0,0 @@ -_errors: - resource: '@TwigBundle/Resources/config/routing/errors.xml' - prefix: /_error diff --git a/tests/Application/config/sylius/1.8/routes/sylius_admin_api.yaml b/tests/Application/config/sylius/1.8/routes/sylius_admin_api.yaml deleted file mode 100644 index 80aed45..0000000 --- a/tests/Application/config/sylius/1.8/routes/sylius_admin_api.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_admin_api: - resource: "@SyliusAdminApiBundle/Resources/config/routing.yml" - prefix: /api diff --git a/tests/Application/config/sylius/1.9/bundles.php b/tests/Application/config/sylius/1.9/bundles.php deleted file mode 100644 index 36137b9..0000000 --- a/tests/Application/config/sylius/1.9/bundles.php +++ /dev/null @@ -1,10 +0,0 @@ - ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true], - Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.9/packages/_sylius.yaml b/tests/Application/config/sylius/1.9/packages/_sylius.yaml deleted file mode 100644 index 1674a97..0000000 --- a/tests/Application/config/sylius/1.9/packages/_sylius.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" } diff --git a/tests/Application/config/sylius/1.9/packages/dev/jms_serializer.yaml b/tests/Application/config/sylius/1.9/packages/dev/jms_serializer.yaml deleted file mode 100644 index 2f32a9b..0000000 --- a/tests/Application/config/sylius/1.9/packages/dev/jms_serializer.yaml +++ /dev/null @@ -1,12 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION - json_deserialization: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/sylius/1.9/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.9/packages/jms_serializer.yaml deleted file mode 100644 index ed7bc61..0000000 --- a/tests/Application/config/sylius/1.9/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.9/packages/prod/jms_serializer.yaml b/tests/Application/config/sylius/1.9/packages/prod/jms_serializer.yaml deleted file mode 100644 index c288182..0000000 --- a/tests/Application/config/sylius/1.9/packages/prod/jms_serializer.yaml +++ /dev/null @@ -1,10 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION - json_deserialization: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/sylius/1.9/packages/security.yaml b/tests/Application/config/sylius/1.9/packages/security.yaml deleted file mode 100644 index 8161bda..0000000 --- a/tests/Application/config/sylius/1.9/packages/security.yaml +++ /dev/null @@ -1,159 +0,0 @@ -parameters: - sylius.security.admin_regex: "^/%sylius_admin.path_name%" - sylius.security.api_regex: "^/api" - sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|new-api|api/.*|api$|media/.*)[^/]++" - sylius.security.new_api_route: "/new-api" - sylius.security.new_api_regex: "^%sylius.security.new_api_route%" - sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin" - sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%" - sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop" - sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%" - -security: - always_authenticate_before_granting: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - - encoders: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - anonymous: true - - oauth_token: - pattern: "%sylius.security.api_regex%/oauth/v2/token" - security: false - - new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/admin-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/shop-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api: - pattern: "%sylius.security.new_api_regex%/*" - provider: sylius_api_chain_provider - stateless: true - anonymous: lazy - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - api: - pattern: "%sylius.security.api_regex%/.*" - provider: sylius_admin_user_provider - fos_oauth: true - stateless: true - anonymous: 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 - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_login - invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.api_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/tests/Application/config/sylius/1.9/routes/sylius_admin_api.yaml b/tests/Application/config/sylius/1.9/routes/sylius_admin_api.yaml deleted file mode 100644 index 80aed45..0000000 --- a/tests/Application/config/sylius/1.9/routes/sylius_admin_api.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_admin_api: - resource: "@SyliusAdminApiBundle/Resources/config/routing.yml" - prefix: /api diff --git a/tests/Application/config/symfony/4.4/packages/framework.yaml b/tests/Application/config/symfony/4.4/packages/framework.yaml deleted file mode 100644 index 62f82d3..0000000 --- a/tests/Application/config/symfony/4.4/packages/framework.yaml +++ /dev/null @@ -1,2 +0,0 @@ -framework: - templating: { engines: ["twig"] } diff --git a/tests/Application/public/media/image/.gitignore b/tests/Application/public/media/image/.gitignore deleted file mode 100644 index e69de29..0000000 From e7676a89e7d68f02809b73388e07d7d3939cd9be Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 13:36:13 +0200 Subject: [PATCH 02/30] Update packages --- .github/workflows/build.yml | 21 ++++++++----------- composer.json | 18 ++++++++-------- tests/Application/config/bundles.php | 3 ++- .../config/sylius/1.12/bundles.php | 6 ++++++ .../config/sylius/1.13/bundles.php | 7 +++++++ .../config/sylius/1.13/packages/_sylius.yaml | 7 +++++++ tests/Application/package.json | 2 +- 7 files changed, 41 insertions(+), 23 deletions(-) create mode 100644 tests/Application/config/sylius/1.12/bundles.php create mode 100644 tests/Application/config/sylius/1.13/bundles.php create mode 100644 tests/Application/config/sylius/1.13/packages/_sylius.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d96b31..cae70d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,21 +21,17 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.0", "7.4"] - symfony: ["^4.4", "^5.2"] - sylius: ["~1.9.6", "~1.10.0", "~1.11.0"] + php: ["8.0"] + symfony: ["^5.4", "^6.0"] + ssylius: ["~1.12.0", "~1.13.0"] node: ["14.x"] mysql: ["8.0"] + state_machine_adapter: ["winzou_state_machine", "symfony_workflow"] exclude: - - sylius: ~1.9.6 - php: 8.0 - - - sylius: ~1.10.0 - symfony: 4.4 - - - sylius: ~1.11.0 - php: 7.4 + - + sylius: ~1.12.0 + state_machine_adapter: "symfony_workflow" env: APP_ENV: test @@ -129,6 +125,7 @@ jobs: key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }} restore-keys: | ${{ runner.os }}-node-${{ matrix.node }}-yarn- + - name: Install JS dependencies run: (cd tests/Application && yarn install) @@ -178,7 +175,7 @@ jobs: - name: Run PHPUnit run: ./vendor/bin/phpunit --coverage-text - + - name: Failed build Slack notification uses: rtCamp/action-slack-notify@v2 if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} diff --git a/composer.json b/composer.json index f9e010f..be54fe2 100644 --- a/composer.json +++ b/composer.json @@ -9,13 +9,13 @@ ], "license": "MIT", "require": { - "php": "^7.4 || ^8.0", - "sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0", + "php": "^8.0", + "sylius/sylius": "~1.12.0 || ~1.13.0", "twig/inky-extra": "^3.3" }, "require-dev": { - "behat/behat": "^3.6.1", - "behat/mink-selenium2-driver": "^1.4", + "behat/behat": "^3.7", + "behat/mink-selenium2-driver": "~1.6.0", "bitbag/coding-standard": "^1.0", "dmore/behat-chrome-extension": "^1.3", "dmore/chrome-mink-driver": "^2.7", @@ -38,11 +38,11 @@ "phpunit/phpunit": "^9.5", "sensiolabs/security-checker": "^6.0", "sylius-labs/coding-standard": "^4.0", - "symfony/browser-kit": "^4.4 || ^5.2", - "symfony/debug-bundle": "^4.4 || ^5.2", - "symfony/dotenv": "^4.4 || ^5.2", - "symfony/intl": "^4.4 || ^5.2", - "symfony/web-profiler-bundle": "^4.4 || ^5.2", + "symfony/browser-kit": "^5.4 || ^6.0", + "symfony/debug-bundle": "^5.4 || ^6.0", + "symfony/dotenv": "^5.4 || ^6.0", + "symfony/intl": "^5.4 || ^6.0", + "symfony/web-profiler-bundle": "^5.4 || ^6.0", "symfony/webpack-encore-bundle": "^1.13", "vimeo/psalm": "4.7.1", "polishsymfonycommunity/symfony-mocker-container": "^1.0" diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index d8015bb..0f554cf 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -6,7 +6,6 @@ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['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], @@ -59,4 +58,6 @@ Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true], Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true], + League\FlysystemBundle\FlysystemBundle::class => ['all' => true], + Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/sylius/1.12/bundles.php b/tests/Application/config/sylius/1.12/bundles.php new file mode 100644 index 0000000..bd33f4a --- /dev/null +++ b/tests/Application/config/sylius/1.12/bundles.php @@ -0,0 +1,6 @@ + ['all' => true], + SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], +]; diff --git a/tests/Application/config/sylius/1.13/bundles.php b/tests/Application/config/sylius/1.13/bundles.php new file mode 100644 index 0000000..b0560bc --- /dev/null +++ b/tests/Application/config/sylius/1.13/bundles.php @@ -0,0 +1,7 @@ + ['all' => true], + SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['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 0000000..76aa43a --- /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/package.json b/tests/Application/package.json index 1347083..d0f787a 100644 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -2,7 +2,7 @@ "dependencies": { "axios": "^0.25.0", "babel-polyfill": "^6.26.0", - "chart.js": "^2.9.3", + "chart.js": "^3.7.1", "codemirror": "^5.65.1", "jquery": "^3.4.0", "jquery.dirtyforms": "^2.0.0", From 272b54a0be691296f8932fa404d0e7addb3ac40d Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 13:37:44 +0200 Subject: [PATCH 03/30] Update changes: - security - mailer - kernel --- tests/Application/.env | 7 - tests/Application/Kernel.php | 11 +- tests/Application/config/bootstrap.php | 2 +- tests/Application/config/packages/mailer.yaml | 3 + .../config/packages/test/mailer.yaml | 7 + .../config/routes/sylius_shop.yaml | 2 +- .../config/sylius/1.12/packages/security.yaml | 124 ++++++++++++++++++ .../config/sylius/1.13/packages/security.yaml | 124 ++++++++++++++++++ tests/Behat/Resources/suites/ui/checkout.yml | 2 +- 9 files changed, 267 insertions(+), 15 deletions(-) create mode 100644 tests/Application/config/packages/mailer.yaml create mode 100644 tests/Application/config/packages/test/mailer.yaml create mode 100644 tests/Application/config/sylius/1.12/packages/security.yaml create mode 100644 tests/Application/config/sylius/1.13/packages/security.yaml diff --git a/tests/Application/.env b/tests/Application/.env index 283d78f..26f3fac 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -21,13 +21,6 @@ JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem JWT_PASSPHRASE=topsecret ###< lexik/jwt-authentication-bundle ### -###> symfony/swiftmailer-bundle ### -# For Gmail as a transport, use: "gmail://username:password@localhost" -# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" -# Delivery is disabled by default via "null://localhost" -MAILER_URL=smtp://localhost -###< symfony/swiftmailer-bundle ### - ###> symfony/messenger ### # Choose one of the transports below # MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index c20ac6c..2e00669 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -12,6 +12,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Kernel as BaseKernel; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; use Symfony\Component\Routing\RouteCollectionBuilder; final class Kernel extends BaseKernel @@ -58,7 +59,7 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa } } - protected function configureRoutes(RouteCollectionBuilder $routes): void + protected function configureRoutes(RoutingConfigurator $routes): void { foreach ($this->getConfigurationDirectories() as $confDir) { $this->loadRoutesConfiguration($routes, $confDir); @@ -87,11 +88,11 @@ private function loadContainerConfiguration(LoaderInterface $loader, string $con $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob'); } - private function loadRoutesConfiguration(RouteCollectionBuilder $routes, string $confDir): void + private function loadRoutesConfiguration(RoutingConfigurator $routes, string $confDir): void { - $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob'); + $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'); } /** diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php index d7ac51d..2291ab4 100644 --- a/tests/Application/config/bootstrap.php +++ b/tests/Application/config/bootstrap.php @@ -15,7 +15,7 @@ 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'; diff --git a/tests/Application/config/packages/mailer.yaml b/tests/Application/config/packages/mailer.yaml new file mode 100644 index 0000000..56a650d --- /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/test/mailer.yaml b/tests/Application/config/packages/test/mailer.yaml new file mode 100644 index 0000000..092eb28 --- /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/routes/sylius_shop.yaml b/tests/Application/config/routes/sylius_shop.yaml index 92eeae0..fae46cb 100644 --- a/tests/Application/config/routes/sylius_shop.yaml +++ b/tests/Application/config/routes/sylius_shop.yaml @@ -11,4 +11,4 @@ sylius_shop_default_locale: path: / methods: [GET] defaults: - _controller: sylius.controller.shop.locale_switch:switchAction + _controller: sylius.controller.shop.locale_switch::switchAction diff --git a/tests/Application/config/sylius/1.12/packages/security.yaml b/tests/Application/config/sylius/1.12/packages/security.yaml new file mode 100644 index 0000000..4ed342f --- /dev/null +++ b/tests/Application/config/sylius/1.12/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%/authentication-token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + new_api_shop_user: + pattern: "%sylius.security.new_api_shop_regex%/.*" + provider: sylius_api_shop_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_shop_route%/authentication-token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + shop: + switch_user: { role: ROLE_ALLOWED_TO_SWITCH } + context: shop + pattern: "%sylius.security.shop_regex%" + provider: sylius_shop_user_provider + form_login: + success_handler: sylius.authentication.success_handler + failure_handler: sylius.authentication.failure_handler + provider: sylius_shop_user_provider + login_path: sylius_shop_login + check_path: sylius_shop_login_check + failure_path: sylius_shop_login + default_target_path: sylius_shop_homepage + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_shop_security_token + csrf_token_id: shop_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + name: APP_SHOP_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_shop_logout + target: sylius_shop_homepage + invalidate_session: false + + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + 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%/reset-password-requests", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } + - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } + - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/sylius/1.13/packages/security.yaml b/tests/Application/config/sylius/1.13/packages/security.yaml new file mode 100644 index 0000000..c81f04b --- /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/Behat/Resources/suites/ui/checkout.yml b/tests/Behat/Resources/suites/ui/checkout.yml index ccd9004..968958a 100644 --- a/tests/Behat/Resources/suites/ui/checkout.yml +++ b/tests/Behat/Resources/suites/ui/checkout.yml @@ -3,7 +3,7 @@ default: ui_checkout: contexts: - sylius.behat.context.hook.doctrine_orm - - sylius.behat.context.hook.email_spool + - sylius.behat.context.hook.mailer - sylius.behat.context.transform.address - sylius.behat.context.transform.country From 44f7c03c95bd2c534b853d16c2b7a47bce652af3 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 13:37:57 +0200 Subject: [PATCH 04/30] Fix tests --- ...ing_confirmation_email_after_completing_checkout.feature | 2 +- .../sending_confirmation_email_after_shipping_order.feature | 2 +- .../TwigError/SecurityNotAllowedFilterErrorResponseSpec.php | 2 +- .../SecurityNotAllowedFunctionErrorResponseSpec.php | 2 +- .../TwigError/SecurityNotAllowedMethodErrorResponseSpec.php | 2 +- .../SecurityNotAllowedPropertyErrorResponseSpec.php | 2 +- .../TwigError/SecurityNotAllowedTagErrorResponseSpec.php | 2 +- spec/Validator/IsRenderableMailContentValidatorSpec.php | 1 + tests/Behat/Context/Ui/Admin/EmailTemplateContext.php | 6 +++--- tests/Behat/Context/Ui/EmailTemplateContext.php | 2 +- tests/Behat/Resources/suites/ui/login.yml | 2 +- tests/Behat/Resources/suites/ui/managing_orders.yml | 2 +- tests/Behat/Resources/suites/ui/requesting_contact.yml | 2 +- tests/Behat/Resources/suites/ui/user_registration.yml | 2 +- 14 files changed, 16 insertions(+), 15 deletions(-) diff --git a/features/shop/receiving_confirmation_email_after_completing_checkout.feature b/features/shop/receiving_confirmation_email_after_completing_checkout.feature index 1fe16af..9cf4ec0 100644 --- a/features/shop/receiving_confirmation_email_after_completing_checkout.feature +++ b/features/shop/receiving_confirmation_email_after_completing_checkout.feature @@ -29,7 +29,7 @@ Feature: Receiving confirmation email after finalizing checkout @ui @email Scenario: Receiving a custom confirmation email after finalizing checkout - Given there is mail template with "order_confirmation" type and "Order confirmation" name and "Congratulations, you have bought new gun" subject and "Pif paf
{{order.number}}" content + Given there is mail template with "order_confirmation" type and "Order confirmation" name and "Congratulations, you have bought new gun" subject and "Pif paf {{order.number}}" content And I have product "Sig Sauer P226" in the cart And I have completed addressing step with email "john@example.com" and "United States" based billing address And I have proceeded order with "Free" shipping method and "Offline" payment diff --git a/features/shop/sending_confirmation_email_after_shipping_order.feature b/features/shop/sending_confirmation_email_after_shipping_order.feature index 5eb2e90..7c5aa22 100644 --- a/features/shop/sending_confirmation_email_after_shipping_order.feature +++ b/features/shop/sending_confirmation_email_after_shipping_order.feature @@ -32,7 +32,7 @@ Feature: Sending a confirmation email after shipping an order @ui @email Scenario: Sending a custom confirmation email after shipping an order - Given there is mail template with "shipment_confirmation" type and "Shipment confirmation" name and "Your products are waiting for you!" subject and "Enjoy your new stuff!
{{order.number}}
{{ shipment.method.name }}
{{shipment.tracking}}" content + Given there is mail template with "shipment_confirmation" type and "Shipment confirmation" name and "Your products are waiting for you!" subject and "Enjoy your new stuff! {{order.number}} {{ shipment.method.name }} {{shipment.tracking}}" content When I view the summary of the order "#00000666" And specify its tracking code as "#00044" And I ship this order diff --git a/spec/Response/TwigError/SecurityNotAllowedFilterErrorResponseSpec.php b/spec/Response/TwigError/SecurityNotAllowedFilterErrorResponseSpec.php index d892b8e..96b3833 100644 --- a/spec/Response/TwigError/SecurityNotAllowedFilterErrorResponseSpec.php +++ b/spec/Response/TwigError/SecurityNotAllowedFilterErrorResponseSpec.php @@ -22,7 +22,7 @@ class SecurityNotAllowedFilterErrorResponseSpec extends ObjectBehavior { public const ERROR_MESSAGE_TRANSLATION = 'Filter "%s" is not allowed at line %d'; - public const EXPECTED_RESPONSE_MESSAGE = '{"message":"Filter \u0022bar\u0022 is not allowed at line 2"}'; + public const EXPECTED_RESPONSE_MESSAGE = '{"message":"Filter \u0022bar\u0022 is not allowed at line -1"}'; function let(TranslatorInterface $translator) { diff --git a/spec/Response/TwigError/SecurityNotAllowedFunctionErrorResponseSpec.php b/spec/Response/TwigError/SecurityNotAllowedFunctionErrorResponseSpec.php index 7a8f4ce..5afdab3 100644 --- a/spec/Response/TwigError/SecurityNotAllowedFunctionErrorResponseSpec.php +++ b/spec/Response/TwigError/SecurityNotAllowedFunctionErrorResponseSpec.php @@ -22,7 +22,7 @@ class SecurityNotAllowedFunctionErrorResponseSpec extends ObjectBehavior { public const ERROR_MESSAGE_TRANSLATION = 'Function "%s" is not allowed at line %d'; - public const EXPECTED_RESPONSE_MESSAGE = '{"message":"Function \u0022bar\u0022 is not allowed at line 2"}'; + public const EXPECTED_RESPONSE_MESSAGE = '{"message":"Function \u0022bar\u0022 is not allowed at line -1"}'; function let(TranslatorInterface $translator) { diff --git a/spec/Response/TwigError/SecurityNotAllowedMethodErrorResponseSpec.php b/spec/Response/TwigError/SecurityNotAllowedMethodErrorResponseSpec.php index 2dc2507..8338337 100644 --- a/spec/Response/TwigError/SecurityNotAllowedMethodErrorResponseSpec.php +++ b/spec/Response/TwigError/SecurityNotAllowedMethodErrorResponseSpec.php @@ -22,7 +22,7 @@ class SecurityNotAllowedMethodErrorResponseSpec extends ObjectBehavior { public const ERROR_MESSAGE_TRANSLATION = 'Method "%s" is not allowed at line %d'; - public const EXPECTED_RESPONSE_MESSAGE = '{"message":"Method \u0022baz\u0022 is not allowed at line 2"}'; + public const EXPECTED_RESPONSE_MESSAGE = '{"message":"Method \u0022baz\u0022 is not allowed at line -1"}'; function let(TranslatorInterface $translator) { diff --git a/spec/Response/TwigError/SecurityNotAllowedPropertyErrorResponseSpec.php b/spec/Response/TwigError/SecurityNotAllowedPropertyErrorResponseSpec.php index faad8e9..0d63c43 100644 --- a/spec/Response/TwigError/SecurityNotAllowedPropertyErrorResponseSpec.php +++ b/spec/Response/TwigError/SecurityNotAllowedPropertyErrorResponseSpec.php @@ -22,7 +22,7 @@ class SecurityNotAllowedPropertyErrorResponseSpec extends ObjectBehavior { public const ERROR_MESSAGE_TRANSLATION = 'Property "%s" is not allowed at line %d'; - public const EXPECTED_RESPONSE_MESSAGE = '{"message":"Property \u0022baz\u0022 is not allowed at line 2"}'; + public const EXPECTED_RESPONSE_MESSAGE = '{"message":"Property \u0022baz\u0022 is not allowed at line -1"}'; function let(TranslatorInterface $translator) { diff --git a/spec/Response/TwigError/SecurityNotAllowedTagErrorResponseSpec.php b/spec/Response/TwigError/SecurityNotAllowedTagErrorResponseSpec.php index fc5fb66..c2bdd27 100644 --- a/spec/Response/TwigError/SecurityNotAllowedTagErrorResponseSpec.php +++ b/spec/Response/TwigError/SecurityNotAllowedTagErrorResponseSpec.php @@ -22,7 +22,7 @@ class SecurityNotAllowedTagErrorResponseSpec extends ObjectBehavior { public const ERROR_MESSAGE_TRANSLATION = 'Tag "%s" is not allowed at line %d'; - public const EXPECTED_RESPONSE_MESSAGE = '{"message":"Tag \u0022bar\u0022 is not allowed at line 2"}'; + public const EXPECTED_RESPONSE_MESSAGE = '{"message":"Tag \u0022bar\u0022 is not allowed at line -1"}'; function let(TranslatorInterface $translator) { diff --git a/spec/Validator/IsRenderableMailContentValidatorSpec.php b/spec/Validator/IsRenderableMailContentValidatorSpec.php index 833fcc5..f964884 100644 --- a/spec/Validator/IsRenderableMailContentValidatorSpec.php +++ b/spec/Validator/IsRenderableMailContentValidatorSpec.php @@ -94,6 +94,7 @@ function it_should_do_nothing_if_no_exception_has_been_thrown_while_rendering( $mailPreviewDataProvider->get(Argument::any())->willReturn($mailPreviewData); $constraint = new IsRenderableMailContent(); + $twig->render(RenderEmailPreviewAction::EMAIL_PREVIEW_TEMPLATE, Argument::type('array')); $validator = new IsRenderableMailContentValidator( $twig->getWrappedObject(), $mailPreviewDataProvider->getWrappedObject() diff --git a/tests/Behat/Context/Ui/Admin/EmailTemplateContext.php b/tests/Behat/Context/Ui/Admin/EmailTemplateContext.php index 3682410..7f2d616 100644 --- a/tests/Behat/Context/Ui/Admin/EmailTemplateContext.php +++ b/tests/Behat/Context/Ui/Admin/EmailTemplateContext.php @@ -173,9 +173,9 @@ private function addAllCustomEmailTypesInDatabase(): void 'remove_existing' => false, 'translations' => [ 'en_US' => [ - 'name' => "Name for ${type} type", - 'subject' => "Subject for ${type} type", - 'content' => "Content for ${type} type", + 'name' => "Name for {$type} type", + 'subject' => "Subject for {$type} type", + 'content' => "Content for {$type} type", ], ], ]; diff --git a/tests/Behat/Context/Ui/EmailTemplateContext.php b/tests/Behat/Context/Ui/EmailTemplateContext.php index a1be79d..1da5ab0 100644 --- a/tests/Behat/Context/Ui/EmailTemplateContext.php +++ b/tests/Behat/Context/Ui/EmailTemplateContext.php @@ -12,10 +12,10 @@ namespace Tests\BitBag\SyliusMailTemplatePlugin\Behat\Context\Ui; use Behat\Behat\Context\Context; +use Sylius\Behat\Service\Checker\EmailCheckerInterface; use Sylius\Behat\Service\SharedStorageInterface; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\ShipmentInterface; -use Sylius\Component\Core\Test\Services\EmailCheckerInterface; use Webmozart\Assert\Assert; final class EmailTemplateContext implements Context diff --git a/tests/Behat/Resources/suites/ui/login.yml b/tests/Behat/Resources/suites/ui/login.yml index b26b89c..7eb03fc 100644 --- a/tests/Behat/Resources/suites/ui/login.yml +++ b/tests/Behat/Resources/suites/ui/login.yml @@ -3,7 +3,7 @@ default: ui_customer_login: contexts: - sylius.behat.context.hook.doctrine_orm - - sylius.behat.context.hook.email_spool + - sylius.behat.context.hook.mailer - sylius.behat.context.transform.locale - sylius.behat.context.transform.shared_storage diff --git a/tests/Behat/Resources/suites/ui/managing_orders.yml b/tests/Behat/Resources/suites/ui/managing_orders.yml index 90c0a91..90e9cea 100644 --- a/tests/Behat/Resources/suites/ui/managing_orders.yml +++ b/tests/Behat/Resources/suites/ui/managing_orders.yml @@ -4,7 +4,7 @@ default: contexts: - sylius.behat.context.hook.calendar - sylius.behat.context.hook.doctrine_orm - - sylius.behat.context.hook.email_spool + - sylius.behat.context.hook.mailer - sylius.behat.context.setup.admin_security - sylius.behat.context.setup.admin_user diff --git a/tests/Behat/Resources/suites/ui/requesting_contact.yml b/tests/Behat/Resources/suites/ui/requesting_contact.yml index 8240707..cf56505 100644 --- a/tests/Behat/Resources/suites/ui/requesting_contact.yml +++ b/tests/Behat/Resources/suites/ui/requesting_contact.yml @@ -3,7 +3,7 @@ default: ui_customer_requesting_contact: contexts: - sylius.behat.context.hook.doctrine_orm - - sylius.behat.context.hook.email_spool + - sylius.behat.context.hook.mailer - sylius.behat.context.transform.shared_storage diff --git a/tests/Behat/Resources/suites/ui/user_registration.yml b/tests/Behat/Resources/suites/ui/user_registration.yml index 2a0373f..432ba3e 100644 --- a/tests/Behat/Resources/suites/ui/user_registration.yml +++ b/tests/Behat/Resources/suites/ui/user_registration.yml @@ -3,7 +3,7 @@ default: ui_user_registration: contexts: - sylius.behat.context.hook.doctrine_orm - - sylius.behat.context.hook.email_spool + - sylius.behat.context.hook.mailer - sylius.behat.context.transform.customer - sylius.behat.context.transform.locale From 245b00107b43e8f06f6b8b5e16ea99c7d1e37166 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 13:42:37 +0200 Subject: [PATCH 05/30] Fix typo --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cae70d6..1061bff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: matrix: php: ["8.0"] symfony: ["^5.4", "^6.0"] - ssylius: ["~1.12.0", "~1.13.0"] + sylius: ["~1.12.0", "~1.13.0"] node: ["14.x"] mysql: ["8.0"] state_machine_adapter: ["winzou_state_machine", "symfony_workflow"] From 274cba2d08c8709a7bad1bdeed17be0a70023ab1 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 13:47:17 +0200 Subject: [PATCH 06/30] Update coding standard packages version --- .github/workflows/coding_standard.yml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index ab60581..63e46d0 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -21,21 +21,17 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.0", "7.4"] - symfony: ["^4.4", "^5.2"] - sylius: ["~1.9.6", "~1.10.0", "~1.11.0"] + php: ["8.0"] + symfony: ["^5.4", "^6.0"] + sylius: ["~1.12.0", "~1.13.0"] node: ["14.x"] mysql: ["8.0"] + state_machine_adapter: ["winzou_state_machine", "symfony_workflow"] exclude: - - sylius: ~1.9.6 - php: 8.0 - - - sylius: ~1.10.0 - symfony: 4.4 - - - sylius: ~1.11.0 - php: 7.4 + - + sylius: ~1.12.0 + state_machine_adapter: "symfony_workflow" env: APP_ENV: test @@ -81,15 +77,15 @@ jobs: name: Install PHP dependencies run: composer install --no-interaction - - + - name: Run ECS run: vendor/bin/ecs - name: Run PHPStan run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ - - - + + - name: Failed build Slack notification uses: rtCamp/action-slack-notify@v2 if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} From 4c3092f46f5d5d6f1d7d99941a4446839e63a7dd Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 13:57:22 +0200 Subject: [PATCH 07/30] Upgrade PHP version to 8.2 --- .github/workflows/build.yml | 2 +- .github/workflows/coding_standard.yml | 2 +- composer.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1061bff..30388cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.0"] + php: ["^8.2"] symfony: ["^5.4", "^6.0"] sylius: ["~1.12.0", "~1.13.0"] node: ["14.x"] diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index 63e46d0..8267943 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.0"] + php: ["^8.2"] symfony: ["^5.4", "^6.0"] sylius: ["~1.12.0", "~1.13.0"] node: ["14.x"] diff --git a/composer.json b/composer.json index be54fe2..a8a2975 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ ], "license": "MIT", "require": { - "php": "^8.0", + "php": "^8.2", "sylius/sylius": "~1.12.0 || ~1.13.0", "twig/inky-extra": "^3.3" }, From c294c2ff450cd4ea84eeb2ec15670008ac50c984 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 13:57:28 +0200 Subject: [PATCH 08/30] PHP stan fix --- src/Repository/RepositoryDecoratorTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Repository/RepositoryDecoratorTrait.php b/src/Repository/RepositoryDecoratorTrait.php index ab7b6f7..9ee81aa 100644 --- a/src/Repository/RepositoryDecoratorTrait.php +++ b/src/Repository/RepositoryDecoratorTrait.php @@ -34,8 +34,8 @@ public function findAll(): array public function findBy( array $criteria, ?array $orderBy = null, - $limit = null, - $offset = null + ?int $limit = null, + ?int $offset = null ): array { return $this->decoratedRepository->findBy($criteria, $orderBy, $limit, $offset); } From 18c9900a75a14befc6f8b44405d6f48f87fec3c2 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 13:58:56 +0200 Subject: [PATCH 09/30] Fix php version in CI --- .github/workflows/build.yml | 2 +- .github/workflows/coding_standard.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 30388cf..46f3ba8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - php: ["^8.2"] + php: ["8.2"] symfony: ["^5.4", "^6.0"] sylius: ["~1.12.0", "~1.13.0"] node: ["14.x"] diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index 8267943..f59b7ac 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - php: ["^8.2"] + php: ["8.2"] symfony: ["^5.4", "^6.0"] sylius: ["~1.12.0", "~1.13.0"] node: ["14.x"] From 64608ce2266b231f749931e6c0cac116f4f8c9d1 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 21:14:46 +0200 Subject: [PATCH 10/30] Remove conflicts from composer --- composer.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/composer.json b/composer.json index a8a2975..2454c20 100644 --- a/composer.json +++ b/composer.json @@ -47,10 +47,6 @@ "vimeo/psalm": "4.7.1", "polishsymfonycommunity/symfony-mocker-container": "^1.0" }, - "conflict": { - "doctrine/dbal": "^3.0", - "doctrine/orm": ">=2.15.2" - }, "config": { "sort-packages": true, "allow-plugins": { From 3a30353b7d3cc03e27ed979c225b7b3bf2b26cad Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 21:24:18 +0200 Subject: [PATCH 11/30] Remove php stan package, update BitBag coding standard --- .github/workflows/build.yml | 2 +- .github/workflows/coding_standard.yml | 2 +- composer.json | 7 +------ ecs.php | 23 ++++++++--------------- phpstan.neon | 22 +++++++--------------- 5 files changed, 18 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 46f3ba8..43c264e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.2"] + php: ["8.2"]compose symfony: ["^5.4", "^6.0"] sylius: ["~1.12.0", "~1.13.0"] node: ["14.x"] diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index f59b7ac..2ccc6a7 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -83,7 +83,7 @@ jobs: - name: Run PHPStan - run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ + run: vendor/bin/phpstan analyse -c phpstan.neon - name: Failed build Slack notification diff --git a/composer.json b/composer.json index 2454c20..1b44a06 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "require-dev": { "behat/behat": "^3.7", "behat/mink-selenium2-driver": "~1.6.0", - "bitbag/coding-standard": "^1.0", + "bitbag/coding-standard": "^3.0.0", "dmore/behat-chrome-extension": "^1.3", "dmore/chrome-mink-driver": "^2.7", "friends-of-behat/mink": "^1.8", @@ -30,11 +30,6 @@ "friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev", "lchrusciel/api-test-case": "^5.2", "phpspec/phpspec": "^7.0", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "0.12.85", - "phpstan/phpstan-doctrine": "0.12.33", - "phpstan/phpstan-strict-rules": "^0.12.0", - "phpstan/phpstan-webmozart-assert": "0.12.12", "phpunit/phpunit": "^9.5", "sensiolabs/security-checker": "^6.0", "sylius-labs/coding-standard": "^4.0", diff --git a/ecs.php b/ecs.php index efab80b..89ad086 100644 --- a/ecs.php +++ b/ecs.php @@ -1,20 +1,13 @@ import('vendor/bitbag/coding-standard/ecs.php'); +use Symplify\EasyCodingStandard\Config\ECSConfig; - $parameters = $containerConfigurator->parameters(); - $parameters->set(Option::PATHS, [ - __DIR__ . '/src', - __DIR__ . '/tests', - __DIR__ . '/spec', - ]); - $parameters->set(Option::SKIP, [ - __DIR__ . '/tests/Application', - VisibilityRequiredFixer::class => ['*Spec.php'], - ]); +return static function (ECSConfig $config): void { + + putenv('ALLOW_BITBAG_OS_HEADER=1'); + + $config->import('vendor/bitbag/coding-standard/ecs.php'); + $config->paths(['src', 'spec', 'tests/Repository', 'tests/Behat']); }; diff --git a/phpstan.neon b/phpstan.neon index 84eac9f..0a0bb8e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,17 +1,9 @@ +includes: + - vendor/bitbag/coding-standard/phpstan.neon parameters: level: 8 - reportUnmatchedIgnoredErrors: false - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false - - excludes_analyse: - # Makes PHPStan crash - - 'src/DependencyInjection/Configuration.php' - - # Test dependencies - - 'tests/Application/*' - - # ECS Fixer dependency - - 'src/Fixer' - 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\./' + excludePaths: + - tests/Repository + paths: + - src + - tests From 536b8cdaa316184a6fdc1d67a03a8f548d92befb Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 21:33:00 +0200 Subject: [PATCH 12/30] Php stan fixes --- src/Repository/RepositoryDecoratorTrait.php | 2 +- .../Context/Ui/Admin/EmailTemplateContext.php | 2 +- .../Behat/Context/Ui/EmailTemplateContext.php | 30 +++++++++++++++++-- tests/Behat/Context/Ui/LoginContext.php | 18 ++++++++++- .../Page/Admin/EmailTemplate/CreatePage.php | 13 +++++++- 5 files changed, 58 insertions(+), 7 deletions(-) diff --git a/src/Repository/RepositoryDecoratorTrait.php b/src/Repository/RepositoryDecoratorTrait.php index 9ee81aa..8e80ac2 100644 --- a/src/Repository/RepositoryDecoratorTrait.php +++ b/src/Repository/RepositoryDecoratorTrait.php @@ -29,7 +29,7 @@ public function findAll(): array } /** - * @return object[] + * @return array */ public function findBy( array $criteria, diff --git a/tests/Behat/Context/Ui/Admin/EmailTemplateContext.php b/tests/Behat/Context/Ui/Admin/EmailTemplateContext.php index 7f2d616..813c15e 100644 --- a/tests/Behat/Context/Ui/Admin/EmailTemplateContext.php +++ b/tests/Behat/Context/Ui/Admin/EmailTemplateContext.php @@ -119,7 +119,7 @@ public function iAmOnTheEmailTemplatesList(): void /** * @Given /^I have added all of custom email types$/ */ - public function iHaveAddedAllOfCustomEmailTypes() + public function iHaveAddedAllOfCustomEmailTypes(): void { $this->addAllCustomEmailTypesInDatabase(); } diff --git a/tests/Behat/Context/Ui/EmailTemplateContext.php b/tests/Behat/Context/Ui/EmailTemplateContext.php index 1da5ab0..1ae48bb 100644 --- a/tests/Behat/Context/Ui/EmailTemplateContext.php +++ b/tests/Behat/Context/Ui/EmailTemplateContext.php @@ -14,8 +14,11 @@ use Behat\Behat\Context\Context; use Sylius\Behat\Service\Checker\EmailCheckerInterface; use Sylius\Behat\Service\SharedStorageInterface; +use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\ShipmentInterface; +use Sylius\Component\Core\Model\ShippingMethodInterface; +use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Webmozart\Assert\Assert; final class EmailTemplateContext implements Context @@ -213,7 +216,15 @@ public function aDefaultEmailWithTheConfirmationOfTheOrderShouldBeSentTo( */ public function anEmailWithSummaryOfOrderPlacedByShouldBeSentTo(OrderInterface $order, string $localeCode = 'en_US'): void { - $this->anEmailWithTheConfirmationOfTheOrderShouldBeSentTo($order, $order->getCustomer()->getEmailCanonical(), $localeCode); + /** @var ?CustomerInterface $customer */ + $customer = $order->getCustomer(); + Assert::notNull($customer); + + /** @var ?string $email */ + $email = $customer->getEmailCanonical(); + Assert::notNull($email); + + $this->anEmailWithTheConfirmationOfTheOrderShouldBeSentTo($order, $email, $localeCode); } /** @@ -222,7 +233,15 @@ public function anEmailWithSummaryOfOrderPlacedByShouldBeSentTo(OrderInterface $ */ public function aDefaultEmailWithSummaryOfOrderPlacedByShouldBeSentTo(OrderInterface $order, string $localeCode = 'en_US'): void { - $this->aDefaultEmailWithTheConfirmationOfTheOrderShouldBeSentTo($order, $order->getCustomer()->getEmailCanonical(), $localeCode); + /** @var ?CustomerInterface $customer */ + $customer = $order->getCustomer(); + Assert::notNull($customer); + + /** @var ?string $email */ + $email = $customer->getEmailCanonical(); + Assert::notNull($email); + + $this->aDefaultEmailWithTheConfirmationOfTheOrderShouldBeSentTo($order, $email, $localeCode); } /** @@ -282,6 +301,11 @@ private function getShippingMethodName(OrderInterface $order): string throw new \LogicException('Order should have at least one shipment.'); } - return $shipment->getMethod()->getName(); + /** @var ?ShippingMethodInterface $shippingMethod */ + $shippingMethod = $shipment->getMethod(); + Assert::notNull($shippingMethod); + + Assert::notNull($shippingMethod->getName()); + return $shippingMethod->getName(); } } diff --git a/tests/Behat/Context/Ui/LoginContext.php b/tests/Behat/Context/Ui/LoginContext.php index 13a5668..a5ac491 100644 --- a/tests/Behat/Context/Ui/LoginContext.php +++ b/tests/Behat/Context/Ui/LoginContext.php @@ -104,6 +104,10 @@ public function iFollowLinkOnMyEmailToResetPassword(UserInterface $user): void */ public function iSpecifyTheUsername(?string $username = null): void { + if (null === $username) { + throw new \InvalidArgumentException('Username cannot be null.'); + } + $this->loginPage->specifyUsername($username); } @@ -122,6 +126,10 @@ public function iSpecifyTheEmail(?string $email = null): void */ public function iSpecifyThePasswordAs(?string $password = null): void { + if (null === $password) { + throw new \InvalidArgumentException('Password cannot be null.'); + } + $this->loginPage->specifyPassword($password); } @@ -131,6 +139,10 @@ public function iSpecifyThePasswordAs(?string $password = null): void */ public function iSpecifyMyNewPassword(?string $password = null): void { + if (null === $password) { + throw new \InvalidArgumentException('Password cannot be null.'); + } + $this->resetPasswordPage->specifyNewPassword($password); } @@ -140,6 +152,10 @@ public function iSpecifyMyNewPassword(?string $password = null): void */ public function iConfirmMyNewPassword(?string $password = null): void { + if (null === $password) { + throw new \InvalidArgumentException('Password cannot be null.'); + } + $this->resetPasswordPage->specifyConfirmPassword($password); } @@ -246,7 +262,7 @@ public function iShouldBeNotifiedThatEmailWithResetInstructionWasSent(): void /** * @Then I should be notified that the :elementName is required */ - public function iShouldBeNotifiedThatElementIsRequired($elementName) + public function iShouldBeNotifiedThatElementIsRequired(string $elementName): void { Assert::true($this->requestPasswordResetPage->checkValidationMessageFor($elementName, sprintf('Please enter your %s.', $elementName))); } diff --git a/tests/Behat/Page/Admin/EmailTemplate/CreatePage.php b/tests/Behat/Page/Admin/EmailTemplate/CreatePage.php index 0a52ff5..d9a9cd8 100644 --- a/tests/Behat/Page/Admin/EmailTemplate/CreatePage.php +++ b/tests/Behat/Page/Admin/EmailTemplate/CreatePage.php @@ -11,6 +11,8 @@ namespace Tests\BitBag\SyliusMailTemplatePlugin\Behat\Page\Admin\EmailTemplate; use ArrayAccess; +use Behat\Gherkin\Exception\NodeException; +use Behat\Mink\Element\NodeElement; use Behat\Mink\Exception\DriverException; use Behat\Mink\Exception\ElementNotFoundException; use Behat\Mink\Exception\UnsupportedDriverActionException; @@ -56,7 +58,14 @@ public function fillInvisibleField(string $field, string $value): void public function preview(string $locale): void { - $this->getDocument()->find('css', sprintf('[data-locale="%s"] .bitbag_preview_mail_template', $locale))->click(); + /** @var ?NodeElement $node */ + $node = $this->getDocument()->find('css', sprintf('[data-locale="%s"] .bitbag_preview_mail_template', $locale)); + + if (null === $node) { + throw new NodeException(); + } + + $node->click(); } /** @@ -68,7 +77,9 @@ public function checkHasPreviewModal(string $subject, string $content): void { $this->getDriver()->wait(300, 'document.querySelector(".mail-preview").offsetParent !== null'); Assert::true($this->previewModal->isModalVisible()); + /** @phpstan-ignore-next-line */ Assert::contains($this->previewModal->getSubject(), $subject); + /** @phpstan-ignore-next-line */ Assert::contains($this->previewModal->getContent(), $content); } } From f62205c71a2f638e21ed4c1adcc237fc028fd639 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 21:33:28 +0200 Subject: [PATCH 13/30] Ecs fixes --- spec/EmailSender/SenderSpec.php | 17 +++--- ...peCreateEmailTemplateEventListenerSpec.php | 15 +++--- .../TwigErrorEventListenerSpec.php | 19 +++---- .../CustomerPreviewDataFactorySpec.php | 7 +-- .../CustomTwigErrorResponseProviderSpec.php | 9 +++- spec/Provider/EmailCodesProviderSpec.php | 15 ++++-- spec/Provider/MailPreviewDataProviderSpec.php | 11 +++- ...EmailTemplateTranslationRepositorySpec.php | 9 ++-- ...urityNotAllowedFilterErrorResponseSpec.php | 7 +++ ...ityNotAllowedFunctionErrorResponseSpec.php | 7 +++ ...urityNotAllowedMethodErrorResponseSpec.php | 7 +++ ...ityNotAllowedPropertyErrorResponseSpec.php | 7 +++ ...SecurityNotAllowedTagErrorResponseSpec.php | 7 +++ spec/Twig/Sandbox/SecurityPolicySpec.php | 15 +++--- .../IsRenderableMailContentValidatorSpec.php | 15 ++++-- src/BitBagSyliusMailTemplatePlugin.php | 9 ++-- .../Action/RenderEmailPreviewAction.php | 7 +-- .../RequestDtoArgumentValueResolver.php | 7 +-- .../BitBagSyliusMailTemplateExtension.php | 19 +++---- .../SyliusBehatPolyfillCompilerPass.php | 7 +-- src/DependencyInjection/Configuration.php | 9 ++-- src/EmailSender/Sender.php | 8 +-- src/EmailSender/SenderInterface.php | 2 +- src/Entity/EmailTemplate.php | 9 ++-- src/Entity/EmailTemplateInterface.php | 9 ++-- src/Entity/EmailTemplateTranslation.php | 9 ++-- .../EmailTemplateTranslationInterface.php | 9 ++-- ...ndTypeCreateEmailTemplateEventListener.php | 9 ++-- src/EventListener/TwigErrorEventListener.php | 7 +-- .../Factory/EmailTemplateFixtureFactory.php | 4 +- src/Form/Type/EmailTemplateType.php | 9 ++-- .../EmailTemplateTranslationType.php | 9 ++-- src/Http/Exception/BadRequestException.php | 7 +-- ...ccountVerificationTokenMailPreviewData.php | 7 +-- .../ContactRequestMailPreviewData.php | 7 +-- .../Factory/CustomerPreviewDataFactory.php | 7 +-- .../Factory/PreviewDataFactoryInterface.php | 7 +-- .../GenericMailPreviewData.php | 7 +-- .../MailPreviewDataInterface.php | 7 +-- .../OrderConfirmationMailPreviewData.php | 7 +-- ...OrderConfirmationResentMailPreviewData.php | 7 +-- .../PasswordResetMailPreviewData.php | 7 +-- .../ShipmentConfirmationMailPreviewData.php | 7 +-- .../UserRegistrationMailPreviewData.php | 7 +-- src/Menu/EmailTemplateMenuListener.php | 9 ++-- .../CustomTwigErrorResponseProvider.php | 7 +-- ...stomTwigErrorResponseProviderInterface.php | 7 +-- src/Provider/EmailCodesProvider.php | 11 ++-- src/Provider/EmailCodesProviderInterface.php | 7 +-- src/Provider/MailPreviewDataProvider.php | 7 +-- .../MailPreviewDataProviderInterface.php | 7 +-- src/Repository/EmailTemplateRepository.php | 11 ++-- .../EmailTemplateRepositoryInterface.php | 9 ++-- .../EmailTemplateTranslationRepository.php | 9 ++-- ...TemplateTranslationRepositoryInterface.php | 9 ++-- src/Repository/RepositoryDecoratorTrait.php | 9 ++-- src/Request/MailPreviewRequest.php | 9 ++-- src/Request/RequestDtoInterface.php | 7 +-- .../TwigError/AbstractTwigErrorResponse.php | 9 ++-- .../SecurityNotAllowedFilterErrorResponse.php | 7 +-- ...ecurityNotAllowedFunctionErrorResponse.php | 7 +-- .../SecurityNotAllowedMethodErrorResponse.php | 7 +-- ...ecurityNotAllowedPropertyErrorResponse.php | 7 +-- .../SecurityNotAllowedTagErrorResponse.php | 7 +-- .../TwigError/TwigErrorResponseInterface.php | 7 +-- src/Twig/Sandbox/SecurityPolicy.php | 9 ++-- src/Validator/IsRenderableMailContent.php | 7 +-- .../IsRenderableMailContentValidator.php | 7 +-- .../Context/Setup/EmailTemplateContext.php | 8 +-- .../Context/Ui/Admin/EmailTemplateContext.php | 11 ++-- .../Behat/Context/Ui/EmailTemplateContext.php | 54 +++++++++---------- tests/Behat/Context/Ui/LoginContext.php | 8 +-- .../Element/Admin/PreviewModalElement.php | 7 +-- .../Admin/PreviewModalElementInterface.php | 7 +-- .../Page/Admin/EmailTemplate/CreatePage.php | 11 ++-- .../EmailTemplate/CreatePageInterface.php | 7 +-- .../Provider/EmailTemplateTypeProvider.php | 7 +-- tests/Repository/EmailTemplateTest.php | 11 ++-- 78 files changed, 421 insertions(+), 295 deletions(-) diff --git a/spec/EmailSender/SenderSpec.php b/spec/EmailSender/SenderSpec.php index 142b342..dc67cc7 100644 --- a/spec/EmailSender/SenderSpec.php +++ b/spec/EmailSender/SenderSpec.php @@ -1,9 +1,10 @@ beConstructedWith( $rendererAdapter, $senderAdapter, $provider, $defaultSettingsProvider, - $templateTranslationRepository + $templateTranslationRepository, ); $this->shouldHaveType(Sender::class); } @@ -60,7 +61,7 @@ function it_should_send_email( DefaultSettingsProviderInterface $defaultSettingsProvider, EmailTemplateTranslationRepositoryInterface $templateTranslationRepository, EmailInterface $email, - RenderedEmail $renderedEmail + RenderedEmail $renderedEmail, ): void { $this->beConstructedWith( $rendererAdapter, @@ -102,7 +103,7 @@ function it_should_set_custom_email_template_if_found( DefaultSettingsProviderInterface $defaultSettingsProvider, EmailTemplateTranslationRepositoryInterface $templateTranslationRepository, EmailInterface $email, - RenderedEmail $renderedEmail + RenderedEmail $renderedEmail, ): void { $this->beConstructedWith( $rendererAdapter, @@ -122,7 +123,7 @@ function it_should_set_custom_email_template_if_found( $emailTemplateTranslation = new EmailTemplateTranslation(); $templateTranslationRepository->findOneByLocaleCodeAndType( self::LOCALE, - self::EMAIL_TYPE + self::EMAIL_TYPE, )->willReturn($emailTemplateTranslation); $rendererAdapter->render($email, Argument::type('array'))->willReturn($renderedEmail); diff --git a/spec/EventListener/NotFoundTypeCreateEmailTemplateEventListenerSpec.php b/spec/EventListener/NotFoundTypeCreateEmailTemplateEventListenerSpec.php index 3578df2..9454965 100644 --- a/spec/EventListener/NotFoundTypeCreateEmailTemplateEventListenerSpec.php +++ b/spec/EventListener/NotFoundTypeCreateEmailTemplateEventListenerSpec.php @@ -1,9 +1,10 @@ attributes = $attributes; @@ -47,7 +48,7 @@ function it_should_do_nothing_when_route_is_not_create_email_template( RequestEvent $requestEvent, Request $request, ParameterBag $attributes, - EmailCodesProviderInterface $emailCodesProvider + EmailCodesProviderInterface $emailCodesProvider, ): void { $requestEvent->getRequest()->willReturn($request); @@ -64,7 +65,7 @@ function it_should_not_redirect_when_type_are_available_to_create_email_template ParameterBag $attributes, EmailCodesProviderInterface $emailCodesProvider, Session $session, - FlashBagInterface $flashBag + FlashBagInterface $flashBag, ): void { $requestEvent->getRequest()->willReturn($request); @@ -90,7 +91,7 @@ function it_should_redirect_when_route_is_create_email_template( Session $session, FlashBagInterface $flashBag, RouterInterface $router, - DataCollectorTranslator $dataCollectorTranslator + DataCollectorTranslator $dataCollectorTranslator, ): void { $requestEvent->getRequest()->willReturn($request); diff --git a/spec/EventListener/TwigErrorEventListenerSpec.php b/spec/EventListener/TwigErrorEventListenerSpec.php index 970bd9c..9a850c0 100644 --- a/spec/EventListener/TwigErrorEventListenerSpec.php +++ b/spec/EventListener/TwigErrorEventListenerSpec.php @@ -1,9 +1,10 @@ getWrappedObject(), $request->getWrappedObject(), HttpKernelInterface::MASTER_REQUEST, - new \Exception() + new \Exception(), ); $customTwigErrorResponseProvider->provide(Argument::type(Error::class))->shouldNotBeCalled(); @@ -53,14 +54,14 @@ function it_should_do_nothing_if_exception_is_not_a_twig_security_error( function it_should_do_nothing_if_provided_custom_response_is_null( HttpKernelInterface $httpKernel, Request $request, - CustomTwigErrorResponseProviderInterface $customTwigErrorResponseProvider + CustomTwigErrorResponseProviderInterface $customTwigErrorResponseProvider, ): void { $genericResponse = new Response(); $exceptionEvent = new ExceptionEvent( $httpKernel->getWrappedObject(), $request->getWrappedObject(), HttpKernelInterface::MASTER_REQUEST, - new \Exception() + new \Exception(), ); $exceptionEvent->setResponse($genericResponse); $customTwigErrorResponseProvider->provide(Argument::type(Error::class))->willReturn(null); @@ -73,7 +74,7 @@ function it_should_do_nothing_if_provided_custom_response_is_null( function it_should_set_response_to_the_provided_custom_twig_error_response( HttpKernelInterface $httpKernel, Request $request, - CustomTwigErrorResponseProviderInterface $customTwigErrorResponseProvider + CustomTwigErrorResponseProviderInterface $customTwigErrorResponseProvider, ): void { $jsonResponse = new JsonResponse(); $error = new Error('foo'); @@ -81,7 +82,7 @@ function it_should_set_response_to_the_provided_custom_twig_error_response( $httpKernel->getWrappedObject(), $request->getWrappedObject(), HttpKernelInterface::MASTER_REQUEST, - $error + $error, ); $exceptionEvent->setResponse(new Response()); $customTwigErrorResponseProvider->provide($error)->willReturn($jsonResponse); diff --git a/spec/MailPreviewData/Factory/CustomerPreviewDataFactorySpec.php b/spec/MailPreviewData/Factory/CustomerPreviewDataFactorySpec.php index 97d2a91..a4bfed6 100644 --- a/spec/MailPreviewData/Factory/CustomerPreviewDataFactorySpec.php +++ b/spec/MailPreviewData/Factory/CustomerPreviewDataFactorySpec.php @@ -1,9 +1,10 @@ beConstructedWith( self::EXAMPLE_EMAILS_CONFIGURATION, $emailTemplateRepository, - $dataCollectorTranslator + $dataCollectorTranslator, ); } @@ -93,12 +100,12 @@ function it_should_return_not_email_template_types(EmailTemplateRepositoryInterf function it_should_return_not_used_types_for_edit_email_template( EmailTemplateRepositoryInterface $emailTemplateRepository, EmailTemplateInterface $emailTemplate, - DataCollectorTranslator $dataCollectorTranslator + DataCollectorTranslator $dataCollectorTranslator, ): void { $dataCollectorTranslator->trans( 'Contact Request', [], - EmailTemplateType::MAIL_TEMPLATE_TYPE_DOMAIN + EmailTemplateType::MAIL_TEMPLATE_TYPE_DOMAIN, )->shouldBeCalled()->willReturn('Contact Request'); $emailTemplateRepository->getAllTypes()->willReturn([ diff --git a/spec/Provider/MailPreviewDataProviderSpec.php b/spec/Provider/MailPreviewDataProviderSpec.php index 884e39e..64019ff 100644 --- a/spec/Provider/MailPreviewDataProviderSpec.php +++ b/spec/Provider/MailPreviewDataProviderSpec.php @@ -1,5 +1,12 @@ $genericMailPreviewData, @@ -60,7 +67,7 @@ function it_should_throw_exception_if_matched_mail_preview_data_is_not_implement function it_should_return_mail_preview_data_for_requested_type( MailPreviewDataInterface $genericMailPreviewData, - MailPreviewDataInterface $fooMailPreviewData + MailPreviewDataInterface $fooMailPreviewData, ): void { $availableMailPreviewData = [ MailPreviewDataProvider::GENERIC_PREVIEW_DATA_KEY => $genericMailPreviewData, diff --git a/spec/Repository/EmailTemplateTranslationRepositorySpec.php b/spec/Repository/EmailTemplateTranslationRepositorySpec.php index 0e9e3e1..3835783 100644 --- a/spec/Repository/EmailTemplateTranslationRepositorySpec.php +++ b/spec/Repository/EmailTemplateTranslationRepositorySpec.php @@ -1,9 +1,10 @@ createQueryBuilder('tt', null)->willReturn($queryBuilder); diff --git a/spec/Response/TwigError/SecurityNotAllowedFilterErrorResponseSpec.php b/spec/Response/TwigError/SecurityNotAllowedFilterErrorResponseSpec.php index 96b3833..e09cbd0 100644 --- a/spec/Response/TwigError/SecurityNotAllowedFilterErrorResponseSpec.php +++ b/spec/Response/TwigError/SecurityNotAllowedFilterErrorResponseSpec.php @@ -1,5 +1,12 @@ '*', @@ -51,7 +52,7 @@ function it_should_not_call_decorated_object_on_check_method_if_allowed_methods_ } function it_should_not_call_decorated_object_on_check_method_if_allowed_methods_contains__class_wildcard_with_matching_method( - SecurityPolicyInterface $securityPolicy + SecurityPolicyInterface $securityPolicy, ): void { $allowedMethods = [ '*' => [ @@ -65,7 +66,7 @@ function it_should_not_call_decorated_object_on_check_method_if_allowed_methods_ } function it_should_not_call_decorated_object_on_check_method_if_allowed_methods_contains_wildcard_class_with_wildcard_method( - SecurityPolicyInterface $securityPolicy + SecurityPolicyInterface $securityPolicy, ): void { $allowedMethods = [ '*' => '*', @@ -77,7 +78,7 @@ function it_should_not_call_decorated_object_on_check_method_if_allowed_methods_ } function it_should_call_decorated_object_method_on_check_method_if_passed_object_or_method_doesnt_meet_requirements( - SecurityPolicyInterface $securityPolicy + SecurityPolicyInterface $securityPolicy, ): void { $securityPolicy->checkMethodAllowed(Argument::type('object'), self::EXAMPLE_METHOD)->shouldBeCalled(); diff --git a/spec/Validator/IsRenderableMailContentValidatorSpec.php b/spec/Validator/IsRenderableMailContentValidatorSpec.php index f964884..e9281d6 100644 --- a/spec/Validator/IsRenderableMailContentValidatorSpec.php +++ b/spec/Validator/IsRenderableMailContentValidatorSpec.php @@ -1,5 +1,12 @@ createEmailTemplateTranslationWithSampleEmailTemplate(); @@ -69,7 +76,7 @@ function it_should_add_violation_if_exception_is_thrown_while_rendering( $constraint = new IsRenderableMailContent(); $validator = new IsRenderableMailContentValidator( $twig->getWrappedObject(), - $mailPreviewDataProvider->getWrappedObject() + $mailPreviewDataProvider->getWrappedObject(), ); $validator->initialize($context->getWrappedObject()); @@ -85,7 +92,7 @@ function it_should_do_nothing_if_no_exception_has_been_thrown_while_rendering( ExecutionContextInterface $context, environment $twig, MailPreviewDataProviderInterface $mailPreviewDataProvider, - MailPreviewDataInterface $mailPreviewData + MailPreviewDataInterface $mailPreviewData, ): void { $emailTemplateTranslation = $this->createEmailTemplateTranslationWithSampleEmailTemplate(); @@ -97,7 +104,7 @@ function it_should_do_nothing_if_no_exception_has_been_thrown_while_rendering( $twig->render(RenderEmailPreviewAction::EMAIL_PREVIEW_TEMPLATE, Argument::type('array')); $validator = new IsRenderableMailContentValidator( $twig->getWrappedObject(), - $mailPreviewDataProvider->getWrappedObject() + $mailPreviewDataProvider->getWrappedObject(), ); $validator->initialize($context->getWrappedObject()); diff --git a/src/BitBagSyliusMailTemplatePlugin.php b/src/BitBagSyliusMailTemplatePlugin.php index 0a270bf..7d40d1f 100644 --- a/src/BitBagSyliusMailTemplatePlugin.php +++ b/src/BitBagSyliusMailTemplatePlugin.php @@ -1,10 +1,11 @@ setParameter( self::ALLOWED_FILTERS_PARAMETER, - array_unique(array_merge($config[Configuration::TWIG][Configuration::ALLOWED_FILTERS], self::REQUIRED_FILTERS)) + array_unique(array_merge($config[Configuration::TWIG][Configuration::ALLOWED_FILTERS], self::REQUIRED_FILTERS)), ); $container->setParameter( self::ALLOWED_FUNCTIONS_PARAMETER, - array_unique(array_merge($config[Configuration::TWIG][Configuration::ALLOWED_FUNCTIONS], self::REQUIRED_FUNCTIONS)) + array_unique(array_merge($config[Configuration::TWIG][Configuration::ALLOWED_FUNCTIONS], self::REQUIRED_FUNCTIONS)), ); $container->setParameter( self::ALLOWED_METHODS_PARAMETER, - $config[Configuration::TWIG][Configuration::ALLOWED_METHODS] + $config[Configuration::TWIG][Configuration::ALLOWED_METHODS], ); $container->setParameter( self::ALLOWED_PROPERTIES_PARAMETER, - $config[Configuration::TWIG][Configuration::ALLOWED_PROPERTIES] + $config[Configuration::TWIG][Configuration::ALLOWED_PROPERTIES], ); $container->setParameter( self::ALLOWED_TAGS_PARAMETER, - array_unique(array_merge($config[Configuration::TWIG][Configuration::ALLOWED_TAGS], self::REQUIRED_TAGS)) + array_unique(array_merge($config[Configuration::TWIG][Configuration::ALLOWED_TAGS], self::REQUIRED_TAGS)), ); } diff --git a/src/DependencyInjection/CompilerPass/SyliusBehatPolyfillCompilerPass.php b/src/DependencyInjection/CompilerPass/SyliusBehatPolyfillCompilerPass.php index d1d55d9..a656a08 100644 --- a/src/DependencyInjection/CompilerPass/SyliusBehatPolyfillCompilerPass.php +++ b/src/DependencyInjection/CompilerPass/SyliusBehatPolyfillCompilerPass.php @@ -1,9 +1,10 @@ senderAdapter = $senderAdapter; $this->rendererAdapter = $rendererAdapter; @@ -55,7 +55,7 @@ public function send( array $recipients, array $data = [], array $attachments = [], - array $replyTo = [] + array $replyTo = [], ): void { $email = $this->provider->getEmail($code); @@ -65,7 +65,7 @@ public function send( $customTemplate = $this->templateTranslationRepository->findOneByLocaleCodeAndType( $data[self::LOCALE_CODE_KEY] ?? '', - $code + $code, ); if (null !== $customTemplate) { @@ -86,7 +86,7 @@ public function send( $email, $data, $attachments, - $replyTo + $replyTo, ); } } diff --git a/src/EmailSender/SenderInterface.php b/src/EmailSender/SenderInterface.php index 4b43639..0da14ac 100644 --- a/src/EmailSender/SenderInterface.php +++ b/src/EmailSender/SenderInterface.php @@ -18,6 +18,6 @@ public function send( array $recipients, array $data = [], array $attachments = [], - array $replyTo = [] + array $replyTo = [], ): void; } diff --git a/src/Entity/EmailTemplate.php b/src/Entity/EmailTemplate.php index 66db9b6..f31c669 100644 --- a/src/Entity/EmailTemplate.php +++ b/src/Entity/EmailTemplate.php @@ -1,10 +1,11 @@ emailCodesProvider = $emailCodesProvider; $this->translator = $translator; diff --git a/src/EventListener/TwigErrorEventListener.php b/src/EventListener/TwigErrorEventListener.php index ae04230..8baeb40 100644 --- a/src/EventListener/TwigErrorEventListener.php +++ b/src/EventListener/TwigErrorEventListener.php @@ -1,9 +1,10 @@ emailTemplateFactory = $emailTemplateFactory; $this->emailTemplateTranslationFactory = $emailTemplateTranslationFactory; @@ -57,7 +57,7 @@ public function load(array $options): void private function createEmailTemplate( string $type, string $styleCss, - array $emailTemplateData + array $emailTemplateData, ): void { /** @var EmailTemplateInterface $emailTemplate */ $emailTemplate = $this->emailTemplateFactory->createNew(); diff --git a/src/Form/Type/EmailTemplateType.php b/src/Form/Type/EmailTemplateType.php index 7f8d940..3a922a4 100644 --- a/src/Form/Type/EmailTemplateType.php +++ b/src/Form/Type/EmailTemplateType.php @@ -1,10 +1,11 @@ emails = $emails; $this->emailTemplateRepository = $emailTemplateRepository; @@ -74,7 +75,7 @@ public function getAvailableEmailTemplateTypes(EmailTemplateInterface $emailTemp $translatedLabelName = $this->dataCollectorTranslator->trans( $labelName, [], - EmailTemplateType::MAIL_TEMPLATE_TYPE_DOMAIN + EmailTemplateType::MAIL_TEMPLATE_TYPE_DOMAIN, ); $types[$translatedLabelName] = $dataType; diff --git a/src/Provider/EmailCodesProviderInterface.php b/src/Provider/EmailCodesProviderInterface.php index c83dc7d..4a7f11d 100644 --- a/src/Provider/EmailCodesProviderInterface.php +++ b/src/Provider/EmailCodesProviderInterface.php @@ -1,9 +1,10 @@ select('et.type') ->getQuery() ->getResult() - ; + ; } } diff --git a/src/Repository/EmailTemplateRepositoryInterface.php b/src/Repository/EmailTemplateRepositoryInterface.php index 7afee5a..b1a7e8e 100644 --- a/src/Repository/EmailTemplateRepositoryInterface.php +++ b/src/Repository/EmailTemplateRepositoryInterface.php @@ -1,10 +1,11 @@ decoratedRepository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Request/MailPreviewRequest.php b/src/Request/MailPreviewRequest.php index db479a3..ebde15c 100644 --- a/src/Request/MailPreviewRequest.php +++ b/src/Request/MailPreviewRequest.php @@ -1,9 +1,10 @@ name = $name; $this->subject = $subject; diff --git a/src/Request/RequestDtoInterface.php b/src/Request/RequestDtoInterface.php index 59536c8..58fa7f0 100644 --- a/src/Request/RequestDtoInterface.php +++ b/src/Request/RequestDtoInterface.php @@ -1,9 +1,10 @@ $this->getErrorMessage($error), ], - Response::HTTP_BAD_REQUEST + Response::HTTP_BAD_REQUEST, ); } diff --git a/src/Response/TwigError/SecurityNotAllowedFilterErrorResponse.php b/src/Response/TwigError/SecurityNotAllowedFilterErrorResponse.php index ffd9850..094c9c7 100644 --- a/src/Response/TwigError/SecurityNotAllowedFilterErrorResponse.php +++ b/src/Response/TwigError/SecurityNotAllowedFilterErrorResponse.php @@ -1,9 +1,10 @@ decoratedSecurityPolicy->checkSecurity($tags, $filters, $functions); } diff --git a/src/Validator/IsRenderableMailContent.php b/src/Validator/IsRenderableMailContent.php index 8a9e06d..3188731 100644 --- a/src/Validator/IsRenderableMailContent.php +++ b/src/Validator/IsRenderableMailContent.php @@ -1,9 +1,10 @@ sharedStorage = $sharedStorage; $this->templateFactory = $templateFactory; @@ -47,7 +47,7 @@ public function thereIsMailTemplateWithTypeAndNameAndSubjectAndContent( string $type, string $name, string $subject, - string $content + string $content, ): void { $emailTemplate = $this->createEmailTemplate($type, $name, $subject, $content); @@ -62,7 +62,7 @@ public function thereIsMailTemplateWithTypeAndNameAndSubjectAndContentAndLocale( string $name, string $subject, string $content, - string $locale + string $locale, ): void { $emailTemplate = $this->createEmailTemplate($type, $name, $subject, $content, $locale); @@ -74,7 +74,7 @@ private function createEmailTemplate( ?string $name = null, ?string $subject = null, ?string $content = null, - ?string $locale = null + ?string $locale = null, ): EmailTemplateInterface { /** @var EmailTemplateTranslationInterface $emailTemplateTranslation */ $emailTemplateTranslation = $this->templateTranslationFactory->createNew(); diff --git a/tests/Behat/Context/Ui/Admin/EmailTemplateContext.php b/tests/Behat/Context/Ui/Admin/EmailTemplateContext.php index 813c15e..cc8ebf9 100644 --- a/tests/Behat/Context/Ui/Admin/EmailTemplateContext.php +++ b/tests/Behat/Context/Ui/Admin/EmailTemplateContext.php @@ -1,9 +1,10 @@ createPage = $createPage; $this->notificationChecker = $notificationChecker; @@ -88,7 +89,7 @@ public function iShouldBeNotifiedThatTheEmailTemplateHasBeenSuccessfullyCreated( { $this->notificationChecker->checkNotification( 'Email template has been successfully created.', - NotificationType::success() + NotificationType::success(), ); } diff --git a/tests/Behat/Context/Ui/EmailTemplateContext.php b/tests/Behat/Context/Ui/EmailTemplateContext.php index 1ae48bb..11bba3d 100644 --- a/tests/Behat/Context/Ui/EmailTemplateContext.php +++ b/tests/Behat/Context/Ui/EmailTemplateContext.php @@ -18,7 +18,6 @@ use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\ShipmentInterface; use Sylius\Component\Core\Model\ShippingMethodInterface; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Webmozart\Assert\Assert; final class EmailTemplateContext implements Context @@ -29,7 +28,7 @@ final class EmailTemplateContext implements Context public function __construct( SharedStorageInterface $sharedStorage, - EmailCheckerInterface $emailChecker + EmailCheckerInterface $emailChecker, ) { $this->sharedStorage = $sharedStorage; $this->emailChecker = $emailChecker; @@ -52,9 +51,9 @@ public function aCustomEmailShouldBeSentTo(string $recipient, string $sender): v sprintf( '%s wrote %s', $sender, - 'Hi! I did not receive an item!' + 'Hi! I did not receive an item!', ), - $recipient + $recipient, ); } @@ -69,9 +68,9 @@ public function aDefaultEmailShouldBeSentTo(string $recipient, string $sender): 'Message from', $sender, 'Content', - 'Hi! I did not receive an item!' + 'Hi! I did not receive an item!', ), - $recipient + $recipient, ); } @@ -83,7 +82,7 @@ public function aDefaultEmailWithResetTokenShouldBeSentTo(string $recipient, str { $this->assertEmailContainsMessageTo( 'To reset your password - click the link below', - $recipient + $recipient, ); } @@ -95,7 +94,7 @@ public function aCustomEmailWithResetTokenShouldBeSentTo(string $recipient, stri { $this->assertEmailContainsMessageTo( 'Wanna reset password? Here is your code:', - $recipient + $recipient, ); } @@ -105,15 +104,15 @@ public function aCustomEmailWithResetTokenShouldBeSentTo(string $recipient, stri public function anEmailWithShipmentsConfirmationForTheOrderShouldBeSentTo( string $method, string $orderNumber, - string $recipient + string $recipient, ): void { Assert::true($this->emailChecker->hasMessageTo( sprintf( 'Your order with number %s has been sent using %s.', $orderNumber, - $method + $method, ), - $recipient + $recipient, )); } @@ -124,7 +123,7 @@ public function aDefaultAccountVerificationEmailShouldHaveBeenSentTo(string $rec { $this->assertEmailContainsMessageTo( 'To verify your email address - click the link below', - $recipient + $recipient, ); } @@ -135,7 +134,7 @@ public function aCustomAccountVerificationEmailShouldHaveBeenSentTo(string $reci { $this->assertEmailContainsMessageTo( 'Verify yourself. We need you!', - $recipient + $recipient, ); } @@ -155,7 +154,7 @@ public function aWelcomingEmailShouldHaveBeenSentTo(string $recipient, string $l { $this->assertEmailContainsMessageTo( 'Enjoy our stuff!', - $recipient + $recipient, ); } @@ -167,7 +166,7 @@ public function aDefaultWelcomingEmailShouldHaveBeenSentTo(string $recipient, st { $this->assertEmailContainsMessageTo( 'You have just been registered. Thank you', - $recipient + $recipient, ); } @@ -178,15 +177,15 @@ public function aDefaultWelcomingEmailShouldHaveBeenSentTo(string $recipient, st public function anEmailWithTheConfirmationOfTheOrderShouldBeSentTo( OrderInterface $order, string $recipient, - string $localeCode = 'en_US' + string $localeCode = 'en_US', ): void { $this->assertEmailContainsMessageTo( sprintf( '%s %s', 'Pif paf', - $order->getNumber() + $order->getNumber(), ), - $recipient + $recipient, ); } @@ -197,16 +196,16 @@ public function anEmailWithTheConfirmationOfTheOrderShouldBeSentTo( public function aDefaultEmailWithTheConfirmationOfTheOrderShouldBeSentTo( OrderInterface $order, string $recipient, - string $localeCode = 'en_US' + string $localeCode = 'en_US', ): void { $this->assertEmailContainsMessageTo( sprintf( '%s %s %s', 'Your order no.', $order->getNumber(), - 'has been successfully placed.' + 'has been successfully placed.', ), - $recipient + $recipient, ); } @@ -251,11 +250,11 @@ public function aDefaultEmailWithSummaryOfOrderPlacedByShouldBeSentTo(OrderInter public function aDefaultEmailWithShipmentDetailsOfOrderShouldBeSentTo( OrderInterface $order, string $recipient, - string $localeCode = 'en_US' + string $localeCode = 'en_US', ): void { $this->assertEmailContainsMessageTo( 'Thank you for a successful transaction.', - $recipient + $recipient, ); } @@ -268,22 +267,22 @@ public function aDefaultEmailWithShipmentDetailsOfOrderShouldBeSentTo( public function anEmailWithShipmentDetailsOfOrderShouldBeSentTo( OrderInterface $order, string $recipient, - string $localeCode = 'en_US' + string $localeCode = 'en_US', ): void { $this->assertEmailContainsMessageTo( sprintf( '%s %s %s', 'Enjoy your new stuff!', $order->getNumber(), - $this->getShippingMethodName($order) + $this->getShippingMethodName($order), ), - $recipient + $recipient, ); if ($this->sharedStorage->has('tracking_code')) { $this->assertEmailContainsMessageTo( $this->sharedStorage->get('tracking_code'), - $recipient + $recipient, ); } } @@ -306,6 +305,7 @@ private function getShippingMethodName(OrderInterface $order): string Assert::notNull($shippingMethod); Assert::notNull($shippingMethod->getName()); + return $shippingMethod->getName(); } } diff --git a/tests/Behat/Context/Ui/LoginContext.php b/tests/Behat/Context/Ui/LoginContext.php index a5ac491..92544cb 100644 --- a/tests/Behat/Context/Ui/LoginContext.php +++ b/tests/Behat/Context/Ui/LoginContext.php @@ -54,7 +54,7 @@ public function __construct( WellKnownPasswordChangePageInterface $wellKnownPasswordChangePage, RegisterElementInterface $registerElement, NotificationCheckerInterface $notificationChecker, - CurrentPageResolverInterface $currentPageResolver + CurrentPageResolverInterface $currentPageResolver, ) { $this->homePage = $homePage; $this->loginPage = $loginPage; @@ -255,7 +255,7 @@ public function iShouldBeNotifiedThatEmailWithResetInstructionWasSent(): void { $this->notificationChecker->checkNotification( 'If the email you have specified exists in our system, we have sent there an instruction on how to reset your password.', - NotificationType::success() + NotificationType::success(), ); } @@ -296,7 +296,7 @@ public function iShouldBeNotifiedThatTheEnteredPasswordsDoNotMatch(): void { Assert::true($this->resetPasswordPage->checkValidationMessageFor( 'password', - 'The entered passwords don\'t match' + 'The entered passwords don\'t match', )); } @@ -307,7 +307,7 @@ public function iShouldBeNotifiedThatThePasswordShouldBeAtLeastCharactersLong(): { Assert::true($this->resetPasswordPage->checkValidationMessageFor( 'password', - 'Password must be at least 4 characters long.' + 'Password must be at least 4 characters long.', )); } diff --git a/tests/Behat/Element/Admin/PreviewModalElement.php b/tests/Behat/Element/Admin/PreviewModalElement.php index 108f58e..458b366 100644 --- a/tests/Behat/Element/Admin/PreviewModalElement.php +++ b/tests/Behat/Element/Admin/PreviewModalElement.php @@ -1,9 +1,10 @@ getDriver()->executeScript( - sprintf('document.querySelector("[name=\'%s\']").value = "%s";', $field, $value) + sprintf('document.querySelector("[name=\'%s\']").value = "%s";', $field, $value), ); } diff --git a/tests/Behat/Page/Admin/EmailTemplate/CreatePageInterface.php b/tests/Behat/Page/Admin/EmailTemplate/CreatePageInterface.php index df70acd..3113877 100644 --- a/tests/Behat/Page/Admin/EmailTemplate/CreatePageInterface.php +++ b/tests/Behat/Page/Admin/EmailTemplate/CreatePageInterface.php @@ -1,9 +1,10 @@ emailCodesProvider->provideWithLabelsNotUsedTypes()) + count($this->emailCodesProvider->provideWithLabelsNotUsedTypes()), ); } } From d1a939bda869a19ff3e0cf5494f00ecea577a417 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 21:38:51 +0200 Subject: [PATCH 14/30] Remove psalm package, change friendsofsymfony/oauth-server-bundle version to master for php support --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 1b44a06..6ca0dac 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "friends-of-behat/suite-settings-extension": "^1.0", "friends-of-behat/symfony-extension": "^2.1", "friends-of-behat/variadic-extension": "^1.3", - "friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev", + "friendsofsymfony/oauth-server-bundle": "dev-master", "lchrusciel/api-test-case": "^5.2", "phpspec/phpspec": "^7.0", "phpunit/phpunit": "^9.5", @@ -39,7 +39,6 @@ "symfony/intl": "^5.4 || ^6.0", "symfony/web-profiler-bundle": "^5.4 || ^6.0", "symfony/webpack-encore-bundle": "^1.13", - "vimeo/psalm": "4.7.1", "polishsymfonycommunity/symfony-mocker-container": "^1.0" }, "config": { From 946ccafae649873c087d2006cbf3078c65b6bbb9 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Tue, 14 May 2024 21:42:49 +0200 Subject: [PATCH 15/30] Fix build typo --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 43c264e..46f3ba8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.2"]compose + php: ["8.2"] symfony: ["^5.4", "^6.0"] sylius: ["~1.12.0", "~1.13.0"] node: ["14.x"] From cfe2559da171d00751cd5e3e4846d6eed6dfda99 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Fri, 17 May 2024 11:44:08 +0200 Subject: [PATCH 16/30] Add mailhog docker --- docker-compose.yml | 13 ++++++++ tests/Application/.env | 7 +++++ .../config/packages/prod/doctrine.yaml | 31 ------------------- 3 files changed, 20 insertions(+), 31 deletions(-) create mode 100644 docker-compose.yml delete mode 100644 tests/Application/config/packages/prod/doctrine.yaml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..47c0c3f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3.4' + +services: + mailhog: + # do not use in production! + image: mailhog/mailhog:latest + environment: + - MH_STORAGE=maildir + # volumes: + # - ./docker/mailhog/maildir:/maildir:rw,delegated + ports: + - "8025:8025" + - "1025:1025" diff --git a/tests/Application/.env b/tests/Application/.env index 26f3fac..552028c 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -21,6 +21,13 @@ JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem JWT_PASSPHRASE=topsecret ###< lexik/jwt-authentication-bundle ### +###> symfony/mailer ### +MAILER_DSN=null://null + +# Use with docker-compose.yml mailhog configuration +#MAILER_DSN=smtp://localhost:1025 +###< symfony/mailer ### + ###> symfony/messenger ### # Choose one of the transports below # MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages diff --git a/tests/Application/config/packages/prod/doctrine.yaml b/tests/Application/config/packages/prod/doctrine.yaml deleted file mode 100644 index 2f16f0f..0000000 --- a/tests/Application/config/packages/prod/doctrine.yaml +++ /dev/null @@ -1,31 +0,0 @@ -doctrine: - orm: - metadata_cache_driver: - type: service - id: doctrine.system_cache_provider - query_cache_driver: - type: service - id: doctrine.system_cache_provider - result_cache_driver: - type: service - id: doctrine.result_cache_provider - -services: - doctrine.result_cache_provider: - class: Symfony\Component\Cache\DoctrineProvider - public: false - arguments: - - '@doctrine.result_cache_pool' - doctrine.system_cache_provider: - class: Symfony\Component\Cache\DoctrineProvider - public: false - arguments: - - '@doctrine.system_cache_pool' - -framework: - cache: - pools: - doctrine.result_cache_pool: - adapter: cache.app - doctrine.system_cache_pool: - adapter: cache.system From c5855d06f0d173c99e9576ec66ebf91f431d4eea Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Fri, 17 May 2024 11:44:25 +0200 Subject: [PATCH 17/30] Adjust behat tests to Sylius 1.13 --- .../receiving_user_registration_emails.feature | 6 +++--- tests/Behat/Context/Ui/EmailTemplateContext.php | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/features/shop/receiving_user_registration_emails.feature b/features/shop/receiving_user_registration_emails.feature index ae472b3..9fdf762 100644 --- a/features/shop/receiving_user_registration_emails.feature +++ b/features/shop/receiving_user_registration_emails.feature @@ -14,7 +14,7 @@ Feature: Receiving set of welcoming emails after registration @ui @email Scenario: Receiving a custom welcoming email after registration - Given there is mail template with "user_registration" type and "User registration" name and "Welcome to our shop!" subject and "Enjoy our stuff!" content + Given there is mail template with "verification_token" type and "User registration" name and "Welcome to our shop!" subject and "Enjoy our stuff!" content When I register with email "ghastly@bespoke.com" and password "suitsarelife" Then a welcoming email should have been sent to "ghastly@bespoke.com" @@ -24,7 +24,7 @@ Feature: Receiving set of welcoming emails after registration When I register with email "ghastly@bespoke.com" and password "suitsarelife" Then I should be notified that my account has been created and the verification email has been sent And a default account verification email should have been sent to "ghastly@bespoke.com" - And 2 emails should be sent to "ghastly@bespoke.com" + And emails should be sent to "ghastly@bespoke.com" depending on Sylius version But I should not be able to log in as "ghastly@bespoke.com" with "suitsarelife" password @ui @email @@ -33,5 +33,5 @@ Feature: Receiving set of welcoming emails after registration When I register with email "ghastly@bespoke.com" and password "suitsarelife" Then I should be notified that my account has been created and the verification email has been sent And a custom account verification email should have been sent to "ghastly@bespoke.com" - And 2 emails should be sent to "ghastly@bespoke.com" + And emails should be sent to "ghastly@bespoke.com" depending on Sylius version But I should not be able to log in as "ghastly@bespoke.com" with "suitsarelife" password diff --git a/tests/Behat/Context/Ui/EmailTemplateContext.php b/tests/Behat/Context/Ui/EmailTemplateContext.php index 11bba3d..c773ef7 100644 --- a/tests/Behat/Context/Ui/EmailTemplateContext.php +++ b/tests/Behat/Context/Ui/EmailTemplateContext.php @@ -19,6 +19,7 @@ use Sylius\Component\Core\Model\ShipmentInterface; use Sylius\Component\Core\Model\ShippingMethodInterface; use Webmozart\Assert\Assert; +use Sylius\Bundle\CoreBundle\SyliusCoreBundle; final class EmailTemplateContext implements Context { @@ -146,6 +147,20 @@ public function numberOfEmailsShouldBeSentTo(int $count, string $recipient): voi Assert::same($this->emailChecker->countMessagesTo($recipient), $count); } + /** + * @Then email(s) should be sent to :recipient depending on Sylius version + */ + public function numberOfEmailsShouldBeSentToDependingOnSyliusVersion(string $recipient): void + { + $count = 1; + + if (13 !== (int) SyliusCoreBundle::MINOR_VERSION) { + $count = 2; + } + + Assert::same($this->emailChecker->countMessagesTo($recipient), $count); + } + /** * @Then a welcoming email should have been sent to :recipient * @Then a welcoming email should have been sent to :recipient in :localeCode locale @@ -165,7 +180,7 @@ public function aWelcomingEmailShouldHaveBeenSentTo(string $recipient, string $l public function aDefaultWelcomingEmailShouldHaveBeenSentTo(string $recipient, string $localeCode = 'en_US'): void { $this->assertEmailContainsMessageTo( - 'You have just been registered. Thank you', + 'To verify your email address - click the link below', $recipient, ); } From db5761b33c36e2596d7c2fc54ed923733f9360a0 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Fri, 17 May 2024 11:46:20 +0200 Subject: [PATCH 18/30] Coding standard fixes --- tests/Behat/Context/Ui/EmailTemplateContext.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Behat/Context/Ui/EmailTemplateContext.php b/tests/Behat/Context/Ui/EmailTemplateContext.php index c773ef7..8e0edc8 100644 --- a/tests/Behat/Context/Ui/EmailTemplateContext.php +++ b/tests/Behat/Context/Ui/EmailTemplateContext.php @@ -14,12 +14,12 @@ use Behat\Behat\Context\Context; use Sylius\Behat\Service\Checker\EmailCheckerInterface; use Sylius\Behat\Service\SharedStorageInterface; +use Sylius\Bundle\CoreBundle\SyliusCoreBundle; use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\ShipmentInterface; use Sylius\Component\Core\Model\ShippingMethodInterface; use Webmozart\Assert\Assert; -use Sylius\Bundle\CoreBundle\SyliusCoreBundle; final class EmailTemplateContext implements Context { @@ -154,6 +154,7 @@ public function numberOfEmailsShouldBeSentToDependingOnSyliusVersion(string $rec { $count = 1; + /** @phpstan-ignore-next-line */ if (13 !== (int) SyliusCoreBundle::MINOR_VERSION) { $count = 2; } From ec11a8997799e389537aa5f3aef0f307b30ea632 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Mon, 20 May 2024 08:46:29 +0200 Subject: [PATCH 19/30] Remove oauth symfony bundle --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 6ca0dac..13d2512 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,6 @@ "friends-of-behat/suite-settings-extension": "^1.0", "friends-of-behat/symfony-extension": "^2.1", "friends-of-behat/variadic-extension": "^1.3", - "friendsofsymfony/oauth-server-bundle": "dev-master", "lchrusciel/api-test-case": "^5.2", "phpspec/phpspec": "^7.0", "phpunit/phpunit": "^9.5", From 728da89bf09766713318f784047ce3fd7473fe77 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Mon, 20 May 2024 09:13:35 +0200 Subject: [PATCH 20/30] Remove sensiolabs security checker package --- composer.json | 1 - tests/Application/config/packages/security_checker.yaml | 9 --------- 2 files changed, 10 deletions(-) delete mode 100644 tests/Application/config/packages/security_checker.yaml diff --git a/composer.json b/composer.json index 13d2512..f028f2f 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,6 @@ "lchrusciel/api-test-case": "^5.2", "phpspec/phpspec": "^7.0", "phpunit/phpunit": "^9.5", - "sensiolabs/security-checker": "^6.0", "sylius-labs/coding-standard": "^4.0", "symfony/browser-kit": "^5.4 || ^6.0", "symfony/debug-bundle": "^5.4 || ^6.0", diff --git a/tests/Application/config/packages/security_checker.yaml b/tests/Application/config/packages/security_checker.yaml deleted file mode 100644 index 0f9cf00..0000000 --- a/tests/Application/config/packages/security_checker.yaml +++ /dev/null @@ -1,9 +0,0 @@ -services: - SensioLabs\Security\SecurityChecker: - public: false - - SensioLabs\Security\Command\SecurityCheckerCommand: - arguments: ['@SensioLabs\Security\SecurityChecker'] - public: false - tags: - - { name: console.command, command: 'security:check' } From 77033c787b4268d9b9fe99673f958e92b5bc31f8 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Mon, 20 May 2024 09:24:31 +0200 Subject: [PATCH 21/30] Symfony upgrade configuration property --- tests/Application/config/packages/test/framework.yaml | 2 +- tests/Application/config/packages/test_cached/framework.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Application/config/packages/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml index 76d7e5e..cac2181 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 + handler_id: session.storage.mock_file diff --git a/tests/Application/config/packages/test_cached/framework.yaml b/tests/Application/config/packages/test_cached/framework.yaml index 76d7e5e..cac2181 100644 --- a/tests/Application/config/packages/test_cached/framework.yaml +++ b/tests/Application/config/packages/test_cached/framework.yaml @@ -1,4 +1,4 @@ framework: test: ~ session: - storage_id: session.storage.mock_file + handler_id: session.storage.mock_file From d8e146d7653390db5e90295f05cf830d1490071e Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Mon, 20 May 2024 09:24:39 +0200 Subject: [PATCH 22/30] Add php stan ignore --- src/Repository/RepositoryDecoratorTrait.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Repository/RepositoryDecoratorTrait.php b/src/Repository/RepositoryDecoratorTrait.php index 5e3646d..a502792 100644 --- a/src/Repository/RepositoryDecoratorTrait.php +++ b/src/Repository/RepositoryDecoratorTrait.php @@ -32,11 +32,12 @@ public function findAll(): array /** * @return array */ + /** @phpstan-ignore-next-line */ public function findBy( array $criteria, ?array $orderBy = null, - ?int $limit = null, - ?int $offset = null, + $limit = null, + $offset = null, ): array { return $this->decoratedRepository->findBy($criteria, $orderBy, $limit, $offset); } From 288b352c51be58c48b1bf43829c6e17b422541b2 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Mon, 20 May 2024 09:44:44 +0200 Subject: [PATCH 23/30] Symfony upgrade changes --- tests/Application/config/packages/test/framework.yaml | 2 +- tests/Application/config/packages/test/security.yaml | 2 +- tests/Application/config/packages/test_cached/framework.yaml | 2 +- tests/Application/config/packages/test_cached/security.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Application/config/packages/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml index cac2181..daf04d4 100644 --- a/tests/Application/config/packages/test/framework.yaml +++ b/tests/Application/config/packages/test/framework.yaml @@ -1,4 +1,4 @@ framework: test: ~ session: - handler_id: session.storage.mock_file + handler_id: ~ diff --git a/tests/Application/config/packages/test/security.yaml b/tests/Application/config/packages/test/security.yaml index 21cc377..8ccd542 100644 --- a/tests/Application/config/packages/test/security.yaml +++ b/tests/Application/config/packages/test/security.yaml @@ -1,3 +1,3 @@ security: - encoders: + password_hashers: sha512: sha512 diff --git a/tests/Application/config/packages/test_cached/framework.yaml b/tests/Application/config/packages/test_cached/framework.yaml index cac2181..daf04d4 100644 --- a/tests/Application/config/packages/test_cached/framework.yaml +++ b/tests/Application/config/packages/test_cached/framework.yaml @@ -1,4 +1,4 @@ framework: test: ~ session: - handler_id: session.storage.mock_file + handler_id: ~ diff --git a/tests/Application/config/packages/test_cached/security.yaml b/tests/Application/config/packages/test_cached/security.yaml index 21cc377..8ccd542 100644 --- a/tests/Application/config/packages/test_cached/security.yaml +++ b/tests/Application/config/packages/test_cached/security.yaml @@ -1,3 +1,3 @@ security: - encoders: + password_hashers: sha512: sha512 From cccbdfc91a8c801e8f78b631d129d2b87e81ce61 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Mon, 20 May 2024 10:13:53 +0200 Subject: [PATCH 24/30] Replace incorrect class --- .../NotFoundTypeCreateEmailTemplateEventListenerSpec.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/EventListener/NotFoundTypeCreateEmailTemplateEventListenerSpec.php b/spec/EventListener/NotFoundTypeCreateEmailTemplateEventListenerSpec.php index 9454965..394ef55 100644 --- a/spec/EventListener/NotFoundTypeCreateEmailTemplateEventListenerSpec.php +++ b/spec/EventListener/NotFoundTypeCreateEmailTemplateEventListenerSpec.php @@ -16,7 +16,6 @@ use PhpSpec\ObjectBehavior; use Prophecy\Argument; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; -use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; @@ -47,10 +46,12 @@ function it_is_initializable(): void function it_should_do_nothing_when_route_is_not_create_email_template( RequestEvent $requestEvent, Request $request, - ParameterBag $attributes, + ParameterBagInterface $attributes, EmailCodesProviderInterface $emailCodesProvider, + Session $session, ): void { $requestEvent->getRequest()->willReturn($request); + $request->getSession()->willReturn($session); $attributes->get('_route')->shouldBeCalled()->willReturn('wrong_route'); @@ -62,7 +63,7 @@ function it_should_do_nothing_when_route_is_not_create_email_template( function it_should_not_redirect_when_type_are_available_to_create_email_template( RequestEvent $requestEvent, Request $request, - ParameterBag $attributes, + ParameterBagInterface $attributes, EmailCodesProviderInterface $emailCodesProvider, Session $session, FlashBagInterface $flashBag, @@ -86,7 +87,7 @@ function it_should_not_redirect_when_type_are_available_to_create_email_template function it_should_redirect_when_route_is_create_email_template( RequestEvent $requestEvent, Request $request, - ParameterBag $attributes, + ParameterBagInterface $attributes, EmailCodesProviderInterface $emailCodesProvider, Session $session, FlashBagInterface $flashBag, From 7e3aaa98523073f0b87c1fbb24ea7e8c59126405 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Mon, 20 May 2024 10:14:06 +0200 Subject: [PATCH 25/30] Increase js wait time in behat --- tests/Behat/Page/Admin/EmailTemplate/CreatePage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Behat/Page/Admin/EmailTemplate/CreatePage.php b/tests/Behat/Page/Admin/EmailTemplate/CreatePage.php index 2132a38..2639d2c 100644 --- a/tests/Behat/Page/Admin/EmailTemplate/CreatePage.php +++ b/tests/Behat/Page/Admin/EmailTemplate/CreatePage.php @@ -76,7 +76,7 @@ public function preview(string $locale): void */ public function checkHasPreviewModal(string $subject, string $content): void { - $this->getDriver()->wait(300, 'document.querySelector(".mail-preview").offsetParent !== null'); + $this->getDriver()->wait(1000, 'document.querySelector(".mail-preview").offsetParent !== null'); Assert::true($this->previewModal->isModalVisible()); /** @phpstan-ignore-next-line */ Assert::contains($this->previewModal->getSubject(), $subject); From 8561a72087d896a58561ea8e224c7a6ba714abfc Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Mon, 20 May 2024 10:32:40 +0200 Subject: [PATCH 26/30] Use getContainer method --- tests/Repository/EmailTemplateTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Repository/EmailTemplateTest.php b/tests/Repository/EmailTemplateTest.php index 6241f8f..967a07b 100644 --- a/tests/Repository/EmailTemplateTest.php +++ b/tests/Repository/EmailTemplateTest.php @@ -36,7 +36,7 @@ protected function setUp(): void { self::bootKernel(); - $container = self::$container; + $container = $this->getContainer(); $this->emailTemplateRepository = $container->get('bitbag_sylius_mail_template_plugin.custom_repository.email_template'); $this->emailCodesProvider = $container->get('bitbag_sylius_mail_template_plugin.provider.email_codes'); From 2e5f5946857ad040907efe7bcb0d795182100172 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Mon, 20 May 2024 10:32:54 +0200 Subject: [PATCH 27/30] Add doctrine annotations package --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f028f2f..ab99f2f 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ "require": { "php": "^8.2", "sylius/sylius": "~1.12.0 || ~1.13.0", - "twig/inky-extra": "^3.3" + "twig/inky-extra": "^3.3", + "doctrine/annotations": "^1.14" }, "require-dev": { "behat/behat": "^3.7", From 5aebc60eefd0387b8c0dd7fdeb1c137bf0f1b494 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Wed, 22 May 2024 08:46:26 +0200 Subject: [PATCH 28/30] Add more php versions support --- .github/workflows/build.yml | 2 +- .github/workflows/coding_standard.yml | 2 +- composer.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 46f3ba8..73a28d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.2"] + php: ["8.1", "8.2"] symfony: ["^5.4", "^6.0"] sylius: ["~1.12.0", "~1.13.0"] node: ["14.x"] diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index 2ccc6a7..e725e3e 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.2"] + php: ["8.1", "8.2"] symfony: ["^5.4", "^6.0"] sylius: ["~1.12.0", "~1.13.0"] node: ["14.x"] diff --git a/composer.json b/composer.json index ab99f2f..bba6f23 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ ], "license": "MIT", "require": { - "php": "^8.2", + "php": "^8.1", "sylius/sylius": "~1.12.0 || ~1.13.0", "twig/inky-extra": "^3.3", "doctrine/annotations": "^1.14" From b12ee9490787f4ee3b06f73647f683342d98bc5b Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Wed, 22 May 2024 08:57:04 +0200 Subject: [PATCH 29/30] Add documentation about docker image --- doc/testing.md | 11 +++++++++++ docker-compose.yml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/testing.md b/doc/testing.md index 55fadcc..aa29731 100644 --- a/doc/testing.md +++ b/doc/testing.md @@ -15,3 +15,14 @@ $ cd ../.. $ vendor/bin/behat $ vendor/bin/phpspec run ``` +## Testing emails with quick docker setup + +Steps to use mailhog docker image +- create `tests/Application/.env.local` +- copy content from `tests/Application/.env` +- `MAILER_DSN=null://null` -> comment this line +- `#MAILER_DSN=smtp://localhost:1025` -> uncomment this line +- remember to match port with docker image - by default they are set to 1025 +- start docker image with `docker-compose -f docker-compose.yml up` +- you can access mailhog UI on second mapped port - by default 8025 + diff --git a/docker-compose.yml b/docker-compose.yml index 47c0c3f..94e353f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,5 +9,5 @@ services: # volumes: # - ./docker/mailhog/maildir:/maildir:rw,delegated ports: - - "8025:8025" + - "8025:8025" # UI - "1025:1025" From aee3fb10892a60943e2369c9f615ba3d20df5b46 Mon Sep 17 00:00:00 2001 From: Marek Rzytki Date: Wed, 22 May 2024 09:02:21 +0200 Subject: [PATCH 30/30] Increase wait time in randomly failing behat scenario --- tests/Behat/Page/Admin/EmailTemplate/CreatePage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Behat/Page/Admin/EmailTemplate/CreatePage.php b/tests/Behat/Page/Admin/EmailTemplate/CreatePage.php index 2639d2c..d9fd535 100644 --- a/tests/Behat/Page/Admin/EmailTemplate/CreatePage.php +++ b/tests/Behat/Page/Admin/EmailTemplate/CreatePage.php @@ -76,7 +76,7 @@ public function preview(string $locale): void */ public function checkHasPreviewModal(string $subject, string $content): void { - $this->getDriver()->wait(1000, 'document.querySelector(".mail-preview").offsetParent !== null'); + $this->getDriver()->wait(3000, 'document.querySelector(".mail-preview").offsetParent !== null'); Assert::true($this->previewModal->isModalVisible()); /** @phpstan-ignore-next-line */ Assert::contains($this->previewModal->getSubject(), $subject);