Skip to content

Commit

Permalink
feature #199 Sylius 1.13 (Prometee)
Browse files Browse the repository at this point in the history
This PR was merged into the main branch.

Discussion
----------

Here is a PR aiming to fix the build and add support for Sylius 1.13. I also:
- [x] Remove support for Sylius 1.11.
- [x] Add Panther config to run Behat.
- [x] Add `symfony/runtime` on the test application.
- [x] Update PHPStan config.
- [x] Update Github action build.
- [x] Fix the Behat build by updating number format on scenarios.

Commits
-------

31ff455 Update all config files and remove some no more necessary stuffs
91ed886 Update bootstrap file to get env vars
eefaf0c Little deprecation fixed
c56ab66 Ignore public/build folder
bbf92a9 Restore the same config as on the main branch
6bbd7d6 Fix int to float prices
072ff7b Fix thousand separator
8fc6e0a Fix PantherDriver reference
f077335 Fix expected message argument ordering
ea489a9 Wrong format
fb08556 Increase timeout to let the ajax query be done
c3eaecc Fix build for Sylius 1.12
a35c891 Update from Sylius-Standard config
e79a18b Cleanup and remove no more required codes
66e2cb6 ECS fix
f53509e Fix wrong scenario description
49359d1 Sync config with sylius/sylius
0de0c7a Try to rely on Sylius Behat helpers to know if a form or an ajax request is pending
557fc96 Refactor to merge two similar methods
  • Loading branch information
GSadee committed Jun 10, 2024
2 parents 7567ffa + 557fc96 commit 35c6a31
Show file tree
Hide file tree
Showing 75 changed files with 477 additions and 507 deletions.
60 changes: 25 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Build

on:
push: ~
push:
branches-ignore:
- 'dependabot/**'
pull_request: ~
release:
types: [created]
Expand All @@ -19,36 +21,31 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.0", "8.1"]
symfony: ["^5.4", "^6.0"]
sylius: ["~1.11.10", "~1.12.0"]
node: ["16.x"]
mysql: ["5.7", "8.0"]

exclude:
- sylius: "~1.11.10"
symfony: "^6.0"

php: ["8.1","8.2","8.3"]
symfony: ["^5.4", "^6.4"]
sylius: ["~1.12.0", "~1.13.0"]
node: ["20.x"]
mysql: ["8.0"]
env:
APP_ENV: test
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}"

steps:
-
uses: actions/checkout@v2
uses: actions/checkout@v3

-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
extensions: intl, gd
tools: symfony
tools: flex, symfony
coverage: none

-
name: Setup Node
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: "${{ matrix.node }}"

Expand All @@ -70,54 +67,47 @@ jobs:
-
name: Install certificates
run: symfony server:ca:install

-
name: Run Chrome Headless
run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 &

-
name: Run webserver
run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon)

-
name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

-
name: Cache Composer
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-composer-
-
name: Restrict Symfony version
if: matrix.symfony != ''
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
composer config extra.symfony.require "${{ matrix.symfony }}"
-
name: Restrict Sylius version
if: matrix.sylius != ''
run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction

-
name: Install PHP dependencies
run: composer update --no-interaction
run: composer install --no-interaction
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}

-
name: Install Behat driver
run: vendor/bin/bdi browser:google-chrome drivers

-
name: Get Yarn cache directory
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

-
name: Cache Yarn
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
Expand All @@ -138,7 +128,7 @@ jobs:
name: Prepare test application assets
run: |
(cd tests/Application && bin/console assets:install public -vvv)
(cd tests/Application && yarn build)
(cd tests/Application && yarn build:prod)
-
name: Prepare test application cache
Expand All @@ -162,7 +152,7 @@ jobs:

-
name: Run PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon -l max src/
run: vendor/bin/phpstan analyse

-
name: Run PHPSpec
Expand All @@ -178,7 +168,7 @@ jobs:

