Skip to content

Commit

Permalink
Support Sylius 1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMilek committed Jan 5, 2023
1 parent b1908ae commit 8657ed0
Show file tree
Hide file tree
Showing 25 changed files with 191 additions and 59 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [8.0, 8.1]
node: [16.x]
mysql: [5.7, 8.0]
symfony: [^5.4]
sylius: [~1.11.0]
php: ["8.0", "8.1"]
symfony: ["^5.4"]
sylius: ["~1.11.10", "~1.12.0"]
node: ["16.x"]
mysql: ["5.7", "8.0"]

env:
APP_ENV: test
APP_SECRET: "Dead men tell no tales"
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"
MESSENGER_TRANSPORT_DSN: "sync://"
MAILER_DSN: "null://null"

steps:
-
Expand Down Expand Up @@ -76,7 +77,7 @@ jobs:
name: Restrict Sylius version
if: matrix.sylius != ''
run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction

-
name: Install PHP dependencies
run: composer update --no-interaction
Expand All @@ -102,3 +103,4 @@ jobs:
-
name: Run PHPUnit
run: vendor/bin/phpunit --colors=always

11 changes: 6 additions & 5 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",
"sylius/sylius": "~1.11.10 || ~1.12.0",
"lexik/jwt-authentication-bundle": "^2.5",
"symfony/messenger": "^5.4",
"doctrine/doctrine-bundle": "^2.0"
Expand All @@ -15,13 +15,14 @@
"matthiasnoback/symfony-config-test": "^4.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
"phpspec/phpspec": "^7.0",
"phpstan/phpstan": "0.12.96",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^9.0",
"sylius-labs/coding-standard": "^4.0",
"symfony/debug-bundle": "^5.4",
"symfony/dotenv": "^5.4",
"symfony/web-profiler-bundle": "^5.4"
"symfony/web-profiler-bundle": "^5.4",
"symfony/webpack-encore-bundle": "^1.15"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -55,7 +56,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "1.6-dev"
}
}
}
8 changes: 4 additions & 4 deletions src/Resources/config/routing/address_book.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sylius_shop_api_address_book_create:
path: /address-book/
controller: sylius.controller.address:createAction
controller: sylius.controller.address::createAction
methods: [POST]
defaults:
_sylius:
Expand All @@ -11,7 +11,7 @@ sylius_shop_api_address_book_create:

sylius_shop_api_address_book_index:
path: /address-book/
controller: sylius.controller.address:indexAction
controller: sylius.controller.address::indexAction
methods: [GET]
defaults:
_sylius:
Expand All @@ -23,7 +23,7 @@ sylius_shop_api_address_book_index:

sylius_shop_api_address_book_delete:
path: /address-book/{id}
controller: sylius.controller.address:deleteAction
controller: sylius.controller.address::deleteAction
methods: [DELETE]
defaults:
_sylius:
Expand All @@ -36,7 +36,7 @@ sylius_shop_api_address_book_delete:

sylius_shop_api_address_book_update:
path: /address-book/{id}
controller: sylius.controller.address:updateAction
controller: sylius.controller.address::updateAction
methods: [PUT, PATCH]
defaults:
_sylius:
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/config/routing/checkout.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sylius_shop_api_country_checkout:
path: /countries
methods: [GET]
controller: sylius.controller.country:indexAction
controller: sylius.controller.country::indexAction
defaults:
_sylius:
paginate: false
Expand All @@ -15,7 +15,7 @@ sylius_shop_api_country_checkout:
sylius_shop_api_country_show_details_by_code_checkout:
path: /countries/{code}
methods: [GET]
controller: sylius.controller.country:showAction
controller: sylius.controller.country::showAction
defaults:
_sylius:
paginate: false
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/routing/customer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ sylius_shop_api_change_password:
path: /me/change-password
methods: [PUT]
defaults:
_controller: sylius.controller.shop_user:changePasswordAction
_controller: sylius.controller.shop_user::changePasswordAction
2 changes: 1 addition & 1 deletion src/Resources/config/routing/register.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ sylius_shop_api_password_reset:
path: /password-reset/{token}
methods: [PUT]
defaults:
_controller: sylius.controller.shop_user:resetPasswordAction
_controller: sylius.controller.shop_user::resetPasswordAction
16 changes: 14 additions & 2 deletions tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@

declare(strict_types=1);

return [
use Sylius\Bundle\CoreBundle\Application\Kernel;

$bundles = [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true],
Expand Down Expand Up @@ -61,4 +62,15 @@
Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['all' => true],
Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['all' => true],
SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
];

if (Kernel::VERSION_ID < 11200) {
$bundles[Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class] = ['all' => true];
}

