Skip to content

Commit ec7d20b

Browse files
authored
Support Sylius 1.13 + 1.14 & Symfony 5.4 + 6.4 (#53)
* Allow Symfony 6 * Allow Symfony 4.4/5.4/6.0 and Sylius 1.11/1.12 * Remove tests/Application from build as there is no one * Fix the build * Allow Sylius 1.13 & 1.14 and Symfony 5.4 & 6.4 * CS fixes
1 parent 410f783 commit ec7d20b

10 files changed

+53
-141
lines changed

.github/workflows/build.yml

+13-53
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,25 @@ env:
1717

1818
jobs:
1919
tests:
20-
runs-on: ubuntu-18.04
20+
runs-on: ubuntu-latest
2121

22-
name: "PHP ${{ matrix.php }}, MySQL ${{ matrix.mysql }}"
22+
name: "PHP ${{ matrix.php }}, MySQL ${{ matrix.mysql }}, Sylius ${{ matrix.sylius }}"
2323

2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
php: [7.4, 7.3]
27+
php: [8.1, 8.2, 8.3]
2828
node: [10.x]
2929
mysql: [5.7, 8.0]
30-
31-
exclude:
32-
- # PHP 7.3 does not support "caching_sha2_password" authentication plugin which is a default one in MySQL 8.0
33-
php: 7.3
34-
mysql: 8.0
30+
sylius: [1.13.*, 1.14.*]
3531

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

4036
steps:
4137
-
42-
uses: actions/checkout@v2
38+
uses: actions/checkout@v4
4339

4440
-
4541
name: Setup PHP
@@ -52,7 +48,7 @@ jobs:
5248

5349
-
5450
name: Setup Node
55-
uses: actions/setup-node@v1
51+
uses: actions/setup-node@v4
5652
with:
5753
node-version: "${{ matrix.node }}"
5854

@@ -79,24 +75,24 @@ jobs:
7975
name: Run Chrome Headless
8076
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 &
8177

82-
-
83-
name: Run webserver
84-
run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon)
85-
8678
-
8779
name: Get Composer cache directory
8880
id: composer-cache
8981
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
9082

9183
-
9284
name: Cache Composer
93-
uses: actions/cache@v2
85+
uses: actions/cache@v4
9486
with:
9587
path: ${{ steps.composer-cache.outputs.dir }}
9688
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
9789
restore-keys: |
9890
${{ runner.os }}-php-${{ matrix.php }}-composer-
9991
92+
-
93+
name: Require Sylius version
94+
run: composer require sylius/sylius:"${{ matrix.sylius }}" --no-update
95+
10096
-
10197
name: Install PHP dependencies
10298
run: composer install --no-interaction
@@ -108,57 +104,21 @@ jobs:
108104

109105
-
110106
name: Cache Yarn
111-
uses: actions/cache@v2
107+
uses: actions/cache@v4
112108
with:
113109
path: ${{ steps.yarn-cache.outputs.dir }}
114110
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
115111
restore-keys: |
116112
${{ runner.os }}-node-${{ matrix.node }}-yarn-
117113
118-
-
119-
name: Install JS dependencies
120-
run: (cd tests/Application && yarn install)
121-
122-
-
123-
name: Prepare test application database
124-
run: |
125-
(cd tests/Application && bin/console doctrine:database:create -vvv)
126-
(cd tests/Application && bin/console doctrine:schema:create -vvv)
127-
128-
-
129-
name: Prepare test application assets
130-
run: |
131-
(cd tests/Application && bin/console assets:install public -vvv)
132-
(cd tests/Application && yarn build)
133-
134-
-
135-
name: Prepare test application cache
136-
run: (cd tests/Application && bin/console cache:warmup -vvv)
137-
138-
-
139-
name: Load fixtures in test application
140-
run: (cd tests/Application && bin/console sylius:fixtures:load -n)
141-
142114
-
143115
name: Validate composer.json
144116
run: composer validate --ansi --strict
145117

146118
-
147-
name: Validate database schema
148-
run: (cd tests/Application && bin/console doctrine:schema:validate)
149-
150-
-
151-
name: Run php-cs-fixer
119+
name: Run php-cs-fixer
152120
run: vendor/bin/php-cs-fixer fix --verbose --diff --dry-run
153121

154122
-
155123
name: Run PHPStan
156124
run: vendor/bin/phpstan analyse -c phpstan.neon -l max src/
157-
158-
-
159-
name: Run PHPSpec
160-
run: vendor/bin/phpspec run --ansi -f progress --no-interaction
161-
162-
-
163-
name: Run PHPUnit
164-
run: vendor/bin/phpunit --colors=always

