Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SYL-3329 Add support for Sylius 1.13 #287

Merged
merged 32 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6076771
[Composer] Remove Psalm
Rafikooo Jan 18, 2024
12ecb57
[Psalm] Remove configuration file
Rafikooo Jan 18, 2024
2e5bff9
[Psalm] Remove outdated annotations
Rafikooo Jan 18, 2024
8f63d74
minor #283 Bye Psalm 👋 (Rafikooo)
NoResponseMate Jan 18, 2024
e068f7c
fix cancel payment
oallain Jan 27, 2023
65c1dca
bug #273 [Payment] fix cancel payment (oallain)
GSadee Jan 18, 2024
7347d95
[Conflict] Add conflict with behat/mink-selenium2-driver:>=1.7.0
Rafikooo Feb 8, 2024
bea2505
[CI] Bump version of symfony/flex to ^2.4
Rafikooo Feb 12, 2024
9ab11fd
bug #285 Conflict `behat/mink-selenium2-driver:>=1.7.0` && Bump versi…
GSadee Feb 15, 2024
a8265ab
Fix 1.13
leszczuu Mar 14, 2024
b80121a
Update composer.json, add ecs check
mpysiak Mar 19, 2024
b538220
Limit builds
mpysiak Mar 19, 2024
7e3a348
Add support for node 20
mpysiak Mar 19, 2024
63566c1
Add state machine config, add migrations for postgresql
mpysiak Mar 20, 2024
9eadb53
Remove conflict
mpysiak Mar 26, 2024
5296209
Change build
mpysiak Mar 26, 2024
1627d0b
Fixes after code review
mpysiak Mar 26, 2024
e905c9f
Fix Spec
mpysiak Mar 27, 2024
793091f
Merge branch 'master' into fix/1.13
mpysiak Mar 27, 2024
0065fc5
Fixes after testing 'Enable' method
leszczuu Mar 27, 2024
eebcada
Fix BC changes
mpysiak Mar 27, 2024
d03ea1d
Merge remote-tracking branch 'leszczuu/fix/1.13' into fix/1.13
mpysiak Mar 27, 2024
47f7eaa
Fix BC changes
mpysiak Mar 27, 2024
fed5c61
Remove old services
mpysiak Mar 27, 2024
563fdd2
Fixes after CR
mpysiak Mar 28, 2024
773bc07
Fixes
mpysiak Mar 29, 2024
b183882
More fixes after CR
mpysiak Apr 2, 2024
816a068
Fixes after code review
mpysiak Apr 3, 2024
553b05a
Add specs
mpysiak Apr 4, 2024
68f8f73
Fix phpstan
mpysiak Apr 4, 2024
fb93f1d
Fix ecs
mpysiak Apr 5, 2024
d1ba389
Fix readme Sylius logo
mpysiak Apr 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 37 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,38 @@ jobs:
tests:
runs-on: ubuntu-latest

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

strategy:
fail-fast: false
matrix:
php: ["8.0", "8.1"]
node: ["16.x"]
mysql: ["5.7", "8.0"]
symfony: ["^5.4", "^6.0"]
sylius: ["~1.12.0"]
php: ["8.1", "8.2"]
node: ["20.x"]
mysql: ["8.0"]
symfony: ["^5.4.21", "^6.4"]
sylius: ["~1.12.0", "~1.13.x-dev"]
state_machine_adapter: ["winzou_state_machine", "symfony_workflow"]

include:
- php: "8.3"
node: "20.x"
mysql: "8.0"
symfony: "^6.4"
sylius: "~1.13.x-dev"
state_machine_adapter: "symfony_workflow"

exclude:
- sylius: "~1.12.0"
state_machine_adapter: "symfony_workflow"

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

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

-
name: Setup PHP
Expand All @@ -43,7 +58,7 @@ jobs:

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

Expand All @@ -69,11 +84,11 @@ 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@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
Expand All @@ -85,7 +100,7 @@ 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.18.5"
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.4"
composer config --no-plugins allow-plugins.symfony/thanks true
composer config extra.symfony.require "${{ matrix.symfony }}"

Expand All @@ -101,11 +116,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@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
Expand Down Expand Up @@ -147,12 +162,21 @@ jobs:
name: Load fixtures in test application
run: (cd tests/Application && bin/console sylius:fixtures:load -n)

-
name: Run security check
run: symfony security:check

-
name: Run ECS
run: vendor/bin/ecs check

-
name: Validate composer.json
run: composer validate --ansi --strict

-
name: Run analysis
if: ${{ matrix.sylius != '1.13.x-dev' }}
run: composer analyse

-
Expand Down
10 changes: 10 additions & 0 deletions CONFLICTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# CONFLICTS

This document explains why certain conflicts were added to `composer.json` and
references related issues.

- `behat/mink-selenium2-driver:>=1.7.0`:

This version adds strict type to the `Behat\Mink\Driver\Selenium2Driver::visit($url)` method
which causes a fatal error because the method signature is no longer compatible with the parent class:
`PHP Fatal error: Declaration of Behat\Mink\Driver\Selenium2Driver::visit(string $url) must be compatible with Behat\Mink\Driver\CoreDriver::visit($url) in /home/runner/work/Sylius-Standard/Sylius-Standard/vendor/behat/mink-selenium2-driver/src/Selenium2Driver.php on line 401`
5 changes: 5 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### UPGRADE FROM 1.5.1 to 1.6
mpysiak marked this conversation as resolved.
Show resolved Hide resolved

1. Support for Sylius 1.13 has been added, it is now the recommended Sylius version to use.
2. Support for PHP 8.0 has been dropped.

