Skip to content

Commit 0d58a6b

Browse files
authored
Merge pull request #15 from SzymonKostrubiec/op-467
OP-467 - Add fix for Sylius 1.12
2 parents 02939d9 + d5ec8ac commit 0d58a6b

8 files changed

Lines changed: 136 additions & 50 deletions

File tree

.github/workflows/build.yml

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ on:
88
release:
99
types: [created]
1010
schedule:
11-
-
12-
cron: "0 1 * * 6" # Run at 1am every Saturday
11+
- cron: "0 1 * * 6" # Run at 1am every Saturday
1312
workflow_dispatch: ~
1413

1514
jobs:
@@ -21,12 +20,19 @@ jobs:
2120
strategy:
2221
fail-fast: false
2322
matrix:
24-
php: [ "8.1" ]
25-
symfony: [ "5.4.*", "^6.0" ]
26-
sylius: ["~1.12.0", "1.13.0"]
27-
node: [ "14.x" ]
23+
php: [ "8.0", "8.1", "8.2", "8.3" ]
24+
symfony: [ "^5.4", "^6.4" ]
25+
sylius: [ "^1.12", "^1.13" ]
26+
node: [ "18.x", "20.x" ]
2827
mysql: [ "8.0" ]
2928

29+
exclude:
30+
- sylius: ^1.13
31+
php: 8.0
32+
- sylius: ^1.12
33+
php: 8.0
34+
symfony: ^6.4
35+
3036
env:
3137
APP_ENV: test
3238
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}"
@@ -41,12 +47,12 @@ jobs:
4147
with:
4248
php-version: "${{ matrix.php }}"
4349
extensions: intl
44-
tools: flex,symfony
50+
tools: symfony
4551
coverage: none
4652

4753
-
4854
name: Setup Node
49-
uses: actions/setup-node@v3
55+
uses: actions/setup-node@v4
5056
with:
5157
node-version: "${{ matrix.node }}"
5258

@@ -80,29 +86,23 @@ jobs:
8086
-
8187
name: Get Composer cache directory
8288
id: composer-cache
83-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
89+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
8490

8591
-
8692
name: Cache Composer
87-
uses: actions/cache@v3
93+
uses: actions/cache@v4
8894
with:
8995
path: ${{ steps.composer-cache.outputs.dir }}
9096
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
9197
restore-keys: |
9298
${{ runner.os }}-php-${{ matrix.php }}-composer-
93-
94-
-
95-
name: Configure global composer
96-
run: |
97-
composer global config --no-plugins allow-plugins.symfony/flex true
98-
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.2.2"
99-
10099
-
101100
name: Restrict Symfony version
102101
if: matrix.symfony != ''
103102
run: |
103+
composer global config --no-plugins allow-plugins.symfony/flex true
104+
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
104105
composer config extra.symfony.require "${{ matrix.symfony }}"
105-
106106
-
107107
name: Restrict Sylius version
108108
if: matrix.sylius != ''
@@ -117,17 +117,16 @@ jobs:
117117
-
118118
name: Get Yarn cache directory
119119
id: yarn-cache
120-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
120+
run: echo "::set-output name=dir::$(yarn cache dir)"
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') }}
128128
restore-keys: |
129129
${{ runner.os }}-node-${{ matrix.node }}-yarn-
130-
131130
-
132131
name: Install JS dependencies
133132
run: (cd tests/Application && yarn install)
@@ -137,13 +136,11 @@ jobs:
137136
run: |
138137
(cd tests/Application && bin/console doctrine:database:create -vvv)
139138
(cd tests/Application && bin/console doctrine:schema:create -vvv)
140-
141139
-
142140
name: Prepare test application assets
143141
run: |
144142
(cd tests/Application && bin/console assets:install public -vvv)
145-
(cd tests/Application && yarn build:prod)
146-
143+
(cd tests/Application && yarn encore dev)
147144
-
148145
name: Prepare test application cache
149146
run: (cd tests/Application && bin/console cache:warmup -vvv)
@@ -154,26 +151,26 @@ jobs:
154151

155152
-
156153
name: Validate composer.json
157-
if: ${{ matrix.sylius != '1.13.0' }}
158154
run: composer validate --ansi --strict
159155

160156
-
161157
name: Validate database schema
162158
run: (cd tests/Application && bin/console doctrine:schema:validate)
163159

164-
- name: Run PHPStan
165-
run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/
166-
167-
- name: Run ECS
168-
run: vendor/bin/ecs check src
169-
170-
- name: Run PHPSpec
160+
-
161+
name: Run PHPSpec
171162
run: vendor/bin/phpspec run --ansi -f progress --no-interaction
172163

