Skip to content

Commit

Permalink
Merge pull request #78 from SzymonKostrubiec/op-366
Browse files Browse the repository at this point in the history
OP-366 - Add Sylius 1.13 Support
  • Loading branch information
senghe authored Sep 10, 2024
2 parents 2732a15 + e576d40 commit 76dcd9c
Show file tree
Hide file tree
Showing 108 changed files with 648 additions and 474 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,24 @@ 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: ["8.0"]
php: [ "8.0", "8.1", "8.2", "8.3" ]
symfony: ["^5.4", "^6.0"]
sylius: ["~1.11.0", "~1.12.0"]
node: ["14.x"]
sylius: ["^1.12", "^1.13"]
node: [ "18.x", "20.x" ]
mysql: ["8.0"]

exclude:
- sylius: ~1.11.0
symfony: "^6.0"

- sylius: ^1.13
php: 8.0
- sylius: ^1.12
php: 8.0
symfony: ^6.4
env:
APP_ENV: test
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"
Expand Down Expand Up @@ -126,11 +127,6 @@ jobs:
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-
-
name: Copy package.json.dist to package.json
if: matrix.sylius != ''
run: (cd tests/Application && cp package.json.\${{ matrix.sylius }}.dist package.json)

-
name: Install JS dependencies
run: (cd tests/Application && yarn install)
Expand Down Expand Up @@ -165,7 +161,7 @@ jobs:

-
name: Run PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon -l 6 src/
run: vendor/bin/phpstan analyse -c phpstan.neon.dist -l 6 src/

-
name: Run PHPSpec
Expand All @@ -175,7 +171,9 @@ jobs:
name: Run PHPUnit
run: vendor/bin/phpunit --colors=always

# todo add behat test if necessary
-
name: Run ECS
run: vendor/bin/ecs

-
name: Upload Behat logs
Expand All @@ -185,7 +183,7 @@ jobs:
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
22 changes: 12 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
"php": "^8.0",
"ext-json": "*",
"sylius/refund-plugin": "^1.0",
"sylius/sylius": "~1.11.0 || ~1.12.0",
"sylius/sylius": "^1.12 || ^1.13",
"twig/extra-bundle": "^3.4",
"symfony/webpack-encore-bundle": "^1.16"
},
"require-dev": {
"behat/behat": "^3.7",
"behat/mink-selenium2-driver": "^1.4",
"bitbag/coding-standard": "^1.0",
"bitbag/coding-standard": "^3.0",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"doctrine/dbal": "^2.7.0",
"doctrine/dbal": "^2.7 || ^3.0",
"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-debug-extension": "^2.0",
"friends-of-behat/mink-extension": "^2.4",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/suite-settings-extension": "^1.0",
Expand All @@ -29,9 +29,10 @@
"league/flysystem-bundle": "2.4.0",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.85",
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-doctrine": "^1.3",
"phpstan/phpstan-strict-rules": "^1.3.0",
"phpstan/phpstan-webmozart-assert": "^1.2.0",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sylius-labs/coding-standard": "^4.0",
Expand All @@ -41,12 +42,13 @@
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/intl": "^5.4 || ^6.0",
"symfony/mailer": "^5.4 || ^6.0",
"symfony/maker-bundle": "^1.53",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"vimeo/psalm": "4.27.0"
"vimeo/psalm": "4.27.0",
"nyholm/psr7": "^1.8",
"symfony/http-client": "^5.4 || ^6.0"
},
"conflict": {
"symfony/validator": "^6.4.7"
"symfony/validator": "~6.4.7"
},
"config": {
"sort-packages": true,
Expand Down
26 changes: 18 additions & 8 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
<?php

declare(strict_types=1);
/*
* 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
*/

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
declare(strict_types=1);

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/bitbag/coding-standard/ecs.php');
use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
return static function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/tests/Behat',
__DIR__ . '/ecs.php',
]);

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

$ecsConfig->skip([
VisibilityRequiredFixer::class => ['*Spec.php'],
]);
};
1 change: 1 addition & 0 deletions phpstan.neon → phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ parameters:
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
treatPhpDocTypesAsCertain: false

excludes_analyse:
# Makes PHPStan crash
Expand Down
2 changes: 1 addition & 1 deletion src/BitBagSyliusImojePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function build(ContainerBuilder $container): void
$container->addCompilerPass(
new MessageBusPolyfillPass(),
PassConfig::TYPE_BEFORE_OPTIMIZATION,
1
1,
);
}
}
2 changes: 1 addition & 1 deletion src/Bus/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class Dispatcher implements DispatcherInterface
use HandleTrait;

