Skip to content

Commit

Permalink
Merge pull request #37 from BitBagCommerce/OP-138/sylius_upgrade
Browse files Browse the repository at this point in the history
OP-138 Add sylius 1.12 support
  • Loading branch information
senghe authored Apr 6, 2023
2 parents 2230368 + 793a411 commit dfe8fce
Show file tree
Hide file tree
Showing 49 changed files with 346 additions and 328 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,22 @@ on:

jobs:
tests:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

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

strategy:
fail-fast: false
matrix:
php: ["8.0", "7.4"]
symfony: ["^4.4", "^5.2"]
sylius: ["~1.11.0", "~1.10.0"]
node: ["12.x"]
mysql: ["8.0"]
php: ["8.0"]
symfony: ["^5.4", "^6.0"]
sylius: ["~1.11.0", "~1.12.0"]
node: ["14.x"]
mysql: ["5.7", "8.0"]

exclude:
- sylius: ~1.11.0
symfony: ^4.4

- sylius: ~1.11.0
php: 7.4

- sylius: ~1.10.0
php: 8.0
symfony: ^6.0

env:
APP_ENV: test
Expand Down Expand Up @@ -152,7 +146,7 @@ jobs:
name: Prepare test application assets
run: |
(cd tests/Application && bin/console assets:install public -vvv)
(cd tests/Application && yarn build)
(cd tests/Application && yarn encore dev)
-
name: Prepare test application cache
Expand Down
15 changes: 8 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"description": "Catalog plugin for Sylius",
"license": "MIT",
"require": {
"php": "^7.4 || ^8.0",
"sylius/sylius": "~1.10.0 || ~1.11.0"
"php": "^8.0",
"sylius/sylius": "~1.11.0 || ~1.12.0"
},
"require-dev": {
"behat/behat": "^3.7",
Expand All @@ -31,11 +31,12 @@
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"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",
"symfony/browser-kit": "^5.4 || ^6.0",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/intl": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.14",
"vimeo/psalm": "^4.7"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion src/Checker/Sort/Doctrine/CheapestSort.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ final class CheapestSort implements SortInterface
{
public function modifyQueryBuilder(QueryBuilder $queryBuilder): void
{
$queryBuilder->orderBy('price', self::ASC);
$queryBuilder->orderBy('min_price', self::ASC);
}
}
2 changes: 1 addition & 1 deletion src/Checker/Sort/Doctrine/MostExpensiveSort.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ final class MostExpensiveSort implements SortInterface
{
public function modifyQueryBuilder(QueryBuilder $queryBuilder): void
{
$queryBuilder->orderBy('price', self::DESC);
$queryBuilder->orderBy('max_price', self::DESC);
}
}
4 changes: 2 additions & 2 deletions src/Resolver/ProductsInsideCatalogResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public function findMatchingProducts(CatalogInterface $catalog): array
$rules = $catalog->getRules();

$qb = $this->productRepository->createQueryBuilder('p')
->addSelect('min(price) AS HIDDEN min_price')
->addSelect('max(price) AS HIDDEN max_price')
->addSelect('min(price.price) AS HIDDEN min_price')
->addSelect('max(price.price) AS HIDDEN max_price')
->addGroupBy('p')
->leftJoin('p.translations', 'name')
->leftJoin('p.variants', 'variant')
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/assets/admin/entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import './js';
import './scss/main.scss';
Empty file.
Empty file.
2 changes: 2 additions & 0 deletions src/Resources/assets/shop/entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import './js';
import './scss/main.scss';
Empty file.
Empty file.
4 changes: 2 additions & 2 deletions src/Resources/config/routing/admin/attribute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ bitbag_admin_ajax_attribute_by_code:
path: /attribute-search-by-code
methods: [GET]
defaults:
_controller: sylius.controller.product_attribute:indexAction
_controller: sylius.controller.product_attribute::indexAction
_format: json
_sylius:
permission: true
Expand All @@ -16,7 +16,7 @@ bitbag_admin_ajax_attribute_by_id:
path: /attribute-search-by-id
methods: [GET]
defaults:
_controller: sylius.controller.product_attribute:indexAction
_controller: sylius.controller.product_attribute::indexAction
_format: json
_sylius:
permission: true
Expand Down
6 changes: 4 additions & 2 deletions tests/Application/.env
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ JWT_PASSPHRASE=acme_plugin_development
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=smtp://localhost
# MAILER_URL=smtp://localhost
###< symfony/swiftmailer-bundle ###

###> symfony/messenger ###
MESSENGER_TRANSPORT_DSN=sync://
###> symfony/messenger ###
###> symfony/messenger ###

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

final class Kernel extends BaseKernel
{
Expand Down Expand Up @@ -58,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 @@ -87,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
1 change: 1 addition & 0 deletions tests/Application/assets/admin/entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'sylius/bundle/AdminBundle/Resources/private/entry';
1 change: 1 addition & 0 deletions tests/Application/assets/shop/entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'sylius/bundle/ShopBundle/Resources/private/entry';
2 changes: 1 addition & 1 deletion tests/Application/config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} else {
// load all the .env files
(new Dotenv(true))->loadEnv(dirname(__DIR__) . '/.env');
(new Dotenv())->loadEnv(dirname(__DIR__) . '/.env');
}

$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
Expand Down
7 changes: 6 additions & 1 deletion tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* 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
*/

declare(strict_types=1);

return [
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
2 changes: 0 additions & 2 deletions tests/Application/config/packages/dev/swiftmailer.yaml

This file was deleted.

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

This file was deleted.

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,5 +1,5 @@
framework:
test: ~
session:
storage_id: session.storage.mock_file
handler_id: ~
profiler: { only_exceptions: false }
3 changes: 0 additions & 3 deletions tests/Application/config/packages/test/security.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions tests/Application/config/packages/test/swiftmailer.yaml

This file was deleted.

This file was deleted.

7 changes: 7 additions & 0 deletions tests/Application/config/packages/webpack_encore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
webpack_encore:
output_path: '%kernel.project_dir%/public/build/default'
builds:
shop: '%kernel.project_dir%/public/build/shop'
admin: '%kernel.project_dir%/public/build/admin'
cs_shop: '%kernel.project_dir%/public/build/bitbag/cs/shop'
cs_admin: '%kernel.project_dir%/public/build/bitbag/cs/admin'
2 changes: 1 addition & 1 deletion tests/Application/config/routes/sylius_shop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ sylius_shop_default_locale:
path: /
methods: [GET]
defaults:
_controller: sylius.controller.shop.locale_switch:switchAction
_controller: sylius.controller.shop.locale_switch::switchAction
8 changes: 0 additions & 8 deletions tests/Application/config/sylius/1.10/bundles.php

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

8 changes: 8 additions & 0 deletions tests/Application/config/sylius/1.11/bundles.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* 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
*/

declare(strict_types=1);

return [
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
];

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
swiftmailer:
disable_delivery: true

This file was deleted.

This file was deleted.

Loading

0 comments on commit dfe8fce

Please sign in to comment.