From 76515da01f9c818feefddfbbf32da72264d3ff01 Mon Sep 17 00:00:00 2001 From: janpalen Date: Tue, 30 Jul 2024 17:34:47 +0200 Subject: [PATCH 1/7] OP-448 - Update dependencies --- composer.json | 7 +- tests/Application/.env | 11 +- tests/Application/Kernel.php | 12 +- tests/Application/config/bundles.php | 15 +- .../config/packages/dev/jms_serializer.yaml | 8 + .../config/packages/dev/swiftmailer.yaml | 2 - tests/Application/config/packages/mailer.yaml | 3 + .../config/packages/prod/jms_serializer.yaml | 6 + .../config/packages/security_checker.yaml | 9 - .../config/packages/staging/swiftmailer.yaml | 2 - .../config/packages/swiftmailer.yaml | 2 - .../config/packages/test/swiftmailer.yaml | 6 - .../packages/test_cached/swiftmailer.yaml | 6 - tests/Application/config/routes.yaml | 1 - .../config/routes/sylius_shop.yaml | 2 +- .../config/sylius/1.10/bundles.php | 6 - .../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.12/packages/mailer.yaml | 3 + .../{1.10 => 1.12}/packages/security.yaml | 86 ++++------ .../sylius/1.12/packages/test/mailer.yaml | 7 + .../config/sylius/1.13/bundles.php | 7 + .../config/sylius/1.13/packages/_sylius.yaml | 2 + .../{1.11 => 1.13}/packages/security.yaml | 86 ++++------ .../sylius/1.13/packages/test/mailer.yaml | 7 + .../sylius/1.13/packages/test/security.yaml | 3 + .../Application/config/sylius/1.9/bundles.php | 8 - .../config/sylius/1.9/packages/_sylius.yaml | 2 - .../config/sylius/1.9/packages/security.yaml | 159 ------------------ .../sylius/1.9/routes/sylius_admin_api.yaml | 3 - .../symfony/4.4/packages/framework.yaml | 2 - tests/Application/package.json | 64 ++++--- 34 files changed, 174 insertions(+), 398 deletions(-) create mode 100644 tests/Application/config/packages/dev/jms_serializer.yaml delete mode 100644 tests/Application/config/packages/dev/swiftmailer.yaml create mode 100644 tests/Application/config/packages/mailer.yaml create mode 100644 tests/Application/config/packages/prod/jms_serializer.yaml delete mode 100644 tests/Application/config/packages/security_checker.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/routes.yaml delete mode 100644 tests/Application/config/sylius/1.10/bundles.php 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 create mode 100644 tests/Application/config/sylius/1.12/packages/mailer.yaml rename tests/Application/config/sylius/{1.10 => 1.12}/packages/security.yaml (58%) create mode 100644 tests/Application/config/sylius/1.12/packages/test/mailer.yaml create mode 100644 tests/Application/config/sylius/1.13/bundles.php create mode 100644 tests/Application/config/sylius/1.13/packages/_sylius.yaml rename tests/Application/config/sylius/{1.11 => 1.13}/packages/security.yaml (58%) create mode 100644 tests/Application/config/sylius/1.13/packages/test/mailer.yaml create mode 100644 tests/Application/config/sylius/1.13/packages/test/security.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/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 diff --git a/composer.json b/composer.json index f3b68ca..134da6e 100644 --- a/composer.json +++ b/composer.json @@ -5,15 +5,14 @@ "description": "MultiSafepay payment plugin for Sylius applications.", "license": "MIT", "require": { - "php": "^7.4 || ^8.0", + "php": "^8.0", "doctrine/annotations": "^1.13", - "friendsofphp/php-cs-fixer": "^3.3", "multisafepay/api": "^2.0", "php-http/message-factory": "^1.1", - "sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0" + "sylius/sylius": "~1.12.0" }, "require-dev": { - "babdev/pagerfanta-bundle": "^2.5", + "babdev/pagerfanta-bundle": "^3.0", "behat/behat": "^3.6.1", "behat/mink-selenium2-driver": "^1.4", "bitbag/coding-standard": "^1.0", diff --git a/tests/Application/.env b/tests/Application/.env index ab99ad1..e9711c8 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -12,7 +12,7 @@ APP_SECRET=EDITME # Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url # For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db" # Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls -DATABASE_URL=mysql://root@127.0.0.1/sylius_%kernel.environment%?serverVersion=5.5 +DATABASE_URL=mysql://root@127.0.0.1/sylius_multi_safepay%kernel.environment%?serverVersion=8.0 ###< doctrine/doctrine-bundle ### ###> lexik/jwt-authentication-bundle ### @@ -21,12 +21,9 @@ JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem JWT_PASSPHRASE=acme_plugin_development ###< lexik/jwt-authentication-bundle ### -###> symfony/swiftmailer-bundle ### -# For Gmail as a transport, use: "gmail://username:password@localhost" -# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" -# Delivery is disabled by default via "null://localhost" -MAILER_URL=smtp://localhost -###< symfony/swiftmailer-bundle ### +###> symfony/mailer ### +MAILER_DSN=null://null +###< symfony/mailer ### ###> symfony/messenger ### # Choose one of the transports below diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index f993094..a0243e6 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Kernel as BaseKernel; -use Symfony\Component\Routing\RouteCollectionBuilder; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; final class Kernel extends BaseKernel { @@ -59,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); @@ -88,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); + $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS); + $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS); } /** diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index dd3f7aa..80eb2f2 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -1,10 +1,18 @@ ['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], @@ -54,4 +62,9 @@ Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], + Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], + League\FlysystemBundle\FlysystemBundle::class => ['all' => true], + Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], + BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], + SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/packages/dev/jms_serializer.yaml b/tests/Application/config/packages/dev/jms_serializer.yaml new file mode 100644 index 0000000..a530cb1 --- /dev/null +++ b/tests/Application/config/packages/dev/jms_serializer.yaml @@ -0,0 +1,8 @@ + +jms_serializer: + visitors: + json_serialization: + options: + - JSON_PRETTY_PRINT + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/packages/dev/swiftmailer.yaml b/tests/Application/config/packages/dev/swiftmailer.yaml deleted file mode 100644 index f438078..0000000 --- a/tests/Application/config/packages/dev/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - disable_delivery: true diff --git a/tests/Application/config/packages/mailer.yaml b/tests/Application/config/packages/mailer.yaml new file mode 100644 index 0000000..0a0697c --- /dev/null +++ b/tests/Application/config/packages/mailer.yaml @@ -0,0 +1,3 @@ +framework: + mailer: + dsn: '%env(MAILER_DSN)%' diff --git a/tests/Application/config/packages/prod/jms_serializer.yaml b/tests/Application/config/packages/prod/jms_serializer.yaml new file mode 100644 index 0000000..814e821 --- /dev/null +++ b/tests/Application/config/packages/prod/jms_serializer.yaml @@ -0,0 +1,6 @@ +jms_serializer: + visitors: + json_serialization: + options: + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION 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' } 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/routes.yaml b/tests/Application/config/routes.yaml deleted file mode 100644 index 8b13789..0000000 --- a/tests/Application/config/routes.yaml +++ /dev/null @@ -1 +0,0 @@ - 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.10/bundles.php b/tests/Application/config/sylius/1.10/bundles.php deleted file mode 100644 index bd33f4a..0000000 --- a/tests/Application/config/sylius/1.10/bundles.php +++ /dev/null @@ -1,6 +0,0 @@ - ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.11/bundles.php b/tests/Application/config/sylius/1.11/bundles.php deleted file mode 100644 index 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.12/packages/mailer.yaml b/tests/Application/config/sylius/1.12/packages/mailer.yaml new file mode 100644 index 0000000..0a0697c --- /dev/null +++ b/tests/Application/config/sylius/1.12/packages/mailer.yaml @@ -0,0 +1,3 @@ +framework: + mailer: + dsn: '%env(MAILER_DSN)%' diff --git a/tests/Application/config/sylius/1.10/packages/security.yaml b/tests/Application/config/sylius/1.12/packages/security.yaml similarity index 58% rename from tests/Application/config/sylius/1.10/packages/security.yaml rename to tests/Application/config/sylius/1.12/packages/security.yaml index 1062810..c81f04b 100644 --- a/tests/Application/config/sylius/1.10/packages/security.yaml +++ b/tests/Application/config/sylius/1.12/packages/security.yaml @@ -1,16 +1,5 @@ -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 + enable_authenticator_manager: true providers: sylius_admin_user_provider: id: sylius.admin_user_provider.email_or_name_based @@ -20,11 +9,8 @@ security: id: sylius.shop_user_provider.email_or_name_based sylius_api_shop_user_provider: id: sylius.shop_user_provider.email_or_name_based - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - encoders: + password_hashers: Sylius\Component\User\Model\UserInterface: argon2i firewalls: admin: @@ -40,7 +26,7 @@ security: default_target_path: sylius_admin_dashboard use_forward: false use_referer: true - csrf_token_generator: security.csrf.token_manager + enable_csrf: true csrf_parameter: _csrf_admin_security_token csrf_token_id: admin_authenticate remember_me: @@ -52,46 +38,32 @@ security: logout: path: sylius_admin_logout target: sylius_admin_login - anonymous: true new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider + pattern: "%sylius.security.new_api_admin_regex%/.*" + provider: sylius_api_admin_user_provider stateless: true - anonymous: true + entry_point: jwt json_login: - check_path: "%sylius.security.new_api_route%/admin-user-authentication-token" + check_path: "%sylius.security.new_api_admin_route%/administrators/token" username_path: email password_path: password success_handler: lexik_jwt_authentication.handler.authentication_success failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator + jwt: true new_api_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider + pattern: "%sylius.security.new_api_shop_regex%/.*" + provider: sylius_api_shop_user_provider stateless: true - anonymous: true + entry_point: jwt json_login: - check_path: "%sylius.security.new_api_route%/shop-user-authentication-token" + check_path: "%sylius.security.new_api_shop_route%/customers/token" username_path: email password_path: password success_handler: lexik_jwt_authentication.handler.authentication_success failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api: - pattern: "%sylius.security.new_api_regex%/*" - provider: sylius_api_chain_provider - stateless: true - anonymous: lazy - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator + jwt: true shop: switch_user: { role: ROLE_ALLOWED_TO_SWITCH } @@ -108,7 +80,7 @@ security: default_target_path: sylius_shop_homepage use_forward: false use_referer: true - csrf_token_generator: security.csrf.token_manager + enable_csrf: true csrf_parameter: _csrf_shop_security_token csrf_token_id: shop_authenticate remember_me: @@ -118,31 +90,35 @@ security: remember_me_parameter: _remember_me logout: path: sylius_shop_logout - target: sylius_shop_login + target: sylius_shop_homepage invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + image_resolver: + pattern: ^/media/cache/resolve security: false access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.api_regex%/.*", role: ROLE_API_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_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.new_api_admin_route%/administrators/token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } + - { path: "%sylius.security.new_api_shop_route%/customers/token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/sylius/1.12/packages/test/mailer.yaml b/tests/Application/config/sylius/1.12/packages/test/mailer.yaml new file mode 100644 index 0000000..56cc28f --- /dev/null +++ b/tests/Application/config/sylius/1.12/packages/test/mailer.yaml @@ -0,0 +1,7 @@ +framework: + mailer: + dsn: 'null://null' + cache: + pools: + test.mailer_pool: + adapter: cache.adapter.filesystem diff --git a/tests/Application/config/sylius/1.13/bundles.php b/tests/Application/config/sylius/1.13/bundles.php new file mode 100644 index 0000000..5d54121 --- /dev/null +++ b/tests/Application/config/sylius/1.13/bundles.php @@ -0,0 +1,7 @@ + ['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..63c02ac --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/_sylius.yaml @@ -0,0 +1,2 @@ +sylius_api: + enabled: true diff --git a/tests/Application/config/sylius/1.11/packages/security.yaml b/tests/Application/config/sylius/1.13/packages/security.yaml similarity index 58% rename from tests/Application/config/sylius/1.11/packages/security.yaml rename to tests/Application/config/sylius/1.13/packages/security.yaml index 1062810..c81f04b 100644 --- a/tests/Application/config/sylius/1.11/packages/security.yaml +++ b/tests/Application/config/sylius/1.13/packages/security.yaml @@ -1,16 +1,5 @@ -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 + enable_authenticator_manager: true providers: sylius_admin_user_provider: id: sylius.admin_user_provider.email_or_name_based @@ -20,11 +9,8 @@ security: id: sylius.shop_user_provider.email_or_name_based sylius_api_shop_user_provider: id: sylius.shop_user_provider.email_or_name_based - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - encoders: + password_hashers: Sylius\Component\User\Model\UserInterface: argon2i firewalls: admin: @@ -40,7 +26,7 @@ security: default_target_path: sylius_admin_dashboard use_forward: false use_referer: true - csrf_token_generator: security.csrf.token_manager + enable_csrf: true csrf_parameter: _csrf_admin_security_token csrf_token_id: admin_authenticate remember_me: @@ -52,46 +38,32 @@ security: logout: path: sylius_admin_logout target: sylius_admin_login - anonymous: true new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider + pattern: "%sylius.security.new_api_admin_regex%/.*" + provider: sylius_api_admin_user_provider stateless: true - anonymous: true + entry_point: jwt json_login: - check_path: "%sylius.security.new_api_route%/admin-user-authentication-token" + check_path: "%sylius.security.new_api_admin_route%/administrators/token" username_path: email password_path: password success_handler: lexik_jwt_authentication.handler.authentication_success failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator + jwt: true new_api_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider + pattern: "%sylius.security.new_api_shop_regex%/.*" + provider: sylius_api_shop_user_provider stateless: true - anonymous: true + entry_point: jwt json_login: - check_path: "%sylius.security.new_api_route%/shop-user-authentication-token" + check_path: "%sylius.security.new_api_shop_route%/customers/token" username_path: email password_path: password success_handler: lexik_jwt_authentication.handler.authentication_success failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api: - pattern: "%sylius.security.new_api_regex%/*" - provider: sylius_api_chain_provider - stateless: true - anonymous: lazy - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator + jwt: true shop: switch_user: { role: ROLE_ALLOWED_TO_SWITCH } @@ -108,7 +80,7 @@ security: default_target_path: sylius_shop_homepage use_forward: false use_referer: true - csrf_token_generator: security.csrf.token_manager + enable_csrf: true csrf_parameter: _csrf_shop_security_token csrf_token_id: shop_authenticate remember_me: @@ -118,31 +90,35 @@ security: remember_me_parameter: _remember_me logout: path: sylius_shop_logout - target: sylius_shop_login + target: sylius_shop_homepage invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + image_resolver: + pattern: ^/media/cache/resolve security: false access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.api_regex%/.*", role: ROLE_API_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_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.new_api_admin_route%/administrators/token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } + - { path: "%sylius.security.new_api_shop_route%/customers/token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/sylius/1.13/packages/test/mailer.yaml b/tests/Application/config/sylius/1.13/packages/test/mailer.yaml new file mode 100644 index 0000000..56cc28f --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/test/mailer.yaml @@ -0,0 +1,7 @@ +framework: + mailer: + dsn: 'null://null' + cache: + pools: + test.mailer_pool: + adapter: cache.adapter.filesystem diff --git a/tests/Application/config/sylius/1.13/packages/test/security.yaml b/tests/Application/config/sylius/1.13/packages/test/security.yaml new file mode 100644 index 0000000..a6f2ff7 --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/test/security.yaml @@ -0,0 +1,3 @@ +security: + password_hashers: + sha512: sha512 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 66f523d..0000000 --- a/tests/Application/config/sylius/1.9/bundles.php +++ /dev/null @@ -1,8 +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/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/package.json b/tests/Application/package.json index 14072b2..0514d25 100644 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -1,46 +1,58 @@ { "dependencies": { + "@babel/core": "^7.24.9", + "@babel/preset-env": "^7.14.7", "babel-polyfill": "^6.26.0", - "jquery": "^3.2.0", - "lightbox2": "^2.9.0", - "semantic-ui-css": "^2.2.0" + "chart.js": "^3.7.1", + "jquery": "^3.6.0", + "jquery.dirtyforms": "^2.0.0", + "lightbox2": "^2.11.0", + "semantic-ui-css": "^2.4.0", + "slick-carousel": "^1.8.1", + "yarn": "^1.22.10" }, "devDependencies": { + "@symfony/webpack-encore": "^4.0.0", "babel-core": "^6.26.3", "babel-plugin-external-helpers": "^6.22.0", - "babel-plugin-module-resolver": "^3.1.1", + "babel-plugin-module-resolver": "^3.2.0", "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-preset-env": "^1.7.0", "babel-register": "^6.26.0", "dedent": "^0.7.0", - "eslint": "^4.19.1", - "eslint-config-airbnb-base": "^12.1.0", - "eslint-import-resolver-babel-module": "^4.0.0", - "eslint-plugin-import": "^2.12.0", - "fast-async": "^6.3.7", + "eslint": "^8.22.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-import-resolver-babel-module": "^5.3.0", + "eslint-plugin-import": "^2.26.0", + "fast-async": "^7.0.0", "gulp": "^4.0.0", "gulp-chug": "^0.5", "gulp-concat": "^2.6.0", - "gulp-debug": "^2.1.2", - "gulp-if": "^2.0.0", - "gulp-livereload": "^3.8.1", + "gulp-debug": "^4.0.0", + "gulp-if": "^3.0.0", + "gulp-livereload": "^4.0.1", "gulp-order": "^1.1.1", - "gulp-sass": "^4.0.1", - "gulp-sourcemaps": "^1.6.0", - "gulp-uglifycss": "^1.0.5", - "merge-stream": "^1.0.0", - "rollup": "^0.60.7", - "rollup-plugin-babel": "^3.0.4", - "rollup-plugin-commonjs": "^9.1.3", - "rollup-plugin-inject": "^2.0.0", - "rollup-plugin-node-resolve": "^3.3.0", - "rollup-plugin-uglify": "^4.0.0", - "upath": "^1.1.0", - "yargs": "^6.4.0" + "gulp-sass": "^5.1.0", + "gulp-sourcemaps": "^3.0.0", + "gulp-uglifycss": "^1.0.9", + "merge-stream": "^2.0.0", + "rollup": "^3.18.0", + "rollup-plugin-babel": "^4.4.0", + "rollup-plugin-commonjs": "^10.1.0", + "rollup-plugin-inject": "^3.0.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-uglify": "^6.0.0", + "sass": "^1.77.0", + "sass-loader": "^13.0.0", + "upath": "^2.0.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "yargs": "^17.7.0" }, "scripts": { - "build": "gulp build", - "gulp": "gulp build", + "dev": "yarn encore dev", + "watch": "yarn encore dev --watch", + "prod": "yarn encore prod", "lint": "yarn lint:js", "lint:js": "eslint gulpfile.babel.js" }, From 4e26aa08f2c29c3a9dc5699965cce600eca722da Mon Sep 17 00:00:00 2001 From: janpalen Date: Tue, 30 Jul 2024 17:36:10 +0200 Subject: [PATCH 2/7] OP-448 - Upgrade build --- .github/workflows/build.yml | 37 +++++++------- composer.json | 36 ++++++++------ tests/Application/assets/admin/entry.js | 1 + tests/Application/assets/shop/entry.js | 1 + tests/Application/config/bootstrap.php | 2 +- .../config/packages/webpack_encore.yaml | 5 ++ tests/Application/webpack.config.js | 49 +++++++++++++++++++ 7 files changed, 94 insertions(+), 37 deletions(-) create mode 100644 tests/Application/assets/admin/entry.js create mode 100644 tests/Application/assets/shop/entry.js create mode 100644 tests/Application/config/packages/webpack_encore.yaml create mode 100644 tests/Application/webpack.config.js diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e6e7ca4..95964d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,26 +11,24 @@ on: jobs: tests: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" strategy: fail-fast: false matrix: - php: [8.0] - symfony: [^4.4, ^5.2] - sylius: [~1.11] - node: [14.x] - mysql: [8.0] + php: [ "8.0", "8.1", "8.2", "8.3" ] + symfony: [ "^5.4", "^6.4" ] + sylius: [ "~1.12.0", "~1.13.0" ] + node: [ "^20.0" ] + mysql: [ "8.0" ] exclude: - - sylius: ~1.9 - php: 8.0 - - sylius: ~1.10 - symfony: 4.4 - - sylius: ~1.11 - php: 7.4 + - sylius: "~1.13.0" + php: "8.0" + - symfony: "^6.4" + php: "8.0" env: @@ -39,7 +37,7 @@ jobs: steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP @@ -52,7 +50,7 @@ jobs: - name: Setup Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: "${{ matrix.node }}" @@ -90,7 +88,7 @@ jobs: - name: Cache Composer - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} @@ -117,7 +115,7 @@ jobs: - name: Get Yarn cache directory id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Cache Yarn @@ -142,8 +140,7 @@ jobs: name: Prepare test application assets run: | (cd tests/Application && bin/console assets:install public -vvv) - (cd tests/Application && yarn add slick-carousel) - (cd tests/Application && yarn build) + (cd tests/Application && yarn add encore dev) - name: Prepare test application cache @@ -185,8 +182,8 @@ jobs: name: Behat logs path: etc/build/ if-no-files-found: ignore - - - + + - 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 134da6e..442d4c4 100644 --- a/composer.json +++ b/composer.json @@ -5,17 +5,18 @@ "description": "MultiSafepay payment plugin for Sylius applications.", "license": "MIT", "require": { - "php": "^8.0", + "php": "^8.0 || ^8.1", "doctrine/annotations": "^1.13", "multisafepay/api": "^2.0", "php-http/message-factory": "^1.1", - "sylius/sylius": "~1.12.0" + "sylius/sylius": "~1.12.0 || ~1.13.0", + "symfony/webpack-encore-bundle": "^1.14" }, "require-dev": { "babdev/pagerfanta-bundle": "^3.0", "behat/behat": "^3.6.1", "behat/mink-selenium2-driver": "^1.4", - "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", @@ -29,20 +30,23 @@ "lakion/mink-debug-extension": "^2.0.0", "phpspec/phpspec": "^7.0", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "0.12.88", - "phpstan/phpstan-doctrine": "0.12.37", - "phpstan/phpstan-strict-rules": "^0.12.0", - "phpstan/phpstan-webmozart-assert": "0.12.12", - "phpunit/phpunit": "^9.5", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-doctrine": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", + "phpstan/phpstan-webmozart-assert": "^1.0", + "phpunit/phpunit": ">=8.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", - "sensiolabs/security-checker": "^6.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", - "symplify/easy-coding-standard": "^9.4", - "vimeo/psalm": "4.24.0" + "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", + "symplify/easy-coding-standard": "^10.0 || ^11.0", + "vimeo/psalm": "~4.12 || ^5.0.0", + "psalm/plugin-symfony": "~4.0 || ~5.0" + }, + "conflict": { + "behat/mink-selenium2-driver": ">=1.7.0" }, "config": { "sort-packages": true, diff --git a/tests/Application/assets/admin/entry.js b/tests/Application/assets/admin/entry.js new file mode 100644 index 0000000..635f5ac --- /dev/null +++ b/tests/Application/assets/admin/entry.js @@ -0,0 +1 @@ +import 'sylius/bundle/AdminBundle/Resources/private/entry'; diff --git a/tests/Application/assets/shop/entry.js b/tests/Application/assets/shop/entry.js new file mode 100644 index 0000000..aadc317 --- /dev/null +++ b/tests/Application/assets/shop/entry.js @@ -0,0 +1 @@ +import 'sylius/bundle/ShopBundle/Resources/private/entry'; diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php index bba582f..2e20a38 100644 --- a/tests/Application/config/bootstrap.php +++ b/tests/Application/config/bootstrap.php @@ -16,7 +16,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())->usePutenv()->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/webpack_encore.yaml b/tests/Application/config/packages/webpack_encore.yaml new file mode 100644 index 0000000..9427d36 --- /dev/null +++ b/tests/Application/config/packages/webpack_encore.yaml @@ -0,0 +1,5 @@ +webpack_encore: + output_path: '%kernel.project_dir%/public/build/default' + builds: + shop: '%kernel.project_dir%/public/build/shop' + admin: '%kernel.project_dir%/public/build/admin' diff --git a/tests/Application/webpack.config.js b/tests/Application/webpack.config.js new file mode 100644 index 0000000..91d756a --- /dev/null +++ b/tests/Application/webpack.config.js @@ -0,0 +1,49 @@ +const path = require('path'); +const Encore = require('@symfony/webpack-encore'); + +const syliusBundles = path.resolve(__dirname, '../../vendor/sylius/sylius/src/Sylius/Bundle/'); +const uiBundleScripts = path.resolve(syliusBundles, 'UiBundle/Resources/private/js/'); +const uiBundleResources = path.resolve(syliusBundles, 'UiBundle/Resources/private/'); + +// Shop config +Encore + .setOutputPath('public/build/shop/') + .setPublicPath('/build/shop') + .addEntry('shop-entry', './assets/shop/entry.js') + .disableSingleRuntimeChunk() + .cleanupOutputBeforeBuild() + .enableSourceMaps(!Encore.isProduction()) + .enableVersioning(Encore.isProduction()) + .enableSassLoader(); + +const shopConfig = Encore.getWebpackConfig(); + +shopConfig.resolve.alias['sylius/ui'] = uiBundleScripts; +shopConfig.resolve.alias['sylius/ui-resources'] = uiBundleResources; +shopConfig.resolve.alias['sylius/bundle'] = syliusBundles; +shopConfig.name = 'shop'; + +Encore.reset(); + +// Admin config +Encore + .setOutputPath('public/build/admin/') + .setPublicPath('/build/admin') + .addEntry('admin-entry', './assets/admin/entry.js') + .disableSingleRuntimeChunk() + .cleanupOutputBeforeBuild() + .enableSourceMaps(!Encore.isProduction()) + .enableVersioning(Encore.isProduction()) + .enableSassLoader(); + +const adminConfig = Encore.getWebpackConfig(); + +adminConfig.resolve.alias['sylius/ui'] = uiBundleScripts; +adminConfig.resolve.alias['sylius/ui-resources'] = uiBundleResources; +adminConfig.resolve.alias['sylius/bundle'] = syliusBundles; +adminConfig.resolve.alias['chart.js/dist/Chart.min'] = path.resolve(__dirname, 'node_modules/chart.js/dist/chart.min.js'); +adminConfig.externals = Object.assign({}, adminConfig.externals, {window: 'window', document: 'document'}); + +adminConfig.name = 'admin'; + +module.exports = [shopConfig, adminConfig]; From 5ee2158350093bfec86869ed4159309b2fccda8d Mon Sep 17 00:00:00 2001 From: janpalen Date: Wed, 31 Jul 2024 11:00:53 +0200 Subject: [PATCH 3/7] OP-448 - Fix code for phpstan --- src/Action/NotifyAction.php | 6 +----- src/PaymentProcessing/RefundPaymentProcessor.php | 5 ----- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/Action/NotifyAction.php b/src/Action/NotifyAction.php index 9b294c8..d22996f 100644 --- a/src/Action/NotifyAction.php +++ b/src/Action/NotifyAction.php @@ -32,15 +32,11 @@ final class NotifyAction implements ActionInterface, ApiAwareInterface, GatewayA { use GatewayAwareTrait, ApiAwareTrait; - /** @var LoggerInterface */ - private $logger; - /** @var FactoryInterface */ private $stateMachineFactory; - public function __construct(LoggerInterface $logger, FactoryInterface $stateMachineFactory) + public function __construct(FactoryInterface $stateMachineFactory) { - $this->logger = $logger; $this->stateMachineFactory = $stateMachineFactory; } diff --git a/src/PaymentProcessing/RefundPaymentProcessor.php b/src/PaymentProcessing/RefundPaymentProcessor.php index 2fdbb1e..312dd02 100644 --- a/src/PaymentProcessing/RefundPaymentProcessor.php +++ b/src/PaymentProcessing/RefundPaymentProcessor.php @@ -27,17 +27,12 @@ final class RefundPaymentProcessor implements PaymentProcessorInterface /** @var MultiSafepayApiClientInterface */ private $multiSafepayApiClient; - /** @var LoggerInterface */ - private $logger; - public function __construct( Session $session, MultiSafepayApiClientInterface $multiSafepayApiClient, - LoggerInterface $logger ) { $this->session = $session; $this->multiSafepayApiClient = $multiSafepayApiClient; - $this->logger = $logger; } public function process(PaymentInterface $payment): void From 46e5bec08501e6031d824a04526b21b9361d43f5 Mon Sep 17 00:00:00 2001 From: janpalen Date: Wed, 31 Jul 2024 11:08:50 +0200 Subject: [PATCH 4/7] OP-448 - ecs code fix --- .github/workflows/build.yml | 2 +- ecs.php | 15 ++++++--------- src/Action/Api/ApiAwareTrait.php | 9 +++++---- src/Action/CaptureAction.php | 9 +++++---- src/Action/ConvertPaymentAction.php | 9 +++++---- src/Action/NotifyAction.php | 10 +++++----- src/Action/StatusAction.php | 10 +++++----- src/ApiClient/MultiSafepayApiClient.php | 15 ++++++++------- src/ApiClient/MultiSafepayApiClientInterface.php | 13 +++++++------ src/BitBagSyliusMultiSafepayPlugin.php | 9 +++++---- .../BitBagSyliusMultiSafepayExtension.php | 9 +++++---- .../Type/MultiSafepayGatewayConfigurationType.php | 9 +++++---- src/MultiSafepayGatewayFactory.php | 9 +++++---- .../PaymentProcessorInterface.php | 9 +++++---- src/PaymentProcessing/RefundPaymentProcessor.php | 12 ++++++------ 15 files changed, 78 insertions(+), 71 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 95964d1..f170096 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -160,7 +160,7 @@ jobs: - name: Run PHPStan - run: vendor/bin/phpstan analyse -c phpstan.neon -l max src/ + run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ - name: Run ECS diff --git a/ecs.php b/ecs.php index b088160..abcfbcf 100644 --- a/ecs.php +++ b/ecs.php @@ -2,15 +2,12 @@ declare(strict_types=1); -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; -use Symplify\EasyCodingStandard\ValueObject\Option; +use Symplify\EasyCodingStandard\Config\ECSConfig; -return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->import('vendor/bitbag/coding-standard/ecs.php'); +return static function (ECSConfig $config): void { - $parameters = $containerConfigurator->parameters(); - $parameters->set(Option::PATHS, [ - __DIR__ . '/src', - __DIR__ . '/tests', - ]); + putenv('ALLOW_BITBAG_OS_HEADER=1'); + + $config->import('vendor/bitbag/coding-standard/ecs.php'); + $config->paths(['src', 'tests']); }; diff --git a/src/Action/Api/ApiAwareTrait.php b/src/Action/Api/ApiAwareTrait.php index d603e81..7a58240 100644 --- a/src/Action/Api/ApiAwareTrait.php +++ b/src/Action/Api/ApiAwareTrait.php @@ -1,10 +1,11 @@ type = $type; $this->allowMultiCurrency = $allowMultiCurrency; @@ -36,7 +37,7 @@ public function initialise( $this->client = new Client(); $this->client->setApiKey($apiKey); $this->client->setApiUrl( - $sandbox ? self::API_URL_TEST : self::API_URL_LIVE + $sandbox ? self::API_URL_TEST : self::API_URL_LIVE, ); } @@ -65,7 +66,7 @@ public function getAllowMultiCurrency(): bool public function refund( string $orderId, int $amount, - string $currencyCode + string $currencyCode, ): void { $endpoint = sprintf('orders/%s/refunds', $orderId); diff --git a/src/ApiClient/MultiSafepayApiClientInterface.php b/src/ApiClient/MultiSafepayApiClientInterface.php index 7f1a158..a59846f 100644 --- a/src/ApiClient/MultiSafepayApiClientInterface.php +++ b/src/ApiClient/MultiSafepayApiClientInterface.php @@ -1,10 +1,11 @@ multiSafepayApiClient->initialise( $gatewayConfig['apiKey'], $gatewayConfig['type'], - $gatewayConfig['sandbox'] + $gatewayConfig['sandbox'], ); try { From 230822592b846ada0b3603eae82d300be80670b6 Mon Sep 17 00:00:00 2001 From: janpalen Date: Wed, 31 Jul 2024 12:12:54 +0200 Subject: [PATCH 5/7] OP-448 - Fix behat config --- composer.json | 2 +- tests/Application/.env | 2 +- tests/Application/config/sylius/1.13/bundles.php | 7 +++++++ .../suites/ui/managing_payment_method_multisafepay.yml | 2 +- .../suites/ui/paying_with_multisafepay_for_order.yml | 2 +- .../Resources/suites/ui/refunding_multisafepay_payment.yml | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 442d4c4..a51fbe0 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "license": "MIT", "require": { "php": "^8.0 || ^8.1", - "doctrine/annotations": "^1.13", + "doctrine/annotations": "^2.0.0", "multisafepay/api": "^2.0", "php-http/message-factory": "^1.1", "sylius/sylius": "~1.12.0 || ~1.13.0", diff --git a/tests/Application/.env b/tests/Application/.env index e9711c8..3076069 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -12,7 +12,7 @@ APP_SECRET=EDITME # Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url # For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db" # Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls -DATABASE_URL=mysql://root@127.0.0.1/sylius_multi_safepay%kernel.environment%?serverVersion=8.0 +DATABASE_URL=mysql://root@127.0.0.1/sylius_multi_safepay_%kernel.environment%?serverVersion=8.0 ###< doctrine/doctrine-bundle ### ###> lexik/jwt-authentication-bundle ### diff --git a/tests/Application/config/sylius/1.13/bundles.php b/tests/Application/config/sylius/1.13/bundles.php index 5d54121..e615f85 100644 --- a/tests/Application/config/sylius/1.13/bundles.php +++ b/tests/Application/config/sylius/1.13/bundles.php @@ -1,5 +1,12 @@ Date: Wed, 31 Jul 2024 12:34:17 +0200 Subject: [PATCH 6/7] OP-448 - Remove session service --- .github/workflows/build.yml | 2 +- composer.json | 1 - src/Action/NotifyAction.php | 7 ++++++- src/Resources/config/services.xml | 1 - 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f170096..4c8f81c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -140,7 +140,7 @@ jobs: name: Prepare test application assets run: | (cd tests/Application && bin/console assets:install public -vvv) - (cd tests/Application && yarn add encore dev) + (cd tests/Application && yarn encore dev) - name: Prepare test application cache diff --git a/composer.json b/composer.json index a51fbe0..43793dd 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,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": "^1.6 || >2.0.0-alpha.0 ^2.0@dev", "lakion/mink-debug-extension": "^2.0.0", "phpspec/phpspec": "^7.0", "phpstan/extension-installer": "^1.0", diff --git a/src/Action/NotifyAction.php b/src/Action/NotifyAction.php index a918431..a5701f5 100644 --- a/src/Action/NotifyAction.php +++ b/src/Action/NotifyAction.php @@ -21,6 +21,7 @@ use Payum\Core\Reply\HttpResponse; use Payum\Core\Request\GetHttpRequest; use Payum\Core\Request\Notify; +use Psr\Log\LoggerInterface; use SM\Factory\FactoryInterface; use Sylius\Bundle\PayumBundle\Model\GatewayConfigInterface; use Sylius\Component\Core\Model\OrderInterface; @@ -32,11 +33,15 @@ final class NotifyAction implements ActionInterface, ApiAwareInterface, GatewayA { use GatewayAwareTrait, ApiAwareTrait; + /** @var LoggerInterface */ + private $logger; + /** @var FactoryInterface */ private $stateMachineFactory; - public function __construct(FactoryInterface $stateMachineFactory) + public function __construct(LoggerInterface $logger, FactoryInterface $stateMachineFactory) { + $this->logger = $logger; $this->stateMachineFactory = $stateMachineFactory; } diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 9a6f89c..3978d56 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -11,7 +11,6 @@ - From 18153691d63f744e02222e89d4f6c42204f4797d Mon Sep 17 00:00:00 2001 From: janpalen Date: Thu, 1 Aug 2024 11:16:39 +0200 Subject: [PATCH 7/7] OP-448 - Fix build config --- 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 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Application/config/packages/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml index 76d7e5e..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: - storage_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 76d7e5e..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: - storage_id: session.storage.mock_file + handler_id: ~