public function __construct(
MessageBusInterface $messageBus
MessageBusInterface $messageBus,
) {
$this->messageBus = $messageBus;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Bus/Handler/FinalizeOrderHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class FinalizeOrderHandler implements MessageHandlerInterface
public function __construct(
FactoryInterface $stateMachineFactory,
RepositoryInterface $orderRepository,
MessageBusInterface $commandBus
MessageBusInterface $commandBus,
) {
$this->stateMachineFactory = $stateMachineFactory;
$this->orderRepository = $orderRepository;
Expand Down
12 changes: 6 additions & 6 deletions src/Bus/Handler/GetBlikTransactionDataHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ final class GetBlikTransactionDataHandler implements MessageHandlerInterface

public function __construct(
ImojeClientConfigurationProviderInterface $configurationProvider,
TransactionBlikModelFactoryInterface $transactionBlikModelFactory,
ImojeClientProviderInterface $imojeClientProvider,
ImojeTransactionFactoryInterface $imojeTransactionFactory,
TransactionDataResolverInterface $transactionDataResolver
TransactionBlikModelFactoryInterface $transactionBlikModelFactory,
ImojeClientProviderInterface $imojeClientProvider,
ImojeTransactionFactoryInterface $imojeTransactionFactory,
TransactionDataResolverInterface $transactionDataResolver,
) {
$this->configurationProvider = $configurationProvider;
$this->transactionBlikModelFactory = $transactionBlikModelFactory;
Expand All @@ -52,7 +52,7 @@ public function __invoke(GetBlikTransactionData $query): ImojeTransactionInterfa
$query->getPaymentMethod(),
$query->getPaymentMethodCode(),
$config->getServiceId(),
$query->getBlikModel()
$query->getBlikModel(),
);

$response = $this->imojeClientProvider
Expand All @@ -77,7 +77,7 @@ public function __invoke(GetBlikTransactionData $query): ImojeTransactionInterfa
$paymentUrl,
$serviceId,
$orderId,
$query->getCode()
$query->getCode(),
);
}
}
12 changes: 6 additions & 6 deletions src/Bus/Handler/GetResponseDataHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ final class GetResponseDataHandler implements MessageHandlerInterface
private UrlResolverInterface $urlResolver;

public function __construct(
ImojeTransactionRepositoryInterface $imojeTransactionRepository,
ImojeClientProviderInterface $imojeClientProvider,
ImojeTransactionRepositoryInterface $imojeTransactionRepository,
ImojeClientProviderInterface $imojeClientProvider,
ImojeClientConfigurationProviderInterface $configurationProvider,
ReadyTransactionFactoryInterface $readyTransactionFactory,
OrderRepository $orderRepository,
UrlResolverInterface $urlResolver
ReadyTransactionFactoryInterface $readyTransactionFactory,
OrderRepository $orderRepository,
UrlResolverInterface $urlResolver,
) {
$this->imojeTransactionRepository = $imojeTransactionRepository;
$this->imojeClientProvider = $imojeClientProvider;
Expand All @@ -60,7 +60,7 @@ public function __invoke(GetResponseData $query): ReadyTransactionModelInterface
return $this->readyTransactionFactory->createReadyTransaction(
$response->getBody()->getContents(),
$imojeTransaction,
$order
$order,
);
}
}
12 changes: 6 additions & 6 deletions src/Bus/Handler/GetTransactionDataHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ final class GetTransactionDataHandler implements MessageHandlerInterface

public function __construct(
ImojeClientConfigurationProviderInterface $configurationProvider,
TransactionModelFactoryInterface $transactionModelFactory,
ImojeClientProviderInterface $imojeClientProvider,
ImojeTransactionFactoryInterface $imojeTransactionFactory,
TransactionDataResolverInterface $transactionDataResolver
TransactionModelFactoryInterface $transactionModelFactory,
ImojeClientProviderInterface $imojeClientProvider,
ImojeTransactionFactoryInterface $imojeTransactionFactory,
TransactionDataResolverInterface $transactionDataResolver,
) {
$this->configurationProvider = $configurationProvider;
$this->transactionModelFactory = $transactionModelFactory;
Expand All @@ -51,7 +51,7 @@ public function __invoke(GetTransactionData $query): ImojeTransactionInterface
$this->transactionModelFactory::SALE_TYPE,
$query->getPaymentMethod(),
$query->getPaymentMethodCode(),
$config->getServiceId()
$config->getServiceId(),
);

$response = $this->imojeClientProvider
Expand All @@ -76,7 +76,7 @@ public function __invoke(GetTransactionData $query): ImojeTransactionInterface
$paymentUrl,
$serviceId,
$orderId,
$query->getCode()
$query->getCode(),
);
}
}
2 changes: 1 addition & 1 deletion src/Bus/Handler/PaymentFinalizationHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class PaymentFinalizationHandler implements MessageHandlerInterface

public function __construct(
FactoryInterface $stateMachineFactory,
RepositoryInterface $paymentRepository
RepositoryInterface $paymentRepository,
) {
$this->stateMachineFactory = $stateMachineFactory;
$this->paymentRepository = $paymentRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/Bus/Handler/TakeOverPaymentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class TakeOverPaymentHandler implements MessageHandlerInterface
public function __construct(
PaymentMethodRepositoryInterface $paymentMethodRepository,
PaymentMethodResolver $paymentMethodResolver,
RepositoryInterface $paymentRepository
RepositoryInterface $paymentRepository,
) {
$this->paymentMethodRepository = $paymentMethodRepository;
$this->paymentMethodResolver = $paymentMethodResolver;
Expand Down
2 changes: 1 addition & 1 deletion src/Bus/Query/GetBlikTransactionData.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(
string $code,
string $paymentMethod,
string $paymentMethodCode,
BlikModelInterface $blikModel
BlikModelInterface $blikModel,
) {
$this->order = $order;
$this->code = $code;
Expand Down
2 changes: 1 addition & 1 deletion src/Bus/Query/GetTransactionData.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(
OrderInterface $order,
string $code,
string $paymentMethod,
string $paymentMethodCode
string $paymentMethodCode,
) {
$this->order = $order;
$this->code = $code;
Expand Down
Loading

0 comments on commit 76dcd9c

Please sign in to comment.