Skip to content

Commit 278bc0f

Browse files
authored
Merge pull request #40 from BitBagCommerce/feature/OP-126
OP-126 - Sylius 1.12 support
2 parents 5127662 + 0d8f774 commit 278bc0f

Some content is hidden

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

44 files changed

+364
-141
lines changed

Diff for: .github/workflows/build.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,22 @@ on:
1414

1515
jobs:
1616
tests:
17-
runs-on: ubuntu-18.04
17+
runs-on: ubuntu-22.04
1818

1919
name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"
2020

2121
strategy:
2222
fail-fast: false
2323
matrix:
2424
php: [8.0]
25-
symfony: [^4.4, ^5.2]
26-
sylius: [~1.11.0]
25+
symfony: [^5.4, ^6.0]
26+
sylius: [~1.11.0, ~1.12.0]
2727
node: [14.x]
28-
mysql: [5.7]
28+
mysql: [5.7, 8.0]
29+
30+
exclude:
31+
- sylius: ~1.11.0
32+
symfony: ^6.0
2933

3034
env:
3135
APP_ENV: test
@@ -119,6 +123,7 @@ jobs:
119123
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
120124
restore-keys: |
121125
${{ runner.os }}-node-${{ matrix.node }}-yarn-
126+
122127
-
123128
name: Install JS dependencies
124129
run: (cd tests/Application && yarn install)
@@ -132,7 +137,7 @@ jobs:
132137
name: Prepare test application assets
133138
run: |
134139
(cd tests/Application && bin/console assets:install public -vvv)
135-
(cd tests/Application && yarn build)
140+
(cd tests/Application && yarn encore dev)
136141
-
137142
name: Prepare test application cache
138143
run: (cd tests/Application && bin/console cache:warmup -vvv)

Diff for: .github/workflows/coding_standard.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,23 @@ on:
1414

1515
jobs:
1616
tests:
17-
runs-on: ubuntu-18.04
17+
runs-on: ubuntu-22.04
1818

1919
name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"
2020

2121
strategy:
2222
fail-fast: false
2323
matrix:
2424
php: [8.0]
25-
symfony: [^4.4, ^5.2]
26-
sylius: [~1.11.0]
25+
symfony: [ ^5.4, ^6.0]
26+
sylius: [~1.11.0, ~1.12.0]
2727
node: [14.x]
2828
mysql: [5.7]
2929

30+
exclude:
31+
- sylius: ~1.11.0
32+
symfony: ^6.0
33+
3034
env:
3135
APP_ENV: test
3236
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"
@@ -78,8 +82,4 @@ jobs:
7882
name: Run PHPStan in /src directory
7983
run: ./vendor/bin/phpstan analyze --configuration=vendor/bitbag/coding-standard/phpstan.neon src --level=8
8084

81-
-
82-
name: Run PHPStan in /test directory
83-
run: ./vendor/bin/phpstan analyze --configuration=vendor/bitbag/coding-standard/phpstan.neon tests --level=5
84-
8585

