Skip to content

Commit dfe8fce

Browse files
authored
Merge pull request #37 from BitBagCommerce/OP-138/sylius_upgrade
OP-138 Add sylius 1.12 support
2 parents 2230368 + 793a411 commit dfe8fce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+346
-328
lines changed

.github/workflows/build.yml

+8-14
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,22 @@ on:
1414

1515
jobs:
1616
tests:
17-
runs-on: ubuntu-18.04
17+
runs-on: ubuntu-20.04
1818

1919
name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"
2020

2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
php: ["8.0", "7.4"]
25-
symfony: ["^4.4", "^5.2"]
26-
sylius: ["~1.11.0", "~1.10.0"]
27-
node: ["12.x"]
28-
mysql: ["8.0"]
24+
php: ["8.0"]
25+
symfony: ["^5.4", "^6.0"]
26+
sylius: ["~1.11.0", "~1.12.0"]
27+
node: ["14.x"]
28+
mysql: ["5.7", "8.0"]
2929

3030
exclude:
3131
- sylius: ~1.11.0
32-
symfony: ^4.4
33-
34-
- sylius: ~1.11.0
35-
php: 7.4
36-
37-
- sylius: ~1.10.0
38-
php: 8.0
32+
symfony: ^6.0
3933

4034
env:
4135
APP_ENV: test
@@ -152,7 +146,7 @@ jobs:
152146
name: Prepare test application assets
153147
run: |
154148
(cd tests/Application && bin/console assets:install public -vvv)
155-
(cd tests/Application && yarn build)
149+
(cd tests/Application && yarn encore dev)
156150
157151
-
158152
name: Prepare test application cache

composer.json

+8-7
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"description": "Catalog plugin for Sylius",
66
"license": "MIT",
77
"require": {
8-
"php": "^7.4 || ^8.0",
9-
"sylius/sylius": "~1.10.0 || ~1.11.0"
8+
"php": "^8.0",
9+
"sylius/sylius": "~1.11.0 || ~1.12.0"
1010
},
1111
"require-dev": {
1212
"behat/behat": "^3.7",
@@ -31,11 +31,12 @@
3131
"phpunit/phpunit": "^9.5",
3232
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
3333
"sylius-labs/coding-standard": "^4.0",
34-
"symfony/browser-kit": "^4.4 || ^5.2",
35-
"symfony/debug-bundle": "^4.4 || ^5.2",
36-
"symfony/dotenv": "^4.4 || ^5.2",
37-
"symfony/intl": "^4.4 || ^5.2",
38-
"symfony/web-profiler-bundle": "^4.4 || ^5.2",
34+
"symfony/browser-kit": "^5.4 || ^6.0",
35+
"symfony/debug-bundle": "^5.4 || ^6.0",
36+
"symfony/dotenv": "^5.4 || ^6.0",
37+
"symfony/intl": "^5.4 || ^6.0",
38+
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
39+
"symfony/webpack-encore-bundle": "^1.14",
3940
"vimeo/psalm": "^4.7"
4041
},
4142
"config": {

src/Checker/Sort/Doctrine/CheapestSort.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ final class CheapestSort implements SortInterface
1616
{
1717
public function modifyQueryBuilder(QueryBuilder $queryBuilder): void
1818
{
19-
$queryBuilder->orderBy('price', self::ASC);
19+
$queryBuilder->orderBy('min_price', self::ASC);
2020
}
2121
}

src/Checker/Sort/Doctrine/MostExpensiveSort.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ final class MostExpensiveSort implements SortInterface
1616
{
1717
public function modifyQueryBuilder(QueryBuilder $queryBuilder): void
1818
{
19-
$queryBuilder->orderBy('price', self::DESC);
19+
$queryBuilder->orderBy('max_price', self::DESC);
2020
}
2121
}

src/Resolver/ProductsInsideCatalogResolver.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public function findMatchingProducts(CatalogInterface $catalog): array
5050
$rules = $catalog->getRules();
5151

5252
$qb = $this->productRepository->createQueryBuilder('p')
53-
->addSelect('min(price) AS HIDDEN min_price')
54-
->addSelect('max(price) AS HIDDEN max_price')
53+
->addSelect('min(price.price) AS HIDDEN min_price')
54+
->addSelect('max(price.price) AS HIDDEN max_price')
5555
->addGroupBy('p')
5656
->leftJoin('p.translations', 'name')
5757
->leftJoin('p.variants', 'variant')

src/Resources/assets/admin/entry.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import './js';
2+
import './scss/main.scss';

src/Resources/assets/admin/js/index.js

Whitespace-only changes.

src/Resources/assets/admin/scss/main.scss

Whitespace-only changes.

src/Resources/assets/shop/entry.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import './js';
2+
import './scss/main.scss';

src/Resources/assets/shop/js/index.js

Whitespace-only changes.

src/Resources/assets/shop/scss/main.scss

Whitespace-only changes.

src/Resources/config/routing/admin/attribute.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ bitbag_admin_ajax_attribute_by_code:
22
path: /attribute-search-by-code
33
methods: [GET]
44
defaults:
5-
_controller: sylius.controller.product_attribute:indexAction
5+
_controller: sylius.controller.product_attribute::indexAction
66
_format: json
77
_sylius:
88
permission: true
@@ -16,7 +16,7 @@ bitbag_admin_ajax_attribute_by_id:
1616
path: /attribute-search-by-id
1717
methods: [GET]
1818
defaults:
19-
_controller: sylius.controller.product_attribute:indexAction
19+
_controller: sylius.controller.product_attribute::indexAction
2020
_format: json
2121
_sylius:
2222
permission: true

tests/Application/.env

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ JWT_PASSPHRASE=acme_plugin_development
2525
# For Gmail as a transport, use: "gmail://username:password@localhost"
2626
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
2727
# Delivery is disabled by default via "null://localhost"
28-
MAILER_URL=smtp://localhost
28+
# MAILER_URL=smtp://localhost
2929
###< symfony/swiftmailer-bundle ###
3030

3131
###> symfony/messenger ###
3232
MESSENGER_TRANSPORT_DSN=sync://
33-
###> symfony/messenger ###
33+
###> symfony/messenger ###
34+
35+
# MAILER_DSN=smtp://localhost

tests/Application/Kernel.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Symfony\Component\DependencyInjection\ContainerBuilder;
1313
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
1414
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
15-
use Symfony\Component\Routing\RouteCollectionBuilder;
15+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
1616

1717
final class Kernel extends BaseKernel
1818
{
@@ -58,7 +58,7 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa
5858
}
5959
}
6060