if (11200 <= Kernel::VERSION_ID) {
$bundles[League\FlysystemBundle\FlysystemBundle::class] = ['all' => true];
}

return $bundles;
16 changes: 16 additions & 0 deletions tests/Application/config/packages/dev/swiftmailer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

use Sylius\Bundle\CoreBundle\Application\Kernel;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

if (Kernel::VERSION_ID >= 11200) {
return;
}

return static function (ContainerConfigurator $containerConfigurator) {
$containerConfigurator->extension('swiftmailer', [
'disable_delivery' => true,
]);
};
2 changes: 0 additions & 2 deletions tests/Application/config/packages/dev/swiftmailer.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions tests/Application/config/packages/mailer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

use Sylius\Bundle\CoreBundle\Application\Kernel;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

if (Kernel::VERSION_ID < 11200) {
return;
}

return static function (ContainerConfigurator $containerConfigurator) {
$containerConfigurator->extension('framework', [
'mailer' => [
'dsn' => '%env(MAILER_DSN)%',
],
]);
};
12 changes: 5 additions & 7 deletions tests/Application/config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ parameters:
sylius_shop_api.security.regex: "^/shop-api"

security:
enable_authenticator_manager: true
providers:
sylius_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

encoders:
password_hashers:
Sylius\Component\User\Model\UserInterface: argon2i
firewalls:
admin:
Expand All @@ -25,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:
Expand All @@ -37,22 +38,19 @@ security:
logout:
path: sylius_admin_logout
target: sylius_admin_login
anonymous: true

sylius_shop_api:
pattern: "%sylius_shop_api.security.regex%"
stateless: true
anonymous: true
entry_point: jwt
provider: sylius_shop_user_provider
json_login:
check_path: /shop-api/login
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

dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
Expand Down
10 changes: 0 additions & 10 deletions tests/Application/config/packages/staging/monolog.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions tests/Application/config/packages/staging/swiftmailer.yaml

This file was deleted.

16 changes: 16 additions & 0 deletions tests/Application/config/packages/swiftmailer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

use Sylius\Bundle\CoreBundle\Application\Kernel;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

if (Kernel::VERSION_ID >= 11200) {
return;
}

return static function (ContainerConfigurator $containerConfigurator) {
$containerConfigurator->extension('swiftmailer', [
'url' => '%env(MAILER_URL)%',
]);
};
2 changes: 0 additions & 2 deletions tests/Application/config/packages/swiftmailer.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion tests/Application/config/packages/test/framework.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
framework:
test: ~
session:
storage_id: session.storage.mock_file
storage_factory_id: session.storage.factory.mock_file
22 changes: 22 additions & 0 deletions tests/Application/config/packages/test/mailer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

use Sylius\Bundle\CoreBundle\Application\Kernel;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

if (Kernel::VERSION_ID < 11200) {
return;
}

return static function (ContainerConfigurator $containerConfigurator) {
$containerConfigurator->extension('framework', [
'cache' => [
'pools' => [
'test.mailer_pool' => [
'adapter' => 'cache.adapter.filesystem',
],
],
],
]);
};
21 changes: 21 additions & 0 deletions tests/Application/config/packages/test/swiftmailer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

use Sylius\Bundle\CoreBundle\Application\Kernel;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

if (Kernel::VERSION_ID >= 11200) {
return;
}

return static function (ContainerConfigurator $containerConfigurator) {
$containerConfigurator->extension('swiftmailer', [
'disable_delivery' => true,
'logging' => true,
'spool' => [
'type' => 'file',
'path' => '%kernel.cache_dir%/spool',
],
]);
};
6 changes: 0 additions & 6 deletions tests/Application/config/packages/test/swiftmailer.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
framework:
test: ~
session:
storage_id: session.storage.mock_file
storage_factory_id: session.storage.factory.mock_file
14 changes: 14 additions & 0 deletions tests/Application/config/packages/test_cached/mailer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

use Sylius\Bundle\CoreBundle\Application\Kernel;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

if (Kernel::VERSION_ID < 11200) {
return;
}

return static function (ContainerConfigurator $containerConfigurator) {
$containerConfigurator->import(__DIR__ . '/../test/mailer.php');
};
14 changes: 14 additions & 0 deletions tests/Application/config/packages/test_cached/swiftmailer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

use Sylius\Bundle\CoreBundle\Application\Kernel;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

if (Kernel::VERSION_ID >= 11200) {
return;
}

return static function (ContainerConfigurator $containerConfigurator) {
$containerConfigurator->import(__DIR__ . '/../test/swiftmailer.php');
};

This file was deleted.

Loading

0 comments on commit 8657ed0

Please sign in to comment.