Diff for: composer.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
"license": "MIT",
77
"require": {
88
"php": "^8.0",
9-
"sylius/sylius": "~1.11.0"
9+
"sylius/sylius": "~1.11.0 || ~1.12.0"
1010
},
1111
"require-dev": {
1212
"ext-json": "*",
13+
"symfony/webpack-encore-bundle": "^1.15",
1314
"behat/behat": "^3.6.1",
1415
"behat/mink-selenium2-driver": "^1.4",
1516
"dmore/behat-chrome-extension": "^1.3",
@@ -21,7 +22,6 @@
2122
"friends-of-behat/suite-settings-extension": "^1.0",
2223
"friends-of-behat/symfony-extension": "^2.1",
2324
"friends-of-behat/variadic-extension": "^1.3",
24-
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
2525
"lakion/mink-debug-extension": "^2.0.0",
2626
"phpspec/phpspec": "^7.0",
2727
"phpstan/extension-installer": "^1.0",
@@ -30,13 +30,12 @@
3030
"phpstan/phpstan-strict-rules": "^0.12.0",
3131
"phpstan/phpstan-webmozart-assert": "0.12.12",
3232
"phpunit/phpunit": "^9.5",
33-
"sensiolabs/security-checker": "^6.0",
3433
"sylius-labs/coding-standard": "^4.0",
35-
"symfony/browser-kit": "^4.4 || ^5.2",
36-
"symfony/debug-bundle": "^4.4 || ^5.2",
37-
"symfony/dotenv": "^4.4 || ^5.2",
38-
"symfony/intl": "^4.4 || ^5.2",
39-
"symfony/web-profiler-bundle": "^4.4 || ^5.2",
34+
"symfony/browser-kit": "^5.4 || ^6.0",
35+
"symfony/debug-bundle": "^5.4 || ^6.0",
36+
"symfony/dotenv": "^5.4 || ^6.0",
37+
"symfony/intl": "^5.4 || ^6.0",
38+
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
4039
"vimeo/psalm": "^4.12",
4140
"composer/xdebug-handler": "^2.0",
4241
"friendsofphp/php-cs-fixer": "^3.0",
@@ -70,7 +69,8 @@
7069
"allow-plugins": {
7170
"composer/package-versions-deprecated": true,
7271
"dealerdirect/phpcodesniffer-composer-installer": true,
73-
"phpstan/extension-installer": true
72+
"phpstan/extension-installer": true,
73+
"symfony/thanks": false
7474
}
7575
}
7676
}

Diff for: src/Resources/assets/admin/entry.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import './js';
2+
import './scss/main.scss';

Diff for: src/Resources/assets/admin/scss/main.scss

Whitespace-only changes.

Diff for: src/Resources/assets/shop/entry.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import './js';
2+
import './scss/main.scss';

Diff for: src/Resources/assets/shop/js/index.js

Whitespace-only changes.

Diff for: src/Resources/assets/shop/scss/main.scss

Whitespace-only changes.

Diff for: src/Resources/config/routing/admin.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ bitbag_product_bundle_admin_product_create_bundle:
22
path: /products/new/bundle
33
methods: [GET, POST]
44
defaults:
5-
_controller: sylius.controller.product:createAction
5+
_controller: sylius.controller.product::createAction
66
_sylius:
77
section: admin
88
permission: true
@@ -26,7 +26,7 @@ bitbag_product_bundle_admin_ajax_product_variants_by_phrase:
2626
path: /ajax/product-variants/search-by-phrase
2727
methods: [GET]
2828
defaults:
29-
_controller: sylius.controller.product_variant:indexAction
29+
_controller: sylius.controller.product_variant::indexAction
3030
_format: json
3131
_sylius:
3232
serialization_groups: [Autocomplete]
@@ -41,7 +41,7 @@ bitbag_product_bundle_admin_ajax_product_variants_by_codes:
4141
path: /ajax/product-variants/by-codes
4242
methods: [GET]
4343
defaults:
44-
_controller: sylius.controller.product_variant:indexAction
44+
_controller: sylius.controller.product_variant::indexAction
4545
_format: json
4646
_sylius:
4747
serialization_groups: [Autocomplete]

Diff for: src/Resources/config/routing/shop.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ bitbag_sylius_product_bundle_shop_ajax_cart_add_product_bundle:
22
path: /ajax/cart/product-bundle/add
33
methods: [POST]
44
defaults:
5-
_controller: bitbag_sylius_product_bundle.controller.order_item:addProductBundleAction
5+
_controller: bitbag_sylius_product_bundle.controller.order_item::addProductBundleAction
66
_format: json
77
_sylius:
88
factory:
@@ -21,7 +21,7 @@ bitbag_sylius_product_bundle_shop_partial_cart_add_product_bundle:
2121
path: /_partial/cart/product-bundle/add
2222
methods: [GET]
2323
defaults:
24-
_controller: bitbag_sylius_product_bundle.controller.order_item:addProductBundleAction
24+
_controller: bitbag_sylius_product_bundle.controller.order_item::addProductBundleAction
2525
_sylius:
2626
template: $template
2727
factory:

Diff for: src/Resources/views/Admin/Form/productBundleItem.html.twig

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% import _self as self %}
66
{% set attr = attr|merge({'class': attr.class|default ~ ' controls collection-widget'}) %}
77

