Skip to content

Commit 1001f2d

Browse files
author
Damian D'amico
authored
Merge pull request #27 from odiseoteam/1.8
Improvements
2 parents a29844d + dc207a4 commit 1001f2d

File tree

26 files changed

+250
-196
lines changed

26 files changed

+250
-196
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 9 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"]
25-
symfony: ["5.4.*", "^6.0"]
26-
sylius: ["^1.12"]
27-
node: ["14.x", "16.x", "18.x"]
28-
mysql: ["5.7", "8.0"]
24+
php: ["8.1", "8.2", "8.3"]
25+
symfony: ["^5.4", "^6.4"]
26+
sylius: ["~1.12.0", "~1.13.0"]
27+
node: ["20.x"]
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@v3
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@v3
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@v3
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') }}
@@ -182,7 +182,7 @@ jobs:
182182

183183
-
184184
name: Run Behat
185-
run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun
185+
run: vendor/bin/behat --colors --strict -vvv --no-interaction -f progress || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun
186186

187187
-
188188
name: Upload Behat logs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<a href="https://odiseo.com.ar/" target="_blank" title="Odiseo">
2+
<a href="https://odiseo.io/" target="_blank" title="Odiseo">
33
<img src="https://github.com/odiseoteam/SyliusVendorPlugin/blob/master/sylius-vendor-plugin.png" alt="Sylius Vendor Plugin" />
44
</a>
55
<br />

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.yaml
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: panther
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: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
"description": "Vendor plugin for Sylius. Add Vendor (Brand) to your products",
1111
"license": "MIT",
1212
"require": {
13-
"php": "^8.0",
13+
"php": "^8.1",
1414
"sylius/sylius": "^1.12",
15-
"sylius/mailer-bundle": "^1.8 || ^2.0@beta",
1615
"symfony/webpack-encore-bundle": "^1.15"
1716
},
1817
"require-dev": {
1918
"behat/behat": "^3.6.1",
2019
"behat/mink-selenium2-driver": "^1.4",
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",
@@ -31,24 +31,24 @@
3131
"phpspec/phpspec": "^7.2",
3232
"phpstan/extension-installer": "^1.0",
3333
"phpstan/phpstan": "^1.8.1",
34-
"phpstan/phpstan-doctrine": "1.3.40",
34+
"phpstan/phpstan-doctrine": "1.3.69",
3535
"phpstan/phpstan-strict-rules": "^1.3.0",
3636
"phpstan/phpstan-webmozart-assert": "^1.2.0",
37-
"phpunit/phpunit": "^9.5",
37+
"phpunit/phpunit": "^10.5",
3838
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
39+
"robertfausk/behat-panther-extension": "^1.1",
3940
"sylius-labs/coding-standard": "^4.2",
40-
"symfony/browser-kit": "^5.4 || ^6.0",
41-
"symfony/debug-bundle": "^5.4 || ^6.0",
42-
"symfony/dotenv": "^5.4 || ^6.0",
43-
"symfony/flex": "^2.2.2",
44-
"symfony/intl": "^5.4 || ^6.0",
45-
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
46-
"vimeo/psalm": "5.12.0"
41+
"sylius-labs/suite-tags-extension": "^0.2",
42+
"symfony/browser-kit": "^5.4 || ^6.4",
43+
"symfony/debug-bundle": "^5.4 || ^6.4",
44+
"symfony/dotenv": "^5.4 || ^6.4",
45+
"symfony/flex": "^2.4",
46+
"symfony/intl": "^5.4 || ^6.4",
47+
"symfony/web-profiler-bundle": "^5.4 || ^6.4",
48+
"vimeo/psalm": "5.24.0"
4749
},
4850
"conflict": {
49-
"symfony/framework-bundle": "6.2.8",
50-
"api-platform/core": "2.7.17",
51-
"behat/mink-selenium2-driver": ">=1.7.0"
51+
"symfony/framework-bundle": "6.2.8"
5252
},
5353
"suggest": {
5454
"stefandoorn/sitemap-plugin": "Adds vendors to the Sylius sitemap plugin"
@@ -63,7 +63,7 @@
6363
},
6464
"extra": {
6565
"symfony": {
66-
"require": "^5.4 || ^6.0"
66+
"require": "^5.4 || ^6.4"
6767
}
6868
},
6969
"autoload": {

phpstan.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
parameters:
22
level: max
33
reportUnmatchedIgnoredErrors: false
4-
checkMissingIterableValueType: false
5-
checkGenericClassInNonGenericObjectType: false
64
paths:
75
- src
86
- tests/Behat
@@ -18,6 +16,8 @@ parameters:
1816
- 'tests/Application/src/**.php'
1917

2018
ignoreErrors:
19+
- identifier: missingType.iterableValue
20+
- identifier: missingType.generics
2121
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./'
2222
- '/Cannot cast mixed to int./'
2323
- '/Cannot cast mixed to string./'

src/Resources/config/routing/shop/partial/vendor.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ odiseo_sylius_vendor_plugin_shop_partial_vendor_show_by_slug:
1010
arguments:
1111
- $slug
1212
- "expr:service('sylius.context.locale').getLocaleCode()"
13-
requirements:
14-
slug: .+
1513

1614
odiseo_sylius_vendor_plugin_shop_partial_vendor_index_by_channel:
1715
path: /by-channel
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
odiseo_sylius_vendor_plugin_shop_vendor_product_index:
2-
path: /{slug}/products
2+
path: /{slug}
33
methods: [GET]
44
defaults:
55
_controller: sylius.controller.product::indexAction
66
_sylius:
77
template: "@OdiseoSyliusVendorPlugin/Shop/Vendor/Product/index.html.twig"
88
grid: odiseo_sylius_vendor_plugin_shop_vendor_product
9-
requirements:
10-
slug: .+

src/Resources/config/sylius_ui.yaml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,43 @@ sylius_ui:
66
template: "@OdiseoSyliusVendorPlugin/Admin/Layout/_vendor_js.html.twig"
77
priority: 5
88

9-
odiseo_sylius_vendor_plugin.shop.vendor.product.index.before_vertical_menu:
9+
odiseo_sylius_vendor_plugin.shop.vendor.product.index.header.content:
1010
blocks:
11+
breadcrumb:
12+
template: "@OdiseoSyliusVendorPlugin/Shop/Vendor/Product/Index/Header/_breadcrumb.html.twig"
13+
priority: 20
1114
legacy:
1215
template: "@SyliusUi/Block/_legacySonataEvent.html.twig"
16+
priority: 15
1317
context:
14-
event: odiseo_sylius_vendor_plugin.shop.vendor.product.index.before_vertical_menu
18+
event: odiseo_sylius_vendor_plugin.shop.vendor.product.index.header
19+
content:
20+
template: "@OdiseoSyliusVendorPlugin/Shop/Vendor/Product/Index/Header/_content.html.twig"
21+
priority: 10
1522

16-
odiseo_sylius_vendor_plugin.shop.vendor.product.index.after_vertical_menu:
23+
odiseo_sylius_vendor_plugin.shop.vendor.product.index.content:
1724
blocks:
18-
legacy:
25+
before_header_legacy:
1926
template: "@SyliusUi/Block/_legacySonataEvent.html.twig"
27+
priority: 25
28+
context:
29+
event: odiseo_sylius_vendor_plugin.shop.vendor.product.index.before_header
30+
header:
31+
template: "@OdiseoSyliusVendorPlugin/Shop/Vendor/Product/Index/_headerWidget.html.twig"
32+
priority: 20
33+
after_header_legacy:
34+
template: "@SyliusUi/Block/_legacySonataEvent.html.twig"
35+
priority: 15
36+
context:
37+
event: odiseo_sylius_vendor_plugin.shop.vendor.product.index.after_header
38+
content:
39+
template: "@OdiseoSyliusVendorPlugin/Shop/Vendor/Product/Index/_content.html.twig"
40+
priority: 10
41+
after_content_legacy:
42+
template: "@SyliusUi/Block/_legacySonataEvent.html.twig"
43+
priority: 5
2044
context:
21-
event: odiseo_sylius_vendor_plugin.shop.vendor.product.index.after_vertical_menu
45+
event: odiseo_sylius_vendor_plugin.shop.vendor.product.index.after_content
2246

2347
odiseo_sylius_vendor_plugin.shop.vendor.product.index.before_list:
2448
blocks:

src/Resources/views/Shop/Vendor/Index/_pagination.html.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
{{ 'sylius.ui.show'|trans }} {{ resources.data.maxPerPage }}
77
<i class="dropdown icon"></i>
88
<div class="menu">
9-
{% for limit in paginationLimits|filter(limit => limit != resources.data.maxPerPage) %}
10-
{% set path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge(app.request.query.all)|merge({'limit': limit})) %}
11-
<a class="item" href="{{ path }}">{{ limit }}</a>
12-
{% endfor %}
9+
{% for limit in paginationLimits|filter(limit => limit != resources.data.maxPerPage) %}
10+
{% set path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge(app.request.query.all)|merge({'limit': limit})) %}
11+
<a class="item" href="{{ path }}">{{ limit }}</a>
12+
{% endfor %}
1313
</div>
1414
</div>
1515
</div>
Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,41 @@
11
{% if resources.data.nbResults > 0 %}
2+
{% set route = app.request.attributes.get('_route') %}
3+
{% set route_parameters = app.request.attributes.all('_route_params')|merge(app.request.query.all) %}
24

