From 1271658118ae732f601f05391f479bf2bf922f35 Mon Sep 17 00:00:00 2001 From: Mateusz Zalewski Date: Fri, 9 Jul 2021 15:08:47 +0200 Subject: [PATCH] Drop support for Sylius 1.8 --- .github/workflows/build.yml | 8 +- composer.json | 4 +- tests/Application/Kernel.php | 19 --- .../config/routes/sylius_shop.yaml | 8 + .../config/sylius/1.10/packages/security.yaml | 2 +- .../Application/config/sylius/1.8/bundles.php | 8 - .../config/sylius/1.8/packages/_sylius.yaml | 2 - .../1.8/packages/dev/jms_serializer.yaml | 7 - .../config/sylius/1.8/packages/framework.yaml | 2 - .../sylius/1.8/packages/jms_serializer.yaml | 4 - .../1.8/packages/prod/jms_serializer.yaml | 7 - .../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 - .../config/sylius/1.9/packages/security.yaml | 2 +- 15 files changed, 13 insertions(+), 225 deletions(-) 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/framework.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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 24dae674..f36579af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,15 +22,9 @@ jobs: node: ["10.x"] mysql: ["5.7", "8.0"] symfony: ["^4.4", "^5.2"] - sylius: ["~1.8.0", "~1.9.0", "~1.10.0"] + sylius: ["~1.9.0", "~1.10.0"] exclude: - - - sylius: "~1.8.0" - symfony: "^5.2" - - - php: "8.0" - sylius: "~1.8.0" - php: "8.0" sylius: "~1.9.0" diff --git a/composer.json b/composer.json index 982868ab..907ed6e5 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "require": { "php": "^7.4 || ^8.0", - "sylius/sylius": "^1.8", + "sylius/sylius": "^1.9", "phpseclib/phpseclib": "^2.0", "sylius-labs/doctrine-migrations-extra-bundle": "^0.1.3", "doctrine/doctrine-migrations-bundle": "^3.0" @@ -25,7 +25,7 @@ "friends-of-behat/mink-debug-extension": "^2.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": ">2.0.0-alpha.0 ^2.0@dev", "phpspec/phpspec": "^6.1", "phpstan/phpstan": "0.12.98", "phpstan/phpstan-doctrine": "0.12.33", diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index cd5022a6..e52fbee8 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -76,25 +76,6 @@ protected function getContainerBaseClass(): string return parent::getContainerBaseClass(); } - protected function getContainerLoader(ContainerInterface $container): LoaderInterface - { - /** @var ContainerBuilder $container */ - Assert::isInstanceOf($container, ContainerBuilder::class); - - $locator = new FileLocator($this, $this->getProjectDir() . '/Resources'); - $resolver = new LoaderResolver(array( - new XmlFileLoader($container, $locator), - new YamlFileLoader($container, $locator), - new IniFileLoader($container, $locator), - new PhpFileLoader($container, $locator), - new GlobFileLoader($container, $locator), - new DirectoryLoader($container, $locator), - new ClosureLoader($container), - )); - - return new DelegatingLoader($resolver); - } - private function isTestEnvironment(): bool { return 0 === strpos($this->getEnvironment(), 'test'); diff --git a/tests/Application/config/routes/sylius_shop.yaml b/tests/Application/config/routes/sylius_shop.yaml index 8818568b..039c5746 100644 --- a/tests/Application/config/routes/sylius_shop.yaml +++ b/tests/Application/config/routes/sylius_shop.yaml @@ -12,3 +12,11 @@ sylius_shop_default_locale: methods: [GET] defaults: _controller: sylius.controller.shop.locale_switch:switchAction + +sylius_shop_request_password_reset_token_redirect: + path: /.well-known/change-password + methods: [GET] + controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction + defaults: + route: sylius_shop_request_password_reset_token + permanent: false diff --git a/tests/Application/config/sylius/1.10/packages/security.yaml b/tests/Application/config/sylius/1.10/packages/security.yaml index 10628102..61e1a2dc 100644 --- a/tests/Application/config/sylius/1.10/packages/security.yaml +++ b/tests/Application/config/sylius/1.10/packages/security.yaml @@ -2,7 +2,7 @@ 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_route: "/api/v2" sylius.security.new_api_regex: "^%sylius.security.new_api_route%" sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin" sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%" 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 1787cda9..00000000 --- a/tests/Application/config/sylius/1.8/bundles.php +++ /dev/null @@ -1,8 +0,0 @@ - ['all' => true], - Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true], - Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true], - WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::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 1674a972..00000000 --- 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 353e4602..00000000 --- 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/framework.yaml b/tests/Application/config/sylius/1.8/packages/framework.yaml deleted file mode 100644 index 62f82d35..00000000 --- a/tests/Application/config/sylius/1.8/packages/framework.yaml +++ /dev/null @@ -1,2 +0,0 @@ -framework: - templating: { engines: ["twig"] } 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 64dd8d10..00000000 --- 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 353e4602..00000000 --- a/tests/Application/config/sylius/1.8/packages/prod/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/security.yaml b/tests/Application/config/sylius/1.8/packages/security.yaml deleted file mode 100644 index 8161bdab..00000000 --- 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 f4ee8396..00000000 --- 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 80aed457..00000000 --- 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/packages/security.yaml b/tests/Application/config/sylius/1.9/packages/security.yaml index 8161bdab..904410bf 100644 --- a/tests/Application/config/sylius/1.9/packages/security.yaml +++ b/tests/Application/config/sylius/1.9/packages/security.yaml @@ -2,7 +2,7 @@ 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_route: "/api/v2" sylius.security.new_api_regex: "^%sylius.security.new_api_route%" sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin" sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%"