8-
{% spaceless %}
8+
{% apply spaceless %}
99
<div data-form-type="collection" {{ block('widget_container_attributes') }}
1010
{% if prototype is defined and allow_add %}
1111
data-prototype='{{ self.collection_item(prototype, allow_delete, button_delete_label, prototype.vars.name)|e }}'
@@ -42,11 +42,11 @@
4242
</a>
4343
{% endif %}
4444
</div>
45-
{% endspaceless %}
45+
{% endapply %}
4646
{%- endblock collection_widget %}
4747

4848
{% macro collection_item(form, allow_delete, button_delete_label, index) %}
49-
{% spaceless %}
49+
{% apply spaceless %}
5050
<tr data-form-collection="item" data-form-collection-index="{{ index }}">
5151
<td>
5252
{{ form_row(form.productVariant, {'remote_url': path('bitbag_product_bundle_admin_ajax_product_variants_by_phrase'), 'remote_criteria_type': 'contains', 'remote_criteria_name': 'phrase', 'load_edit_url': path('bitbag_product_bundle_admin_ajax_product_variants_by_codes')}) }}
@@ -64,5 +64,5 @@
6464
</td>
6565
{% endif %}
6666
</tr>
67-
{% endspaceless %}
67+
{% endapply %}
6868
{% endmacro %}