173-
- name: Load fixtures in test application
164+
-
165+
name: Run PHPUnit
166+
run: vendor/bin/phpunit --colors=always
167+
168+
-
169+
name: Load fixtures in test application
174170
run: (cd tests/Application && bin/console sylius:fixtures:load -n)
175-
176-
- name: Failed build Slack notification
171+
172+
-
173+
name: Failed build Slack notification
177174
uses: rtCamp/action-slack-notify@v2
178175
if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
179176
env:
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Coding standard
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'dependabot/**'
7+
pull_request: ~
8+
release:
9+
types: [ created ]
10+
workflow_dispatch: ~
11+
12+
jobs:
13+
tests:
14+
runs-on: ubuntu-latest
15+
16+
name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}"
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
php: [ "8.0", "8.1", "8.2", "8.3" ]
22+
symfony: [ "^5.4", "^6.4" ]
23+
sylius: [ "^1.12", "^1.13" ]
24+
node: [ "18.x", "20.x" ]
25+
26+
exclude:
27+
- sylius: ^1.13
28+
php: 8.0
29+
- sylius: ^1.12
30+
php: 8.0
31+
symfony: ^6.4
32+
33+
steps:
34+
- uses: actions/checkout@v3
35+
36+
- name: Setup PHP
37+
uses: shivammathur/setup-php@v2
38+
with:
39+
php-version: "${{ matrix.php }}"
40+
extensions: intl
41+
tools: symfony
42+
coverage: none
43+
44+
- name: Get Composer cache directory
45+
id: composer-cache
46+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
47+
48+
- name: Cache Composer
49+
uses: actions/cache@v4
50+
with:
51+
path: ${{ steps.composer-cache.outputs.dir }}
52+
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json', '**/composer.lock') }}
53+
restore-keys: |
54+
${{ runner.os }}-php-${{ matrix.php }}-composer-
55+
56+
- name: Restrict Symfony version
57+
if: matrix.symfony != ''
58+
run: |
59+
composer global config --no-plugins allow-plugins.symfony/flex true
60+
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
61+
composer config extra.symfony.require "${{ matrix.symfony }}"
62+
63+
- name: Restrict Sylius version
64+
if: matrix.sylius != ''
65+
run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction
66+
67+
- name: Install PHP dependencies
68+
run: composer install --no-interaction
69+
env:
70+
SYMFONY_REQUIRE: ${{ matrix.symfony }}
71+
72+
- name: Run PHPStan
73+
run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/
74+
75+
- name: Run ECS
76+
run: vendor/bin/ecs check src
77+
78+
- name: Failed build Slack notification
79+
uses: rtCamp/action-slack-notify@v2
80+
if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
81+
env:
82+
SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }}
83+
SLACK_COLOR: ${{ job.status }}
84+
SLACK_ICON: https://github.com/rtCamp.png?size=48
85+
SLACK_MESSAGE: ':x:'
86+
SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository
87+
SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }}
88+
SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }}

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
],
99
"license": "MIT",
1010
"require": {
11-
"php": "^8.1",
11+
"php": "^8.0",
1212
"doctrine/annotations": "^1.14",
13-
"sylius/sylius": ">=1.12.13 || ~1.13.0",
13+
"sylius/sylius": "~1.12.0 || ~1.13.0",
1414
"sylius/mailer-bundle": "^1.8 || ^2.0@beta",
1515
"symfony/webpack-encore-bundle": "^1.15"
1616
},
@@ -43,9 +43,10 @@
4343
"symfony/flex": "^2.2.2",
4444
"symfony/intl": "^5.4 || ^6.0",
4545
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
46-
"vimeo/psalm": "5.12.0"
46+
"vimeo/psalm": "4.27.0"
4747
},
4848
"conflict": {
49+
"behat/mink-selenium2-driver": ">=1.7.0",
4950
"symfony/framework-bundle": "6.2.8",
5051
"symfony/validator": "6.4.7"
5152
},

src/Action/CaptureAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class CaptureAction implements ActionInterface, ApiAwareInterface
2828
{
2929
use ApiAwareTrait;
3030

31-
public function __construct(private readonly SignatureResolverInterface $signatureResolver)
31+
public function __construct(private SignatureResolverInterface $signatureResolver)
3232
{
3333
$this->apiClass = ImojeApi::class;
3434
}

src/Action/NotifyAction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ final class NotifyAction implements ActionInterface, ApiAwareInterface
2828
private ?Request $request;
2929

3030
public function __construct(
31-
private readonly RequestStack $requestStack,
32-
private readonly SignatureResolverInterface $signatureResolver,
31+
private RequestStack $requestStack,
32+
private SignatureResolverInterface $signatureResolver,
3333
) {
3434
$this->request = $requestStack->getCurrentRequest();
3535
$this->apiClass = ImojeApi::class;

src/Api/ImojeApi.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
class ImojeApi implements ImojeApiInterface
1414
{
1515
public function __construct(
16-
private readonly string $environment,
17-
private readonly string $merchantId,
18-
private readonly string $serviceId,
19-
private readonly string $serviceKey,
20-
private readonly string $authorizationToken,
16+
private string $environment,
17+
private string $merchantId,
18+
private string $serviceId,
19+
private string $serviceKey,
20+
private string $authorizationToken,
2121
) {
2222
}
2323

src/Controller/NotifyController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
final class NotifyController
2323
{
2424
public function __construct(
25-
private readonly Payum $payum,
26-
private readonly PaymentTokenProviderInterface $paymentTokenProvider,
25+
private Payum $payum,
26+
private PaymentTokenProviderInterface $paymentTokenProvider,
2727
) {
2828
}
2929

src/Provider/PaymentTokenProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
final class PaymentTokenProvider implements PaymentTokenProviderInterface
2121
{
2222
public function __construct(
23-
private readonly RepositoryInterface $orderRepository,
24-
private readonly RepositoryInterface $paymentTokenRepository,
23+
private RepositoryInterface $orderRepository,
24+
private RepositoryInterface $paymentTokenRepository,
2525
) {
2626
}
2727

0 commit comments

Comments
 (0)