Skip to content

Commit

Permalink
Drop Sylius 1.11 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mpysiak committed Dec 5, 2023
1 parent f29982a commit 84fe18c
Show file tree
Hide file tree
Showing 20 changed files with 98 additions and 454 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.0"]
php: ["8.1"]
symfony: ["^5.4", "^6.0"]
sylius: ["~1.11.0", "~1.12.0"]
sylius: ["~1.12.0"]
node: ["^14.17.x"]
mysql: ["8.0"]

exclude:
- sylius: ~1.11.0
symfony: "^6.0"
env:
APP_ENV: test
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"
Expand Down Expand Up @@ -136,6 +133,7 @@ jobs:
run: (cd tests/Application && bin/console cache:warmup -vvv)

- name: Load fixtures in test application
if: matrix.sylius != '~1.11.0'
run: (cd tests/Application && bin/console sylius:fixtures:load -n)

- name: Validate composer.json
Expand Down
12 changes: 2 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"require": {
"php": "^8.0",
"sylius/sylius": "~1.11.0 || ~1.12.0",
"sylius/sylius": "~1.12.0",
"symfony/webpack-encore-bundle": "^1.15",
"dompdf/dompdf": "^2.0"
},
Expand Down Expand Up @@ -35,15 +35,7 @@
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"symfony/dependency-injection": "^5.4 || ^6.0",
"league/flysystem-bundle": "2.4.0",
"sylius/mailer-bundle": "^1.8 || ^2.0@beta"
},
"conflict": {
"doctrine/orm": ">=2.15.2",
"symfony/symfony": "4.1.8",
"symfony/browser-kit": "4.1.8",
"symfony/dom-crawler": "4.1.8",
"symfony/routing": "4.1.8",
"symfony/doctrine-bridge": "4.4.16"
"sylius/mailer-bundle": "^1.8 || ^2.0"
},
"prefer-stable": true,
"autoload": {
Expand Down
18 changes: 9 additions & 9 deletions doc/01-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
1. *We work on stable, supported and up-to-date versions of packages. We recommend you to do the same.*

```bash
$ composer require bitbag/wishlist-plugin
composer require bitbag/wishlist-plugin
```

2. Add plugin dependencies to your `config/bundles.php` file:
Expand Down Expand Up @@ -45,37 +45,37 @@ bitbag_sylius_wishlist_plugin:
5. Clear application cache by using command:

```bash
$ bin/console cache:clear
bin/console cache:clear
```

6. Update your database

First, please run legacy-versioned migrations by using command:

```bash
$ bin/console doctrine:migrations:migrate
bin/console doctrine:migrations:migrate
```

After migration, please create a new diff migration and run it:

```bash
$ bin/console doctrine:migrations:diff
$ bin/console doctrine:migrations:migrate
bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate
```

**Note:** If you are running it on production, add the `-e prod` flag to this command.

**Note:** If you are updating this plugin from version 1.4.x you need to run:

```bash
$ bin/console doctrine:migrations:version BitBag\\SyliusWishlistPlugin\\Migrations\\Version20201029161558 --add --no-interaction
bin/console doctrine:migrations:version BitBag\\SyliusWishlistPlugin\\Migrations\\Version20201029161558 --add --no-interaction
```

7. Please add plugin templates into your project:
```bash
$ cp -R vendor/bitbag/wishlist-plugin/tests/Application/templates/bundles/SyliusShopBundle/Product templates/bundles/SyliusShopBundle
$ cp vendor/bitbag/wishlist-plugin/tests/Application/templates/bundles/SyliusShopBundle/_header.html.twig templates/bundles/SyliusShopBundle
$ cp vendor/bitbag/wishlist-plugin/tests/Application/templates/bundles/SyliusShopBundle/_logo.html.twig templates/bundles/SyliusShopBundle
cp -R vendor/bitbag/wishlist-plugin/tests/Application/templates/bundles/SyliusShopBundle/Product templates/bundles/SyliusShopBundle
cp vendor/bitbag/wishlist-plugin/tests/Application/templates/bundles/SyliusShopBundle/_header.html.twig templates/bundles/SyliusShopBundle
cp vendor/bitbag/wishlist-plugin/tests/Application/templates/bundles/SyliusShopBundle/_logo.html.twig templates/bundles/SyliusShopBundle
```

8. Add plugin assets to your project
Expand Down
2 changes: 1 addition & 1 deletion doc/01.5-non-webpack.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
1. Install plugin assets using:

```bash
$ bin/console assets:install
bin/console assets:install
```

2. Add twig inclusions in your templates:
Expand Down
6 changes: 3 additions & 3 deletions doc/03-customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

Run the below command to see what Symfony services are shared with this plugin:
```bash
$ bin/console debug:container | grep bitbag_sylius_wishlist_plugin
bin/console debug:container | grep bitbag_sylius_wishlist_plugin
```

### List of parameters you can override in your parameters.yml(.dist) file
```bash
$ bin/console debug:container --parameters | grep bitbag
$ bin/console debug:container --parameters | grep wishlist
bin/console debug:container --parameters | grep bitbag
bin/console debug:container --parameters | grep wishlist
```
22 changes: 11 additions & 11 deletions doc/04-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@
Clone this repository, go to the plugin root directory and run

```bash
$ composer install
$ cd tests/Application
composer install
cd tests/Application
```

If needed, create `.env.local` file with the correct configuration for your environment in the `tests/Application` directory. <br>
Then run the following commands from `tests/Application`:

```bash
$ bin/console doctrine:database:create
$ bin/console doctrine:schema:create
$ bin/console sylius:fixtures:load
$ bin/console assets:install --symlink
bin/console doctrine:database:create
bin/console doctrine:schema:create
bin/console sylius:fixtures:load
bin/console assets:install --symlink
```

Copy `package.json.~1.xx.dist` file to `package.json` for specific version of Sylius (example for 1.12.0):
```bash
$ cp package.json.\~1.12.dist package.json
cp package.json.\~1.12.dist package.json
```

Then:

```bash
$ yarn install
$ yarn dev
yarn install
yarn dev
```

You're ready to start coding 🎉
Expand All @@ -48,7 +48,7 @@ You're ready to start coding 🎉
To start the development server, from the `tests/Application` directory run:

```bash
$ symfony server:start
symfony server:start
```

and then you should get information about the server address and port (usually http://localhost:8000). <br>
Expand All @@ -60,7 +60,7 @@ If you don't already have Symfony CLI, here's how to install it: https://symfony
To start working on frontend, from the `tests/Application` directory run:

```bash
$ yarn watch
yarn watch
```

It's an infinite process, which will watch your changes in the assets folder and (re)build them. So all of your frontend changes should be done in `{root}/src/Resources/assets` directory. We have configured two independent entry points that should not be combined - `shop` for the storefront and `admin` for the admin panel.
Expand Down
24 changes: 12 additions & 12 deletions doc/05-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
## Testing

```bash
$ composer install
$ cd tests/Application
composer install
cd tests/Application
```

Copy `package.json.~1.xx.dist` file to `package.json` for specific version of Sylius (example for 1.12.0):
```bash
$ cp package.json.\~1.12.dist package.json
cp package.json.\~1.12.dist package.json
```

Then:

```bash
$ yarn install
$ yarn dev
$ APP_ENV=test bin/console assets:install public
$ APP_ENV=test bin/console doctrine:schema:create
$ cd ../..
$ APP_ENV=test symfony server:start --port=8080 --dir=tests/Application/public --daemon
$ open https://localhost:8080
$ vendor/bin/behat
$ vendor/bin/phpspec run
yarn install
yarn dev
APP_ENV=test bin/console assets:install public
APP_ENV=test bin/console doctrine:schema:create
cd ../..
APP_ENV=test symfony server:start --port=8080 --dir=tests/Application/public --daemon
open https://localhost:8080
vendor/bin/behat
vendor/bin/phpspec run
```
2 changes: 2 additions & 0 deletions tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@
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],
];
86 changes: 55 additions & 31 deletions tests/Application/config/packages/security.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
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:
enable_authenticator_manager: true
always_authenticate_before_granting: true
providers:
sylius_admin_user_provider:
id: sylius.admin_user_provider.email_or_name_based
Expand All @@ -9,8 +20,11 @@ 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]

