Skip to content

Commit

Permalink
Merge pull request #66 from BitBagCommerce/OP-139/sylius_upgrade
Browse files Browse the repository at this point in the history
OP-139/Add Sylius 1.12 support
  • Loading branch information
senghe authored Apr 6, 2023
2 parents 02f2886 + 7e7d386 commit 6e4164a
Show file tree
Hide file tree
Showing 49 changed files with 129 additions and 533 deletions.
20 changes: 7 additions & 13 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: ["7.4", "8.0"]
symfony: ["^4.4", "^5.2"]
sylius: ["~1.9.0", "~1.10.0", "~1.11.0"]
node: ["14.19"]
mysql: ["8.0"]
php: ["8.0"]
symfony: ["^5.4", "^6.0"]
sylius: ["~1.11.0", "~1.12.0"]
node: ["^14.17.x"]
mysql: ["5.7", "8.0"]

exclude:
- sylius: ~1.9.0
php: 8.0

- sylius: ~1.10.0
symfony: 4.4

- sylius: ~1.11.0
php: 7.4
symfony: ^6.0

env:
APP_ENV: test
Expand Down
18 changes: 8 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"description": "Blacklist plugin for Sylius.",
"license": "MIT",
"require": {
"php": "^7.4 || ^8.0",
"sylius/sylius": "~1.8.0 || ~1.9.0 || ~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 @@ -23,7 +23,6 @@
"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",
"lchrusciel/api-test-case": "^4.1||^5.0",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
Expand All @@ -33,14 +32,13 @@
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sensiolabs/security-checker": "^6.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.1"
"vimeo/psalm": "4.12"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 4 additions & 2 deletions spec/Checker/UserRoleCheckerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Sylius\Component\Core\Model\AdminUserInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\User\UserInterface;

final class UserRoleCheckerSpec extends ObjectBehavior
{
Expand All @@ -41,9 +42,10 @@ public function it_returns_true_if_object_returned_from_storage_is_an_admin_user

public function it_returns_false_if_object_returned_from_storage_is_not_an_admin_user_interface(
TokenStorageInterface $tokenStorage,
TokenInterface $token
TokenInterface $token,
UserInterface $user
): void {
$token->getUser()->willReturn(new \stdClass());
$token->getUser()->willReturn($user);
$tokenStorage->getToken()->willReturn($token);

$this->isAdmin()->shouldReturn(false);
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/config/routing/admin/fraud_suspicion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ bitbag_sylius_blacklist_plugin_admin_fraud_suspicion_show:
path: fraud-suspicions/{id}
methods: [GET]
defaults:
_controller: bitbag_sylius_blacklist_plugin.controller.fraud_suspicion:showAction
_controller: bitbag_sylius_blacklist_plugin.controller.fraud_suspicion::showAction
_sylius:
template: "@BitBagSyliusBlacklistPlugin/FraudSuspicion/Admin/show.html.twig"
criteria:
Expand All @@ -26,7 +26,7 @@ bitbag_sylius_blacklist_plugin_admin_order_mark_suspicious:
path: /order/{orderId}/fraud-suspicion/new
methods: [GET, POST]
defaults:
_controller: bitbag_sylius_blacklist_plugin.controller.fraud_suspicion:createAction
_controller: bitbag_sylius_blacklist_plugin.controller.fraud_suspicion::createAction
_sylius:
vars:
route:
Expand Down
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
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,10 +1,15 @@
<?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
*/

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.

9 changes: 0 additions & 9 deletions tests/Application/config/packages/security_checker.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,4 +1,4 @@
framework:
test: ~
session:
storage_id: session.storage.mock_file
handler_id: ~
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.

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
6 changes: 0 additions & 6 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,7 +1,15 @@
<?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
*/

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],
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
swiftmailer:
disable_delivery: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
swiftmailer:
url: '%env(MAILER_URL)%'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
security:
encoders:
sha512: sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
swiftmailer:
disable_delivery: true
logging: true
spool:
type: file
path: "%kernel.cache_dir%/spool"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
security:
encoders:
sha512: sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
swiftmailer:
disable_delivery: true
logging: true
spool:
type: file
path: "%kernel.cache_dir%/spool"
16 changes: 16 additions & 0 deletions tests/Application/config/sylius/1.12/bundles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?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 [
League\FlysystemBundle\FlysystemBundle::class => ['all' => true],
Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true],
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
];
3 changes: 3 additions & 0 deletions tests/Application/config/sylius/1.12/packages/mailer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
framework:
mailer:
dsn: '%env(MAILER_DSN)%'
Loading

0 comments on commit 6e4164a

Please sign in to comment.