3-
{% set route = app.request.attributes.get('_route') %}
4-
{% set route_parameters = app.request.attributes.all('_route_params')|merge(app.request.query.all) %}
5+
{% set criteria = app.request.query.all('criteria') %}
56

6-
{% set criteria = app.request.query.all('criteria') %}
7+
{% set default_path = path(route, route_parameters|merge({'sorting': null, 'criteria': criteria})) %}
8+
{% set from_a_to_z_path = path(route, route_parameters|merge({'sorting': {'name': 'asc'}, 'criteria': criteria})) %}
9+
{% set from_z_to_a_path = path(route, route_parameters|merge({'sorting': {'name': 'desc'}, 'criteria': criteria})) %}
10+
{% set oldest_first_path = path(route, route_parameters|merge({'sorting': {'createdAt': 'asc'}, 'criteria': criteria})) %}
11+
{% set newest_first_path = path(route, route_parameters|merge({'sorting': {'createdAt': 'desc'}, 'criteria': criteria})) %}
712

8-
{% set default_path = path(route, route_parameters|merge({'sorting': null, 'criteria': criteria})) %}
9-
{% set from_a_to_z_path = path(route, route_parameters|merge({'sorting': {'name': 'asc'}, 'criteria': criteria})) %}
10-
{% set from_z_to_a_path = path(route, route_parameters|merge({'sorting': {'name': 'desc'}, 'criteria': criteria})) %}
11-
{% set oldest_first_path = path(route, route_parameters|merge({'sorting': {'createdAt': 'asc'}, 'criteria': criteria})) %}
12-
{% set newest_first_path = path(route, route_parameters|merge({'sorting': {'createdAt': 'desc'}, 'criteria': criteria})) %}
13+
{% if app.request.query.all()['sorting'] is not defined or app.request.query.all()['sorting'] is empty %}
14+
{% set current_sorting_label = 'sylius.ui.by_position'|trans|lower %}
15+
{% elseif app.request.query.all()['sorting'].name is defined and app.request.query.all()['sorting'].name == 'asc'%}
16+
{% set current_sorting_label = 'sylius.ui.from_a_to_z'|trans|lower %}
17+
{% elseif app.request.query.all()['sorting'].name is defined and app.request.query.all()['sorting'].name == 'desc'%}
18+
{% set current_sorting_label = 'sylius.ui.from_z_to_a'|trans|lower %}
19+
{% elseif app.request.query.all()['sorting'].createdAt is defined and app.request.query.all()['sorting'].createdAt == 'desc'%}
20+
{% set current_sorting_label = 'sylius.ui.newest_first'|trans|lower %}
21+
{% elseif app.request.query.all()['sorting'].createdAt is defined and app.request.query.all()['sorting'].createdAt == 'asc'%}
22+
{% set current_sorting_label = 'sylius.ui.oldest_first'|trans|lower %}
23+
{% endif %}
1324

