Skip to content

Commit

Permalink
Merge pull request #29 from FLUX-SE/update-tests
Browse files Browse the repository at this point in the history
Update tests for Symfony 6 and Sylius 1.12
  • Loading branch information
Prometee authored Dec 13, 2022
2 parents d598b3d + d0eb5bf commit d2000ac
Show file tree
Hide file tree
Showing 85 changed files with 677 additions and 960 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
-
package-ecosystem: composer
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 4
versioning-strategy: increase-if-necessary
92 changes: 46 additions & 46 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ on:
release:
types: [created]
schedule:
-
cron: "0 1 * * 6" # Run at 1am every Saturday
- cron: "0 1 * * 6" # Run at 1am every Saturday
workflow_dispatch: ~

jobs:
Expand All @@ -29,12 +28,12 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.0"]
symfony: ["^4.4", "^5.4"]
php: [ 8.0 ]
symfony: [ ^5.4, ^6.0 ]

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

-
name: Setup PHP
Expand All @@ -51,15 +50,15 @@ jobs:
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 global require --no-progress --no-scripts --no-plugins "symfony/flex"
-
name: Get Composer cache directory
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

-
name: Cache Composer
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -85,21 +84,26 @@ jobs:
-
name: Validate Yaml files
run: vendor/bin/yaml-lint src
if: always() && steps.end-of-setup.outcome == 'success' && matrix.symfony != '^4.4'
if: always() && steps.end-of-setup.outcome == 'success'

-
name: Run ECS
run: vendor/bin/ecs check src
if: always() && steps.end-of-setup.outcome == 'success' && matrix.symfony != '^4.4'
if: always() && steps.end-of-setup.outcome == 'success'

-
name: Run Psalm
run: vendor/bin/psalm --show-info=false --output-format=github --php-version=${{ matrix.php }}
run: vendor/bin/psalm --show-info=false --output-format=github
if: always() && steps.end-of-setup.outcome == 'success'

-
name: Run PHPStan
run: vendor/bin/phpstan analyse -l max src
run: vendor/bin/phpstan analyse
if: always() && steps.end-of-setup.outcome == 'success'

-
name: Run PHPSpec
run: vendor/bin/phpspec run --ansi -f progress --no-interaction
if: always() && steps.end-of-setup.outcome == 'success'
tests:
runs-on: ubuntu-latest
Expand All @@ -110,27 +114,21 @@ jobs:
fail-fast: false
matrix:
php: [7.3, 7.4, 8.0]
symfony: [^4.4, ^5.4]
sylius: [~1.8.0, ~1.9.0, ~1.10.0, ~1.11.0]
node: [12.x]
symfony: [^5.4, ^6.0]
sylius: [~1.9.0, ~1.10.0, ~1.11.0, ~1.12.0]
node: [18.x]
mysql: [5.7]

exclude:
-
sylius: ~1.8.0
symfony: ^5.4
-
sylius: ~1.8.0
php: 8.0
-
sylius: ~1.9.0
php: 8.0
-
sylius: ~1.10.0
php: 7.3
-
sylius: ~1.10.0 # issue with a missing service declaration : Service "api_platform.error_listener": Parent definition "exception_listener" does not exist.
symfony: ^4.4
sylius: ~1.10.0
symfony: ^6.0
-
sylius: ~1.11.0
php: 7.3
Expand All @@ -139,15 +137,27 @@ jobs:
php: 7.4
-
sylius: ~1.11.0
symfony: ^4.4
symfony: ^6.0
-
sylius: ~1.12.0
php: 7.3
-
sylius: ~1.12.0
php: 7.4
-
php: 7.3
symfony: ^6.0
-
php: 7.4
symfony: ^6.0

env:
APP_ENV: test
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"

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

-
name: Setup PHP
Expand All @@ -160,7 +170,7 @@ jobs:

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

Expand All @@ -183,22 +193,22 @@ 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='*' https://127.0.0.1 > /dev/null 2>&1 &

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

-
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-features=Translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 https://127.0.0.1 > /dev/null 2>&1 &

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

-
name: Cache Composer
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
Expand All @@ -210,23 +220,13 @@ jobs:
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 global require --no-progress --no-scripts --no-plugins "symfony/flex"
-
name: Restrict Sylius version
if: matrix.sylius != ''
run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction

-
name: Fix build on Sylius 1.8
if: matrix.sylius == '~1.8.0'
run: |
composer require "friendsofsymfony/oauth-server-bundle:^1.6 || >2.0.0-alpha.0 ^2.0@dev" --no-update --no-scripts --no-interaction
# Sylius issues on `json_array` type not existing
composer require "doctrine/dbal:^2.6" --no-update --no-scripts --no-interaction
# Not added into Sylius 1.8 but available in 1.9
composer require "liip/imagine-bundle:<2.6" --no-update --no-scripts --no-interaction
-
name: Fix build on Sylius 1.9
if: matrix.sylius == '~1.9.0'
Expand All @@ -244,11 +244,11 @@ jobs:
-
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@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
Expand Down Expand Up @@ -288,7 +288,7 @@ jobs:

