Skip to content

Commit

Permalink
Merge pull request #15 from SzymonKostrubiec/op-316
Browse files Browse the repository at this point in the history
OP-316 - Add suport for sylius 1.12 and 1.13
  • Loading branch information
marekrzytki authored Jun 24, 2024
2 parents b16740a + 65fdbb4 commit 278eab1
Show file tree
Hide file tree
Showing 113 changed files with 558 additions and 977 deletions.
21 changes: 6 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,12 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ "8.0", "7.4" ]
symfony: [ "^4.4", "^5.2" ]
sylius: ["~1.9.0", "~1.10.0", "~1.11.0"]
node: [ "14.19" ]
php: [ "8.1", "8.2" ]
symfony: [ "^5.4", "^6.0" ]
sylius: [ "~1.12.0", "~1.13.0" ]
node: [ "14.x" ]
mysql: [ "8.0" ]

exclude:
- sylius: ~1.9.0
php: 8.0

- sylius: ~1.10.0
symfony: 4.4

- sylius: ~1.11.0
php: 7.4

env:
APP_ENV: test
Expand Down Expand Up @@ -121,7 +112,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
run: (cd tests/Application && bin/console cache:warmup -vvv)

Expand Down Expand Up @@ -153,7 +144,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
31 changes: 14 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
}
},
"require": {
"sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0",
"php": "^7.4 || ^8.0",
"bitbag/coding-standard": "^v1.0.1"
"php": "^8.1",
"sylius/sylius": "~1.12.0 || ~1.13.0",
"twig/inky-extra": "^3.3",
"doctrine/annotations": "^1.14",
"symfony/webpack-encore-bundle": "^1.17"
},
"require-dev": {
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.4",
"bitbag/coding-standard": "v3.0.0",
"behat/behat": "^3.7",
"behat/mink-selenium2-driver": "~1.6.0",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
Expand All @@ -28,21 +31,15 @@
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
"symfony/dotenv": "^4.4 || ^5.2",
"symfony/config": "^2.7 || ^3.0 || ^4.0 || ^5.0",
"symfony/debug-bundle": "^4.4 || ^5.2",
"symfony/web-profiler-bundle": "^4.4 | ^5.2",
"symfony/browser-kit": "^4.4 || ^5.2",
"phpstan/extension-installer": "^1.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "5.4 | ^6.0",
"symfony/browser-kit": "^5.4 || ^6.0",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"symfony/security-bundle": "^5.2 | ^4.4",
"symfony/dependency-injection": "^5.2 | ^4.4",
"symfony/event-dispatcher": "^5.2 | ^4.4",
"symfony/intl": "^5.4 || ^6.0",
"phpspec/phpspec": "^7.0"
},
"conflict": {
"doctrine/orm": ">=2.15.2"
},
"scripts": {
"check:code":
[
Expand Down
19 changes: 8 additions & 11 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<?php

use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff;
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 Symplify\EasyCodingStandard\Config\ECSConfig;

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

putenv('ALLOW_BITBAG_OS_HEADER=1');

$config->import('vendor/bitbag/coding-standard/ecs.php');
$config->paths(['src', 'spec', 'tests/Repository', 'tests/Behat']);
};
22 changes: 22 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
parameters:
level: 8
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
treatPhpDocTypesAsCertain: false
strictRules:
booleansInConditions: false
paths:
- src
- tests/Behat

excludes_analyse:
# Makes PHPStan crash
- 'src/DependencyInjection/Configuration.php'

# Test dependencies
- 'tests/Application/app/**.php'
- 'tests/Application/src/**.php'

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\./'
18 changes: 9 additions & 9 deletions spec/Checker/AgreementHistoryCheckerSpec.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 @@ -19,10 +20,10 @@
final class AgreementHistoryCheckerSpec extends ObjectBehavior
{
function let(
AgreementHistoryResolverInterface $agreementHistoryResolver
AgreementHistoryResolverInterface $agreementHistoryResolver,
): void {
$this->beConstructedWith(
$agreementHistoryResolver
$agreementHistoryResolver,
);
}

Expand All @@ -34,7 +35,7 @@ function it_is_initializable(): void
function it_resolves_agreement_correctly(
AgreementInterface $agreement,
AgreementHistoryInterface $agreementHistory,
AgreementHistoryResolverInterface $agreementHistoryResolver
AgreementHistoryResolverInterface $agreementHistoryResolver,
): void {
$agreementHistoryResolver->resolveHistory($agreement)->willReturn($agreementHistory);
$agreementHistory->getState()->willReturn('accepted');
Expand All @@ -45,12 +46,11 @@ function it_resolves_agreement_correctly(
function it_not_resolves_agreement_when_state_is_other(
AgreementInterface $agreement,
AgreementHistoryInterface $agreementHistory,
AgreementHistoryResolverInterface $agreementHistoryResolver
AgreementHistoryResolverInterface $agreementHistoryResolver,
): void {
$agreementHistoryResolver->resolveHistory($agreement)->willReturn($agreementHistory);
$agreementHistory->getState()->willReturn('rejected');

$this->isAgreementAccepted($agreement)->shouldReturn(false);
}

}
22 changes: 11 additions & 11 deletions spec/DataModifier/AgreementHistoryModifierSpec.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 @@ -21,10 +22,10 @@
final class AgreementHistoryModifierSpec extends ObjectBehavior
{
function let(
AgreementHistoryResolverInterface $agreementHistoryResolver
AgreementHistoryResolverInterface $agreementHistoryResolver,
): void {
$this->beConstructedWith(
$agreementHistoryResolver
$agreementHistoryResolver,
);
}

Expand All @@ -38,7 +39,7 @@ function it_returns_agreement_history_from_repository(
ShopUserInterface $shopUser,
AgreementInterface $agreement,
AgreementHistoryResolverInterface $agreementHistoryResolver,
AgreementHistoryInterface $agreementHistory
AgreementHistoryInterface $agreementHistory,
): void {
$agreementHistoryResolver->resolveHistory($agreement)->willReturn($agreementHistory);
$agreementHistory->getId()->willReturn('1');
Expand All @@ -49,7 +50,7 @@ function it_returns_agreement_history_from_repository(
'registration_form',
$order,
$shopUser,
$agreement
$agreement,
)->shouldReturn($agreementHistory);
}

Expand All @@ -58,7 +59,7 @@ function it_sets_data_when_history_id_is_null(
ShopUserInterface $shopUser,
AgreementInterface $agreement,
AgreementHistoryResolverInterface $agreementHistoryResolver,
AgreementHistoryInterface $agreementHistory
AgreementHistoryInterface $agreementHistory,
): void {
$agreementHistoryResolver->resolveHistory($agreement)->willReturn($agreementHistory);
$agreementHistory->getId()->willReturn(null);
Expand All @@ -72,8 +73,7 @@ function it_sets_data_when_history_id_is_null(
'registration_form',
$order,
$shopUser,
$agreement
$agreement,
)->shouldReturn($agreementHistory);
}

}
30 changes: 17 additions & 13 deletions spec/EventSubscriber/AgreementSubscriberSpec.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 @@ -23,10 +24,10 @@
final class AgreementSubscriberSpec extends ObjectBehavior
{
function let(
AgreementHandler $agreementHandler
AgreementHandler $agreementHandler,
): void {
$this->beConstructedWith(
$agreementHandler
$agreementHandler,
);
}

Expand All @@ -36,7 +37,7 @@ function it_is_initializable(): void
}

function it_quit_function_when_user_is_null(
AgreementCheckedEvent $agreementCheckedEvent
AgreementCheckedEvent $agreementCheckedEvent,
): void {
$agreementCheckedEvent->getEventDataUserId()->willReturn(null);

Expand All @@ -50,7 +51,7 @@ function it_processes_successfully(
OrderInterface $order,
ShopUserInterface $shopUser,
Collection $userAgreements,
AgreementHandler $agreementHandler
AgreementHandler $agreementHandler,
): void {
$agreementCheckedEvent->getEvent()->willReturn($formEvent);
$agreementCheckedEvent->getEventDataUserId()->willReturn('1');
Expand All @@ -65,7 +66,8 @@ function it_processes_successfully(
$userAgreements,
'checkout_form',
$order,
$shopUser)
$shopUser,
)
->shouldBeCalled();

$this->processAgreementsFromAnywhere($agreementCheckedEvent);
Expand All @@ -77,7 +79,7 @@ function it_processes_successfully_when_order_id_is_null(
OrderInterface $order,
ShopUserInterface $shopUser,
Collection $userAgreements,
AgreementHandler $agreementHandler
AgreementHandler $agreementHandler,
): void {
$agreementCheckedEvent->getEvent()->willReturn($formEvent);
$agreementCheckedEvent->getEventDataUserId()->willReturn('1');
Expand All @@ -92,7 +94,8 @@ function it_processes_successfully_when_order_id_is_null(
$userAgreements,
'checkout_form',
null,
$shopUser)
$shopUser,
)
->shouldBeCalled();

$this->processAgreementsFromAnywhere($agreementCheckedEvent);
Expand All @@ -106,7 +109,7 @@ function it_processes_successfully_when_data_is_not_instance_of_order(
Collection $userAgreements,
AgreementHandler $agreementHandler,
OrderInterface $order2,
CustomerInterface $customer
CustomerInterface $customer,
): void {
$agreementCheckedEvent->getEvent()->willReturn($formEvent);
$agreementCheckedEvent->getEventDataUserId()->willReturn('1');
Expand All @@ -121,7 +124,8 @@ function it_processes_successfully_when_data_is_not_instance_of_order(
$userAgreements,
'checkout_form',
null,
$shopUser)
$shopUser,
)
->shouldBeCalled();

$this->processAgreementsFromAnywhere($agreementCheckedEvent);
Expand Down
Loading

0 comments on commit 278eab1

Please sign in to comment.