Skip to content

Commit

Permalink
Update Action for Sylius 1.12 (#5)
Browse files Browse the repository at this point in the history
Update Action for Sylius 1.12

Co-authored-by: jb cr <[email protected]>
  • Loading branch information
macintoshplus and jbcr authored Dec 7, 2022
1 parent d1ec2b4 commit ee4f750
Show file tree
Hide file tree
Showing 29 changed files with 122 additions and 18 deletions.
29 changes: 21 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ on:
jobs:
tests:
runs-on: ubuntu-18.04

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

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

Expand All @@ -40,6 +38,18 @@ jobs:
-
php: "7.4"
sylius: "~1.11.0"
-
php: "7.4"
sylius: "~1.12.0"
-
sylius: "~1.9.0"
symfony: "^6.0"
-
sylius: "~1.10.0"
symfony: "^6.0"
-
sylius: "~1.11.0"
symfony: "^6.0"


env:
Expand All @@ -48,7 +58,7 @@ jobs:

steps:
-
uses: actions/checkout@v2
uses: actions/checkout@v3

-
name: Setup PHP
Expand Down Expand Up @@ -96,11 +106,11 @@ jobs:
-
name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

-
name: Cache Composer
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
Expand All @@ -119,7 +129,10 @@ jobs:
name: Restrict Sylius version
if: matrix.sylius != ''
run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction

-
name: Remove FOS OAuth Server
if: matrix.sylius == '~1.12.0'
run: composer remove "friendsofsymfony/oauth-server-bundle" --dev --no-update --no-scripts --no-interaction
-
name: Install PHP dependencies
run: composer install --no-interaction
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "MIT",
"require": {
"php": ">=7.4",
"sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0 || ~1.12.0"
"sylius/sylius": "~1.12.0"
},
"require-dev": {
"behat/behat": "^3.6.1",
Expand Down Expand Up @@ -38,7 +38,7 @@
"symfony/intl": "^4.4 || ^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^4.4 || ^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.12",
"vimeo/psalm": "4.7.1",
"vimeo/psalm": "4.7.1||^5.0",
"polishsymfonycommunity/symfony-mocker-container": "^1.0"
},
"config": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function load(array $configs, ContainerBuilder $container): void
$container->setParameter('jb_dev_labs_sylius_cli_context.config', $config);

$loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../../config'));

/** @psalm-suppress ReservedWord */
$loader->load('services.php');
}

Expand Down
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 @@ -58,7 +59,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 +88,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
9 changes: 8 additions & 1 deletion tests/Application/config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@
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');
if (method_exists(DotEnv::class, 'usePutenv')) {
$dotEnv = new DotEnv();
$dotEnv->usePutenv(true);
} else {
$dotEnv = new DotEnv(true);
}

$dotEnv->loadEnv(dirname(__DIR__) . '/.env');
}

$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
Expand Down
1 change: 0 additions & 1 deletion tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
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
1 change: 1 addition & 0 deletions tests/Application/config/sylius/1.10/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
return [
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
];
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ framework:
test: ~
session:
storage_id: session.storage.mock_file
# storage_factory_id: session.storage.factory.mock_file
1 change: 1 addition & 0 deletions tests/Application/config/sylius/1.11/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::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,5 @@
framework:
test: ~
session:
storage_id: session.storage.mock_file
# storage_factory_id: session.storage.factory.mock_file
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"
6 changes: 6 additions & 0 deletions tests/Application/config/sylius/1.12/bundles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

return [
League\FlysystemBundle\FlysystemBundle::class => ['all' => true],
Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true],
];
22 changes: 22 additions & 0 deletions tests/Application/config/sylius/1.12/packages/security.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
security:
enable_authenticator_manager: true
providers:
sylius_admin_user_provider:
id: sylius.admin_user_provider.email_or_name_based
sylius_api_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
sylius_api_shop_user_provider:
id: sylius.shop_user_provider.email_or_name_based
password_hashers:
Sylius\Component\User\Model\UserInterface: argon2i
firewalls:
main:
security: false
admin:
security: false
shop:
context: shop
pattern: "%sylius.security.shop_regex%"
provider: sylius_shop_user_provider
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
framework:
test: ~
session:
# storage_id: session.storage.mock_file
storage_factory_id: session.storage.factory.mock_file
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
framework:
cache:
pools:
test.mailer_pool:
adapter: cache.adapter.filesystem
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
security:
password_hashers:
Sylius\Component\User\Model\UserInterface:
algorithm: argon2i
time_cost: 3
memory_cost: 10
1 change: 1 addition & 0 deletions tests/Application/config/sylius/1.9/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true],
Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
swiftmailer:
disable_delivery: true
2 changes: 2 additions & 0 deletions tests/Application/config/sylius/1.9/packages/swiftmailer.yaml
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,5 @@
framework:
test: ~
session:
storage_id: session.storage.mock_file
# storage_factory_id: session.storage.factory.mock_file
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"

0 comments on commit ee4f750

Please sign in to comment.