Skip to content

Commit

Permalink
Merge pull request #173 from christopherhero/update_sylius1.10
Browse files Browse the repository at this point in the history
update sylius 1.10
  • Loading branch information
KrisFlorq authored Jul 13, 2021
2 parents 02ba084 + 99ed524 commit 932968e
Show file tree
Hide file tree
Showing 21 changed files with 366 additions and 36 deletions.
31 changes: 14 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,21 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.4, 7.3]
symfony: [^4.4, ^5.2]
sylius: [~1.9.0]
node: [10.x]
mysql: [5.7]
php: ["8.0", "7.4"]
symfony: ["^4.4", "^5.2"]
sylius: ["~1.9.0", "~1.10.0"]
node: ["10.x"]
mysql: ["8.0"]

exclude:
-
sylius: ~1.8.0
symfony: ^5.2
- sylius: ~1.9.0
php: 8.0

- sylius: ~1.10.0
symfony: ^4.4
# friendsofsymfony/elastica-bundle - package is locking php 7.x
- sylius: ~1.10.0
php: 8.0

env:
APP_ENV: test
Expand Down Expand Up @@ -124,7 +129,7 @@ jobs:

-
name: Install PHP dependencies
run: composer install --no-interaction
run: composer install --no-interaction --no-scripts

-
name: Get Yarn cache directory
Expand Down Expand Up @@ -172,14 +177,6 @@ jobs:
name: Validate database schema
run: (cd tests/Application && bin/console doctrine:schema:validate)

# -
# name: Run PHPStan
# run: vendor/bin/phpstan analyse -c phpstan.neon -l max src/

# -
# name: Run Psalm
# run: vendor/bin/psalm

-
name: Run PHPSpec
run: vendor/bin/phpspec run --ansi -f progress --no-interaction
Expand Down
17 changes: 6 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "BitBag Elasticsearch plugin for Sylius.",
"license": "MIT",
"require": {
"php": "^7.3",
"ext-json": "*",
"sylius/sylius": "^1.9.0",
"php": "^7.3 || ^7.4",
"sylius/sylius": "~1.8.0 || ~1.9.0 || ~1.10.0",
"friendsofsymfony/elastica-bundle": "^5.0",
"symfony/property-access": "^4.4 || ^5.2"
},
Expand All @@ -17,13 +17,13 @@
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-debug-extension": "^2.0.0",
"friends-of-behat/mink-extension": "^2.4",
"friends-of-behat/page-object-extension": "^0.3",
"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",
"phpstan/phpstan": "0.12.82",
Expand All @@ -32,21 +32,16 @@
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.5",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^3.1",
"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",
"vimeo/psalm": "4.6.4"
"vimeo/psalm": "4.7.1"
},
"conflict": {
"api-platform/core": "^2.6",
"symfony/symfony": "4.1.8",
"symfony/browser-kit": "4.1.8",
"symfony/dependency-injection": "4.1.8",
"symfony/dom-crawler": "4.1.8",
"symfony/routing": "4.1.8"
"symfony/form": "4.4.11 || 4.4.12"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion tests/Application/.env
Original file line number Diff line number Diff line change
Expand Up @@ -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=sqlite:///%kernel.project_dir%/var/data.db
DATABASE_URL=mysql://root:[email protected]/sylius_elasticsearch_%kernel.environment%
###< doctrine/doctrine-bundle ###

###> lexik/jwt-authentication-bundle ###
Expand Down
2 changes: 1 addition & 1 deletion tests/Application/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ APP_SECRET='ch4mb3r0f5ecr3ts'

KERNEL_CLASS='Tests\BitBag\SyliusElasticsearchPlugin\Application\Kernel'

DATABASE_URL=mysql://root:12345@127.0.0.1/sylius_elasticsearch_%kernel.environment%
DATABASE_URL=mysql://root:password@127.0.0.1/sylius_elasticsearch_%kernel.environment%
2 changes: 0 additions & 2 deletions tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true],
Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true],
Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true],
FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true],
Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true],
FOS\ElasticaBundle\FOSElasticaBundle::class => ['all' => true],
BitBag\SyliusElasticsearchPlugin\BitBagSyliusElasticsearchPlugin::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
Expand Down
1 change: 0 additions & 1 deletion tests/Application/config/packages/_sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ imports:
- { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" }
- { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusShopBundle/Resources/config/app/config.yml" }

Expand Down
4 changes: 4 additions & 0 deletions tests/Application/config/routes/api_platform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
api_platform:
resource: .
type: api_platform
prefix: /api
3 changes: 0 additions & 3 deletions tests/Application/config/routes/dev/twig.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error
6 changes: 6 additions & 0 deletions tests/Application/config/sylius/1.10/bundles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

return [
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
jms_serializer:
visitors:
xml_serialization:
format_output: '%kernel.debug%'
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
jms_serializer:
visitors:
json_serialization:
options:
- JSON_UNESCAPED_SLASHES
- JSON_PRESERVE_ZERO_FRACTION
json_deserialization:
options:
- JSON_UNESCAPED_SLASHES
- JSON_PRESERVE_ZERO_FRACTION
138 changes: 138 additions & 0 deletions tests/Application/config/sylius/1.10/packages/security.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
parameters:
sylius.security.admin_regex: "^/admin"
sylius.security.shop_regex: "^/(?!admin|new-api|api/.*|api$|media/.*)[^/]++"
sylius.security.new_api_route: "/new-api"
sylius.security.new_api_regex: "^%sylius.security.new_api_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: /admin
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.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.shop_regex%/account", role: ROLE_USER }
2 changes: 2 additions & 0 deletions tests/Application/config/sylius/1.8/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
return [
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true],
FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true],
Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true],
];
2 changes: 2 additions & 0 deletions tests/Application/config/sylius/1.8/packages/_sylius.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports:
- { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" }
File renamed without changes.
2 changes: 2 additions & 0 deletions tests/Application/config/sylius/1.9/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
return [
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true],
Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true],
];
2 changes: 2 additions & 0 deletions tests/Application/config/sylius/1.9/packages/_sylius.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports:
- { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" }
Loading

0 comments on commit 932968e

Please sign in to comment.