Skip to content

Commit cd4ac05

Browse files
committed
Add Sylius 1.13 support
1 parent dbf4c04 commit cd4ac05

8 files changed

Lines changed: 98 additions & 83 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
php: ["8.0", "8.1"]
24+
php: ["8.1", "8.2", "8.3"]
2525
symfony: ["5.4.*", "^6.0"]
26-
sylius: ["^1.12"]
26+
sylius: ["^1.12.0", "^1.13.1"]
2727
node: ["18.x"]
28-
mysql: ["5.7", "8.0"]
28+
mysql: ["8.0"]
2929

3030
env:
3131
APP_ENV: test
@@ -46,7 +46,7 @@ jobs:
4646

4747
-
4848
name: Setup Node
49-
uses: actions/setup-node@v1
49+
uses: actions/setup-node@v4
5050
with:
5151
node-version: "${{ matrix.node }}"
5252

@@ -84,7 +84,7 @@ jobs:
8484

8585
-
8686
name: Cache Composer
87-
uses: actions/cache@v2
87+
uses: actions/cache@v4
8888
with:
8989
path: ${{ steps.composer-cache.outputs.dir }}
9090
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
@@ -121,7 +121,7 @@ jobs:
121121

122122
-
123123
name: Cache Yarn
124-
uses: actions/cache@v2
124+
uses: actions/cache@v4
125125
with:
126126
path: ${{ steps.yarn-cache.outputs.dir }}
127127
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}

behat.yml.dist

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ imports:
33
- tests/Behat/Resources/suites.yml
44

55
default:
6+
formatters:
7+
pretty:
8+
verbose: true
9+
paths: false
10+
snippets: false
11+
612
extensions:
713
DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~
14+
Robertfausk\Behat\PantherExtension: ~
815

916
FriendsOfBehat\MinkDebugExtension:
1017
directory: etc/build
@@ -15,32 +22,30 @@ default:
1522
files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/"
1623
base_url: "https://127.0.0.1:8080/"
1724
default_session: symfony
18-
javascript_session: chrome_headless
25+
javascript_session: chromedriver
1926
sessions:
2027
symfony:
2128
symfony: ~
22-
chrome_headless:
29+
chromedriver:
2330
chrome:
2431
api_url: http://127.0.0.1:9222
2532
validate_certificate: false
26-
chrome:
27-
selenium2:
28-
browser: chrome
29-
capabilities:
30-
browserName: chrome
31-
browser: chrome
32-
version: ""
33-
marionette: null # https://github.com/Behat/MinkExtension/pull/311
34-
chrome:
35-
switches:
36-
- "start-fullscreen"
37-
- "start-maximized"
38-
- "no-sandbox"
39-
extra_capabilities:
33+
chrome_headless_second_session:
34+
chrome:
35+
api_url: http://127.0.0.1:9222
36+
validate_certificate: false
37+
panther:
38+
panther:
39+
manager_options:
40+
connection_timeout_in_ms: 5000
41+
request_timeout_in_ms: 120000
42+
chromedriver_arguments:
43+
- --log-path=etc/build/chromedriver.log
44+
- --verbose
45+
capabilities:
46+
acceptSslCerts: true
47+
acceptInsecureCerts: true
4048
unexpectedAlertBehaviour: accept
41-
firefox:
42-
selenium2:
43-
browser: firefox
4449
show_auto: false
4550

4651
FriendsOfBehat\SymfonyExtension:
@@ -53,3 +58,5 @@ default:
5358
FriendsOfBehat\SuiteSettingsExtension:
5459
paths:
5560
- "features"
61+
62+
SyliusLabs\SuiteTagsExtension: ~