61-
protected function configureRoutes(RouteCollectionBuilder $routes): void
61+
protected function configureRoutes(RoutingConfigurator $routes): void
6262
{
6363
foreach ($this->getConfigurationDirectories() as $confDir) {
6464
$this->loadRoutesConfiguration($routes, $confDir);
@@ -87,11 +87,11 @@ private function loadContainerConfiguration(LoaderInterface $loader, string $con
8787
$loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');
8888
}
8989

90-
private function loadRoutesConfiguration(RouteCollectionBuilder $routes, string $confDir): void
90+
private function loadRoutesConfiguration(RoutingConfigurator $routes, string $confDir): void
9191
{
92-
$routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob');
93-
$routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob');
94-
$routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob');
92+
$routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS);
93+
$routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS);
94+
$routes->import($confDir . '/{routes}' . self::CONFIG_EXTS);
9595
}
9696

9797
/**
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import 'sylius/bundle/AdminBundle/Resources/private/entry';
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import 'sylius/bundle/ShopBundle/Resources/private/entry';

tests/Application/config/bootstrap.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
1616
} else {
1717
// load all the .env files
18-
(new Dotenv(true))->loadEnv(dirname(__DIR__) . '/.env');
18+
(new Dotenv())->loadEnv(dirname(__DIR__) . '/.env');
1919
}
2020

2121
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';

tests/Application/config/bundles.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<?php
22

3+
/*
4+
* This file was created by developers working at BitBag
5+
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6+
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7+
*/
8+
39
declare(strict_types=1);
410

511
return [
612
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
713
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
814
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
9-
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
1015
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
1116
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
1217
Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true],

tests/Application/config/packages/dev/swiftmailer.yaml

-2
This file was deleted.

tests/Application/config/packages/staging/swiftmailer.yaml

-2
This file was deleted.

tests/Application/config/packages/swiftmailer.yaml

-2
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
framework:
22
test: ~
33
session:
4-
storage_id: session.storage.mock_file
4+
handler_id: ~
55
profiler: { only_exceptions: false }

tests/Application/config/packages/test/security.yaml

-3
This file was deleted.

tests/Application/config/packages/test/swiftmailer.yaml

-6
This file was deleted.

tests/Application/config/packages/test_cached/swiftmailer.yaml

-6
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
webpack_encore:
2+
output_path: '%kernel.project_dir%/public/build/default'
3+
builds:
4+
shop: '%kernel.project_dir%/public/build/shop'
5+
admin: '%kernel.project_dir%/public/build/admin'
6+
cs_shop: '%kernel.project_dir%/public/build/bitbag/cs/shop'
7+
cs_admin: '%kernel.project_dir%/public/build/bitbag/cs/admin'

tests/Application/config/routes/sylius_shop.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ sylius_shop_default_locale:
1111
path: /
1212
methods: [GET]
1313
defaults:
14-
_controller: sylius.controller.shop.locale_switch:switchAction
14+
_controller: sylius.controller.shop.locale_switch::switchAction

tests/Application/config/sylius/1.10/bundles.php

-8
This file was deleted.

tests/Application/config/sylius/1.10/packages/dev/jms_serializer.yaml

-12
This file was deleted.

tests/Application/config/sylius/1.10/packages/jms_serializer.yaml

-4
This file was deleted.

tests/Application/config/sylius/1.10/packages/prod/jms_serializer.yaml

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
<?php
22

3+
/*
4+
* This file was created by developers working at BitBag
5+
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6+
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7+
*/
8+
39
declare(strict_types=1);
410

511
return [
612
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
13+
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
714
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
815
Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true],
16+
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
917
];

tests/Application/config/sylius/1.11/packages/dev/jms_serializer.yaml

-12
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
swiftmailer:
2+
disable_delivery: true

tests/Application/config/sylius/1.11/packages/jms_serializer.yaml

-4
This file was deleted.

tests/Application/config/sylius/1.11/packages/prod/jms_serializer.yaml

-10
This file was deleted.

0 commit comments

Comments
 (0)