14-
{% if app.request.query.all()['sorting'] is not defined or app.request.query.all()['sorting'] is empty %}
15-
{% set current_sorting_label = 'sylius.ui.by_position'|trans|lower %}
16-
{% elseif app.request.query.all()['sorting'].name is defined and app.request.query.all()['sorting'].name == 'asc'%}
17-
{% set current_sorting_label = 'sylius.ui.from_a_to_z'|trans|lower %}
18-
{% elseif app.request.query.all()['sorting'].name is defined and app.request.query.all()['sorting'].name == 'desc'%}
19-
{% set current_sorting_label = 'sylius.ui.from_z_to_a'|trans|lower %}
20-
{% elseif app.request.query.all()['sorting'].createdAt is defined and app.request.query.all()['sorting'].createdAt == 'desc'%}
21-
{% set current_sorting_label = 'sylius.ui.newest_first'|trans|lower %}
22-
{% elseif app.request.query.all()['sorting'].createdAt is defined and app.request.query.all()['sorting'].createdAt == 'asc'%}
23-
{% set current_sorting_label = 'sylius.ui.oldest_first'|trans|lower %}
24-
{% endif %}
25-
26-
<div class="ui right floated small header">
27-
<div class="content">
28-
{{ 'sylius.ui.sort'|trans }}
29-
<div class="ui inline dropdown">
30-
<div class="text">{{ current_sorting_label }}</div>
31-
<i class="dropdown icon"></i>
32-
<div class="menu">
33-
<a class="item" href="{{ default_path }}" data-text="{{ 'sylius.ui.by_position'|trans|lower }}">{{ 'sylius.ui.by_position'|trans }}</a>
34-
<a class="item" href="{{ from_a_to_z_path }}" data-text="{{ 'sylius.ui.from_a_to_z'|trans|lower }}">{{ 'sylius.ui.from_a_to_z'|trans }}</a>
35-
<a class="item" href="{{ from_z_to_a_path }}" data-text="{{ 'sylius.ui.from_z_to_a'|trans|lower }}">{{ 'sylius.ui.from_z_to_a'|trans }}</a>
36-
<a class="item" href="{{ newest_first_path }}" data-text="{{ 'sylius.ui.newest_first'|trans|lower }}">{{ 'sylius.ui.newest_first'|trans }}</a>
37-
<a class="item" href="{{ oldest_first_path }}" data-text="{{ 'sylius.ui.oldest_first'|trans|lower }}">{{ 'sylius.ui.oldest_first'|trans }}</a>
25+
<div class="ui right floated small header">
26+
<div class="content">
27+
{{ 'sylius.ui.sort'|trans }}
28+
<div class="ui inline dropdown">
29+
<div class="text">{{ current_sorting_label }}</div>
30+
<i class="dropdown icon"></i>
31+
<div class="menu">
32+
<a class="item" href="{{ default_path }}" data-text="{{ 'sylius.ui.by_position'|trans|lower }}">{{ 'sylius.ui.by_position'|trans }}</a>
33+
<a class="item" href="{{ from_a_to_z_path }}" data-text="{{ 'sylius.ui.from_a_to_z'|trans|lower }}">{{ 'sylius.ui.from_a_to_z'|trans }}</a>
34+
<a class="item" href="{{ from_z_to_a_path }}" data-text="{{ 'sylius.ui.from_z_to_a'|trans|lower }}">{{ 'sylius.ui.from_z_to_a'|trans }}</a>
35+
<a class="item" href="{{ newest_first_path }}" data-text="{{ 'sylius.ui.newest_first'|trans|lower }}">{{ 'sylius.ui.newest_first'|trans }}</a>
36+
<a class="item" href="{{ oldest_first_path }}" data-text="{{ 'sylius.ui.oldest_first'|trans|lower }}">{{ 'sylius.ui.oldest_first'|trans }}</a>
37+
</div>
3838
</div>
3939
</div>
4040
</div>
41-
</div>
4241
{% endif %}

0 commit comments

Comments
 (0)