Diff for: src/Validator/SequentiallyValidator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
final class SequentiallyValidator extends ConstraintValidator
1818
{
19-
public function validate($value, Constraint $constraint): void
19+
public function validate(mixed $value, Constraint $constraint): void
2020
{
2121
if (!$constraint instanceof Sequentially) {
2222
throw new UnexpectedTypeException($constraint, Sequentially::class);

Diff for: tests/Api/Responses/admin/get_order_with_bundle_response.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"@context": "\/api\/v2\/contexts\/Order",
33
"@id": "\/api\/v2\/admin\/orders\/zszRdAaZIx",
44
"@type": "Order",
5-
"customer": "\/api\/v2\/admin\/customers\/@integer@",
5+
"customer": "@string@",
66
"channel": "\/api\/v2\/admin\/channels\/WEB",
7-
"shippingAddress": "@*@",
8-
"billingAddress": "@*@",
7+
"shippingAddress": "@...@",
8+
"billingAddress": "@...@",
99
"payments": "@*@",
1010
"shipments": "@*@",
1111
"currencyCode": "EUR",
@@ -18,7 +18,7 @@
1818
"number": "@string@",
1919
"items": [
2020
{
21-
"@id": "\/api\/v2\/admin\/order-items\/@integer@",
21+
"@id": "@string@",
2222
"@type": "OrderItem",
2323
"variant": "\/api\/v2\/admin\/product-variants\/WHISKEY_DOUBLE_PACK",
2424
"productName": "Whiskey Double Pack",
@@ -28,18 +28,18 @@
2828
"originalUnitPrice": 0,
2929
"total": 1800,
3030
"productBundleOrderItems": [
31-
{
31+
{
3232
"@type": "ProductBundleOrderItem",
3333
"@id": "@string@",
3434
"id": "@integer@",
35-
"productVariant": "\/api\/v2\/admin\/product-variants\/@string@",
35+
"productVariant": "@string@",
3636
"quantity": 1
3737
},
3838
{
3939
"@type": "ProductBundleOrderItem",
4040
"@id": "@string@",
4141
"id": "@integer@",
42-
"productVariant": "\/api\/v2\/admin\/product-variants\/@string@",
42+
"productVariant": "@string@",
4343
"quantity": 1
4444
}
4545
],

Diff for: tests/Api/Responses/shop/get_bundled_product_response.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"@context": "\/api\/v2\/contexts\/Product",
33
"@id": "\/api\/v2\/shop\/products\/WHISKEY_DOUBLE_PACK",
44
"@type": "Product",
5-
"productTaxons": "@*@",
5+
"productTaxons": "@...@",
66
"mainTaxon": "@string@||@null@",
7-
"reviews": "@*@",
7+
"reviews": "@...@",
88
"averageRating": "@integer@",
9-
"images": "@*@",
9+
"images": "@...@",
1010
"id": "@integer@",
1111
"code": "WHISKEY_DOUBLE_PACK",
1212
"name": "@string@",
1313
"slug": "@string@",
14-
"variants": "@*@",
15-
"options": "@*@",
14+
"variants": "@...@",
15+
"options": "@...@",
1616
"createdAt": "@string@",
1717
"updatedAt": "@string@",
1818
"bundle": {

Diff for: tests/Api/Responses/shop/get_not_bundled_product_response.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"@context": "\/api\/v2\/contexts\/Product",
33
"@id": "\/api\/v2\/shop\/products\/JOHNNY_WALKER_BLACK",
44
"@type": "Product",
5-
"productTaxons": "@*@",
5+
"productTaxons": "@...@",
66
"mainTaxon": "@null@",
7-
"reviews": "@*@",
7+
"reviews": "@...@",
88
"averageRating": "@integer@",
9-
"images": "@*@",
9+
"images": "@...@",
1010
"id": "@integer@",
1111
"code": "JOHNNY_WALKER_BLACK",
1212
"name": "@string@",
1313
"slug": "@string@",
14-
"variants": "@*@",
15-
"options": "@*@",
14+
"variants": "@...@",
15+
"options": "@...@",
1616
"createdAt": "@string@",
1717
"updatedAt": "@string@",
1818
"bundle": "@null@",

Diff for: tests/Api/Responses/shop/get_order_with_bundle_response.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"@type": "Order",
55
"shippingAddress": "@*@",
66
"billingAddress": "@*@",
7-
"payments": "@*@",
8-
"shipments": "@*@",
7+
"payments": "@...@",
8+
"shipments": "@...@",
99
"currencyCode": "EUR",
1010
"localeCode": "en_US",
1111
"checkoutState": "completed",

Diff for: tests/Api/Responses/shop/get_product_bundle_response.json

+3-35
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,19 @@
11
{
22
"@context": "\/api\/v2\/contexts\/ProductBundle",
3-
"@id": "\/api\/v2\/shop\/product-bundles\/@integer@",
3+
"@id": "@string@",
44
"@type": "ProductBundle",
55
"product": "\/api\/v2\/shop\/products\/WHISKEY_DOUBLE_PACK",
66
"items": [
77
{
88
"@type": "ProductBundleItem",
99
"@id": "@string@",
10-
"productVariant": {
11-
"@id": "/api/v2/shop/product-variants/JOHNNY_WALKER_BLACK",
12-
"@type": "ProductVariant",
13-
"code": "JOHNNY_WALKER_BLACK",
14-
"product": "\/api\/v2\/shop\/products\/JOHNNY_WALKER_BLACK",
15-
"optionValues": "@*@",
16-
"translations": {
17-
"en_US": {
18-
"@id": "/api/v2/shop/product-variant-translation/@integer@",
19-
"@type": "ProductVariantTranslation",
20-
"name": "Johnny Walker Black"
21-
}
22-
},
23-
"price": 1000,
24-
"originalPrice": 1000,
25-
"inStock": true
26-
},
10+
"productVariant": "@...@",
2711
"quantity": 1
2812
},
2913
{
3014
"@type": "ProductBundleItem",
3115
"@id": "@string@",
32-
"productVariant": {
33-
"@id": "/api/v2/shop/product-variants/JACK_DANIELS_GENTLEMAN",
34-
"@type": "ProductVariant",
35-
"code": "JACK_DANIELS_GENTLEMAN",
36-
"product": "\/api\/v2\/shop\/products\/JACK_DANIELS_GENTLEMAN",
37-
"optionValues": "@*@",
38-
"translations": {
39-
"en_US": {
40-
"@id": "/api/v2/shop/product-variant-translation/@integer@",
41-
"@type": "ProductVariantTranslation",
42-
"name": "Jack Daniel's Gentleman Jack"
43-
}
44-
},
45-
"price": 1000,
46-
"originalPrice": 1000,
47-
"inStock": true
48-
},
16+
"productVariant": "@...@",
4917
"quantity": 1
5018
}
5119
],

0 commit comments

Comments
 (0)