-
name: Upload Behat logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: Behat logs
Expand Down
63 changes: 34 additions & 29 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,33 @@
},
"require-dev": {
"ext-json": "*",
"behat/behat": "^3.7",
"behat/mink": "^1.8",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
"behat/behat": "^3.7",
"behat/mink": "^1.9",
"dmore/behat-chrome-extension": "^1.4",
"dmore/chrome-mink-driver": "^2.8",
"friends-of-behat/mink": "^1.9",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-debug-extension": "^2.0",
"friends-of-behat/mink-extension": "^2.4",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-doctrine": "^0.12.33",
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan-doctrine": "^1",
"phpstan/phpstan-strict-rules": "^1",
"phpstan/phpstan-webmozart-assert": "^1",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sylius-labs/coding-standard": "^4.0",
"symfony/browser-kit": "^4.4 || ^5.4",
"symfony/debug-bundle": "^4.4 || ^5.4",
"symfony/dotenv": "^4.4 || ^5.4",
"symfony/intl": "^4.4 || ^5.4",
"symfony/web-profiler-bundle": "^4.4 || ^5.4",
"vimeo/psalm": "^4.6.4"
"symfony/browser-kit": "^5.4|^6.0",
"symfony/debug-bundle": "^5.4|^6.0",
"symfony/dotenv": "^5.4|^6.0",
"symfony/intl": "^5.4|^6.0",
"symfony/runtime": "^5.4|^6.0",
"symfony/web-profiler-bundle": "^5.4|^6.0",
"symfony/webpack-encore-bundle": "^1.16",
"vimeo/psalm": "^4|^5"
},
"autoload": {
"psr-4": { "FluxSE\\SyliusPayumMoneticoPlugin\\": "src/" }
Expand All @@ -51,20 +53,6 @@
"Tests\\FluxSE\\SyliusPayumMoneticoPlugin\\App\\": "tests/Application/src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": false,
"phpstan/extension-installer": true,
"symfony/flex": true,
"symfony/thanks": true
}
},
"scripts": {
"post-install-cmd": [
"@php bin/create_node_symlink.php"
Expand All @@ -75,5 +63,22 @@
"post-create-project-cmd": [
"@php bin/create_node_symlink.php"
]
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true,
"symfony/thanks": true,
"symfony/runtime": true
}
},
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
},
"runtime": {
"project_dir": "tests/Application",
"dotenv_path": "tests/Application/.env"
}
}
}
6 changes: 3 additions & 3 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
use PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

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

$services = $config->services();
$services = $ecsConfig->services();

// PHP 7 compatibility
$services
Expand Down
2 changes: 1 addition & 1 deletion features/shop/paying_with_monetico_during_checkout.feature
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ Feature: Paying with Monetico during checkout
And I retry my payment attempt and succeed
When I get back from the Monetico portal
Then I should be notified that my payment has been completed
And I should see the thank you page
And I should see the thank you page
1 change: 0 additions & 1 deletion node_modules

This file was deleted.

20 changes: 15 additions & 5 deletions phpstan.neon → phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@ parameters:
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false

excludes_analyse:
level: max

paths:
- src
- tests

excludePaths:
# Makes PHPStan crash
- 'src/DependencyInjection/Configuration.php'
- src/DependencyInjection/Configuration.php

# Test dependencies
- 'tests/Application/app/**.php'
- 'tests/Application/src/**.php'
- tests/Application/Kernel.php
- tests/Application/public/index.php
- tests/Application/config/**.php
- tests/Application/var/**.php
- tests/Application/node_modules/**.php

ignoreErrors:
- message: '/Method Tests\\FluxSE\\SyliusPayumMoneticoPlugin\\Behat\\Page\\External\\MoneticoCheckoutPage::__construct\(\) has parameter \$minkParameters with generic interface ArrayAccess but does not specify its types: TKey, TValue/'
path: tests/Behat/Page/External/MoneticoCheckoutPage.php
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./'
- '/Parameter #1 \$request \(Payum\\Core\\Request\\Cancel\) of method FluxSE\\SyliusPayumMoneticoPlugin\\Action\\CancelAction::execute\(\) should be contravariant with parameter \$request \(mixed\) of method Payum\\Core\\Action\\ActionInterface::execute\(\)/'
- '/Parameter #1 \$request \(Payum\\Core\\Request\\Convert\) of method FluxSE\\SyliusPayumMoneticoPlugin\\Action\\ConvertPaymentAction::execute\(\) should be contravariant with parameter \$request \(mixed\) of method Payum\\Core\\Action\\ActionInterface::execute\(\)/'
Expand Down
Loading

0 comments on commit d2000ac

Please sign in to comment.