Skip to content

Commit 93ba437

Browse files
authored
Merge pull request #214 from BitBagCommerce/update-to-sylius-1-12
OP-10: Add support for Sylius 1.12 and Symfony 6
2 parents 07502b4 + 82bf796 commit 93ba437

File tree

173 files changed

+1161
-1470
lines changed

Some content is hidden

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

173 files changed

+1161
-1470
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,15 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
php: ["7.4", "8.0"]
25-
symfony: ["^4.4", "^5.2"]
26-
sylius: ["~1.9.0", "~1.10.0", "~1.11.0"]
24+
php: ["8.0"]
25+
symfony: ["^5.4", "^6.0"]
26+
sylius: ["~1.11.0", "~1.12.0"]
2727
node: ["14.x"]
2828
mysql: ["8.0"]
2929

3030
exclude:
31-
- sylius: ~1.9.0
32-
php: 8.0
33-
34-
- sylius: ~1.10.0
35-
symfony: ^4.4
36-
# friendsofsymfony/elastica-bundle - package is locking php 7.x
37-
3831
- sylius: ~1.11.0
39-
php: 7.4
40-
32+
symfony: "^6.0"
4133
env:
4234
APP_ENV: test
4335
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"
@@ -147,6 +139,11 @@ jobs:
147139
restore-keys: |
148140
${{ runner.os }}-node-${{ matrix.node }}-yarn-
149141
142+
-
143+
name: Copy package.json.dist to package.json
144+
if: matrix.sylius != ''
145+
run: (cd tests/Application && cp package.json.\${{ matrix.sylius }}.dist package.json)
146+
150147
-
151148
name: Install JS dependencies
152149
run: (cd tests/Application && yarn install)

