Skip to content

Commit

Permalink
Merge remote-tracking branch 'janpalen/feature/OP-554-upgrade-to-syli…
Browse files Browse the repository at this point in the history
…us-2.0' into merge-feature-upgrade
  • Loading branch information
dariusz-rup committed Jan 27, 2025
2 parents a3ba11e + 1631458 commit 6c6ccfc
Show file tree
Hide file tree
Showing 41 changed files with 221 additions and 356 deletions.
19 changes: 5 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,12 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ "8.0", "8.1", "8.2", "8.3" ]
symfony: [ "^5.4", "^6.4" ]
sylius: [ "~1.12.0", "~1.13.0", "~1.14.0" ]
node: [ "18.x", "20.x" ]
php: [ "8.2", "8.3" ]
symfony: [ "^7.1" ]
sylius: [ "^2.0" ]
node: [ "20.x" ]
mysql: [ "8.0" ]

exclude:
- sylius: "~1.14.0"
php: "8.0"
- sylius: "~1.13.0"
php: "8.0"
- sylius: "~1.12.0"
php: "8.0"
symfony: "^6.4"

env:
APP_ENV: test
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"
Expand Down Expand Up @@ -191,7 +182,7 @@ jobs:

-
name: Upload Behat logs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: Behat logs
Expand Down
18 changes: 4 additions & 14 deletions .github/workflows/coding_standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,10 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ "8.0", "8.1", "8.2", "8.3" ]
symfony: [ "^5.4", "^6.4" ]
sylius: [ "~1.12.0", "~1.13.0", "~1.14.0" ]
node: [ "18.x", "20.x" ]
mysql: [ "8.0" ]

