Skip to content

Commit

Permalink
Support Symfony 6 and Sylius 1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMilek committed Nov 29, 2022
1 parent 90b55da commit e1b54eb
Show file tree
Hide file tree
Showing 45 changed files with 434 additions and 163 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ jobs:
fail-fast: false
matrix:
php: ["8.0", "8.1"]
symfony: ["^4.4", "^5.4"]
sylius: ["~1.11.2"]
node: ["14.x"]
symfony: ["^5.4", "^6.0"]
sylius: ["~1.11.10", "~1.12.0"]
node: ["16.x"]
mysql: ["5.7", "8.0"]

exclude:
- sylius: "~1.11.10"
symfony: "^6.0"

env:
APP_ENV: test
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}"
Expand Down
18 changes: 7 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
],
"require": {
"php": "^8.0",

"sylius/sylius": "~1.11.2",
"friendsofsymfony/jsrouting-bundle": "^2.2"
"sylius/sylius": "~1.11.2 || ~1.12.0",
"friendsofsymfony/jsrouting-bundle": "^3.2"
},
"require-dev": {
"behat/behat": "^3.6",
Expand All @@ -37,20 +36,17 @@
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"friends-of-behat/mink-debug-extension": "^2.0",
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
"phpspec/phpspec": "^7.0",
"phpstan/phpstan": "0.12.96",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"se/selenium-server-standalone": "^2.52",
"sylius-labs/coding-standard": "^3.0",
"symfony/debug-bundle": "^4.4 || ^5.4",
"symfony/dotenv": "^4.4 || ^5.4",
"symfony/web-profiler-bundle": "^4.4 || ^5.4"
},
"conflict": {
"doctrine/dbal": "^3.0"
"sylius-labs/coding-standard": "^4.0",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.15"
},
"prefer-stable": true,
"autoload": {
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/config/app/ajax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sylius_admin_order_creation_ajax_customer:
path: /customer-search
methods: [GET]
defaults:
_controller: sylius.controller.customer:indexAction
_controller: sylius.controller.customer::indexAction
_format: json
_sylius:
permission: true
Expand All @@ -14,7 +14,7 @@ sylius_admin_order_creation_ajax_customer_by_email:
path: /customer-search-by-email
methods: [GET]
defaults:
_controller: sylius.controller.customer:indexAction
_controller: sylius.controller.customer::indexAction
_format: json
_sylius:
permission: true
Expand All @@ -26,7 +26,7 @@ sylius_admin_order_creation_ajax_product_variants_by_phrase_and_channel:
path: /product-variant-search/{channelCode}
methods: [GET]
defaults:
_controller: sylius.controller.product_variant:indexAction
_controller: sylius.controller.product_variant::indexAction
_format: json
_sylius:
permission: true
Expand All @@ -42,7 +42,7 @@ sylius_admin_order_creation_ajax_product_variant_by_codes:
path: /product-variant-search-by-code
methods: [GET]
defaults:
_controller: sylius.controller.product_variant:indexAction
_controller: sylius.controller.product_variant::indexAction
_format: json
_sylius:
permission: true
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/config/app/routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sylius_admin_order_creation_order_create:
options:
expose: true
defaults:
_controller: sylius.controller.order:createAction
_controller: sylius.controller.order::createAction
_sylius:
event: admin_create
section: admin
Expand Down Expand Up @@ -50,7 +50,7 @@ sylius_admin_order_creation_order_create_from_preview:
options:
expose: true
defaults:
_controller: sylius.controller.order:createAction
_controller: sylius.controller.order::createAction
_sylius:
event: admin_create
section: admin
Expand Down Expand Up @@ -78,7 +78,7 @@ sylius_admin_order_creation_reorder:
options:
expose: true
defaults:
_controller: sylius.controller.order:createAction
_controller: sylius.controller.order::createAction
_sylius:
event: admin_create
section: admin
Expand All @@ -95,4 +95,4 @@ sylius_admin_order_creation_ajax:
resource: "@SyliusAdminOrderCreationPlugin/Resources/config/app/ajax.yml"

fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing-sf4.xml"
4 changes: 2 additions & 2 deletions src/Resources/views/Order/itemCollectionTheme.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends '@SyliusAdmin/Form/theme.html.twig' %}

{% block _sylius_admin_order_creation_new_order_items_entry_widget %}
{% spaceless %}
{% apply spaceless %}
<div class="two fields">
{{ form_row(form.quantity, {'attr': {'class' : 'item-quantity'}}) }}
{{ form_row(form.variant, {
Expand All @@ -11,5 +11,5 @@
'load_edit_url': path('sylius_admin_order_creation_ajax_product_variant_by_codes')
}) }}
</div>
{% endspaceless %}
{% endapply %}
{% endblock %}
15 changes: 0 additions & 15 deletions tests/Application/.babelrc

This file was deleted.

6 changes: 5 additions & 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=mysql://root@127.0.0.1/sylius_admin_order_creation_plugin_%kernel.environment%?serverVersion=5.5
DATABASE_URL=mysql://root@127.0.0.1/sylius_admin_order_creation_plugin_%kernel.environment%?serverVersion=5.7
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
Expand All @@ -34,3 +34,7 @@ JWT_PASSPHRASE=YOUR_SECRET_PASSPHRASE
MESSENGER_TRANSPORT_DSN=doctrine://default
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
###< symfony/messenger ###

###> symfony/mailer ###
MAILER_DSN=null://null
###< symfony/mailer ###
4 changes: 4 additions & 0 deletions tests/Application/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ JWT_PASSPHRASE=ALL_THAT_IS_GOLD_DOES_NOT_GLITTER_NOT_ALL_THOSE_WHO_WANDER_ARE_LO
# Sync transport turned for testing env for the ease of testing
MESSENGER_TRANSPORT_DSN=sync://
###< symfony/messenger ###

###> symfony/mailer ###
MAILER_DSN=null://null
###< symfony/mailer ###
11 changes: 6 additions & 5 deletions tests/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
use Symfony\Component\Routing\RouteCollectionBuilder;

final class Kernel extends BaseKernel
Expand Down Expand Up @@ -57,7 +58,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);
Expand Down Expand Up @@ -86,11 +87,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);
}

/**
Expand Down
Empty file.
Empty file.
18 changes: 18 additions & 0 deletions tests/Application/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

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 @@ -56,4 +57,15 @@
SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true],
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::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;
35 changes: 35 additions & 0 deletions tests/Application/config/packages/assets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', [
'assets' => [
'packages' => [
'admin' => [
'json_manifest_path' => '%kernel.project_dir%/public/build/admin/manifest.json',
],
'shop' => [
'json_manifest_path' => '%kernel.project_dir%/public/build/shop/manifest.json',
],
'app.admin' => [
'json_manifest_path' => '%kernel.project_dir%/public/build/app/admin/manifest.json',
],
'app.shop' => [
'json_manifest_path' => '%kernel.project_dir%/public/build/app/shop/manifest.json',
],
],
],
]);
};
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)%',
],
]);
};
Loading

0 comments on commit e1b54eb

Please sign in to comment.