composer.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
],
99
"license": "MIT",
1010
"require": {
11-
"php": "^8.0",
11+
"php": "^8.1",
1212
"sandwich/vies-bundle": "^2.1",
13-
"sylius/sylius": "^1.12.9",
14-
"sylius/mailer-bundle": "^1.8 || ^2.0",
13+
"sylius/sylius": "^1.12",
1514
"symfony/webpack-encore-bundle": "^1.15",
1615
"webmozart/assert": "^1.9"
1716
},
1817
"require-dev": {
1918
"behat/behat": "^3.6.1",
20-
"behat/mink-selenium2-driver": "^1.4",
19+
"behat/mink-selenium2-driver": "^1.6",
20+
"dbrekelmans/bdi": "^1.1",
2121
"dmore/behat-chrome-extension": "^1.3",
2222
"dmore/chrome-mink-driver": "^2.7",
2323
"friends-of-behat/mink": "^1.8",
@@ -34,16 +34,19 @@
3434
"phpstan/phpstan-doctrine": "1.3.16",
3535
"phpstan/phpstan-strict-rules": "^1.3.0",
3636
"phpstan/phpstan-webmozart-assert": "^1.2.0",
37-
"phpunit/phpunit": "^9.5",
37+
"phpunit/phpunit": "^9.6 || ^10.5",
3838
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
39+
"rector/rector": "^0.15.0",
40+
"robertfausk/behat-panther-extension": "^1.1",
3941
"sylius-labs/coding-standard": "^4.2",
42+
"sylius-labs/suite-tags-extension": "^0.2",
4043
"symfony/browser-kit": "^5.4 || ^6.0",
4144
"symfony/debug-bundle": "^5.4 || ^6.0",
4245
"symfony/dotenv": "^5.4 || ^6.0",
4346
"symfony/flex": "^2.2.2",
4447
"symfony/intl": "^5.4 || ^6.0",
4548
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
46-
"vimeo/psalm": "4.27.0"
49+
"vimeo/psalm": "^4.27"
4750
},
4851
"config": {
4952
"sort-packages": true,

phpstan.neon

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
parameters:
22
level: max
33
reportUnmatchedIgnoredErrors: false
4-
checkMissingIterableValueType: false
54
paths:
65
- src
76
- tests/Behat
87

9-
excludes_analyse:
8+
excludePaths:
109
# Makes PHPStan crash
1110
- 'src/DependencyInjection/Configuration.php'
1211

@@ -15,4 +14,8 @@ parameters:
1514
- 'tests/Application/src/**.php'
1615

1716
ignoreErrors:
17+
-
18+
identifier: missingType.iterableValue
19+
-
20+
identifier: missingType.generics
1821
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./'

tests/Application/config/bundles.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
return [
3+
$bundles = [
44
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
55
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
66
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
@@ -60,3 +60,8 @@
6060
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
6161
League\FlysystemBundle\FlysystemBundle::class => ['all' => true],
6262
];
63+
if (class_exists(Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class)) {
64+
$bundles[Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class] = ['all' => true];
65+
}
66+
67+
return $bundles;

tests/Behat/Context/Transform/AddressContext.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ final class AddressContext implements Context
1818
private Generator $fakerGenerator;
1919

2020
public function __construct(
21-
private ExampleFactoryInterface $exampleAddressFactory,
22-
private CountryNameConverterInterface $countryNameConverter
21+
private readonly ExampleFactoryInterface $exampleAddressFactory,
22+
private readonly CountryNameConverterInterface $countryNameConverter
2323
) {
2424
$this->fakerGenerator = Factory::create();
2525
}
@@ -28,11 +28,11 @@ public function __construct(
2828
* @Transform /^address for the individual "([^"]+)" - "([^"]+)", "([^"]+)", "([^"]+)" - "([^"]+)"$/
2929
*/
3030
public function createNewIndividualAddressWith(
31-
$customerName,
32-
$city,
33-
$street,
34-
$postcode,
35-
$countryName
31+
string $customerName,
32+
string $city,
33+
string $street,
34+
string $postcode,
35+
string $countryName
3636
): AddressInterface {
3737
[$firstName, $lastName] = explode(' ', $customerName);
3838

@@ -57,12 +57,12 @@ public function createNewIndividualAddressWith(
5757
* @Transform /^address for the company "([^"]*)" - "([^"]*)" - "([^"]*)", "([^"]*)", "([^"]*)" - "([^"]*)"$/
5858
*/
5959
public function createNewCompanyAddressWith(
60-
$company,
61-
$customerName,
62-
$street,
63-
$postcode,
64-
$city,
65-
$countryName
60+
string $company,
61+
string $customerName,
62+
string $street,
63+
string $postcode,
64+
string $city,
65+
string $countryName
6666
): AddressInterface {
6767
[$firstName, $lastName] = explode(' ', $customerName);
6868

@@ -90,7 +90,7 @@ public function createNewCompanyAddressWith(
9090
*/
9191
public function createNewValidItalianIndividualBillingAddress()
9292
{
93-
/** @var AddressInterface&ItalianInvoiceableAddressInterface $address */
93+
/** @var AddressInterface|(AddressInterface&ItalianInvoiceableAddressInterface) $address */
9494
$address = $this->exampleAddressFactory->create(['country_code' => 'IT', 'customer' => null]);
9595
Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class);
9696
$address->setBillingRecipientType(ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_INDIVIDUAL);
@@ -105,7 +105,7 @@ public function createNewValidItalianIndividualBillingAddress()
105105
*/
106106
public function createNewValidItalianCompanyBillingAddress()
107107
{
108-
/** @var AddressInterface&ItalianInvoiceableAddressInterface $address */
108+
/** @var AddressInterface|(AddressInterface&ItalianInvoiceableAddressInterface) $address */
109109
$address = $this->exampleAddressFactory->create(['country_code' => 'IT', 'customer' => null]);
110110
Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class);
111111
$address->setBillingRecipientType(ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_COMPANY);
@@ -125,7 +125,7 @@ public function createNewValidItalianCompanyBillingAddress()
125125
*/
126126
public function createNewValidGermanIndividualBillingAddress()
127127
{
128-
/** @var AddressInterface&ItalianInvoiceableAddressInterface $address */
128+
/** @var AddressInterface|(AddressInterface&ItalianInvoiceableAddressInterface) $address */
129129
$address = $this->exampleAddressFactory->create(['country_code' => 'DE', 'customer' => null]);
130130
Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class);
131131
$address->setBillingRecipientType(ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_INDIVIDUAL);
@@ -138,7 +138,7 @@ public function createNewValidGermanIndividualBillingAddress()
138138
*/
139139
public function createNewValidGermanCompanyBillingAddress()
140140
{
141-
/** @var AddressInterface&ItalianInvoiceableAddressInterface $address */
141+
/** @var AddressInterface|(AddressInterface&ItalianInvoiceableAddressInterface) $address */
142142
$address = $this->exampleAddressFactory->create(['country_code' => 'DE', 'customer' => null]);
143143
Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class);
144144
$address->setBillingRecipientType(ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_COMPANY);
@@ -155,7 +155,7 @@ public function createNewValidGermanCompanyBillingAddress()
155155
*/
156156
public function createNewValidUSIndividualBillingAddress()
157157
{
158-
/** @var AddressInterface&ItalianInvoiceableAddressInterface $address */
158+
/** @var AddressInterface|(AddressInterface&ItalianInvoiceableAddressInterface) $address */
159159
$address = $this->exampleAddressFactory->create(['country_code' => 'US', 'customer' => null]);
160160
Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class);
161161
$address->setBillingRecipientType(ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_INDIVIDUAL);
@@ -169,7 +169,7 @@ public function createNewValidUSIndividualBillingAddress()
169169
*/
170170
public function createNewValidUSCompanyBillingAddress()
171171
{
172-
/** @var AddressInterface&ItalianInvoiceableAddressInterface $address */
172+
/** @var AddressInterface|(AddressInterface&ItalianInvoiceableAddressInterface) $address */
173173
$address = $this->exampleAddressFactory->create(['country_code' => 'US', 'customer' => null]);
174174
Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class);
175175
$address->setBillingRecipientType(ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_COMPANY);

tests/Behat/Context/Ui/Shop/Checkout/CheckoutAddressingContext.php

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ final class CheckoutAddressingContext implements Context
1919
private Generator $fakerGenerator;
2020

2121
public function __construct(
22-
private AddressPageInterface $addressPage,
23-
private SharedStorageInterface $sharedStorage
22+
private readonly AddressPageInterface $addressPage,
23+
private readonly SharedStorageInterface $sharedStorage
2424
) {
2525
$this->fakerGenerator = Factory::create();
2626
}
@@ -46,7 +46,7 @@ public function iSpecifyTheBillingAddressForTheIndividual(AddressInterface $addr
4646
*/
4747
public function iSpecifyAValidIndividualTaxCode(): void
4848
{
49-
$this->addressPage->specifyBillingTaxCode($this->fakerGenerator->ssn);
49+
$this->addressPage->specifyBillingTaxCode($this->fakerGenerator->ssn); //@phpstan-ignore-line
5050
}
5151

5252
/**
@@ -291,10 +291,10 @@ public function iDoNotSpecifyTheBillingRecipientTypeInTheBillingAddress(): void
291291
public function iSpecifyTheSameItalianInvoiceableInformationOfTheAddressThatIHaveInMyAddressBook(AddressInterface $address): void
292292
{
293293
/** @var ItalianInvoiceableAddressInterface $address */
294-
$this->addressPage->specifyBillingTaxCode($address->getTaxCode());
295-
$this->addressPage->specifyBillingVatNumber($address->getVatNumber());
296-
$this->addressPage->specifyBillingSdiCode($address->getSdiCode());
297-
$this->addressPage->specifyBillingPecAddress($address->getPecAddress());
294+
$this->addressPage->specifyBillingTaxCode((string) $address->getTaxCode());
295+
$this->addressPage->specifyBillingVatNumber((string) $address->getVatNumber());
296+
$this->addressPage->specifyBillingSdiCode((string) $address->getSdiCode());
297+
$this->addressPage->specifyBillingPecAddress((string) $address->getPecAddress());
298298
}
299299

300300
/**
@@ -329,10 +329,8 @@ public function addressShouldBeFilledAsBillingAddress(AddressInterface $address)
329329
*/
330330
public function iSpecifyAValidItalianIndividualBillingAddress($address): void
331331
{
332-
Assert::isInstanceOf($address, AddressInterface::class);
333-
Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class);
334332
$this->addressPage->specifyBillingAddress($address);
335-
$this->addressPage->specifyBillingTaxCode($address->getTaxCode());
333+
$this->addressPage->specifyBillingTaxCode((string) $address->getTaxCode());
336334
}
337335
/**
338336
* @When /^I specify a (valid italian company billing address)$/
@@ -341,12 +339,10 @@ public function iSpecifyAValidItalianIndividualBillingAddress($address): void
341339
*/
342340
public function iSpecifyAValidItalianCompanyBillingAddress($address): void
343341
{
344-
Assert::isInstanceOf($address, AddressInterface::class);
345-
Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class);
346342
$this->addressPage->specifyBillingAddress($address);
347-
$this->addressPage->specifyBillingVatNumber($address->getVatNumber());
348-
$this->addressPage->specifyBillingTaxCode($address->getTaxCode());
349-
$this->addressPage->specifyBillingSdiCode($address->getSdiCode());
343+
$this->addressPage->specifyBillingVatNumber((string) $address->getVatNumber());
344+
$this->addressPage->specifyBillingTaxCode((string) $address->getTaxCode());
345+
$this->addressPage->specifyBillingSdiCode((string) $address->getSdiCode());
350346
}
351347
/**
352348
* @Given /^I specify a (valid german individual billing address)$/
@@ -355,8 +351,6 @@ public function iSpecifyAValidItalianCompanyBillingAddress($address): void
355351
*/
356352
public function iSpecifyAValidGermanIndividualBillingAddress($address): void
357353
{
358-
Assert::isInstanceOf($address, AddressInterface::class);
359-
Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class);
360354
$this->addressPage->specifyBillingAddress($address);
361355
}
362356
/**
@@ -366,10 +360,8 @@ public function iSpecifyAValidGermanIndividualBillingAddress($address): void
366360
*/
367361
public function iSpecifyAValidGermanCompanyBillingAddress($address): void
368362
{
369-
Assert::isInstanceOf($address, AddressInterface::class);
370-
Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class);
371363
$this->addressPage->specifyBillingAddress($address);
372-
$this->addressPage->specifyBillingVatNumber($address->getVatNumber());
364+
$this->addressPage->specifyBillingVatNumber((string) $address->getVatNumber());
373365
}
374366

375367
/**
@@ -380,8 +372,6 @@ public function iSpecifyAValidGermanCompanyBillingAddress($address): void
380372
*/
381373
public function iSpecifyAValidUSlBillingAddress($address): void
382374
{
383-
Assert::isInstanceOf($address, AddressInterface::class);
384-
Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class);
385375
$this->addressPage->specifyBillingAddress($address);
386376
}
387377
}

0 commit comments

Comments
 (0)