Skip to content

Commit

Permalink
feature #385 [Maintenance] Add support for Sylius 1.12 with Symfony 5…
Browse files Browse the repository at this point in the history
….4 (coldic3)

This PR was merged into the 1.3 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | 1.3
| Bug fix?        | no
| New feature?    | no
| Related tickets | 

To be merged on Sylius 1.12 release 💃

Support for Symfony 6 will be added in a separate PR.

Commits
-------

2dcc5fe [Maintenance] Add support for Sylius 1.12 but without Symfony 6
5be01c2 [GitHub Actions] Add Sylius 1.12 to the matrix
dc8d2b8 Replace gulp with webpack
e4e8226 [Maintenance] Add support for both Swiftmailer and SF Mailer in the test app
f259da1 [Behat] Fix contexts
cee61c3 [GitHub Actions] Use latest version of ubuntu
2048ec2 [Behat] Refactor services config
2254fef [Maintenance] Refactor test app config
  • Loading branch information
GSadee authored Nov 2, 2022
2 parents f8ed624 + 2254fef commit d5efc4a
Show file tree
Hide file tree
Showing 37 changed files with 215 additions and 232 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

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

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

Expand All @@ -21,7 +21,7 @@ jobs:
matrix:
php: ["8.0", "8.1"]
symfony: ["^5.4"]
sylius: ["~1.11.2"]
sylius: ["~1.11.2", "~1.12.0"]
node: ["14.x"]
mysql: ["5.7", "8.0"]
pdf: [true]
Expand Down Expand Up @@ -159,7 +159,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 build:prod)
-
name: Prepare test application cache
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"knplabs/knp-snappy-bundle": "^1.7",
"myclabs/php-enum": "^1.7",
"sylius/resource-bundle": "^1.6",
"sylius/sylius": "~1.11.4",
"sylius/sylius": "~1.11.4 || ~1.12.0",
"symfony/messenger": "^5.4"
},
"require-dev": {
Expand Down Expand Up @@ -54,6 +54,7 @@
"symfony/dotenv": "^5.4",
"symfony/intl": "^5.4",
"symfony/web-profiler-bundle": "^5.4",
"symfony/webpack-encore-bundle": "^1.15",
"symplify/easy-coding-standard": "9.3.26"
},
"autoload": {
Expand Down
15 changes: 0 additions & 15 deletions tests/Application/.babelrc

This file was deleted.

4 changes: 4 additions & 0 deletions tests/Application/.env
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ DATABASE_URL=mysql://[email protected]/sylius_refund_plugin_%kernel.environment%
MAILER_URL=smtp://localhost
###< symfony/swiftmailer-bundle ###

###> symfony/mailer ###
MAILER_DSN=null://null
###< symfony/mailer ###

###> knplabs/knp-snappy-bundle ###
WKHTMLTOPDF_PATH=/usr/local/bin/wkhtmltopdf
###< knplabs/knp-snappy-bundle ###
Expand Down
3 changes: 3 additions & 0 deletions tests/Application/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/public/assets
/public/build
/public/css
/public/js
/public/media/*
Expand All @@ -7,6 +8,8 @@
!/public/media/image/.gitignore

/node_modules
/yarn.lock
/package-lock.json

###> symfony/framework-bundle ###
/.env.*.local
Expand Down
2 changes: 2 additions & 0 deletions tests/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Tests\Sylius\RefundPlugin\Application;

use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer;
use Sylius\Bundle\CoreBundle\Application\Kernel as SyliusKernel;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\FileResource;
Expand Down Expand Up @@ -129,6 +130,7 @@ private function getConfigurationDirectories(): array
{
$directories = [
$this->getProjectDir() . '/config',
$this->getProjectDir() . '/config/sylius/' . SyliusKernel::MAJOR_VERSION . '.' . SyliusKernel::MINOR_VERSION,
];

return array_filter($directories, 'file_exists');
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';
14 changes: 12 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 as SyliusKernel;

$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 @@ -57,4 +58,13 @@
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 (SyliusKernel::MINOR_VERSION > 11) {
$bundles[League\FlysystemBundle\FlysystemBundle::class] = ['all' => true];
} else {
$bundles[Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class] = ['all' => true];
}

return $bundles;
7 changes: 7 additions & 0 deletions tests/Application/config/packages/assets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
framework:
assets:
packages:
shop:
json_manifest_path: '%kernel.project_dir%/public/build/shop/manifest.json'
admin:
json_manifest_path: '%kernel.project_dir%/public/build/admin/manifest.json'
2 changes: 0 additions & 2 deletions tests/Application/config/packages/staging/swiftmailer.yaml

This file was deleted.

This file was deleted.

5 changes: 5 additions & 0 deletions tests/Application/config/packages/webpack_encore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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'
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports:
- { resource: "../dev/mailer.yaml" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports:
- { resource: "../test/mailer.yaml" }
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)%'
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,2 @@
imports:
- { resource: "../test/mailer.yaml" }
60 changes: 0 additions & 60 deletions tests/Application/gulpfile.babel.js

This file was deleted.

85 changes: 48 additions & 37 deletions tests/Application/package.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,63 @@
{
"dependencies": {
"babel-polyfill": "^6.26.0",
"chart.js": "^2.9.3",
"jquery": "^3.2.0",
"@babel/polyfill": "^7.0.0",
"chart.js": "^3.7.1",
"jquery": "^3.5.0",
"jquery.dirtyforms": "^2.0.0",
"lightbox2": "^2.9.0",
"semantic-ui-css": "^2.2.0",
"slick-carousel": "^1.8.1"
},
"devDependencies": {
"@symfony/webpack-encore": "^0.28.0",
"babel-core": "^6.26.3",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-module-resolver": "^3.1.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-register": "^6.26.0",
"@babel/core": "^7.0.0",
"@babel/plugin-external-helpers": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.18.9",
"@babel/preset-env": "^7.18.10",
"@babel/register": "^7.0.0",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-inject": "^4.0.4",
"@rollup/plugin-node-resolve": "^13.3.0",
"@semantic-ui-react/css-patch": "^1.1.2",
"@symfony/webpack-encore": "^3.1.0",
"babel-plugin-fast-async": "^6.1.2",
"babel-plugin-module-resolver": "^4.1.0",
"dedent": "^0.7.0",
"eslint": "^4.19.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-import-resolver-babel-module": "^4.0.0",
"eslint-plugin-import": "^2.12.0",
"fast-async": "^6.3.7",
"gulp": "^4.0.0",
"gulp-chug": "^0.5",
"gulp-concat": "^2.6.0",
"gulp-debug": "^2.1.2",
"gulp-if": "^2.0.0",
"gulp-livereload": "^3.8.1",
"gulp-order": "^1.1.1",
"gulp-sass": "^4.0.1",
"gulp-sourcemaps": "^1.6.0",
"gulp-uglifycss": "^1.0.5",
"merge-stream": "^1.0.0",
"rollup": "^0.60.7",
"rollup-plugin-babel": "^3.0.4",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-inject": "^2.0.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-uglify": "^4.0.0",
"sass-loader": "^7.0.1",
"upath": "^1.1.0",
"yargs": "^6.4.0"
"eslint": "^8.23.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-import-resolver-babel-module": "^5.3.1",
"eslint-plugin-import": "^2.26.0",
"fast-async": "^6.3.8",
"gulp": "^4.0.2",
"gulp-chug": "^0.5.1",
"gulp-concat": "^2.6.1",
"gulp-debug": "^4.0.0",
"gulp-if": "^3.0.0",
"gulp-livereload": "^4.0.2",
"gulp-order": "^1.2.0",
"gulp-sass": "^5.1.0",
"gulp-sourcemaps": "^3.0.0",
"gulp-uglifycss": "^1.1.0",
"merge-stream": "^2.0.0",
"rollup": "^2.79.0",
"rollup-plugin-terser": "^7.0.2",
"sass": "^1.54.8",
"sass-loader": "^13.0.0",
"upath": "^2.0.1",
"yargs": "^17.5.1"
},
"engines": {
"node": "^14 || ^16 || ^18"
},
"engineStrict": true,
"scripts": {
"build": "gulp build",
"watch": "encore dev --watch",
"build": "encore dev",
"build:prod": "encore production",
"gulp": "gulp build",
"lint": "yarn lint:js",
"lint:js": "eslint gulpfile.babel.js"
"lint:js": "eslint gulpfile.babel.js",
"postinstall": "semantic-ui-css-patch"
},
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% include '@SyliusUi/Security/_login.html.twig'
with {
'action': path('sylius_admin_login_check'),
'paths': {'logo': asset('build/admin/images/logo.png', 'admin')}
}
%}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ encore_entry_script_tags('admin-entry', null, 'admin') }}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ encore_entry_link_tags('admin-entry', null, 'admin') }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="column">
<a href="{{ path('sylius_shop_homepage') }}">
<img src="{{ asset('build/shop/images/logo.png', 'shop') }}" alt="Sylius logo" class="ui small image" />
</a>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ encore_entry_script_tags('shop-entry', null, 'shop') }}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ encore_entry_link_tags('shop-entry', null, 'shop') }}
Loading

0 comments on commit d5efc4a

Please sign in to comment.