composer.json

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
"license": "MIT",
66
"require": {
77
"ext-json": "*",
8-
"php": "^7.4 || ^8.0",
9-
"sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0",
8+
"php": "^8.0",
9+
"sylius/sylius": "~1.11.0 || ~1.12.0",
1010
"friendsofsymfony/elastica-bundle": "^6.0",
11-
"symfony/property-access": "^4.4 || ^5.2",
12-
"symfony/webpack-encore-bundle": "^1.13",
13-
"symfony/proxy-manager-bridge": "^4.4 || ^5.4"
11+
"symfony/property-access": "^5.4 || ^6.0",
12+
"symfony/webpack-encore-bundle": "^1.16",
13+
"symfony/proxy-manager-bridge": "^5.4 || ^6.0"
1414
},
1515
"require-dev": {
16-
"behat/behat": "^3.6.1",
16+
"behat/behat": "^3.7",
1717
"behat/mink-selenium2-driver": "^1.4",
1818
"dmore/behat-chrome-extension": "^1.3",
1919
"dmore/chrome-mink-driver": "^2.7",
@@ -25,25 +25,27 @@
2525
"friends-of-behat/suite-settings-extension": "^1.0",
2626
"friends-of-behat/symfony-extension": "^2.1",
2727
"friends-of-behat/variadic-extension": "^1.3",
28-
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
2928
"phpspec/phpspec": "^7.0",
3029
"phpstan/extension-installer": "^1.0",
3130
"phpstan/phpstan": "0.12.82",
3231
"phpstan/phpstan-doctrine": "0.12.33",
3332
"phpstan/phpstan-strict-rules": "^0.12.0",
3433
"phpstan/phpstan-webmozart-assert": "0.12.12",
3534
"phpunit/phpunit": "^9.5",
36-
"sensiolabs/security-checker": "^6.0",
3735
"sylius-labs/coding-standard": "^4.0",
38-
"symfony/browser-kit": "^4.4 || ^5.2",
39-
"symfony/debug-bundle": "^4.4 || ^5.2",
40-
"symfony/dotenv": "^4.4 || ^5.2",
41-
"symfony/intl": "^4.4 || ^5.2",
42-
"symfony/web-profiler-bundle": "^4.4 || ^5.2",
43-
"vimeo/psalm": "4.7.1",
36+
"symfony/browser-kit": "^5.4 || ^6.0",
37+
"symfony/debug-bundle": "^5.4 || ^6.0",
38+
"symfony/dotenv": "^5.4 || ^6.0",
39+
"symfony/intl": "^5.4 || ^6.0",
40+
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
41+
"vimeo/psalm": "4.27.0",
4442
"bitbag/coding-standard": "^1.0.1",
43+
"league/flysystem-bundle": "2.4.0",
4544
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
46-
"lchrusciel/api-test-case": "^5.2"
45+
"lchrusciel/api-test-case": "^5.2",
46+
"symfony/mailer": "^5.4 || ^6.0",
47+
"sylius/mailer-bundle": "^1.8 || ^2.0@beta",
48+
"twig/extra-bundle": "^3.4"
4749
},
4850
"conflict": {
4951
"symfony/form": "4.4.11 || 4.4.12"

spec/Controller/Action/Shop/ListProductsActionSpec.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,10 @@ function it_renders_product_list(
7070
): void {
7171
$form->getData()->willReturn([]);
7272
$form->isValid()->willReturn(true);
73-
$form->handleRequest($request)->shouldBeCalled();
73+
$form->handleRequest($request)->willReturn($form);
7474
$form->createView()->willReturn($formView);
7575

7676
$formFactory->create(ShopProductsFilterType::class)->willReturn($form);
77-
7877
$request->query = $queryParameters;
7978
$queryParameters->all()->willReturn([]);
8079

spec/Twig/Extension/UnsetArrayElementsExtensionSpec.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
use BitBag\SyliusElasticsearchPlugin\Twig\Extension\UnsetArrayElementsExtension;
1414
use PhpSpec\ObjectBehavior;
15+
use Twig\Extension\AbstractExtension;
1516

1617
final class UnsetArrayElementsExtensionSpec extends ObjectBehavior
1718
{
@@ -22,7 +23,7 @@ function it_is_initializable(): void
2223

2324
function it_is_a_twig_extension(): void
2425
{
25-
$this->shouldHaveType(\Twig_Extension::class);
26+
$this->shouldHaveType(AbstractExtension::class);
2627
}
2728

2829
function it_unset_elments(): void

src/Block/SearchFormEventListener.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?php
22

33
/*
4-
* This file was created by developers working at BitBag
5-
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6-
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7-
*/
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+
* another great project.
7+
* You can find more information about us on https://bitbag.io and write us
8+
* an email on [email protected].
9+
*/
810

911
declare(strict_types=1);
1012

@@ -20,17 +22,13 @@
2022

2123
final class SearchFormEventListener
2224
{
23-
/** @var string */
24-
private $template;
25+
private string $template;
2526

26-
/** @var FormFactoryInterface */
27-
private $formFactory;
27+
private FormFactoryInterface $formFactory;
2828

29-
/** @var RouterInterface */
30-
private $router;
29+
private RouterInterface $router;
3130

32-
/** @var FormInterface */
33-
private $form;
31+
private ?FormInterface $form = null;
3432

3533
public function __construct(
3634
string $template,
@@ -67,7 +65,11 @@ public function getForm(Search $search = null): FormInterface
6765
$search = new Search();
6866
}
6967
$this->form = $this->formFactory
70-
->create(SearchType::class, $search, ['action' => $this->router->generate('bitbag_sylius_elasticsearch_plugin_shop_search')]);
68+
->create(
69+
SearchType::class,
70+
$search,
71+
['action' => $this->router->generate('bitbag_sylius_elasticsearch_plugin_shop_search')]
72+
);
7173
}
7274

7375
return $this->form;

src/CompilerPass/AuthenticationManagerPolyfillPass.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
2-
/*
3-
4-
This file was created by developers working at BitBag
52

6-
Do you need more information about us and what we do? Visit our website!
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+
* another great project.
7+
* You can find more information about us on https://bitbag.io and write us
8+
* an email on [email protected].
9+
*/
710

8-
We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
9-
*/
1011
declare(strict_types=1);
1112

1213
namespace BitBag\SyliusElasticsearchPlugin\CompilerPass;
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?php
22

33
/*
4-
* This file was created by developers working at BitBag
5-
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6-
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7-
*/
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+
* another great project.
7+
* You can find more information about us on https://bitbag.io and write us
8+
* an email on [email protected].
9+
*/
810

911
declare(strict_types=1);
1012

@@ -14,11 +16,9 @@
1416

1517
final class ProductAttributesContext implements ProductAttributesContextInterface
1618
{
17-
/** @var TaxonContextInterface */
18-
private $taxonContext;
19+
private TaxonContextInterface $taxonContext;
1920

20-
/** @var ProductAttributesFinderInterface */
21-
private $attributesFinder;
21+
private ProductAttributesFinderInterface $attributesFinder;
2222

2323
public function __construct(
2424
TaxonContextInterface $taxonContext,
@@ -31,8 +31,7 @@ public function __construct(
3131
public function getAttributes(): ?array
3232
{
3333
$taxon = $this->taxonContext->getTaxon();
34-
$attributes = $this->attributesFinder->findByTaxon($taxon);
3534

36-
return $attributes;
35+
return $this->attributesFinder->findByTaxon($taxon);
3736
}
3837
}

src/Context/ProductAttributesContextInterface.php

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

33
/*
4-
* This file was created by developers working at BitBag
5-
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6-
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7-
*/
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+
* another great project.
7+
* You can find more information about us on https://bitbag.io and write us
8+
* an email on [email protected].
9+
*/
810

911
declare(strict_types=1);
1012

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?php
22

33
/*
4-
* This file was created by developers working at BitBag
5-
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6-
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7-
*/
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+
* another great project.
7+
* You can find more information about us on https://bitbag.io and write us
8+
* an email on [email protected].
9+
*/
810

911
declare(strict_types=1);
1012

@@ -14,11 +16,9 @@
1416

1517
final class ProductOptionsContext implements ProductOptionsContextInterface
1618
{
17-
/** @var TaxonContextInterface */
18-
private $taxonContext;
19+
private TaxonContextInterface $taxonContext;
1920

20-
/** @var ProductOptionsFinderInterface */
21-
private $optionsFinder;
21+
private ProductOptionsFinderInterface $optionsFinder;
2222

2323
public function __construct(
2424
TaxonContextInterface $taxonContext,
@@ -31,8 +31,7 @@ public function __construct(
3131
public function getOptions(): ?array
3232
{
3333
$taxon = $this->taxonContext->getTaxon();
34-
$options = $this->optionsFinder->findByTaxon($taxon);
3534

36-
return $options;
35+
return $this->optionsFinder->findByTaxon($taxon);
3736
}
3837
}

src/Context/ProductOptionsContextInterface.php

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

33
/*
4-
* This file was created by developers working at BitBag
5-
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6-
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7-
*/
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+
* another great project.
7+
* You can find more information about us on https://bitbag.io and write us
8+
* an email on [email protected].
9+
*/
810

911
declare(strict_types=1);
1012

0 commit comments

Comments
 (0)