Skip to content

Commit

Permalink
Merge pull request #50 from BitBagCommerce/OP-270/Sylius_1_13_support
Browse files Browse the repository at this point in the history
OP-270 Sylius 1.13 support
  • Loading branch information
senghe authored Jun 5, 2024
2 parents f99b6d7 + 87b6571 commit d1ac27b
Show file tree
Hide file tree
Showing 116 changed files with 717 additions and 568 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [8.0]
symfony: [^5.4, ^6.0]
sylius: [~1.11.0, ~1.12.0]
node: [14.18.x]
mysql: [5.7, 8.0]
php: [ "8.1" ]
symfony: [ "^5.4", "^6.0" ]
sylius: [ "~1.12.0", "~1.13.0" ]
node: [ "^14.17.x" ]
mysql: [ "8.0" ]
state_machine_adapter: [ "winzou_state_machine", "symfony_workflow" ]

exclude:
- sylius: ~1.11.0
symfony: ^6.0
- sylius: ~1.12.0
state_machine_adapter: "symfony_workflow"

env:
APP_ENV: test
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/coding_standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [8.0]
symfony: [ ^5.4, ^6.0]
sylius: [~1.11.0, ~1.12.0]
node: [14.x]
mysql: [5.7]
php: [ "8.1" ]
symfony: [ "^5.4", "^6.0" ]
sylius: [ "~1.12.0", "~1.13.0" ]
node: [ "^14.17.x" ]
mysql: [ "8.0" ]
state_machine_adapter: [ "winzou_state_machine", "symfony_workflow" ]

exclude:
- sylius: ~1.11.0
symfony: ^6.0
- sylius: ~1.12.0
state_machine_adapter: "symfony_workflow"

env:
APP_ENV: test
Expand Down Expand Up @@ -93,4 +94,4 @@ jobs:
SLACK_MESSAGE: ':x:'
SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository
SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }}
SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }}
7 changes: 4 additions & 3 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ default:
DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~

FriendsOfBehat\MinkDebugExtension:
directory: etc/build
clean_start: false
screenshot: true
directory: etc/build
clean_start: false
screenshot: true

Behat\MinkExtension:
files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/"
Expand Down Expand Up @@ -43,6 +43,7 @@ default:
browser: firefox
show_auto: false


FriendsOfBehat\SymfonyExtension:
bootstrap: tests/Application/config/bootstrap.php
kernel:
Expand Down
20 changes: 12 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
"license": "MIT",
"require": {
"php": "^8.0",
"sylius/sylius": "~1.11.0 || ~1.12.0",
"sylius/sylius": "~1.12.0 || ~1.13.0",
"symfony/webpack-encore-bundle": "^1.12"
},
"require-dev": {
"ext-json": "*",
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.4",
"dbrekelmans/bdi": "^1.1",
"bitbag/coding-standard": "^3.0",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
Expand All @@ -25,10 +27,10 @@
"lakion/mink-debug-extension": "^2.0.0",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.82",
"phpstan/phpstan-doctrine": "0.12.33",
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpstan/phpstan": "^1.8.1",
"phpstan/phpstan-doctrine": "^1.3",
"phpstan/phpstan-strict-rules": "^1.3.0",
"phpstan/phpstan-webmozart-assert": "^1.2.0",
"phpunit/phpunit": "^9.5",
"sylius-labs/coding-standard": "^4.0",
"symfony/browser-kit": "^5.4 || ^6.0",
Expand All @@ -39,17 +41,19 @@
"vimeo/psalm": "^4.12",
"composer/xdebug-handler": "^2.0",
"friendsofphp/php-cs-fixer": "^3.0",
"bitbag/coding-standard": "^1.0",
"lchrusciel/api-test-case": "^5.1",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"php-http/message-factory": "^1.1"
"php-http/message-factory": "^1.1",
"robertfausk/behat-panther-extension": "^1.1"
},
"conflict": {
"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"
"symfony/doctrine-bridge": "4.4.16",
"symfony/framework-bundle": "6.2.8",
"behat/mink-selenium2-driver": ">=1.7.0"
},
"autoload": {
"psr-4": {
Expand Down
17 changes: 7 additions & 10 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/bitbag/coding-standard/ecs.php');
return static function (ECSConfig $config): void {

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/src',
__DIR__ . '/tests',
]);
};
putenv('ALLOW_BITBAG_OS_HEADER=1');

$config->import('vendor/bitbag/coding-standard/ecs.php');
$config->paths(['src', 'tests']);
};
2 changes: 2 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ parameters:

ignoreErrors:
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./'
- '#missingType.iterableValue#'
- '#missingType.generics#'
9 changes: 5 additions & 4 deletions src/BitBagSyliusProductBundlePlugin.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 [email protected].
*/

declare(strict_types=1);

