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

Upgrade plugin to Sylius 1.13 compatibility #9

Merged
merged 13 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
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
49 changes: 22 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,31 @@ on:

jobs:
tests:
runs-on: ubuntu-22.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: [^4.4, ^5.2]
sylius: [~1.8.0, ~1.9.0, ~1.10.0, ~1.11.0]
node: [14.x]
mysql: [5.7]

php: ["8.0", "8.1", "8.2", "8.3"]
symfony: ["^5.4","^6.4"]
sylius: ["~1.12.0", "~1.13.0"]
node: ["^18.0", "^20.0"]
mysql: ["8.0"]
exclude:
-
sylius: ~1.8.0
symfony: ^5.2
-
sylius: ~1.8.0
php: 8.0
-
sylius: ~1.9.0
php: 8.0
-
sylius: ~1.11.0
php: 7.4
- sylius: "~1.13.0"
php: "8.0"
- symfony: "^6.4"
php: "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
Expand All @@ -60,7 +51,7 @@ jobs:

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

Expand Down Expand Up @@ -98,7 +89,7 @@ jobs:

-
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 @@ -125,7 +116,7 @@ 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
Expand All @@ -150,7 +141,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 encore dev)

-
name: Prepare test application cache
Expand All @@ -168,6 +159,10 @@ jobs:
name: Validate database schema
run: (cd tests/Application && bin/console doctrine:schema:validate)

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

-
name: Run PHPSpec
run: vendor/bin/phpspec run --ansi -f progress --no-interaction
Expand All @@ -178,14 +173,14 @@ jobs:

-
name: Upload Behat logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: Behat logs
path: etc/build/
if-no-files-found: ignore
-

-
name: Failed build Slack notification
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,18 @@ This **open-source plugin was developed to help the Sylius community**. If you h
[![](https://bitbag.io/wp-content/uploads/2020/10/button-contact.png)](https://bitbag.io/contact-us/?utm_source=github&utm_medium=referral&utm_campaign=plugins_braintree)

# Installation
---
----

### Requirements

We work on stable, supported and up-to-date versions of packages. We recommend you to do the same.

| Package | Version |
| --- |--------------------|
| PHP | ^8.0 or ^8.1 |
| sylius/sylius | ^1.12.0 or ^1.13.0 |

----

```bash
$ composer require bitbag/braintree-plugin
Expand Down Expand Up @@ -72,7 +83,7 @@ $ bin/console debug:container bitbag_sylius_braintree_plugin
$ composer install
$ cd tests/Application
$ yarn install
$ yarn build
$ yarn encore dev
$ bin/console assets:install public -e test
$ bin/console doctrine:database:create -e test
$ bin/console doctrine:schema:create -e test
Expand Down
47 changes: 18 additions & 29 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,38 @@
"description": "Braintree payment plugin for Sylius applications.",
"license": "MIT",
"require": {
"php": "^7.3 || ^8.0",
"sylius/sylius": "~1.8.0 || ~1.9.0 || ~1.10.0 || ~1.11.0",
"php-http/message-factory": "^1.1",
"braintree/braintree_php": "^6.4"
"php": "^8.0 || ^8.1",
"sylius/sylius": "~1.12.0 || ~1.13.0",
"braintree/braintree_php": "^6.4",
"symfony/webpack-encore-bundle": "^1.17"
},
"require-dev": {
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.4",
"behat/behat": "^3.7",
"behat/mink-selenium2-driver": "~1.6.0",
"bitbag/coding-standard": "^3.0",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-debug-extension": "^2.0.0",
"friends-of-behat/mink-extension": "^2.4",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/service-container-extension": "^1.0",
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"friends-of-behat/service-container-extension": "^1.0",
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.85",
"phpstan/phpstan-doctrine": "0.12.33",
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan-webmozart-assert": "^1.0",
"phpunit/phpunit": "^9.5",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^4.0",
"symfony/browser-kit": "^4.4 || ^5.2",
"symfony/debug-bundle": "^4.4 || ^5.2",
"symfony/dotenv": "^4.4 || ^5.2",
senghe marked this conversation as resolved.
Show resolved Hide resolved
"symfony/intl": "^4.4 || ^5.2",
"symfony/web-profiler-bundle": "^4.4 || ^5.2",
"symfony/web-server-bundle": "^3.4|^4.1",
"vimeo/psalm": "4.7.1",
"polishsymfonycommunity/symfony-mocker-container": "^1.0"
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"symfony/browser-kit": "^5.4 || ^6.0",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "5.4 | ^6.0"
},
"config": {
"sort-packages": true,
Expand All @@ -53,13 +48,7 @@
}
},
"conflict": {
"doctrine/dbal": "^3.0",
"symfony/symfony": "4.1.8",
"symfony/browser-kit": "4.1.8",
"symfony/dom-crawler": "4.1.8",
"symfony/routing": "4.1.8",
"symfony/doctrine-bridge": "4.4.16",
"doctrine/orm": ">=2.15.2"
"behat/mink-selenium2-driver": ">=1.7.0"
},
"autoload": {
"psr-4": {
Expand Down
13 changes: 13 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $config): void {

putenv('ALLOW_BITBAG_OS_HEADER=1');

$config->import('vendor/bitbag/coding-standard/ecs.php');
$config->paths(['src', 'tests']);
};
9 changes: 5 additions & 4 deletions src/Action/Api/BaseApiAwareAction.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand Down
11 changes: 6 additions & 5 deletions src/Action/Api/DoSaleAction.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand All @@ -16,9 +17,9 @@

final class DoSaleAction extends BaseApiAwareAction
{
/** @param DoSale $request */
public function execute($request): void
{
/** @var $request DoSale */
RequestNotSupportedException::assertSupports($this, $request);

$requestParams = $this->getSaleRequestParams($request);
Expand Down
11 changes: 6 additions & 5 deletions src/Action/Api/FindPaymentMethodNonceAction.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand All @@ -17,9 +18,9 @@

final class FindPaymentMethodNonceAction extends BaseApiAwareAction
{
/** @param GenerateClientToken $request */
public function execute($request): void
{
/** @var $request GenerateClientToken */
RequestNotSupportedException::assertSupports($this, $request);

try {
Expand Down
11 changes: 6 additions & 5 deletions src/Action/Api/GenerateClientTokenAction.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand All @@ -15,9 +16,9 @@

final class GenerateClientTokenAction extends BaseApiAwareAction
{
/** @param GenerateClientToken $request */
public function execute($request): void
{
/** @var $request GenerateClientToken */
RequestNotSupportedException::assertSupports($this, $request);

$requestParams = [];
Expand Down
9 changes: 5 additions & 4 deletions src/Action/CaptureAction.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand Down
11 changes: 6 additions & 5 deletions src/Action/ConvertPaymentAction.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand Down Expand Up @@ -46,7 +47,7 @@ public function supports($request): bool
return
$request instanceof Convert &&
$request->getSource() instanceof PaymentInterface &&
$request->getTo() == 'array'
'array' == $request->getTo()
;
}
}
10 changes: 5 additions & 5 deletions src/Action/ObtainCardholderAuthenticationAction.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand All @@ -25,7 +26,6 @@ final class ObtainCardholderAuthenticationAction implements ActionInterface, Gat
{
use GatewayAwareTrait;

/** @var string */
private string $templateName;

public function __construct(string $templateName)
Expand Down
Loading
Loading