.github/workflows/test-application.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
include:
22-
- php-version: '7.4'
22+
- php-version: '8.2'
2323
dependency-versions: 'highest'
2424
php-extensions: 'ctype, iconv, mysql, imagick'
2525
tools: 'composer:v2'
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Checkout project
41-
uses: actions/checkout@v2
41+
uses: actions/checkout@v4
4242

4343
- name: Install and configure PHP
4444
uses: shivammathur/setup-php@v2
@@ -49,7 +49,7 @@ jobs:
4949
coverage: none
5050

5151
- name: Install composer dependencies
52-
uses: ramsey/composer-install@v1
52+
uses: ramsey/composer-install@v3
5353
with:
5454
dependency-versions: ${{matrix.dependency-versions}}
5555

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
.idea
1515

1616
.php_cs.cache
17+
.php-cs-fixer.cache

composer.json

+17-16
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,30 @@
55
"description": "Producer for synchronization products with sulu.",
66
"license": "MIT",
77
"require": {
8-
"php": "^7.3|^8.0",
8+
"php": "^8.1",
99

10-
"sylius/sylius": "^1.8",
11-
"symfony/messenger": "^4.4|^5.0",
12-
"symfony/config": "^4.4|^5.0",
13-
"symfony/dependency-injection": "^4.4|^5.0",
14-
"symfony/http-kernel": "^4.4|^5.0",
15-
"symfony/serializer": "^4.4|^5.0"
10+
"sylius/sylius": "1.13.* || 1.14.*",
11+
"symfony/messenger": "^5.4 || ^6.4",
12+
"symfony/config": "^5.4 || ^6.4",
13+
"symfony/dependency-injection": "^5.4 || ^6.4",
14+
"symfony/http-kernel": "^5.4 || ^6.4",
15+
"symfony/serializer": "^5.4 || ^6.4"
1616
},
1717
"require-dev": {
18-
"friendsofphp/php-cs-fixer": "^2.15",
18+
"friendsofphp/php-cs-fixer": "^2.15 || ^3.0",
1919
"phpstan/phpstan": "^1.0",
2020
"phpstan/phpstan-doctrine": "^1.0",
2121
"phpstan/phpstan-phpunit": "^1.0",
2222
"phpstan/phpstan-symfony": "^1.0",
2323
"phpstan/phpstan-webmozart-assert": "^1.0",
2424
"jangregor/phpstan-prophecy": "^1.0",
2525
"thecodingmachine/phpstan-strict-rules": "^1.0",
26-
"phpunit/phpunit": "^8.2",
27-
"symfony/browser-kit": "^4.4 || ^5.0",
28-
"symfony/dotenv": "^4.4 || ^5.0",
26+
"phpunit/phpunit": "^9.5",
27+
"symfony/browser-kit": "^5.4 || ^6.4",
28+
"symfony/dotenv": "^5.4 || ^6.4",
2929
"phpstan/extension-installer": "^1.0",
30-
"sensiolabs/security-checker": "^6.0",
31-
"symfony/intl": "^4.4 || ^5.0",
32-
"symfony/web-profiler-bundle": "^4.4 || ^5.0",
33-
"symfony/web-server-bundle": "^4.4 || ^5.0"
30+
"symfony/intl": "^5.4 || ^6.4",
31+
"symfony/web-profiler-bundle": "^5.4 || ^6.4"
3432
},
3533
"autoload": {
3634
"psr-4": {
@@ -40,7 +38,10 @@
4038
}
4139
},
4240
"config": {
43-
"sort-packages": true
41+
"sort-packages": true,
42+
"allow-plugins": {
43+
"phpstan/extension-installer": false
44+
}
4445
},
4546
"scripts": {
4647
"post-install-cmd": [

phpstan.neon

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ parameters:
55
parallel:
66
processTimeout: 300.0
77
reportUnmatchedIgnoredErrors: false
8-
checkMissingIterableValueType: false
98

109
excludePaths:
1110
- %currentWorkingDirectory%/DependencyInjection/Configuration.php
@@ -14,3 +13,8 @@ parameters:
1413

1514
ignoreErrors:
1615
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./'
16+
- '/Call to an undefined method Sylius\\Component\\User\\Model\\UserInterface\:\:isAccountNonExpired\(\)\./'
17+
- '/Call to an undefined method Sylius\\Component\\User\\Model\\UserInterface\:\:isAccountNonLocked\(\)\./'
18+
- '/Call to an undefined method Sylius\\Component\\User\\Model\\UserInterface\:\:isCredentialsNonExpired\(\)\./'
19+
-
20+
identifier: missingType.iterableValue

src/Command/BaseSynchronizeCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
abstract class BaseSynchronizeCommand extends Command
2222
{
23-
const BULK_SIZE = 50;
23+
public const BULK_SIZE = 50;
2424

2525
/**
2626
* @var EntityManagerInterface

src/Command/SynchronizeProductVariantsCommand.php

+4-22
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,13 @@
2323

2424
class SynchronizeProductVariantsCommand extends BaseSynchronizeCommand
2525
{
26-
/**
27-
* @var EntityManagerInterface
28-
*/
29-
private $entityManager;
30-
31-
/**
32-
* @var ProductVariantMessageProducerInterface
33-
*/
34-
private $productVariantMessageProducer;
35-
36-
/**
37-
* @var ProductVariantRepositoryInterface
38-
*/
39-
private $productVariantRepository;
40-
26+
/** @param ProductVariantRepositoryInterface<ProductVariantInterface> $productVariantRepository */
4127
public function __construct(
42-
EntityManagerInterface $entityManager,
43-
ProductVariantMessageProducerInterface $productVariantMessageProducer,
44-
ProductVariantRepositoryInterface $productVariantRepository
28+
private EntityManagerInterface $entityManager,
29+
private ProductVariantMessageProducerInterface $productVariantMessageProducer,
30+
private ProductVariantRepositoryInterface $productVariantRepository,
4531
) {
4632
parent::__construct($entityManager);
47-
48-
$this->entityManager = $entityManager;
49-
$this->productVariantMessageProducer = $productVariantMessageProducer;
50-
$this->productVariantRepository = $productVariantRepository;
5133
}
5234

5335
protected function configure(): void

src/Command/SynchronizeProductsCommand.php

+4-22
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,13 @@
2323

2424
class SynchronizeProductsCommand extends BaseSynchronizeCommand
2525
{
26-
/**
27-
* @var EntityManagerInterface
28-
*/
29-
private $entityManager;
30-
31-
/**
32-
* @var ProductMessageProducerInterface
33-
*/
34-
private $productMessageProducer;
35-
36-
/**
37-
* @var ProductRepositoryInterface
38-
*/
39-
private $productRepository;
40-
26+
/** @param ProductRepositoryInterface<ProductInterface> $productRepository */
4127
public function __construct(
42-
EntityManagerInterface $entityManager,
43-
ProductMessageProducerInterface $productMessageProducer,
44-
ProductRepositoryInterface $productRepository
28+
private EntityManagerInterface $entityManager,
29+
private ProductMessageProducerInterface $productMessageProducer,
30+
private ProductRepositoryInterface $productRepository,
4531
) {
4632
parent::__construct($entityManager);
47-
48-
$this->entityManager = $entityManager;
49-
$this->productMessageProducer = $productMessageProducer;
50-
$this->productRepository = $productRepository;
5133
}
5234

5335
protected function configure(): void

src/Command/SynchronizeTaxonCommand.php

+4-22
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,13 @@
2222

2323
class SynchronizeTaxonCommand extends BaseSynchronizeCommand
2424
{
25-
/**
26-
* @var EntityManagerInterface
27-
*/
28-
private $entityManager;
29-
30-
/**
31-
* @var TaxonMessageProducerInterface
32-
*/
33-
private $taxonMessageProducer;
34-
35-
/**
36-
* @var TaxonRepositoryInterface
37-
*/
38-
private $taxonRepository;
39-
25+
/** @param TaxonRepositoryInterface<TaxonInterface> $taxonRepository */
4026
public function __construct(
41-
EntityManagerInterface $entityManager,
42-
TaxonMessageProducerInterface $taxonMessageProducer,
43-
TaxonRepositoryInterface $taxonRepository
27+
private EntityManagerInterface $entityManager,
28+
private TaxonMessageProducerInterface $taxonMessageProducer,
29+
private TaxonRepositoryInterface $taxonRepository,
4430
) {
4531
parent::__construct($entityManager);
46-
47-
$this->entityManager = $entityManager;
48-
$this->taxonMessageProducer = $taxonMessageProducer;
49-
$this->taxonRepository = $taxonRepository;
5032
}
5133

5234
protected function configure(): void

src/Producer/ProductMessageProducer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ProductMessageProducer implements ProductMessageProducerInterface
3333

3434
public function __construct(
3535
ProductSerializerInterface $productSerializer,
36-
MessageBusInterface $messageBus
36+
MessageBusInterface $messageBus,
3737
) {
3838
$this->productSerializer = $productSerializer;
3939
$this->messageBus = $messageBus;

0 commit comments

Comments
 (0)