### UPGRADE FROM 1.3.0 to 1.3.1

1. `sylius_paypal_plugin_pay_with_paypal_form` route now operates on both payment ID and order token. URl then changed from
Expand Down
41 changes: 26 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
"description": "PayPal plugin for Sylius.",
"license": "MIT",
"require": {
"php": "^8.0",
"php": "^8.1",
"doctrine/doctrine-migrations-bundle": "^3.0",
"php-http/discovery": "^1.17",
"phpseclib/phpseclib": "^2.0",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"psr/http-client": "^1.0",
"psr/http-client-implementation": "~1.0",
"psr/http-factory-implementation": "~1.0",
"sylius-labs/doctrine-migrations-extra-bundle": "^0.1.4 || ^0.2",
"sylius/sylius": "~1.12.0",
"symfony/mailer": "^5.4 || ^6.0"
"sylius/sylius": "~1.12.0 || ~1.13.x-dev",
"symfony/mailer": "^5.4.21 || ^6.4"
},
"require-dev": {
"behat/behat": "^3.6.1",
Expand All @@ -27,20 +30,22 @@
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"lchrusciel/api-test-case": "^5.1",
"nyholm/psr7": "^1.8",
"phpspec/phpspec": "^7.0",
"phpstan/phpstan": "^1.6",
"phpstan/phpstan-doctrine": "1.3.37",
"phpstan/phpstan-webmozart-assert": "^1.1",
"phpunit/phpunit": "^8.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sylius-labs/coding-standard": "^4.0",
"sylius/sylius-rector": "^1.0",
"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/web-profiler-bundle": "^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.15",
"vimeo/psalm": "4.27.0"
"symfony/browser-kit": "^5.4.21 || ^6.4",
"symfony/debug-bundle": "^5.4.21 || ^6.4",
"symfony/dotenv": "^5.4.21 || ^6.4",
"symfony/http-client": "^5.4.21 || ^6.4",
"symfony/intl": "^5.4.21 || ^6.4",
"symfony/web-profiler-bundle": "^5.4.21 || ^6.4",
"symfony/webpack-encore-bundle": "^1.15"
},
"autoload": {
"psr-4": {
Expand All @@ -51,13 +56,17 @@
"autoload-dev": {
"classmap": ["tests/Application/Kernel.php"]
},
"conflict": {
"behat/mink-selenium2-driver": ">=1.7.0"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": false,
"ocramius/package-versions": false,
"symfony/flex": true,
"symfony/thanks": false
"symfony/thanks": false,
"php-http/discovery": true
}
},
"extra": {
Expand All @@ -68,13 +77,15 @@
"scripts": {
"analyse": [
"@composer validate --strict",
"vendor/bin/phpstan.phar analyse",
"vendor/bin/psalm"
"vendor/bin/phpstan.phar analyse"
],
"fix": [
"vendor/bin/ecs check src/ spec/ --fix"
]
},
"prefer-stable": true,
"minimum-stability": "dev"
"minimum-stability": "dev",
"suggest": {
"php-http/guzzle6-adapter ":"Required to use this package on 32bit PHP"
}
mpysiak marked this conversation as resolved.
Show resolved Hide resolved
}
10 changes: 8 additions & 2 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;

return static function (ECSConfig $config): void {
$config->paths([
__DIR__ . '/src',
__DIR__ . '/tests/Behat',
__DIR__ . '/ecs.php',
]);
mpysiak marked this conversation as resolved.
Show resolved Hide resolved

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

$config->skip([
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ parameters:
- 'src/DependencyInjection/Configuration.php'
- 'src/DependencyInjection/SyliusPayPalExtension.php'
- 'src/Command/CompletePaidPaymentsCommand.php'
- 'src/Migrations/**.php'

# Test dependencies
- 'tests/Application/app/**.php'
Expand Down
82 changes: 0 additions & 82 deletions psalm.xml

This file was deleted.

24 changes: 14 additions & 10 deletions spec/Api/GenericApiSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@

namespace spec\Sylius\PayPalPlugin\Api;

use GuzzleHttp\ClientInterface;
use PhpSpec\ObjectBehavior;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use Sylius\PayPalPlugin\Api\GenericApiInterface;

final class GenericApiSpec extends ObjectBehavior
{
function let(ClientInterface $client): void
function let(ClientInterface $client, RequestFactoryInterface $requestFactory): void
mpysiak marked this conversation as resolved.
Show resolved Hide resolved
{
$this->beConstructedWith($client);
$this->beConstructedWith($client, $requestFactory);
}

function it_implements_generic_api_interface(): void
Expand All @@ -33,17 +35,19 @@ function it_implements_generic_api_interface(): void

function it_calls_api_by_url(
ClientInterface $client,
RequestFactoryInterface $requestFactory,
RequestInterface $request,
ResponseInterface $response,
StreamInterface $body
): void {
$client->request('GET', 'http://url.com/', [
'headers' => [
'Authorization' => 'Bearer TOKEN',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
])->willReturn($response);

mpysiak marked this conversation as resolved.
Show resolved Hide resolved
$requestFactory->createRequest('GET', 'http://url.com/')->willReturn($request);

$request->withHeader('Authorization', 'Bearer TOKEN')->willReturn($request);
$request->withHeader('Content-Type', 'application/json')->willReturn($request);
$request->withHeader('Accept', 'application/json')->willReturn($request);

$client->sendRequest($request)->willReturn($response);
$response->getBody()->willReturn($body);
$body->getContents()->willReturn('{ "parameter": "VALUE" }');

Expand Down
Loading