Skip to content

Commit 33be6ad

Browse files
authored
Merge pull request #16 from BitBagCommerce/OP-570-upgrade-from-1.4-to-2.0
OP-570 - Upgrade Sylius from 1.14 to 2.0
2 parents fc0d2f1 + acc02df commit 33be6ad

29 files changed

+470
-11247
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
php: ["8.1", "8.2", "8.3"]
22-
symfony: ["^5.4", "^6.4"]
23-
sylius: ["~1.14.0"]
24-
node: ["^18.0", "^20.0"]
21+
php: ["8.2", "8.3"]
22+
symfony: ["^6.4", "^7.1"]
23+
sylius: ["^2.0"]
24+
node: ["^20.x"]
2525
mysql: ["8.0"]
2626

2727
env:

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ The complete installation guide can be found **[here](doc/installation.md).**
6969

7070
We work on stable, supported and up-to-date versions of packages. We recommend you to do the same.
7171

72-
| Package | Version |
73-
|---------------|----------|
74-
| PHP | \>=8.1 |
75-
| sylius/sylius | 1.14.x |
76-
| MySQL | \>= 5.7 |
77-
| NodeJS | \>= 18.x |
72+
| Package | Version |
73+
|---------------|----------------|
74+
| PHP | 8.2, 8.3 |
75+
| sylius/sylius | 2.x |
76+
| MySQL | \>= 8.0 |
77+
| NodeJS | \>= 20.x, 22.x |
7878

7979

8080
---

