Skip to content

Commit 34d43c5

Browse files
authored
Merge pull request #20 from JanPalen/feature/OP-371-upgrade-plugin-to-sylius-1.13-support
Upgrade plugin to Sylius 1.13 compatibility
2 parents 85b6825 + 12388c2 commit 34d43c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+397
-637
lines changed

.github/workflows/build.yml

+17-22
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,25 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
php: [8.0]
18-
node: [14.x]
19-
symfony: [^4.4, ^5.2]
20-
sylius: [~1.11.0]
21-
mysql: [5.7, 8.0]
17+
php: ["8.0", "8.1", "8.2", "8.3"]
18+
node: ["^18.0", "^20.0"]
19+
symfony: ["^5.4", "^6.4"]
20+
sylius: ["~1.12.0", "~1.13.0"]
21+
mysql: ["8.0"]
2222

2323
exclude:
24-
- # Segmentation fault while clearing cache
25-
php: 8.0
26-
mysql: 5.7
27-
-
28-
sylius: ~1.9.0
29-
php: 8.0
30-
-
31-
sylius: ~1.11.0
32-
php: 7.4
24+
- sylius: "~1.13.0"
25+
php: "8.0"
26+
- symfony: "^6.4"
27+
php: "8.0"
3328

3429
env:
3530
APP_ENV: test
3631
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"
3732

3833
steps:
3934
-
40-
uses: actions/checkout@v2
35+
uses: actions/checkout@v3
4136

4237
-
4338
name: Setup PHP
@@ -51,7 +46,7 @@ jobs:
5146

5247
-
5348
name: Setup Node
54-
uses: actions/setup-node@v1
49+
uses: actions/setup-node@v4
5550
with:
5651
node-version: "${{ matrix.node }}"
5752

@@ -89,7 +84,7 @@ jobs:
8984

9085
-
9186
name: Cache Composer
92-
uses: actions/cache@v2
87+
uses: actions/cache@v4
9388
with:
9489
path: ${{ steps.composer-cache.outputs.dir }}
9590
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
@@ -116,7 +111,7 @@ jobs:
116111
-
117112
name: Get Yarn cache directory
118113
id: yarn-cache
119-
run: echo "::set-output name=dir::$(yarn cache dir)"
114+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
120115

121116
-
122117
name: Cache Yarn
@@ -138,8 +133,8 @@ jobs:
138133
-
139134
name: Prepare test application assets
140135
run: |
136+
(cd tests/Application && yarn encore dev)
141137
(cd tests/Application && bin/console assets:install public -vvv)
142-
(cd tests/Application && yarn build)
143138
-
144139
name: Prepare test application cache
145140
run: (cd tests/Application && bin/console cache:warmup -vvv)
@@ -170,14 +165,14 @@ jobs:
170165

171166
-
172167
name: Upload Behat logs
173-
uses: actions/upload-artifact@v2
168+
uses: actions/upload-artifact@v3
174169
if: failure()
175170
with:
176171
name: Behat logs
177172
path: etc/build/
178173
if-no-files-found: ignore
179-
180-
-
174+
175+
-
181176
name: Failed build Slack notification
182177
uses: rtCamp/action-slack-notify@v2
183178
if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ imports:
7070