password_hashers:
encoders:
Sylius\Component\User\Model\UserInterface: argon2i
firewalls:
admin:
Expand All @@ -26,7 +40,7 @@ security:
default_target_path: sylius_admin_dashboard
use_forward: false
use_referer: true
enable_csrf: true
csrf_token_generator: security.csrf.token_manager
csrf_parameter: _csrf_admin_security_token
csrf_token_id: admin_authenticate
remember_me:
Expand All @@ -38,32 +52,46 @@ security:
logout:
path: sylius_admin_logout
target: sylius_admin_login
anonymous: true

new_api_admin_user:
pattern: "%sylius.security.new_api_admin_regex%/.*"
provider: sylius_api_admin_user_provider
pattern: "%sylius.security.new_api_route%/admin-user-authentication-token"
provider: sylius_admin_user_provider
stateless: true
entry_point: jwt
anonymous: true
json_login:
check_path: "%sylius.security.new_api_admin_route%/authentication-token"
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
jwt: true
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator

new_api_shop_user:
pattern: "%sylius.security.new_api_shop_regex%/.*"
provider: sylius_api_shop_user_provider
pattern: "%sylius.security.new_api_route%/shop-user-authentication-token"
provider: sylius_shop_user_provider
stateless: true
entry_point: jwt
anonymous: true
json_login:
check_path: "%sylius.security.new_api_shop_route%/authentication-token"
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
jwt: true
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 }
Expand All @@ -80,7 +108,7 @@ security:
default_target_path: sylius_shop_homepage
use_forward: false
use_referer: true
enable_csrf: true
csrf_token_generator: security.csrf.token_manager
csrf_parameter: _csrf_shop_security_token
csrf_token_id: shop_authenticate
remember_me:
Expand All @@ -90,35 +118,31 @@ security:
remember_me_parameter: _remember_me
logout:
path: sylius_shop_logout
target: sylius_shop_homepage
target: sylius_shop_login
invalidate_session: false
success_handler: sylius.handler.shop_user_logout
anonymous: true

dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false

image_resolver:
pattern: ^/media/cache/resolve
pattern: ^/(_(profiler|wdt)|css|images|js)/
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: 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: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] }
- { 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: PUBLIC_ACCESS }
- { path: "%sylius.security.shop_regex%/login", role: PUBLIC_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: PUBLIC_ACCESS }
- { path: "%sylius.security.shop_regex%/verify", 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.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%/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 }
- { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY }
7 changes: 0 additions & 7 deletions tests/Application/config/sylius/1.11/bundles.php

This file was deleted.

Loading

0 comments on commit 84fe18c

Please sign in to comment.