Expand Down
11 changes: 6 additions & 5 deletions src/Command/AddProductBundleItemToCartCommand.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 [email protected].
*/

declare(strict_types=1);

Expand All @@ -18,7 +19,7 @@ final class AddProductBundleItemToCartCommand
public function __construct(
private ProductBundleItemInterface $productBundleItem,
private ?ProductVariantInterface $productVariant = null,
private ?int $quantity = null
private ?int $quantity = null,
) {
$this->productVariant = $productBundleItem->getProductVariant();
$this->quantity = $productBundleItem->getQuantity();
Expand Down
11 changes: 6 additions & 5 deletions src/Command/AddProductBundleToCartCommand.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 [email protected].
*/

declare(strict_types=1);

Expand All @@ -15,7 +16,7 @@ final class AddProductBundleToCartCommand implements OrderIdentityAwareInterface
public function __construct(
private int $orderId,
private string $productCode,
private int $quantity = 1
private int $quantity = 1,
) {
}

Expand Down
7 changes: 4 additions & 3 deletions src/Command/OrderIdentityAwareInterface.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?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 [email protected].
*/

declare(strict_types=1);
Expand Down
7 changes: 4 additions & 3 deletions src/Command/ProductCodeAwareInterface.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?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 [email protected].
*/

declare(strict_types=1);
Expand Down
19 changes: 10 additions & 9 deletions src/Controller/OrderItemController.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 [email protected].
*/

declare(strict_types=1);

Expand Down Expand Up @@ -53,7 +54,7 @@ public function __construct(
private MessageBusInterface $messageBus,
private OrderRepositoryInterface $orderRepository,
private AddProductBundleToCartDtoFactoryInterface $addProductBundleToCartDtoFactory,
private AddProductBundleToCartCommandFactoryInterface $addProductBundleToCartCommandFactory
private AddProductBundleToCartCommandFactoryInterface $addProductBundleToCartCommandFactory,
) {
parent::__construct(
$metadata,
Expand All @@ -72,7 +73,7 @@ public function __construct(
$eventDispatcher,
$stateMachine,
$resourceUpdateHandler,
$resourceDeleteHandler
$resourceDeleteHandler,
);
}

Expand All @@ -96,7 +97,7 @@ public function addProductBundleAction(Request $request): ?Response
$form = $this->getFormFactory()->create(
$configuration->getFormType(),
$addProductBundleToCartDto,
$configuration->getFormOptions()
$configuration->getFormOptions(),
);

if ($request->isMethod(Request::METHOD_POST) && $form->handleRequest($request)->isValid()) {
Expand All @@ -113,15 +114,15 @@ public function addProductBundleAction(Request $request): ?Response
'configuration' => $configuration,
$this->metadata->getName() => $orderItem,
'form' => $form->createView(),
]
],
);
}

private function handleForm(
FormInterface $form,
Controller\RequestConfiguration $configuration,
OrderItemInterface $orderItem,
Request $request
Request $request,
): ?Response {
/** @var AddProductBundleToCartDto $addProductBundleToCartDto */
$addProductBundleToCartDto = $form->getData();
Expand Down
11 changes: 6 additions & 5 deletions src/DataTransformer/AddProductBundleToCartDtoDataTransformer.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?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 [email protected].
*/

declare(strict_types=1);
Expand All @@ -26,7 +27,7 @@ final class AddProductBundleToCartDtoDataTransformer implements DataTransformerI
public function transform(
$object,
string $to,
array $context = []
array $context = [],
): AddProductBundleToCartCommand {
Assert::isInstanceOf($object, AddProductBundleToCartDto::class);

Expand All @@ -43,7 +44,7 @@ public function transform(
public function supportsTransformation(
$data,
string $to,
array $context = []
array $context = [],
): bool {
return isset($context['input']['class']) && AddProductBundleToCartDto::class === $context['input']['class'];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?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 [email protected].
*/

declare(strict_types=1);
Expand All @@ -18,8 +19,7 @@ class AuthenticationManagerPolyfillPass implements CompilerPassInterface
public function process(ContainerBuilder $container): void
{
if (
false === $container->has('security.authentication_manager')
&&
false === $container->has('security.authentication_manager') &&
true === $container->has('security.authentication.manager')
) {
$container->setAlias('security.authentication_manager', 'security.authentication.manager');
Expand Down
9 changes: 5 additions & 4 deletions src/Dto/AddProductBundleToCartDto.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?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 [email protected].
*/

declare(strict_types=1);
Expand All @@ -24,7 +25,7 @@ public function __construct(
private OrderInterface $cart,
private OrderItemInterface $cartItem,
private ProductInterface $product,
array $productBundleItems
array $productBundleItems,
) {
$this->productBundleItems = new ArrayCollection($productBundleItems);
}
Expand Down
Loading

0 comments on commit d1ac27b

Please sign in to comment.