-
name: Upload Behat logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: Behat logs
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/bin/*
!/bin/.gitkeep

/drivers
/vendor/
/node_modules/
/composer.lock
Expand All @@ -13,3 +14,7 @@
/web/media

/.phpunit.result.cache
/phpunit.xml
/phpspec.yml
/phpstan.neon
/behat.yml
49 changes: 29 additions & 20 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@ imports:
- tests/Behat/Resources/suites.yml

default:
formatters:
pretty:
verbose: true
paths: false
snippets: false

extensions:
DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~
Robertfausk\Behat\PantherExtension: ~

FriendsOfBehat\MinkDebugExtension\ServiceContainer\MinkDebugExtension:
FriendsOfBehat\MinkDebugExtension:
directory: etc/build
clean_start: false
screenshot: true
Expand All @@ -15,32 +22,32 @@ default:
files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/"
base_url: "https://127.0.0.1:8080/"
default_session: symfony
javascript_session: chrome_headless
javascript_session: panther
sessions:
symfony:
symfony: ~
chrome_headless:
chromedriver:
chrome:
api_url: http://127.0.0.1:9222
validate_certificate: false
chrome:
selenium2:
browser: chrome
capabilities:
browserName: chrome
browser: chrome
version: ""
marionette: null # https://github.com/Behat/MinkExtension/pull/311
chrome:
switches:
- "start-fullscreen"
- "start-maximized"
- "no-sandbox"
extra_capabilities:
chrome_headless_second_session:
chrome:
api_url: http://127.0.0.1:9222
validate_certificate: false
panther:
panther:
options:
webServerDir: "%paths.base%/tests/Application/public"
manager_options:
connection_timeout_in_ms: 5000
request_timeout_in_ms: 120000
chromedriver_arguments:
- --log-path=etc/build/chromedriver.log
- --verbose
capabilities:
acceptSslCerts: true
acceptInsecureCerts: true
unexpectedAlertBehaviour: accept
firefox:
selenium2:
browser: firefox
show_auto: false

FriendsOfBehat\SymfonyExtension:
Expand All @@ -53,3 +60,5 @@ default:
FriendsOfBehat\SuiteSettingsExtension:
paths:
- "features"

SyliusLabs\SuiteTagsExtension: ~
39 changes: 26 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,35 @@
}
],
"require": {
"php": "^8.0",
"sylius/sylius": "~1.11.2 || ~1.12.0",
"sylius/sylius": "~1.12.0 || ~1.13.0",
"friendsofsymfony/jsrouting-bundle": "^3.2"
},
"require-dev": {
"behat/behat": "^3.6",
"behat/mink-selenium2-driver": "^1.4",
"dbrekelmans/bdi": "^1.1",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
"friends-of-behat/mink-browserkit-driver": "^1.3",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-debug-extension": "^2.0",
"friends-of-behat/mink-extension": "^2.5",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"friends-of-behat/mink-debug-extension": "^2.0",
"phpspec/phpspec": "^7.0",
"phpspec/phpspec": "^7.2",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^10.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"se/selenium-server-standalone": "^2.52",
"sylius-labs/coding-standard": "^4.0",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.15"
"robertfausk/behat-panther-extension": "^1.1",
"sylius-labs/coding-standard": "^4.2",
"sylius-labs/suite-tags-extension": "^0.2",
"symfony/debug-bundle": "^5.4 || ^6.4",
"symfony/dotenv": "^5.4 || ^6.4",
"symfony/runtime": "^5.4 || ^6.4",
"symfony/web-profiler-bundle": "^5.4 || ^6.4"
},
"prefer-stable": true,
"autoload": {
Expand All @@ -55,6 +56,12 @@
"Tests\\Sylius\\AdminOrderCreationPlugin\\": "tests/"
}
},
"autoload-dev": {
"psr-4": {
"spec\\Sylius\\AdminOrderCreationPlugin\\": "spec/"
},
"classmap": ["tests/Application/Kernel.php"]
},
"scripts": {
"analyse": [
"@composer validate --strict",
Expand All @@ -68,12 +75,18 @@
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": false,
"symfony/flex": true
"phpstan/extension-installer": false,
"symfony/flex": false,
"symfony/runtime": true
}
},
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
},
"runtime": {
"project_dir": "tests/Application",
"dotenv_path": "tests/Application/.env"
}
}
}
2 changes: 0 additions & 2 deletions easy-coding-standard.neon

This file was deleted.

2 changes: 0 additions & 2 deletions easy-coding-standard.yml

This file was deleted.

18 changes: 18 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $config): void {
$config->import('vendor/sylius-labs/coding-standard/ecs.php');

$config->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);
$config->skip([
'**/var/*',
'**/node_modules/*',
]);
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Feature: Being unable to create order when item prices are not defined for chann
Given the store operates on a channel named "Web-US" in "USD" currency
And the store operates on a channel named "Web-EC" in "USD" currency
And the store operates on a channel named "Web-PW" in "USD" currency
And the store has a product "Stark Coat" priced at "$100" available in channel "Web-US" and channel "Web-EC"
And the store has a product "Stark Coat" priced at "$100.00" available in channel "Web-US" and channel "Web-EC"
And the store ships everywhere for free
And the store allows paying with "Cash on Delivery"
And there is a customer account "jon.snow@the-wall.com"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Feature: Creating order with different billing address

Background:
Given the store operates on a single channel in "United States"
And the store has a product "Stark Coat" priced at "$100"
And the store has a product "Lannister Banner" priced at "$40"
And the store has a product "Stark Coat" priced at "$100.00"
And the store has a product "Lannister Banner" priced at "$40.00"
And the store ships everywhere for free
And the store allows paying with "Cash on Delivery"
And there is a customer account "jon.snow@the-wall.com"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Feature: Creating order with multiple items

Background:
Given the store operates on a single channel in "United States"
And the store has a product "Stark Coat" priced at "$100"
And the store has a product "Lannister Banner" priced at "$40"
And the store has a product "Greyjoy Boat" priced at "$1000"
And the store has a product "Targaryen Shield" priced at "$200"
And the store has a product "Stark Coat" priced at "$100.00"
And the store has a product "Lannister Banner" priced at "$40.00"
And the store has a product "Greyjoy Boat" priced at "$1,000.00"
And the store has a product "Targaryen Shield" priced at "$200.00"
And the store ships everywhere for free
And the store allows paying with "Cash on Delivery"
And there is a customer account "jon.snow@the-wall.com"
Expand Down
Loading

0 comments on commit 35c6a31

Please sign in to comment.