diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 1984fd0c..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,14 +0,0 @@ -# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 - -updates: - - commit-message: - include: "scope" - prefix: "composer" - directory: "/" - open-pull-requests-limit: 5 - package-ecosystem: "composer" - schedule: - interval: "weekly" - versioning-strategy: "increase-if-necessary" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3b9dbeb2..62c6fa00 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,7 +2,7 @@ name: "build" on: push: branches: - - "0.*" + - "0.*.x" paths-ignore: - "**/*.md" pull_request: @@ -71,6 +71,7 @@ jobs: - "7.4" - "8.0" - "8.1" + - "8.2" dependencies: - "lowest" @@ -78,6 +79,28 @@ jobs: symfony: - "^5.4" + - "~6.0.0" + - "~6.1.0" + - "~6.2.0" + - "~6.3.0" + + exclude: + - php-version: "7.4" + symfony: "~6.0.0" + - php-version: "7.4" + symfony: "~6.1.0" + - php-version: "7.4" + symfony: "~6.2.0" + - php-version: "7.4" + symfony: "~6.3.0" + - php-version: "8.0" + symfony: "~6.0.0" + - php-version: "8.0" + symfony: "~6.1.0" + - php-version: "8.0" + symfony: "~6.2.0" + - php-version: "8.0" + symfony: "~6.3.0" steps: - name: "Checkout" @@ -118,12 +141,36 @@ jobs: - "7.4" - "8.0" - "8.1" + - "8.2" dependencies: + - "lowest" - "highest" symfony: - "^5.4" + - "~6.0.0" + - "~6.1.0" + - "~6.2.0" + - "~6.3.0" + + exclude: + - php-version: "7.4" + symfony: "~6.0.0" + - php-version: "7.4" + symfony: "~6.1.0" + - php-version: "7.4" + symfony: "~6.2.0" + - php-version: "7.4" + symfony: "~6.3.0" + - php-version: "8.0" + symfony: "~6.0.0" + - php-version: "8.0" + symfony: "~6.1.0" + - php-version: "8.0" + symfony: "~6.2.0" + - php-version: "8.0" + symfony: "~6.3.0" steps: - name: "Checkout" @@ -137,6 +184,9 @@ jobs: php-version: "${{ matrix.php-version }}" tools: "flex" + - name: "Remove sylius/sylius from composer.json" + run: "composer remove --dev --no-update --no-plugins --no-scripts sylius/sylius" + - name: "Install composer dependencies" uses: "ramsey/composer-install@v2" env: @@ -144,11 +194,8 @@ jobs: with: dependency-versions: "${{ matrix.dependencies }}" - - name: "Cache warmup" - run: "(cd tests/Application && bin/console cache:warmup)" - - name: "Static analysis" - run: "composer analyse" + run: "vendor/bin/psalm --php-version=${{ matrix.php-version }}" unit-tests: name: "Unit tests (PHP ${{ matrix.php-version }} | Dependency versions: ${{ matrix.dependencies }} | Symfony: ${{ matrix.symfony }})" @@ -161,12 +208,35 @@ jobs: - "7.4" - "8.0" - "8.1" + - "8.2" dependencies: - "highest" symfony: - "^5.4" + - "~6.0.0" + - "~6.1.0" + - "~6.2.0" + - "~6.3.0" + + exclude: + - php-version: "7.4" + symfony: "~6.0.0" + - php-version: "7.4" + symfony: "~6.1.0" + - php-version: "7.4" + symfony: "~6.2.0" + - php-version: "7.4" + symfony: "~6.3.0" + - php-version: "8.0" + symfony: "~6.0.0" + - php-version: "8.0" + symfony: "~6.1.0" + - php-version: "8.0" + symfony: "~6.2.0" + - php-version: "8.0" + symfony: "~6.3.0" steps: - name: "Checkout" @@ -180,6 +250,9 @@ jobs: php-version: "${{ matrix.php-version }}" tools: "flex" + - name: "Remove sylius/sylius from composer.json" + run: "composer remove --dev --no-update --no-plugins --no-scripts sylius/sylius" + - name: "Install composer dependencies" uses: "ramsey/composer-install@v2" env: @@ -201,6 +274,7 @@ jobs: - "7.4" - "8.0" - "8.1" + - "8.2" dependencies: - "highest" @@ -226,7 +300,7 @@ jobs: - name: "Setup node" uses: "actions/setup-node@v3" with: - node-version: "14" + node-version: "16" - name: "Install composer dependencies" uses: "ramsey/composer-install@v2" @@ -315,7 +389,7 @@ jobs: strategy: matrix: php-version: - - "8.1" + - "8.2" dependencies: - "highest" diff --git a/composer.json b/composer.json index b9976ad8..4b1dbd30 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "knplabs/knp-snappy": "^1.4", "knplabs/knp-snappy-bundle": "^1.9", "setono/doctrine-object-manager-trait": "^1.1", - "sylius/api-bundle": "^1.0", + "sylius/api-bundle": "^1.10", "sylius/channel": "^1.0", "sylius/channel-bundle": "^1.0", "sylius/core": "^1.0", @@ -29,7 +29,7 @@ "sylius/locale-bundle": "^1.0", "sylius/mailer-bundle": "^1.6 || ^2.0", "sylius/money-bundle": "^1.0", - "sylius/order": "^1.0", + "sylius/order": "^1.10", "sylius/order-bundle": "^1.0", "sylius/product": "^1.0", "sylius/product-bundle": "^1.0", @@ -57,19 +57,18 @@ "webmozart/assert": "^1.11" }, "require-dev": { - "friendsofsymfony/oauth-server-bundle": ">2.0.0-alpha.0 ^2.0@dev", - "lexik/jwt-authentication-bundle": "^2.16", + "lexik/jwt-authentication-bundle": "^2.19", "matthiasnoback/symfony-config-test": "^4.3", "matthiasnoback/symfony-dependency-injection-test": "^4.3", "php-http/message-factory": "^1.1", - "phpspec/phpspec": "^7.2", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.6", + "phpspec/phpspec": "^7.4", + "phpspec/prophecy-phpunit": "^2.0.2", + "phpunit/phpunit": "^9.6.13", "psalm/plugin-phpunit": "^0.18", "psalm/plugin-symfony": "^5.0", - "setono/code-quality-pack": "^2.4", + "setono/code-quality-pack": "^2.6", "setono/sylius-behat-pack": "^0.2.2", - "setono/sylius-catalog-promotion-plugin": "^0.4", + "setono/sylius-catalog-promotion-plugin": "^0.4.8 || ^0.5", "sylius/sylius": "~1.10.14", "symfony/debug-bundle": "^5.4 || ^6.0", "symfony/dotenv": "^5.4 || ^6.0", @@ -77,8 +76,8 @@ "symfony/intl": "^5.4 || ^6.0", "symfony/property-info": "^5.4 || ^6.0", "symfony/web-profiler-bundle": "^5.4 || ^6.0", - "symfony/webpack-encore-bundle": "^1.16", - "weirdan/doctrine-psalm-plugin": "^2.5" + "symfony/webpack-encore-bundle": "^1.17", + "weirdan/doctrine-psalm-plugin": "^2.9" }, "prefer-stable": true, "autoload": { @@ -104,20 +103,12 @@ }, "sort-packages": true }, - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, "scripts": { "all": [ "@checks", "@tests" ], - "analyse": [ - "@ensure-test-container-exists", - "psalm" - ], + "analyse": "psalm", "assets": [ "@ensure-assets-installed", "@ensure-assets-compiled" @@ -140,7 +131,6 @@ "ensure-env-dev-copied": "(cd tests/Application && ([[ -f .env.local ]] || cp .env .env.local))", "ensure-env-test-copied": "(cd tests/Application && ([[ -f .env.test.local ]] || cp .env.test .env.test.local))", "ensure-schema-updated": "composer ensure-env-copied && (cd tests/Application && bin/console doctrine:schema:update --force -e ${SYMFONY_ENV:-'dev'})", - "ensure-test-container-exists": "[[ -f tests/Application/var/cache/test/Tests_Setono_SyliusGiftCardPlugin_Application_KernelTestDebugContainer.xml ]] || tests/Application/bin/console cache:warmup --env=test", "ensure-vendors-installed": "[[ -f vendor/autoload.php ]] || php -d memory_limit=-1 /usr/local/bin/composer install", "fix-style": "ecs check --fix", "fixtures": [ diff --git a/psalm.xml b/psalm.xml index 31e21377..6962ce05 100644 --- a/psalm.xml +++ b/psalm.xml @@ -4,7 +4,7 @@ xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" findUnusedPsalmSuppress="false" - findUnusedBaselineEntry="true" + findUnusedBaselineEntry="false" findUnusedVariablesAndParams="false" findUnusedCode="false" errorLevel="1" @@ -20,11 +20,9 @@ - - tests/Application/var/cache/test/Tests_Setono_SyliusGiftCardPlugin_Application_KernelTestDebugContainer.xml - + @@ -33,12 +31,25 @@ + + + + + - + + + + + + + + + diff --git a/src/Api/CommandHandler/AddGiftCardToOrderHandler.php b/src/Api/CommandHandler/AddGiftCardToOrderHandler.php index f1a5a5c8..7f16fbac 100644 --- a/src/Api/CommandHandler/AddGiftCardToOrderHandler.php +++ b/src/Api/CommandHandler/AddGiftCardToOrderHandler.php @@ -10,10 +10,9 @@ use Setono\SyliusGiftCardPlugin\Model\OrderInterface; use Setono\SyliusGiftCardPlugin\Repository\GiftCardRepositoryInterface; use Setono\SyliusGiftCardPlugin\Repository\OrderRepositoryInterface; -use Symfony\Component\Messenger\Handler\MessageHandlerInterface; use Webmozart\Assert\Assert; -final class AddGiftCardToOrderHandler implements MessageHandlerInterface +final class AddGiftCardToOrderHandler { private GiftCardRepositoryInterface $giftCardRepository; diff --git a/src/Api/CommandHandler/AddItemToCartHandler.php b/src/Api/CommandHandler/AddItemToCartHandler.php index 6d01c217..52721621 100644 --- a/src/Api/CommandHandler/AddItemToCartHandler.php +++ b/src/Api/CommandHandler/AddItemToCartHandler.php @@ -18,10 +18,9 @@ use Sylius\Component\Core\Repository\ProductVariantRepositoryInterface; use Sylius\Component\Order\Modifier\OrderItemQuantityModifierInterface; use Sylius\Component\Order\Modifier\OrderModifierInterface; -use Symfony\Component\Messenger\Handler\MessageHandlerInterface; use Webmozart\Assert\Assert; -final class AddItemToCartHandler implements MessageHandlerInterface +final class AddItemToCartHandler { private OrderRepositoryInterface $orderRepository; diff --git a/src/Api/CommandHandler/AssociateConfigurationToChannelHandler.php b/src/Api/CommandHandler/AssociateConfigurationToChannelHandler.php index 3dee788a..cc4b4692 100644 --- a/src/Api/CommandHandler/AssociateConfigurationToChannelHandler.php +++ b/src/Api/CommandHandler/AssociateConfigurationToChannelHandler.php @@ -11,10 +11,9 @@ use Sylius\Component\Locale\Model\LocaleInterface; use Sylius\Component\Resource\Factory\FactoryInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; -use Symfony\Component\Messenger\Handler\MessageHandlerInterface; use Webmozart\Assert\Assert; -final class AssociateConfigurationToChannelHandler implements MessageHandlerInterface +final class AssociateConfigurationToChannelHandler { private RepositoryInterface $giftCardConfigurationRepository; diff --git a/src/Api/CommandHandler/CreateGiftCardConfigurationHandler.php b/src/Api/CommandHandler/CreateGiftCardConfigurationHandler.php index 0f083bbd..501c7b2e 100644 --- a/src/Api/CommandHandler/CreateGiftCardConfigurationHandler.php +++ b/src/Api/CommandHandler/CreateGiftCardConfigurationHandler.php @@ -8,9 +8,8 @@ use Setono\SyliusGiftCardPlugin\Api\Command\CreateGiftCardConfiguration; use Setono\SyliusGiftCardPlugin\Factory\GiftCardConfigurationFactoryInterface; use Setono\SyliusGiftCardPlugin\Model\GiftCardConfigurationInterface; -use Symfony\Component\Messenger\Handler\MessageHandlerInterface; -final class CreateGiftCardConfigurationHandler implements MessageHandlerInterface +final class CreateGiftCardConfigurationHandler { private GiftCardConfigurationFactoryInterface $giftCardConfigurationFactory; diff --git a/src/Api/CommandHandler/RemoveGiftCardFromOrderHandler.php b/src/Api/CommandHandler/RemoveGiftCardFromOrderHandler.php index 3e3ab27e..84f86b05 100644 --- a/src/Api/CommandHandler/RemoveGiftCardFromOrderHandler.php +++ b/src/Api/CommandHandler/RemoveGiftCardFromOrderHandler.php @@ -10,10 +10,9 @@ use Setono\SyliusGiftCardPlugin\Model\OrderInterface; use Setono\SyliusGiftCardPlugin\Repository\GiftCardRepositoryInterface; use Setono\SyliusGiftCardPlugin\Repository\OrderRepositoryInterface; -use Symfony\Component\Messenger\Handler\MessageHandlerInterface; use Webmozart\Assert\Assert; -final class RemoveGiftCardFromOrderHandler implements MessageHandlerInterface +final class RemoveGiftCardFromOrderHandler { private GiftCardRepositoryInterface $giftCardRepository; diff --git a/src/Api/Controller/Action/UploadGiftCardConfigurationImageAction.php b/src/Api/Controller/Action/UploadGiftCardConfigurationImageAction.php index 3cd6be98..73c7aec0 100644 --- a/src/Api/Controller/Action/UploadGiftCardConfigurationImageAction.php +++ b/src/Api/Controller/Action/UploadGiftCardConfigurationImageAction.php @@ -78,6 +78,11 @@ private function getOwner(string $ownerIri): GiftCardConfigurationInterface if ($this->iriConverter instanceof LegacyIriConverterInterface) { $owner = $this->iriConverter->getItemFromIri($ownerIri); } else { + /** + * @psalm-suppress UndefinedDocblockClass + * + * @var mixed $owner + */ $owner = $this->iriConverter->getResourceFromIri($ownerIri); } diff --git a/src/Api/Doctrine/QueryCollectionExtension/GiftCardsByLoggedInUserExtension.php b/src/Api/Doctrine/QueryCollectionExtension/GiftCardsByLoggedInUserExtension.php index 76836f9e..bf885ae0 100644 --- a/src/Api/Doctrine/QueryCollectionExtension/GiftCardsByLoggedInUserExtension.php +++ b/src/Api/Doctrine/QueryCollectionExtension/GiftCardsByLoggedInUserExtension.php @@ -48,9 +48,11 @@ public function applyToCollection( /** @var CustomerInterface $customer */ $customer = $user->getCustomer(); - $rootAlias = $queryBuilder->getRootAliases()[0]; + /** @var list $rootAliases */ + $rootAliases = $queryBuilder->getRootAliases(); + $queryBuilder - ->andWhere(sprintf('%s.customer = :customer', $rootAlias)) + ->andWhere(sprintf('%s.customer = :customer', $rootAliases[0])) ->setParameter('customer', $customer->getId(), Types::INTEGER) ; } diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index a8b235bf..132e08c4 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -91,7 +91,7 @@ private function addResourcesSection(ArrayNodeDefinition $node): void private function addGiftCardSection(NodeBuilder $nodeBuilder): void { - /** @psalm-suppress MixedMethodCall,PossiblyNullReference,UndefinedInterfaceMethod */ + /** @psalm-suppress MixedMethodCall,PossiblyNullReference,UndefinedInterfaceMethod,PossiblyUndefinedMethod */ $nodeBuilder ->arrayNode('gift_card') ->addDefaultsIfNotSet() @@ -110,7 +110,7 @@ private function addGiftCardSection(NodeBuilder $nodeBuilder): void private function addGiftCardConfigurationSection(NodeBuilder $nodeBuilder): void { - /** @psalm-suppress MixedMethodCall,PossiblyNullReference,UndefinedInterfaceMethod */ + /** @psalm-suppress MixedMethodCall,PossiblyNullReference,UndefinedInterfaceMethod,PossiblyUndefinedMethod */ $nodeBuilder ->arrayNode('gift_card_configuration') ->addDefaultsIfNotSet() @@ -129,7 +129,7 @@ private function addGiftCardConfigurationSection(NodeBuilder $nodeBuilder): void private function addGiftCardConfigurationImageSection(NodeBuilder $nodeBuilder): void { - /** @psalm-suppress MixedMethodCall,PossiblyNullReference,UndefinedInterfaceMethod */ + /** @psalm-suppress MixedMethodCall,PossiblyNullReference,UndefinedInterfaceMethod,PossiblyUndefinedMethod */ $nodeBuilder ->arrayNode('gift_card_configuration_image') ->addDefaultsIfNotSet() @@ -148,7 +148,7 @@ private function addGiftCardConfigurationImageSection(NodeBuilder $nodeBuilder): private function addChannelConfigurationSection(NodeBuilder $nodeBuilder): void { - /** @psalm-suppress MixedMethodCall,PossiblyNullReference,UndefinedInterfaceMethod */ + /** @psalm-suppress MixedMethodCall,PossiblyNullReference,UndefinedInterfaceMethod,PossiblyUndefinedMethod */ $nodeBuilder ->arrayNode('gift_card_channel_configuration') ->addDefaultsIfNotSet() diff --git a/src/Serializer/Normalizer/GiftCardConfigurationNormalizer.php b/src/Serializer/Normalizer/GiftCardConfigurationNormalizer.php index 4e0f622f..987e28f1 100644 --- a/src/Serializer/Normalizer/GiftCardConfigurationNormalizer.php +++ b/src/Serializer/Normalizer/GiftCardConfigurationNormalizer.php @@ -33,10 +33,8 @@ public function __construct( /** * @param GiftCardConfigurationInterface|mixed $object * @param string $format - * - * @return array|ArrayObject */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { Assert::isInstanceOf($object, GiftCardConfigurationInterface::class); @@ -45,6 +43,10 @@ public function normalize($object, $format = null, array $context = []) throw new UnexpectedTypeException($data, 'array', ArrayObject::class); } + if ($data instanceof ArrayObject) { + $data = $data->getArrayCopy(); + } + $data['image'] = ''; $request = $this->requestStack->getMainRequest(); diff --git a/src/Serializer/Normalizer/GiftCardNormalizer.php b/src/Serializer/Normalizer/GiftCardNormalizer.php index 375390e3..403eb7d6 100644 --- a/src/Serializer/Normalizer/GiftCardNormalizer.php +++ b/src/Serializer/Normalizer/GiftCardNormalizer.php @@ -27,10 +27,8 @@ public function __construct(ObjectNormalizer $objectNormalizer, MoneyFormatterIn /** * @param GiftCardInterface|mixed $object * @param string $format - * - * @return array|ArrayObject */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { Assert::isInstanceOf($object, GiftCardInterface::class); @@ -39,6 +37,10 @@ public function normalize($object, $format = null, array $context = []) throw new UnexpectedTypeException($data, 'array', ArrayObject::class); } + if ($data instanceof ArrayObject) { + $data = $data->getArrayCopy(); + } + $localeCode = isset($context['localeCode']) && is_string($context['localeCode']) ? $context['localeCode'] : 'en_US'; $data['amount'] = $this->moneyFormatter->format($object->getAmount(), (string) $object->getCurrencyCode(), $localeCode); diff --git a/src/Validator/Constraints/DatePeriodValidator.php b/src/Validator/Constraints/DatePeriodValidator.php index 7d2f9943..f8fa38df 100644 --- a/src/Validator/Constraints/DatePeriodValidator.php +++ b/src/Validator/Constraints/DatePeriodValidator.php @@ -19,6 +19,9 @@ public function __construct(DatePeriodUnitProviderInterface $datePeriodUnitProvi $this->datePeriodUnitProvider = $datePeriodUnitProvider; } + /** + * @param mixed $value + */ public function validate($value, Constraint $constraint): void { if (!$constraint instanceof DatePeriod) { diff --git a/src/Validator/Constraints/DefaultGiftCardConfigurationMustExistValidator.php b/src/Validator/Constraints/DefaultGiftCardConfigurationMustExistValidator.php index 47aad67d..d2344661 100644 --- a/src/Validator/Constraints/DefaultGiftCardConfigurationMustExistValidator.php +++ b/src/Validator/Constraints/DefaultGiftCardConfigurationMustExistValidator.php @@ -19,6 +19,9 @@ public function __construct(GiftCardConfigurationRepositoryInterface $giftCardCo $this->giftCardConfigurationRepository = $giftCardConfigurationRepository; } + /** + * @param mixed $value + */ public function validate($value, Constraint $constraint): void { if (!$constraint instanceof DefaultGiftCardConfigurationMustExist) { diff --git a/src/Validator/Constraints/GiftCardIsNotExpiredValidator.php b/src/Validator/Constraints/GiftCardIsNotExpiredValidator.php index 02a1e57a..5ee77279 100644 --- a/src/Validator/Constraints/GiftCardIsNotExpiredValidator.php +++ b/src/Validator/Constraints/GiftCardIsNotExpiredValidator.php @@ -12,6 +12,9 @@ final class GiftCardIsNotExpiredValidator extends ConstraintValidator { + /** + * @param mixed $value + */ public function validate($value, Constraint $constraint): void { if (!$constraint instanceof GiftCardIsNotExpired) { diff --git a/src/Validator/Constraints/HasBackgroundImageValidator.php b/src/Validator/Constraints/HasBackgroundImageValidator.php index beab6da5..1efd72a7 100644 --- a/src/Validator/Constraints/HasBackgroundImageValidator.php +++ b/src/Validator/Constraints/HasBackgroundImageValidator.php @@ -11,6 +11,9 @@ final class HasBackgroundImageValidator extends ConstraintValidator { + /** + * @param mixed $value + */ public function validate($value, Constraint $constraint): void { if (!$constraint instanceof HasBackgroundImage) { diff --git a/src/Validator/Constraints/Pdf/ValidOrientationValidator.php b/src/Validator/Constraints/Pdf/ValidOrientationValidator.php index 2f6d3f91..4c1d3a73 100644 --- a/src/Validator/Constraints/Pdf/ValidOrientationValidator.php +++ b/src/Validator/Constraints/Pdf/ValidOrientationValidator.php @@ -17,6 +17,9 @@ public function __construct(array $availableOrientations) $this->availableOrientations = $availableOrientations; } + /** + * @param mixed $value + */ public function validate($value, Constraint $constraint): void { if (!$constraint instanceof ValidOrientation) { diff --git a/src/Validator/Constraints/Pdf/ValidPageSizeValidator.php b/src/Validator/Constraints/Pdf/ValidPageSizeValidator.php index 9b70886d..9258961b 100644 --- a/src/Validator/Constraints/Pdf/ValidPageSizeValidator.php +++ b/src/Validator/Constraints/Pdf/ValidPageSizeValidator.php @@ -17,6 +17,9 @@ public function __construct(array $availableOrientations) $this->availablePageSizes = $availableOrientations; } + /** + * @param mixed $value + */ public function validate($value, Constraint $constraint): void { if (!$constraint instanceof ValidPageSize) { diff --git a/tests/Unit/Controller/Action/Admin/GenerateEncodedExamplePdfActionTest.php b/tests/Unit/Controller/Action/Admin/GenerateEncodedExamplePdfActionTest.php index 0ce9eb8f..7084e7e3 100644 --- a/tests/Unit/Controller/Action/Admin/GenerateEncodedExamplePdfActionTest.php +++ b/tests/Unit/Controller/Action/Admin/GenerateEncodedExamplePdfActionTest.php @@ -39,7 +39,7 @@ public function it_generates_encoded_pdf(): void $form = $this->prophesize(FormInterface::class); $formFactory = $this->prophesize(FormFactoryInterface::class); $formFactory->create(GiftCardConfigurationType::class, $giftCardConfiguration)->willReturn($form); - $form->handleRequest($request)->shouldBeCalled(); + $form->handleRequest($request)->shouldBeCalled()->willReturn($form); $pdfContent = 'PDF content'; diff --git a/tests/Unit/Security/GiftCardVoterTest.php b/tests/Unit/Security/GiftCardVoterTest.php index 7946ab08..415647fc 100644 --- a/tests/Unit/Security/GiftCardVoterTest.php +++ b/tests/Unit/Security/GiftCardVoterTest.php @@ -20,7 +20,7 @@ public function testAdminCanSeeAllGiftCards(): void $giftCard = new GiftCard(); $voter = new GiftCardVoter(); $user = new AdminUser(); - $token = new UsernamePasswordToken($user, 'credentials', 'memory'); + $token = new UsernamePasswordToken($user, 'memory'); $this->assertSame( Voter::ACCESS_GRANTED, @@ -38,7 +38,7 @@ public function testUsersCanSeeTheirGiftCards(): void $giftCard->setCustomer($customer); - $token = new UsernamePasswordToken($user, 'credentials', 'memory'); + $token = new UsernamePasswordToken($user, 'memory'); $this->assertSame( Voter::ACCESS_GRANTED, @@ -54,7 +54,7 @@ public function testUsersCanSeeAnonymousGiftCards(): void $customer = new Customer(); $user->setCustomer($customer); - $token = new UsernamePasswordToken($user, 'credentials', 'memory'); + $token = new UsernamePasswordToken($user, 'memory'); $this->assertSame( Voter::ACCESS_GRANTED, @@ -73,7 +73,7 @@ public function testUsersCanNotSeeOtherGiftCards(): void $customer2 = new Customer(); $giftCard->setCustomer($customer2); - $token = new UsernamePasswordToken($user, 'credentials', 'memory'); + $token = new UsernamePasswordToken($user, 'memory'); $this->assertSame( Voter::ACCESS_DENIED,