7171
- { resource: "@BitBagSyliusShippingExportPlugin/Resources/config/config.yml" }
7272
```
73+
Finish the installation by updating the database schema:
74+
```bash
75+
bin/console doctrine:migrations:diff
76+
bin/console doctrine:migrations:migrate
77+
```
7378

7479
## Customization
7580

composer.json

+20-25
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,41 @@
88
],
99
"license": "MIT",
1010
"require": {
11-
"php": "^7.4 || ^8.0",
12-
"bitbag/shipping-export-plugin": "^3.0",
13-
"sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0",
14-
"ext-soap": "*"
11+
"php": "^8.0 || ^8.1 || ^8.2 || ^8.3",
12+
"bitbag/shipping-export-plugin": "^3.1.0",
13+
"sylius/sylius": "~1.12.0 || ~1.13.0",
14+
"symfony/webpack-encore-bundle": "^1.17",
15+
"ext-soap": "*"
1516
},
1617
"require-dev": {
17-
"behat/behat": "^3.6.1",
18-
"behat/mink-selenium2-driver": "^1.4",
19-
"bitbag/coding-standard": "^1.0",
18+
"behat/behat": "^3.7.0",
19+
"behat/mink-selenium2-driver": "~1.6.0",
20+
"bitbag/coding-standard": "^3.0.0",
2021
"dmore/behat-chrome-extension": "^1.3",
2122
"dmore/chrome-mink-driver": "^2.7",
2223
"friends-of-behat/mink": "^1.8",
2324
"friends-of-behat/mink-browserkit-driver": "^1.4",
2425
"friends-of-behat/mink-debug-extension": "^2.0.0",
2526
"friends-of-behat/mink-extension": "^2.4",
2627
"friends-of-behat/page-object-extension": "^0.3",
28+
"friends-of-behat/service-container-extension": "^1.0",
2729
"friends-of-behat/suite-settings-extension": "^1.0",
2830
"friends-of-behat/symfony-extension": "^2.1",
2931
"friends-of-behat/variadic-extension": "^1.3",
30-
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
3132
"phpspec/phpspec": "^7.0",
3233
"phpstan/extension-installer": "^1.0",
33-
"phpstan/phpstan": "0.12.85",
34-
"phpstan/phpstan-doctrine": "0.12.33",
35-
"phpstan/phpstan-strict-rules": "^0.12.0",
36-
"phpstan/phpstan-webmozart-assert": "0.12.12",
34+
"phpstan/phpstan": "^1.4",
35+
"phpstan/phpstan-doctrine": "^1.0",
36+
"phpstan/phpstan-strict-rules": "^1.0",
37+
"phpstan/phpstan-webmozart-assert": "^1.0",
3738
"phpunit/phpunit": "^9.5",
3839
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
39-
"sensiolabs/security-checker": "^6.0",
40-
"symfony/browser-kit": "^4.4 || ^5.2",
41-
"symfony/debug-bundle": "^4.4 || ^5.2",
42-
"symfony/dotenv": "^4.4 || ^5.2",
43-
"symfony/intl": "^4.4 || ^5.2",
44-
"symfony/web-profiler-bundle": "^4.4 || ^5.2",
45-
"vimeo/psalm": "4.7.1"
40+
"symfony/browser-kit": "^5.4 || 6.4",
41+
"symfony/debug-bundle": "^5.4 || ^6.4",
42+
"symfony/dotenv": "^5.4 || ^6.4",
43+
"symfony/intl": "^5.4 || ^6.4",
44+
"symfony/web-profiler-bundle": "^5.4 || ^6.4",
45+
"vimeo/psalm": "^4.7 || ^5.0"
4646
},
4747
"config": {
4848
"sort-packages": true,
@@ -54,12 +54,7 @@
5454
}
5555
},
5656
"conflict": {
57-
"doctrine/dbal": "^3.0",
58-
"symfony/symfony": "4.1.8",
59-
"symfony/browser-kit": "4.1.8",
60-
"symfony/dom-crawler": "4.1.8",
61-
"symfony/routing": "4.1.8",
62-
"symfony/doctrine-bridge": "4.4.16"
57+
"behat/mink-selenium2-driver": ">=1.7.0"
6358
},
6459
"autoload": {
6560
"psr-4": {

ecs.php

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
<?php
22

3-
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
4-
use Symplify\EasyCodingStandard\ValueObject\Option;
3+
use Symplify\EasyCodingStandard\Config\ECSConfig;
54

6-
return static function (ContainerConfigurator $containerConfigurator): void {
7-
$containerConfigurator->import('vendor/bitbag/coding-standard/ecs.php');
5+
return static function (ECSConfig $config): void {
6+
putenv('ALLOW_BITBAG_OS_HEADER=1');
87

9-
$parameters = $containerConfigurator->parameters();
10-
$parameters->set(Option::PATHS, [
11-
__DIR__ . '/src',
12-
__DIR__ . '/tests',
13-
]);
8+
$config->import('vendor/bitbag/coding-standard/ecs.php');
9+
$config->paths(['src', 'tests']);
1410
};

features/exporting_shipping_data_to_api_dhl24.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Feature: Managing shipping gateway
3434
And it has "package_length" field set to "22"
3535
And it has "cod_payment_method_code" field set to "stripe_checkout"
3636
And it has "collect_on_delivery_form" field set to "BANK_TRANSFER"
37-
And the store has a product "Chicken" priced at "$2" in "Web-US" channel
37+
And the store has a product "Chicken" priced at "$2.00" in "Web-US" channel
3838
And customer "[email protected]" has placed 5 orders on the "Web-US" channel in each buying 5 "Chicken" products
3939
And the customer set the shipping address "Mike Ross" addressed it to "350 5th Ave", "10118" "New York" in the "United States" to orders
4040
And those orders were placed with "DHL Express" shipping method

src/Api/ShippingLabelFetcher.php

+19-15
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
11
<?php
22

3+
/*
4+
* This file has been created by developers from BitBag.
5+
* Feel free to contact us once you face any issues or want to start
6+
* You can find more information about us on https://bitbag.io and write us
7+
* an email on [email protected].
8+
*/
9+
310
declare(strict_types=1);
411

512
namespace BitBag\SyliusDhl24PlShippingExportPlugin\Api;
613

7-
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
14+
use Symfony\Component\HttpFoundation\RequestStack;
815

916
class ShippingLabelFetcher implements ShippingLabelFetcherInterface
1017
{
11-
/** @var WebClientInterface */
12-
private $webClient;
18+
private WebClientInterface $webClient;
1319

14-
/** @var SoapClientInterface */
15-
private $soapClient;
20+
private SoapClientInterface $soapClient;
1621

17-
/** @var string */
18-
private $response;
22+
private object $response;
1923

20-
private FlashBagInterface $flashBag;
24+
private RequestStack $requestStack;
2125

2226
public function __construct(
23-
FlashBagInterface $flashBag,
27+
RequestStack $requestStack,
2428
WebClientInterface $webClient,
25-
SoapClientInterface $soapClient
29+
SoapClientInterface $soapClient,
2630
) {
27-
$this->flashBag = $flashBag;
31+
$this->requestStack = $requestStack;
2832
$this->webClient = $webClient;
2933
$this->soapClient = $soapClient;
3034
}
@@ -38,13 +42,13 @@ public function createShipment($shippingGateway, $shipment): void
3842

3943
$this->response = $this->soapClient->createShipment($requestData, $shippingGateway->getConfigValue('wsdl'));
4044
} catch (\SoapFault $exception) {
41-
$this->flashBag->add(
45+
$this->requestStack->getSession()->getBag('flashes')->add(
4246
'error',
4347
sprintf(
4448
'DHL24 Web Service for #%s order: %s',
4549
$shipment->getOrder()->getNumber(),
46-
$exception->getMessage()
47-
)
50+
$exception->getMessage(),
51+
),
4852
);
4953

5054
return;
@@ -57,7 +61,7 @@ public function getLabelContent(): ?string
5761
return '';
5862
}
5963

60-
$this->flashBag->add('success', 'bitbag.ui.shipment_data_has_been_exported'); // Add success notification
64+
$this->requestStack->getSession()->getBag('flashes')->add('success', 'bitbag.ui.shipment_data_has_been_exported'); // Add success notification
6165

6266
return base64_decode($this->response->createShipmentResult->label->labelContent);
6367
}

src/Api/ShippingLabelFetcherInterface.php

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/*
4+
* This file has been created by developers from BitBag.
5+
* Feel free to contact us once you face any issues or want to start
6+
* You can find more information about us on https://bitbag.io and write us
7+
* an email on [email protected].
8+
*/
9+
310
declare(strict_types=1);
411

512
namespace BitBag\SyliusDhl24PlShippingExportPlugin\Api;

src/Api/SoapClient.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
22

33
/*
4-
* This file was created by the developers from BitBag.
4+
* This file has been created by developers from BitBag.
55
* Feel free to contact us once you face any issues or want to start
6-
* another great project.
7-
* You can find more information about us on https://bitbag.shop and write us
8-
* an email on [email protected].
6+
* You can find more information about us on https://bitbag.io and write us
7+
* an email on [email protected].
98
*/
109

1110
declare(strict_types=1);

src/Api/SoapClientInterface.php

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/*
4+
* This file has been created by developers from BitBag.
5+
* Feel free to contact us once you face any issues or want to start
6+
* You can find more information about us on https://bitbag.io and write us
7+
* an email on [email protected].
8+
*/
9+
310
declare(strict_types=1);
411

512
namespace BitBag\SyliusDhl24PlShippingExportPlugin\Api;

src/Api/WebClient.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
22

33
/*
4-
* This file was created by the developers from BitBag.
4+
* This file has been created by developers from BitBag.
55
* Feel free to contact us once you face any issues or want to start
6-
* another great project.
7-
* You can find more information about us on https://bitbag.shop and write us
8-
* an email on [email protected].
6+
* You can find more information about us on https://bitbag.io and write us
7+
* an email on [email protected].
98
*/
109

1110
declare(strict_types=1);
@@ -166,7 +165,7 @@ private function resolveHouseNumber(AddressInterface $address): string
166165
'Street "%s" is invalid. The street format must be something like %s, where %d is the house number.',
167166
$street,
168167
'"Opolska 45"',
169-
45
168+
45,
170169
));
171170

172171
return end($streetParts);

src/Api/WebClientInterface.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
22

33
/*
4-
* This file was created by the developers from BitBag.
4+
* This file has been created by developers from BitBag.
55
* Feel free to contact us once you face any issues or want to start
6-
* another great project.
7-
* You can find more information about us on https://bitbag.shop and write us
8-
* an email on [email protected].
6+
* You can find more information about us on https://bitbag.io and write us
7+
* an email on [email protected].
98
*/
109

1110
declare(strict_types=1);

src/BitBagDhl24PlShippingExportPlugin.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
22

33
/*
4-
* This file was created by the developers from BitBag.
4+
* This file has been created by developers from BitBag.
55
* Feel free to contact us once you face any issues or want to start
6-
* another great project.
7-
* You can find more information about us on https://bitbag.shop and write us
8-
* an email on [email protected].
6+
* You can find more information about us on https://bitbag.io and write us
7+
* an email on [email protected].
98
*/
109

1110
declare(strict_types=1);

src/DependencyInjection/BitBagDhl24PlShippingExportExtension.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
22

33
/*
4-
* This file was created by the developers from BitBag.
4+
* This file has been created by developers from BitBag.
55
* Feel free to contact us once you face any issues or want to start
6-
* another great project.
7-
* You can find more information about us on https://bitbag.shop and write us
8-
* an email on [email protected].
6+
* You can find more information about us on https://bitbag.io and write us
7+
* an email on [email protected].
98
*/
109

1110
declare(strict_types=1);

0 commit comments

Comments
 (0)