exclude:
- sylius: "~1.14.0"
php: 8.0
- sylius: "~1.13.0"
php: 8.0
- sylius: "~1.12.0"
php: 8.0
symfony: ^6.4
php: [ "8.2", "8.3" ]
symfony: [ "^7.1" ]
sylius: [ "^2.0" ]
node: [ "20.x" ]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ tests/Application/web/*

/etc/build/*
!/etc/build/.gitkeep
.idea
package-lock.json
60 changes: 32 additions & 28 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,52 @@
"description": "CrossSelling plugin for Sylius applications.",
"license": "MIT",
"require": {
"php": "^8.0",
"friendsofsymfony/elastica-bundle": "^6.0",
"sylius/sylius": "^1.12",
"symfony/webpack-encore-bundle": "^1.16"
"php": "~8.2.0 || ~8.3.0",
"friendsofsymfony/elastica-bundle": "^6.4",
"sylius/sylius": "^2.0.0",
"sylius/twig-hooks": "^0.6",
"sylius/twig-extra": "^0.6",
"symfony/ux-autocomplete": "^2.17",
"symfony/ux-live-component": "^2.20",
"symfony/ux-twig-component": "^2.20",
"symfony/webpack-encore-bundle": "^2.1",
"symfony/stimulus-bundle": "^2.12"
},
"require-dev": {
"behat/behat": "^3.7",
"behat/mink-selenium2-driver": "^1.4",
"behat/behat": "^3.14",
"behat/mink-selenium2-driver": "1.6.0",
"bitbag/coding-standard": "^3.0",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-debug-extension": "^2.0",
"friends-of-behat/mink-extension": "^2.4",
"dmore/behat-chrome-extension": "^1.4",
"dmore/chrome-mink-driver": "^2.9",
"friends-of-behat/mink": "^1.11",
"friends-of-behat/mink-browserkit-driver": "^1.6",
"friends-of-behat/mink-debug-extension": "^2.1",
"friends-of-behat/mink-extension": "^2.7",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"lchrusciel/api-test-case": "^5.0",
"friends-of-behat/symfony-extension": "^2.6",
"friends-of-behat/variadic-extension": "^1.6",
"lchrusciel/api-test-case": "^5.3",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.8.1",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-doctrine": "^1.3",
"phpstan/phpstan-strict-rules": "^1.3.0",
"phpstan/phpstan-webmozart-assert": "^1.2.0",
"phpunit/phpunit": "^9.5",
"phpstan/phpstan-strict-rules": "^1.6.0",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^10.5",
"sylius-labs/coding-standard": "^4.0",
"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/browser-kit": "^7.1",
"symfony/debug-bundle": "^7.1",
"symfony/dotenv": "^7.1",
"symfony/intl": "^7.1",
"symfony/web-profiler-bundle": "^7.1",
"polishsymfonycommunity/symfony-mocker-container": "^1.0"
},
"conflict": {
"behat/mink-selenium2-driver": ">=1.7.0"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": false,
"php-http/discovery": true,
"phpstan/extension-installer": false,
"symfony/thanks": false
}
Expand Down
18 changes: 8 additions & 10 deletions doc/01.1-webpack-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,17 @@ webpack_encore:
4. Add encore functions to your templates

```twig
{# @SyliusShopBundle/_scripts.html.twig #}
{{ encore_entry_script_tags('bitbag-cs-shop', null, 'cs_shop') }}
{# @SyliusShopBundle/_styles.html.twig #}
{{ encore_entry_link_tags('bitbag-cs-shop', null, 'cs_shop') }}
{# @SyliusAdminBundle/_scripts.html.twig #}
{# templates/admin/javascripts.html.twig #}
{{ encore_entry_script_tags('bitbag-cs-admin', null, 'cs_admin') }}
{# @SyliusAdminBundle/_styles.html.twig #}
{# templates/admin/stylesheets.html.twig #}
{{ encore_entry_link_tags('bitbag-cs-admin', null, 'cs_admin') }}
```
Please note, the template file paths may differ, depending on Sylius version.
{# templates/shop/javascripts.html.twig #}
{{ encore_entry_script_tags('bitbag-cs-shop', null, 'cs_shop') }}
{# templates/shop/stylesheets.html.twig #}
{{ encore_entry_link_tags('bitbag-cs-shop', null, 'cs_shop') }}
```

5. Run `yarn encore dev` or `yarn encore production`
22 changes: 11 additions & 11 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ ADDITIONAL
## Requirements:
We work on stable, supported and up-to-date versions of packages. We recommend you to do the same.

| Package | Version |
|---------------|-----------------|
| PHP | \>=8.0 |
| sylius/sylius | 1.12.x - 1.13.x |
| MySQL | \>= 5.7 |
| NodeJS | \>= 18.x |
| ElasticSearch | \>= 7.x |
| Package | Version |
|---------------|----------|
| PHP | \>=8.2 |
| sylius/sylius | \>=2.0.0 |
| MySQL | \>= 5.7 |
| NodeJS | \>= 20.x |
| ElasticSearch | \>= 7.x |

## Composer:
```bash
Expand Down Expand Up @@ -130,18 +130,18 @@ Add encore functions to your templates:

SyliusAdminBundle:
```php
{# @SyliusAdminBundle/_scripts.html.twig #}
{# templates/admin/javascripts.html.twig #}
{{ encore_entry_script_tags('bitbag-cs-admin', null, 'cs_admin') }}
{# @SyliusAdminBundle/_styles.html.twig #}
{# templates/admin/stylesheets.html.twig #}
{{ encore_entry_link_tags('bitbag-cs-admin', null, 'cs_admin') }}
```
SyliusShopBundle:
```php
{# @SyliusShopBundle/_scripts.html.twig #}
{# templates/shop/javascripts.html.twig #}
{{ encore_entry_script_tags('bitbag-cs-shop', null, 'cs_shop') }}
{# @SyliusShopBundle/_styles.html.twig #}
{# templates/shop/stylesheets.html.twig #}
{{ encore_entry_link_tags('bitbag-cs-shop', null, 'cs_shop') }}
```

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
imports:
- { resource: "@BitBagSyliusCrossSellingPlugin/Resources/config/indexes/*" }
- { resource: "@BitBagSyliusCrossSellingPlugin/Resources/config/ui.yaml" }
- { resource: "@BitBagSyliusCrossSellingPlugin/Resources/config/twig_hooks.yaml" }
2 changes: 1 addition & 1 deletion src/Resources/config/services/twig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
>
<parameters>
<parameter key="bitbag_sylius_crossselling_plugin.template.related_products" type="string">@SyliusShop/Product/_horizontalList.html.twig</parameter>
<parameter key="bitbag_sylius_crossselling_plugin.template.related_products" type="string">@SyliusShop/shared/product/horizontal_list.html.twig</parameter>
</parameters>

<services>
Expand Down
9 changes: 9 additions & 0 deletions src/Resources/config/twig_hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sylius_twig_hooks:
hooks:
'sylius_shop.product.show.content.product_listing':
related_products:
template: "@BitBagSyliusCrossSellingPlugin/Shop/Product/_relatedProducts.html.twig"
priority: 15
associations:
template: '@SyliusShop/product/show/content/product_listing/associations.html.twig'
priority: 0
7 changes: 0 additions & 7 deletions src/Resources/config/ui.yaml

This file was deleted.

20 changes: 13 additions & 7 deletions src/Resources/views/Shop/Product/_relatedProducts.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
<h4
class="ui horizontal section divider header"
{{ sylius_test_html_attribute('related-products-header') }}
>
{{ 'bitbag_sylius_crossselling_plugin.ui.related_products'|trans }}
</h4>
{{ bitbag_crossselling_render_related_products(product.slug, 4) }}
{% set product = hookable_metadata.context.product %}

<div class="container mb-6">
<h2
class="mb-5"
{{ sylius_test_html_attribute('related-products-header') }}
>
{{ 'bitbag_sylius_crossselling_plugin.ui.related_products'|trans }}
</h2>
<div>
{{ bitbag_crossselling_render_related_products(product.slug, 4) }}
</div>
</div>
10 changes: 0 additions & 10 deletions tests/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
namespace Tests\BitBag\SyliusCrossSellingPlugin\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;
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 @@ -114,13 +112,5 @@ private function registerBundlesFromFile(string $bundlesFile): iterable
private function getConfigurationDirectories(): iterable
{
yield $this->getProjectDir() . '/config';
$syliusConfigDir = $this->getProjectDir() . '/config/sylius/' . SyliusKernel::MAJOR_VERSION . '.' . SyliusKernel::MINOR_VERSION;
if (is_dir($syliusConfigDir)) {
yield $syliusConfigDir;
}
$symfonyConfigDir = $this->getProjectDir() . '/config/symfony/' . BaseKernel::MAJOR_VERSION . '.' . BaseKernel::MINOR_VERSION;
if (is_dir($symfonyConfigDir)) {
yield $symfonyConfigDir;
}
}
}
2 changes: 1 addition & 1 deletion tests/Application/assets/admin/entry.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import 'sylius/bundle/AdminBundle/Resources/private/entry';
import 'sylius/bundle/AdminBundle/Resources/assets/entrypoint';
1 change: 1 addition & 0 deletions tests/Application/assets/admin/product-entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'sylius/bundle/AdminBundle/Resources/assets/scripts/product/attribute-tabs-refresher';
17 changes: 17 additions & 0 deletions tests/Application/assets/controllers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"controllers": {
"@symfony/ux-autocomplete": {
"autocomplete": {
"main": "dist/controller.js",
"webpackMode": "eager",
"fetch": "eager",
"enabled": true,
"autoimport": {
"tom-select/dist/css/tom-select.default.css": false,
"tom-select/dist/css/tom-select.bootstrap5.css": false
}
}
}
},
"entrypoints": []
}
2 changes: 1 addition & 1 deletion tests/Application/assets/shop/entry.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import 'sylius/bundle/ShopBundle/Resources/private/entry';
import 'sylius/bundle/ShopBundle/Resources/assets/entrypoint';
7 changes: 7 additions & 0 deletions tests/Application/config/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

use Symfony\Component\Dotenv\Dotenv;
Expand Down
28 changes: 18 additions & 10 deletions tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

return [
Expand Down Expand Up @@ -30,19 +37,14 @@
Sylius\Bundle\CoreBundle\SyliusCoreBundle::class => ['all' => true],
Sylius\Bundle\ResourceBundle\SyliusResourceBundle::class => ['all' => true],
Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true],
Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true],
Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['all' => true],
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
FOS\RestBundle\FOSRestBundle::class => ['all' => true],
Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true],
Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true],
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true],
// Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true],
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Sylius\Bundle\FixturesBundle\SyliusFixturesBundle::class => ['all' => true],
Sylius\Bundle\PayumBundle\SyliusPayumBundle::class => ['all' => true],
// Sylius\Bundle\PayumBundle\SyliusPayumBundle::class => ['all' => true],
Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true],
Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true],
Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true],
Expand All @@ -51,14 +53,20 @@
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true],
Sylius\Behat\Application\SyliusTestPlugin\SyliusTestPlugin::class => ['test' => true, 'test_cached' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true],
SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true],
FOS\ElasticaBundle\FOSElasticaBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
League\FlysystemBundle\FlysystemBundle::class =>['all' => true],
Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true],
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class => ['all' => true],
Sylius\TwigHooks\SyliusTwigHooksBundle::class => ['all' => true],
Symfony\UX\TwigComponent\TwigComponentBundle::class => ['all' => true],
Symfony\UX\LiveComponent\LiveComponentBundle::class => ['all' => true],
Symfony\UX\Autocomplete\AutocompleteBundle::class => ['all' => true],
Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true],
Symfony\UX\Icons\UXIconsBundle::class => ['all' => true],
Sylius\TwigExtra\Symfony\SyliusTwigExtraBundle::class => ['all' => true],
];
Loading

0 comments on commit 6c6ccfc

Please sign in to comment.