Skip to content

Commit

Permalink
Updating to Sylius 1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
mamazu committed Apr 16, 2024
1 parent 8983bd2 commit c71fa19
Show file tree
Hide file tree
Showing 25 changed files with 164 additions and 212 deletions.
68 changes: 27 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,39 @@ on:

jobs:
tests:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

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

strategy:
fail-fast: false
matrix:
php: ["7.4", "8.0"]
symfony: ["^5.4", "^6.0"]
sylius: ["~1.9.0", "~1.10.0", "~1.11.0", "~1.12.0"]
node: ["14.x"]
mysql: ["8.0"]

exclude:
-
php: "8.0"
sylius: "~1.9.0"
-
php: "7.4"
sylius: "~1.11.0"
-
symfony: "^6.0"
sylius: "~1.9.0"
-
symfony: "^6.0"
sylius: "~1.10.0"
-
symfony: "^6.0"
sylius: "~1.11.0"
-
php: "7.4"
sylius: "~1.12.0"
php: ["8.0", "8.1"]
symfony: ["5.4.*", "^6.0"]
sylius: ["^1.12"]
node: ["14.x", "16.x", "18.x"]
mysql: ["5.7", "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
tools: symfony
tools: flex,symfony
coverage: none

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

Expand Down Expand Up @@ -100,23 +80,27 @@ jobs:
-
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@v3
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: Configure global composer
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.2.2"
-
name: Restrict Symfony version
if: matrix.symfony != ''
run: |
composer global config --no-plugins allow-plugins.symfony/flex false
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
composer config extra.symfony.require "${{ matrix.symfony }}"
-
Expand All @@ -127,19 +111,17 @@ jobs:
-
name: Install PHP dependencies
run: composer install --no-interaction

env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}