composer.json

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,70 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^8.1",
13+
"php": "^8.2",
1414
"ext-soap": "*",
15-
"bitbag/shipping-export-plugin": "^3.0",
15+
"bitbag/shipping-export-plugin": "^4.0",
1616
"msztorc/php-dpd-api": "^2.1",
17-
"sylius/sylius": "~1.14",
18-
"symfony/webpack-encore-bundle": "^1.17"
17+
"sylius/sylius": "^2.0",
18+
"symfony/webpack-encore-bundle": "^2.2.0"
1919
},
2020
"require-dev": {
21-
"behat/behat": "^3.6.1",
22-
"behat/mink-selenium2-driver": "^1.4",
21+
"behat/behat": "^3.14",
22+
"behat/mink-selenium2-driver": "~1.6",
2323
"bitbag/coding-standard": "^3.0",
24-
"dmore/behat-chrome-extension": "^1.3",
25-
"dmore/chrome-mink-driver": "^2.7",
26-
"friends-of-behat/mink": "^1.8",
27-
"friends-of-behat/mink-browserkit-driver": "^1.4",
28-
"friends-of-behat/mink-debug-extension": "^2.0.0",
29-
"friends-of-behat/mink-extension": "^2.4",
24+
"captainhook/captainhook": "^5.25",
25+
"dmore/behat-chrome-extension": "^1.4",
26+
"dmore/chrome-mink-driver": "^2.9",
27+
"friends-of-behat/mink": "^1.11",
28+
"friends-of-behat/mink-browserkit-driver": "^1.6",
29+
"friends-of-behat/mink-debug-extension": "^2.1",
30+
"friends-of-behat/mink-extension": "^2.7",
3031
"friends-of-behat/page-object-extension": "^0.3",
31-
"friends-of-behat/suite-settings-extension": "^1.0",
32-
"friends-of-behat/symfony-extension": "^2.1",
33-
"friends-of-behat/variadic-extension": "^1.3",
34-
"league/flysystem-bundle": "2.4.0",
35-
"phpspec/phpspec": "^7.0",
32+
"friends-of-behat/suite-settings-extension": "^1.1",
33+
"friends-of-behat/symfony-extension": "^2.6",
34+
"friends-of-behat/variadic-extension": "^1.6",
35+
"league/flysystem-bundle": "3.4.0",
36+
"nyholm/psr7": "^1.8",
37+
"phpspec/phpspec": "^7.5",
3638
"phpstan/extension-installer": "^1.0",
37-
"phpstan/phpstan": "^1.10",
39+
"phpstan/phpstan": "^1.12",
3840
"phpstan/phpstan-doctrine": "^1.3",
3941
"phpstan/phpstan-strict-rules": "^1.5",
4042
"phpstan/phpstan-webmozart-assert": "^1.2",
41-
"phpunit/phpunit": "^9.5",
43+
"phpunit/phpunit": "^10.5",
4244
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
43-
"sylius-labs/coding-standard": "^4.0",
44-
"symfony/browser-kit": "^5.4 || ^6.0",
45-
"symfony/debug-bundle": "^5.4 || ^6.0",
46-
"symfony/dotenv": "^5.4 || ^6.0",
47-
"symfony/intl": "^5.4 || ^6.0",
48-
"symfony/profiler-pack": "^1.0",
49-
"symfony/web-profiler-bundle": "^5.4 || ^6.0"
45+
"robertfausk/behat-panther-extension": "^1.1",
46+
"sylius-labs/coding-standard": "^4.4",
47+
"sylius-labs/suite-tags-extension": "~0.2",
48+
"sylius/sylius-rector": "^2.0",
49+
"symfony/browser-kit": "^6.4 || ^7.1",
50+
"symfony/debug-bundle": "^6.4 || ^7.1",
51+
"symfony/dotenv": "^6.4 || ^7.1",
52+
"symfony/http-client": "^6.4 || ^7.1",
53+
"symfony/intl": "^6.4 || ^7.1",
54+
"symfony/stopwatch": "^6.4",
55+
"symfony/web-profiler-bundle": "^6.4 || ^7.1"
5056
},
5157
"conflict": {
52-
"sylius/resource-bundle": "1.9.1 || 1.9.0",
53-
"behat/mink-selenium2-driver": ">=1.7.0"
58+
"behat/mink-selenium2-driver": ">=1.7.0",
59+
"doctrine/orm": ">=3.1.0"
5460
},
5561
"config": {
5662
"sort-packages": true,
5763
"allow-plugins": {
58-
"symfony/thanks": true,
59-
"composer/package-versions-deprecated": true,
60-
"dealerdirect/phpcodesniffer-composer-installer": true,
64+
"dealerdirect/phpcodesniffer-composer-installer": false,
65+
"php-http/discovery": false,
6166
"phpstan/extension-installer": true
6267
}
6368
},
69+
"extra": {
70+
"branch-alias": {
71+
"dev-master": "2.0-dev"
72+
},
73+
"symfony": {
74+
"require": "^6.4"
75+
}
76+
},
6477
"autoload": {
6578
"psr-4": {
6679
"BitBag\\DpdPlShippingExportPlugin\\": "src/",

doc/installation.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,20 @@ ADDITIONAL
1313
## Requirements:
1414
We work on stable, supported and up-to-date versions of packages. We recommend you to do the same.
1515

16-
| Package | Version |
17-
|---------------|----------|
18-
| PHP | \>=8.1 |
19-
| sylius/sylius | 1.14.x |
20-
| MySQL | \>= 5.7 |
21-
| NodeJS | \>= 18.x |
16+
| Package | Version |
17+
|---------------|----------------|
18+
| PHP | 8.2, 8.3 |
19+
| sylius/sylius | 2.x |
20+
| MySQL | \>= 8.0 |
21+
| NodeJS | \>= 20.x, 22.x |
22+
23+
## CONFLICTS
24+
As described in sylius/sylius-standard:2.0 (see CONFLICTS.md file) there is incompatibility
25+
between version of `behat/mink-selenium2-driver` used in Sylius 2.0 and this plugin.
26+
27+
Before startig the plugin installation, it is necessary to downgrade in `composer.json` version
28+
of `behat/mink-selenium2-driver` to `~1.6.0` and run `composer update behat/mink-selenium2-driver`.
29+
2230

2331
## Composer:
2432
```bash

phpunit.xml.dist

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,37 @@
1818

1919
<env name="APP_ENV" value="test"/>
2020
<env name="SHELL_VERBOSITY" value="-1" />
21+
22+
<!-- ###+ symfony/framework-bundle ### -->
23+
<env name="APP_ENV" value="dev"/>
24+
<env name="APP_SECRET" value="186059096e4873cdf8641717991b911b"/>
25+
<!-- ###- symfony/framework-bundle ### -->
26+
27+
<!-- ###+ symfony/messenger ### -->
28+
<!-- Choose one of the transports below -->
29+
<!-- MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages -->
30+
<!-- MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages -->
31+
<env name="MESSENGER_TRANSPORT_DSN" value="doctrine://default?auto_setup=0"/>
32+
<!-- ###- symfony/messenger ### -->
33+
34+
<!-- ###+ symfony/mailer ### -->
35+
<env name="MAILER_DSN" value="null://null"/>
36+
<!-- ###- symfony/mailer ### -->
37+
38+
<!-- ###+ doctrine/doctrine-bundle ### -->
39+
<!-- Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url -->
40+
<!-- IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml -->
41+
<!-- -->
42+
<!-- DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db" -->
43+
<!-- DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4" -->
44+
<!-- DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" -->
45+
<env name="DATABASE_URL" value="postgresql://app:[email protected]:5432/app?serverVersion=16&amp;charset=utf8"/>
46+
<!-- ###- doctrine/doctrine-bundle ### -->
47+
48+
<!-- ###+ lexik/jwt-authentication-bundle ### -->
49+
<env name="JWT_SECRET_KEY" value="%kernel.project_dir%/config/jwt/private.pem"/>
50+
<env name="JWT_PUBLIC_KEY" value="%kernel.project_dir%/config/jwt/public.pem"/>
51+
<env name="JWT_PASSPHRASE" value="638703cd316ef7f7b64b3cd542ae6dd7327c174190588fe0bc8805016d0b4cda"/>
52+
<!-- ###- lexik/jwt-authentication-bundle ### -->
2153
</php>
2254
</phpunit>

tests/Application/.babelrc

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/Application/Kernel.php

Lines changed: 0 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -4,122 +4,10 @@
44

55
namespace Tests\BitBag\DpdPlShippingExportPlugin\Application;
66

7-
use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer;
8-
use Sylius\Bundle\CoreBundle\Application\Kernel as SyliusKernel;
97
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
10-
use Symfony\Component\Config\Loader\LoaderInterface;
11-
use Symfony\Component\Config\Resource\FileResource;
12-
use Symfony\Component\DependencyInjection\ContainerBuilder;
13-
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
148
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
15-
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
169

1710
final class Kernel extends BaseKernel
1811
{
1912
use MicroKernelTrait;
20-
21-
private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
22-
23-
public function getCacheDir(): string
24-
{
25-
return $this->getProjectDir() . '/var/cache/' . $this->environment;
26-
}
27-
28-
public function getLogDir(): string
29-
{
30-
return $this->getProjectDir() . '/var/log';
31-
}
32-
33-
public function registerBundles(): iterable
34-
{
35-
foreach ($this->getConfigurationDirectories() as $confDir) {
36-
$bundlesFile = $confDir . '/bundles.php';
37-
if (false === is_file($bundlesFile)) {
38-
continue;
39-
}
40-
yield from $this->registerBundlesFromFile($bundlesFile);
41-
}
42-
}
43-
44-
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
45-
{
46-
foreach ($this->getConfigurationDirectories() as $confDir) {
47-
$bundlesFile = $confDir . '/bundles.php';
48-
if (false === is_file($bundlesFile)) {
49-
continue;
50-
}
51-
$container->addResource(new FileResource($bundlesFile));
52-
}
53-
54-
$container->setParameter('container.dumper.inline_class_loader', true);
55-
56-
foreach ($this->getConfigurationDirectories() as $confDir) {
57-
$this->loadContainerConfiguration($loader, $confDir);
58-
}
59-
}
60-
61-
protected function configureRoutes(RoutingConfigurator $routes): void
62-
{
63-
foreach ($this->getConfigurationDirectories() as $confDir) {
64-
$this->loadRoutesConfiguration($routes, $confDir);
65-
}
66-
}
67-
68-
protected function getContainerBaseClass(): string
69-
{
70-
if ($this->isTestEnvironment() && class_exists(MockerContainer::class)) {
71-
return MockerContainer::class;
72-
}
73-
74-
return parent::getContainerBaseClass();
75-
}
76-
77-
private function isTestEnvironment(): bool
78-
{
79-
return 0 === strpos($this->getEnvironment(), 'test');
80-
}
81-
82-
private function loadContainerConfiguration(LoaderInterface $loader, string $confDir): void
83-
{
84-
$loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob');
85-
$loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob');
86-
$loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob');
87-
$loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');
88-
}
89-
90-
private function loadRoutesConfiguration(RoutingConfigurator $routes, string $confDir): void
91-
{
92-
$routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS);
93-
$routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS);
94-
$routes->import($confDir . '/{routes}' . self::CONFIG_EXTS);
95-
}
96-
97-
/**
98-
* @return BundleInterface[]
99-
*/
100-
private function registerBundlesFromFile(string $bundlesFile): iterable
101-
{
102-
$contents = require $bundlesFile;
103-
foreach ($contents as $class => $envs) {
104-
if (isset($envs['all']) || isset($envs[$this->environment])) {
105-
yield new $class();
106-
}
107-
}
108-
}
109-
110-
/**
111-
* @return string[]
112-
*/
113-
private function getConfigurationDirectories(): iterable
114-
{
115-
yield $this->getProjectDir() . '/config';
116-
$syliusConfigDir = $this->getProjectDir() . '/config/sylius/' . SyliusKernel::MAJOR_VERSION . '.' . SyliusKernel::MINOR_VERSION;
117-
if (is_dir($syliusConfigDir)) {
118-
yield $syliusConfigDir;
119-
}
120-
$symfonyConfigDir = $this->getProjectDir() . '/config/symfony/' . BaseKernel::MAJOR_VERSION . '.' . BaseKernel::MINOR_VERSION;
121-
if (is_dir($symfonyConfigDir)) {
122-
yield $symfonyConfigDir;
123-
}
124-
}
12513
}

tests/Application/assets/shop/entrypoint.js

Whitespace-only changes.

0 commit comments

Comments
 (0)