-
name: Validate documentation
run: vendor/bin/doc-parser docs/**.md
-
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 All @@ -160,7 +142,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 @@ -186,6 +168,10 @@ jobs:
name: Run Psalm
run: vendor/bin/psalm

-
name: Run PHPSpec
run: vendor/bin/phpspec run --ansi -f progress --no-interaction

-
name: Run PHPUnit
run: vendor/bin/phpunit --colors=always
Expand All @@ -196,7 +182,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
Expand Up @@ -11,3 +11,8 @@
/behat.yml
/phpspec.yml
/phpunit.xml
.phpunit.result.cache

# Symfony CLI https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project
/.php-version
/php.ini
61 changes: 41 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
"name": "brille24/sylius-customer-options-plugin",
"type": "sylius-plugin",
"description": "Adds product customizing to Sylius",
"keywords": [
"sylius",
"sylius-plugin"
],
"license": "MIT",
"require": {
"php": ">=8.0",
"sylius/sylius": "^1.10"
"php": "^8.0",
"sylius/sylius": "^1.12",
"sylius/mailer-bundle": "^1.8 || ^2.0@beta",
"symfony/webpack-encore-bundle": "^1.15"
},
"require-dev": {
"behat/behat": "^3.6.1",
Expand All @@ -20,24 +26,22 @@
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"friendsofsymfony/oauth-server-bundle": ">2.0.0-alpha.0 ^2.0@dev",
"mamazu/documentation-validator": "dev-master",
"phpstan/phpstan": "^1.5.4",
"phpstan/phpstan-doctrine": "^1.3.2",
"phpstan/phpstan-strict-rules": "^1.5",
"phpstan/phpstan-symfony": "^1.3",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpspec/phpspec": "^7.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.8.1",
"phpstan/phpstan-doctrine": "1.3.40",
"phpstan/phpstan-strict-rules": "^1.3.0",
"phpstan/phpstan-webmozart-assert": "^1.2.0",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^4.0",
"sylius-labs/coding-standard": "^4.2",
"symfony/browser-kit": "^5.4 || ^6.0",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/flex": "^2.2.2",
"symfony/intl": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.15",
"vimeo/psalm": "4.7.1"
"vimeo/psalm": "5.12.0"
},
"prefer-stable": true,
"autoload": {
Expand All @@ -46,27 +50,39 @@
"Tests\\Brille24\\SyliusCustomerOptionsPlugin\\": "tests/"
}
},
"autoload-dev": {
"classmap": ["tests/Application/Kernel.php"]
"conflict": {
"symfony/framework-bundle": "6.2.8"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": false,
"phpstan/extension-installer": true,
"symfony/flex": true,
"symfony/thanks": true
"symfony/flex": true
}
},
"extra": {
"branch-alias": {
"dev-master": "1.12-dev"
},
"symfony": {
"require": "^5.4 || ^6.0"
}
},
"autoload-dev": {
"classmap": [
"tests/Application/Kernel.php"
]
},
"scripts": {
"post-install-cmd": [
"@php bin/create_node_symlink.php"
"php bin/create_node_symlink.php"
],
"post-update-cmd": [
"@php bin/create_node_symlink.php"
"php bin/create_node_symlink.php"
],
"post-create-project-cmd": [
"@php bin/create_node_symlink.php"
"php bin/create_node_symlink.php"
],
"analyse": [
"vendor/bin/ecs check --ansi --no-progress-bar src/ tests/PHPUnit --config etc/coding-standard.php",
Expand All @@ -75,5 +91,10 @@
"fix": [
"vendor/bin/ecs check --ansi --no-progress-bar src/ tests/PHPUnit --config etc/coding-standard.php --fix"
]
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd",
"security-checker security:check": "script"
}
}
}
9 changes: 8 additions & 1 deletion ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@

declare(strict_types=1);

use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return function (ECSConfig $ecsConfig): void {
return static function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests/Behat',
__DIR__ . '/tests/PHPUnit',
__DIR__ . '/ecs.php',
]);

$ecsConfig->import('vendor/sylius-labs/coding-standard/ecs.php');

$ecsConfig->skip([
VisibilityRequiredFixer::class => ['*Spec.php'],
]);
};

15 changes: 6 additions & 9 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
parameters:
level: max
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
paths:
- src
- tests/Behat

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

Expand All @@ -18,9 +20,4 @@ parameters:
- 'tests/Application/src/**.php'

ignoreErrors:
- '/Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface::dispatch/'
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given./'
- '/Cannot call method arrayNode\(\) on Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface\|null./'
- '/Method Brille24\\SyliusCustomerOptionsPlugin\\Entity\\CustomerOptions\\Validator\\Condition\:\:isMet\(\) has parameter \$value with no typehint specified\./'
- '/Access to an undefined property Faker\\UniqueGenerator\:\:\$word\./'
- '/Unreachable statement \- code above always terminates\./'
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./'
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
final class Configuration implements ConfigurationInterface
{
/**
* @inheritdoc
* @psalm-suppress UnusedVariable
*/
public function getConfigTreeBuilder(): TreeBuilder
{
Expand Down
21 changes: 9 additions & 12 deletions tests/Application/.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ APP_SECRET=EDITME
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
DATABASE_URL=mysql://root@127.0.0.1/sylius_%kernel.environment%?serverVersion=5.7
DATABASE_URL=mysql://root@127.0.0.1/acme_sylius_example_plugin_%kernel.environment%?serverVersion=5.7
###< doctrine/doctrine-bundle ###

###> lexik/jwt-authentication-bundle ###
Expand All @@ -21,16 +21,13 @@ JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=acme_plugin_development
###< lexik/jwt-authentication-bundle ###

###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=smtp://localhost
###< symfony/swiftmailer-bundle ###
###> symfony/mailer ###
MAILER_DSN=null://null
###< symfony/mailer ###

###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
MESSENGER_TRANSPORT_DSN=sync://
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
###< symfony/messenger ###
SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN=doctrine://default
SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=doctrine://default?queue_name=main_failed
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=doctrine://default?queue_name=catalog_promotion_removal
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=doctrine://default?queue_name=catalog_promotion_removal_failed
###< symfony/messenger ###
8 changes: 8 additions & 0 deletions tests/Application/.env.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
APP_SECRET='ch4mb3r0f5ecr3ts'

KERNEL_CLASS='Tests\Brille24\SyliusCustomerOptionsPlugin\Application\Kernel'

###> symfony/messenger ###
# Sync transport turned for testing env for the ease of testing
SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN=sync://
SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=sync://
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=sync://
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=sync://
###< symfony/messenger ###
Loading

0 comments on commit c71fa19

Please sign in to comment.