diff --git a/ecs.php b/ecs.php index 3f2b4f3a0aa..be0d66518f9 100644 --- a/ecs.php +++ b/ecs.php @@ -22,7 +22,7 @@ $config->import('vendor/sylius-labs/coding-standard/ecs.php'); $config->parallel(); - $config->paths(['src/Sylius']); + $config->paths(['src/Sylius', 'tests']); $config->skip([ InlineDocCommentDeclarationSniff::class . '.MissingVariable', InlineDocCommentDeclarationSniff::class . '.NoAssignment', diff --git a/src/Sylius/Behat/Context/Api/Admin/ManagingCountriesContext.php b/src/Sylius/Behat/Context/Api/Admin/ManagingCountriesContext.php index 33d25e5204b..24dfa60b92f 100644 --- a/src/Sylius/Behat/Context/Api/Admin/ManagingCountriesContext.php +++ b/src/Sylius/Behat/Context/Api/Admin/ManagingCountriesContext.php @@ -343,7 +343,7 @@ public function iShouldBeNotifiedThatTheCountryCodeIsRequired(string $constraint { Assert::contains( $this->responseChecker->getError($this->client->getLastResponse()), - $constraint === 'required' ? 'Please enter country ISO code.' : 'Country ISO code is invalid.' + $constraint === 'required' ? 'Please enter country ISO code.' : 'Country ISO code is invalid.', ); } diff --git a/src/Sylius/Behat/Context/Api/Admin/ManagingOrdersContext.php b/src/Sylius/Behat/Context/Api/Admin/ManagingOrdersContext.php index df207f40c49..1177d65fe71 100644 --- a/src/Sylius/Behat/Context/Api/Admin/ManagingOrdersContext.php +++ b/src/Sylius/Behat/Context/Api/Admin/ManagingOrdersContext.php @@ -97,7 +97,6 @@ public function iSpecifyFilterDateToAs(string $dateTime): void $this->client->addFilter('checkoutCompletedAt[before]', $dateTime); } - /** * @When I filter by product :productName * @When I filter by products :firstProduct and :secondProduct @@ -147,7 +146,7 @@ public function iSpecifyFilterTotalBeingGreaterThan(string $total): void */ public function iSpecifyFilterTotalBeingLessThan(string $total): void { - $this->client->addFilter('total[lt]', $total. '00'); + $this->client->addFilter('total[lt]', $total . '00'); } /** @@ -488,7 +487,7 @@ public function theFirstOrderShouldHaveNumber(string $number): void */ public function iShouldSeeTheOrderWithTotal(string $orderNumber, int $total): void { - $order = $this->responseChecker->getCollectionItemsWithValue( + $order = $this->responseChecker->getCollectionItemsWithValue( $this->client->getLastResponse(), 'number', trim($orderNumber, '#'), @@ -528,7 +527,7 @@ public function theAdministratorShouldSeeTheOrderWithTotalInOrderList(string $to private function getCurrencyCodeFromTotal(string $total): string { - return match(true) { + return match (true) { str_starts_with($total, '$') => 'USD', str_starts_with($total, '€') => 'EUR', str_starts_with($total, '£') => 'GBP', diff --git a/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentMethodsContext.php b/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentMethodsContext.php index 4a501ea40d9..aed6f71b0f1 100644 --- a/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentMethodsContext.php +++ b/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentMethodsContext.php @@ -358,7 +358,8 @@ public function thePaymentMethodWithElementValueShouldNotBeAdded(string $element public function thisPaymentMethodNameShouldStillBeNamed(string $paymentMethodName): void { Assert::inArray( - $paymentMethodName, $this->getPaymentMethodNamesFromCollection(), + $paymentMethodName, + $this->getPaymentMethodNamesFromCollection(), sprintf('Payment method with name %s does not exist', $paymentMethodName), ); } diff --git a/src/Sylius/Behat/Context/Api/Admin/ManagingPromotionCouponsContext.php b/src/Sylius/Behat/Context/Api/Admin/ManagingPromotionCouponsContext.php index d13e56e2e7a..7f69b4ed5c9 100644 --- a/src/Sylius/Behat/Context/Api/Admin/ManagingPromotionCouponsContext.php +++ b/src/Sylius/Behat/Context/Api/Admin/ManagingPromotionCouponsContext.php @@ -339,7 +339,7 @@ public function thereShouldStillBeOnlyOneCouponWithCodeRelatedTo(string $code, P $coupons = $this->responseChecker->getCollectionItemsWithValue( $this->client->subResourceIndex(Resources::PROMOTIONS, Resources::PROMOTION_COUPONS, $promotion->getCode()), 'code', - $code + $code, ); Assert::count($coupons, 1); diff --git a/src/Sylius/Behat/Context/Api/Admin/ManagingPromotionsContext.php b/src/Sylius/Behat/Context/Api/Admin/ManagingPromotionsContext.php index 9988dddab9e..be6b1735a95 100644 --- a/src/Sylius/Behat/Context/Api/Admin/ManagingPromotionsContext.php +++ b/src/Sylius/Behat/Context/Api/Admin/ManagingPromotionsContext.php @@ -177,7 +177,7 @@ public function iSpecifyItsLabelWithAStringExceedingTheLimitInLocale(string $loc public function iAddTheActionConfiguredWithAmountForChannel( string $actionType, int $amount, - ChannelInterface $channel + ChannelInterface $channel, ): void { $actionTypeMapping = [ 'Order fixed discount' => FixedDiscountPromotionActionCommand::TYPE, @@ -214,8 +214,8 @@ public function iAddTheActionConfiguredWithAPercentageValueForChannel( /** * @When I add the "Item percentage discount" action configured without a percentage value for :channel channel */ - public function iAddTheActionConfiguredWithoutAPercentageValueForChannel(ChannelInterface $channel): void { - + public function iAddTheActionConfiguredWithoutAPercentageValueForChannel(ChannelInterface $channel): void + { $this->addToRequestAction( UnitPercentageDiscountPromotionActionCommand::TYPE, [ @@ -358,7 +358,7 @@ public function iAddTheRuleConfiguredWith(TaxonInterface $taxon, int $amount, Ch public function iAddTheItemTotalRuleConfiguredWithTwoChannel( int $firstAmount, ChannelInterface $firstChannel, - int$secondAmount, + int $secondAmount, ChannelInterface $secondChannel, ): void { $this->addToRequestRule( @@ -640,7 +640,7 @@ public function iShouldNotBeAbleToEditItsCode(): void public function thePromotionShouldBeAvailableFromTo( PromotionInterface $promotion, \DateTimeInterface $startsDate, - \DateTimeInterface $endsDate + \DateTimeInterface $endsDate, ): void { Assert::true( $this->responseChecker->hasItemWithValues( @@ -650,7 +650,7 @@ public function thePromotionShouldBeAvailableFromTo( 'startsAt' => $startsDate->format('Y-m-d H:i:s'), 'endsAt' => $endsDate->format('Y-m-d H:i:s'), ], - ) + ), ); } @@ -680,6 +680,7 @@ public function thePromotionsShouldHavePriority(PromotionInterface $promotion, i ), ); } + /** * @Then I should be notified that it is in use and cannot be deleted */ @@ -836,7 +837,7 @@ private function addToRequestAction(string $type, array $configuration): void $this->client->updateRequestData($data); } - private function getActions(): array + private function getActions(): array { return $this->client->getContent()['actions']; } diff --git a/src/Sylius/Behat/Context/Setup/PromotionContext.php b/src/Sylius/Behat/Context/Setup/PromotionContext.php index 42a412f51cb..398046b3d61 100644 --- a/src/Sylius/Behat/Context/Setup/PromotionContext.php +++ b/src/Sylius/Behat/Context/Setup/PromotionContext.php @@ -193,7 +193,7 @@ public function thereIsPromotionWithCoupon(string $promotionName, string $coupon [ 'code' => $couponCode, 'usage_limit' => $usageLimit, - ] + ], ], couponBased: true, startsAt: (new \DateTime('-3 day'))->format('Y-m-d'), diff --git a/src/Sylius/Behat/Context/Ui/Admin/ManagingPromotionsContext.php b/src/Sylius/Behat/Context/Ui/Admin/ManagingPromotionsContext.php index 03d8acfd24e..ca2b958299e 100644 --- a/src/Sylius/Behat/Context/Ui/Admin/ManagingPromotionsContext.php +++ b/src/Sylius/Behat/Context/Ui/Admin/ManagingPromotionsContext.php @@ -237,7 +237,7 @@ public function iAddTheActionConfiguredWithAPercentageValueForChannel( */ public function iAddTheActionConfiguredWithoutAPercentageValueForChannel( string $actionType, - ChannelInterface $channel + ChannelInterface $channel, ): void { $this->createPage->addAction($actionType); $this->createPage->fillActionOptionForChannel($channel->getCode(), 'Percentage', ''); diff --git a/src/Sylius/Behat/Context/Ui/Shop/CartContext.php b/src/Sylius/Behat/Context/Ui/Shop/CartContext.php index 9e8d535a95b..980234772d0 100644 --- a/src/Sylius/Behat/Context/Ui/Shop/CartContext.php +++ b/src/Sylius/Behat/Context/Ui/Shop/CartContext.php @@ -67,7 +67,7 @@ public function iveBeenGoneForLongTime(): void * @When I update my cart * @When I try to update my cart */ - public function iUpdateMyCart() + public function iUpdateMyCart(): void { $this->summaryPage->updateCart(); } @@ -85,7 +85,7 @@ public function iProceedToTheCheckout(): void * @Then my cart should be cleared * @Then cart should be empty with no value */ - public function iShouldBeNotifiedThatMyCartIsEmpty() + public function iShouldBeNotifiedThatMyCartIsEmpty(): void { $this->summaryPage->open(); @@ -117,7 +117,7 @@ public function iRemoveVariantFromTheCart(ProductVariantInterface $variant): voi * @Given I change product :productName quantity to :quantity * @Given I change product :productName quantity to :quantity in my cart */ - public function iChangeQuantityTo($productName, $quantity) + public function iChangeQuantityTo(string $productName, string $quantity): void { $this->summaryPage->open(); $this->summaryPage->changeQuantity($productName, $quantity); @@ -129,7 +129,7 @@ public function iChangeQuantityTo($productName, $quantity) * @Then the cart total should be :total * @Then their cart total should be :total */ - public function myCartTotalShouldBe($total) + public function myCartTotalShouldBe(string $total): void { $this->summaryPage->open(); @@ -139,7 +139,7 @@ public function myCartTotalShouldBe($total) /** * @Then the grand total value in base currency should be :total */ - public function myBaseCartTotalShouldBe($total) + public function myBaseCartTotalShouldBe(string $total): void { $this->summaryPage->open(); @@ -210,7 +210,7 @@ public function iShouldNotSeeShippingTotalForMyCart(): void /** * @Then my discount should be :promotionsTotal */ - public function myDiscountShouldBe($promotionsTotal) + public function myDiscountShouldBe(string $promotionsTotal): void { $this->summaryPage->open(); @@ -220,7 +220,7 @@ public function myDiscountShouldBe($promotionsTotal) /** * @Given /^there should be no shipping fee$/ */ - public function thereShouldBeNoShippingFee() + public function thereShouldBeNoShippingFee(): void { $this->summaryPage->open(); @@ -236,7 +236,7 @@ public function thereShouldBeNoShippingFee() /** * @Given /^there should be no discount$/ */ - public function thereShouldBeNoDiscount() + public function thereShouldBeNoDiscount(): void { $this->summaryPage->open(); @@ -254,7 +254,7 @@ public function thereShouldBeNoDiscount() * @Then /^(its|theirs) subtotal price should be decreased by ("[^"]+")$/ * @Then /^(product "[^"]+") price should be decreased by ("[^"]+")$/ */ - public function itsPriceShouldBeDecreasedBy(ProductInterface $product, $amount) + public function itsPriceShouldBeDecreasedBy(ProductInterface $product, int $amount): void { $this->summaryPage->open(); @@ -268,7 +268,7 @@ public function itsPriceShouldBeDecreasedBy(ProductInterface $product, $amount) /** * @Then /^(product "[^"]+") price should be discounted by ("[^"]+")$/ */ - public function itsPriceShouldBeDiscountedBy(ProductInterface $product, $amount) + public function itsPriceShouldBeDiscountedBy(ProductInterface $product, int $amount): void { $this->summaryPage->open(); @@ -282,7 +282,7 @@ public function itsPriceShouldBeDiscountedBy(ProductInterface $product, $amount) /** * @Then /^(product "[^"]+") price should not be decreased$/ */ - public function productPriceShouldNotBeDecreased(ProductInterface $product) + public function productPriceShouldNotBeDecreased(ProductInterface $product): void { $this->summaryPage->open(); @@ -312,8 +312,10 @@ public function iAddProductToTheCart(ProductInterface $product): void /** * @When /^I add (products "([^"]+)" and "([^"]+)") to the cart$/ * @When /^I add (products "([^"]+)", "([^"]+)" and "([^"]+)") to the cart$/ + * + * @param ProductInterface[] $products */ - public function iAddMultipleProductsToTheCart(array $products) + public function iAddMultipleProductsToTheCart(array $products): void { foreach ($products as $product) { $this->iAddProductToTheCart($product); @@ -322,6 +324,8 @@ public function iAddMultipleProductsToTheCart(array $products) /** * @When /^an anonymous user in another browser adds (products "([^"]+)" and "([^"]+)") to the cart$/ + * + * @param ProductInterface[] $products */ public function anonymousUserAddsMultipleProductsToTheCart(array $products): void { @@ -338,7 +342,7 @@ public function anonymousUserAddsMultipleProductsToTheCart(array $products): voi * @Given I have :variantName variant of product :product in the cart * @Given /^I have "([^"]+)" variant of (this product) in the cart$/ */ - public function iAddProductToTheCartSelectingVariant($variantName, ProductInterface $product) + public function iAddProductToTheCartSelectingVariant(string $variantName, ProductInterface $product): void { $this->productShowPage->open(['slug' => $product->getSlug()]); $this->productShowPage->addToCartWithVariant($variantName); @@ -356,7 +360,7 @@ public function iAddProductToTheCartSelectingVariant($variantName, ProductInterf /** * @When /^I add (\d+) of (them) to (?:the|my) cart$/ */ - public function iAddQuantityOfProductsToTheCart($quantity, ProductInterface $product) + public function iAddQuantityOfProductsToTheCart(string $quantity, ProductInterface $product): void { $this->productShowPage->open(['slug' => $product->getSlug()]); $this->productShowPage->addToCartWithQuantity($quantity); @@ -366,7 +370,7 @@ public function iAddQuantityOfProductsToTheCart($quantity, ProductInterface $pro * @Given /^I have(?:| added) (\d+) (product(?:|s) "([^"]+)") (?:to|in) the cart$/ * @When /^I add(?:|ed)(?:| again) (\d+) (products "([^"]+)") to the cart$/ */ - public function iAddProductsToTheCart($quantity, ProductInterface $product) + public function iAddProductsToTheCart(string $quantity, ProductInterface $product): void { $this->productShowPage->open(['slug' => $product->getSlug()]); $this->productShowPage->addToCartWithQuantity($quantity); @@ -386,7 +390,7 @@ public function iSpecifyQuantityToInMyCart(string $productName, int $quantity): * @Then /^I should be(?: on| redirected to) my cart summary page$/ * @Then I should not be able to address an order with an empty cart */ - public function shouldBeOnMyCartSummaryPage() + public function shouldBeOnMyCartSummaryPage(): void { $this->summaryPage->waitForRedirect(3); @@ -396,7 +400,7 @@ public function shouldBeOnMyCartSummaryPage() /** * @Then I should be notified that the product has been successfully added */ - public function iShouldBeNotifiedThatItHasBeenSuccessfullyAdded() + public function iShouldBeNotifiedThatItHasBeenSuccessfullyAdded(): void { $this->notificationChecker->checkNotification('Item has been added to cart', NotificationType::success()); } @@ -404,7 +408,7 @@ public function iShouldBeNotifiedThatItHasBeenSuccessfullyAdded() /** * @Then there should be one item in my cart */ - public function thereShouldBeOneItemInMyCart() + public function thereShouldBeOneItemInMyCart(): void { Assert::true($this->summaryPage->isSingleItemOnPage()); } @@ -412,7 +416,7 @@ public function thereShouldBeOneItemInMyCart() /** * @Then this item should have name :itemName */ - public function thisProductShouldHaveName($itemName) + public function thisProductShouldHaveName(string $itemName): void { Assert::true($this->summaryPage->hasItemNamed($itemName)); } @@ -420,7 +424,7 @@ public function thisProductShouldHaveName($itemName) /** * @Then this item should have variant :variantName */ - public function thisItemShouldHaveVariant($variantName) + public function thisItemShouldHaveVariant(string $variantName): void { Assert::true($this->summaryPage->hasItemWithVariantNamed($variantName)); } @@ -428,7 +432,7 @@ public function thisItemShouldHaveVariant($variantName) /** * @Then this item should have code :variantCode */ - public function thisItemShouldHaveCode($variantCode) + public function thisItemShouldHaveCode(string $variantCode): void { Assert::true($this->summaryPage->hasItemWithCode($variantCode)); } @@ -461,7 +465,7 @@ public function iAddThisProductWithToTheCart( /** * @Given /^(this product) should have ([^"]+) "([^"]+)"$/ */ - public function thisItemShouldHaveOptionValue(ProductInterface $product, $optionName, $optionValue) + public function thisItemShouldHaveOptionValue(ProductInterface $product, string $optionName, string $optionValue): void { Assert::true($this->summaryPage->hasItemWithOptionValue($product->getName(), $optionName, $optionValue)); } @@ -469,7 +473,7 @@ public function thisItemShouldHaveOptionValue(ProductInterface $product, $option /** * @When I clear my cart */ - public function iClearMyCart() + public function iClearMyCart(): void { $this->summaryPage->clearCart(); } @@ -477,9 +481,9 @@ public function iClearMyCart() /** * @Then /^I should see "([^"]+)" with quantity (\d+) in my cart$/ */ - public function iShouldSeeWithQuantityInMyCart($productName, $quantity) + public function iShouldSeeWithQuantityInMyCart(string $productName, int $quantity): void { - Assert::same($this->summaryPage->getQuantity($productName), (int) $quantity); + Assert::same($this->summaryPage->getQuantity($productName), $quantity); } /** @@ -495,7 +499,7 @@ public function iShouldSeeProductWithUnitPriceInMyCart(string $productName, int /** * @Then /^the product "([^"]+)" should have total price ("[^"]+") in the cart$/ */ - public function theProductShouldHaveTotalPrice(string $productName, int $totalPrice): void + public function theProductShouldHaveTotalPrice(string $productName, string $totalPrice): void { Assert::same($this->summaryPage->getItemTotal($productName), $totalPrice); } @@ -520,7 +524,7 @@ public function iShouldSeeOnlyWithUnitPriceInMyCart(string $productName, int $un /** * @Given I use coupon with code :couponCode */ - public function iUseCouponWithCode($couponCode) + public function iUseCouponWithCode(string $couponCode): void { $this->summaryPage->applyCoupon($couponCode); } @@ -528,7 +532,7 @@ public function iUseCouponWithCode($couponCode) /** * @Then I should be notified that the coupon is invalid */ - public function iShouldBeNotifiedThatCouponIsInvalid() + public function iShouldBeNotifiedThatCouponIsInvalid(): void { Assert::same($this->summaryPage->getPromotionCouponValidationMessage(), 'Coupon code is invalid.'); } @@ -536,7 +540,7 @@ public function iShouldBeNotifiedThatCouponIsInvalid() /** * @Then total price of :productName item should be :productPrice */ - public function thisItemPriceShouldBe($productName, $productPrice) + public function thisItemPriceShouldBe(string $productName, string $productPrice): void { $this->summaryPage->open(); @@ -546,7 +550,7 @@ public function thisItemPriceShouldBe($productName, $productPrice) /** * @Then /^I should be notified that (this product) has insufficient stock$/ */ - public function iShouldBeNotifiedThatThisProductDoesNotHaveSufficientStock(ProductInterface $product) + public function iShouldBeNotifiedThatThisProductDoesNotHaveSufficientStock(ProductInterface $product): void { Assert::true($this->summaryPage->hasItemWithInsufficientStock($product->getName())); } @@ -554,7 +558,7 @@ public function iShouldBeNotifiedThatThisProductDoesNotHaveSufficientStock(Produ /** * @Then /^I should not be notified that (this product) cannot be updated$/ */ - public function iShouldNotBeNotifiedThatThisProductCannotBeUpdated(ProductInterface $product) + public function iShouldNotBeNotifiedThatThisProductCannotBeUpdated(ProductInterface $product): void { Assert::false($this->summaryPage->hasProductOutOfStockValidationMessage($product)); } @@ -562,7 +566,7 @@ public function iShouldNotBeNotifiedThatThisProductCannotBeUpdated(ProductInterf /** * @Then my cart's total should be :total */ - public function myCartSTotalShouldBe($total) + public function myCartSTotalShouldBe(string $total): void { $this->summaryPage->open(); diff --git a/src/Sylius/Behat/Element/Admin/Promotion/FormElement.php b/src/Sylius/Behat/Element/Admin/Promotion/FormElement.php index d0c0c89958b..dd24b30e41a 100644 --- a/src/Sylius/Behat/Element/Admin/Promotion/FormElement.php +++ b/src/Sylius/Behat/Element/Admin/Promotion/FormElement.php @@ -13,12 +13,7 @@ namespace Sylius\Behat\Element\Admin\Promotion; -use Behat\Mink\Element\NodeElement; -use Behat\Mink\Exception\ElementNotFoundException; use FriendsOfBehat\PageObjectExtension\Element\Element; -use Sylius\Behat\Service\TabsHelper; -use Sylius\Component\Core\Model\ChannelInterface; -use Webmozart\Assert\Assert; final class FormElement extends Element implements FormElementInterface { diff --git a/src/Sylius/Bundle/ApiBundle/Filter/Doctrine/PromotionCouponPromotionFilter.php b/src/Sylius/Bundle/ApiBundle/Filter/Doctrine/PromotionCouponPromotionFilter.php index 3c0e2b23635..a9d5d2c1bb2 100644 --- a/src/Sylius/Bundle/ApiBundle/Filter/Doctrine/PromotionCouponPromotionFilter.php +++ b/src/Sylius/Bundle/ApiBundle/Filter/Doctrine/PromotionCouponPromotionFilter.php @@ -25,7 +25,7 @@ final class PromotionCouponPromotionFilter extends AbstractContextAwareFilter { - const PROPERTY = 'promotion'; + public const PROPERTY = 'promotion'; /** @param array $properties */ public function __construct( diff --git a/src/Sylius/Bundle/ApiBundle/OpenApi/Documentation/PromotionDocumentationModifier.php b/src/Sylius/Bundle/ApiBundle/OpenApi/Documentation/PromotionDocumentationModifier.php index 5517ae8e5d4..f772ad4ad3b 100644 --- a/src/Sylius/Bundle/ApiBundle/OpenApi/Documentation/PromotionDocumentationModifier.php +++ b/src/Sylius/Bundle/ApiBundle/OpenApi/Documentation/PromotionDocumentationModifier.php @@ -19,8 +19,9 @@ /** @experimental */ final class PromotionDocumentationModifier implements DocumentationModifierInterface { - const ROUTE_ADMIN_PROMOTIONS = '/admin/promotions'; - const ROUTE_ADMIN_PROMOTION = '/admin/promotions/{code}'; + public const ROUTE_ADMIN_PROMOTIONS = '/admin/promotions'; + + public const ROUTE_ADMIN_PROMOTION = '/admin/promotions/{code}'; /** * @param string[] $actionTypes diff --git a/src/Sylius/Bundle/ApiBundle/Serializer/CommandDenormalizer.php b/src/Sylius/Bundle/ApiBundle/Serializer/CommandDenormalizer.php index 1e6d46bf779..af5b95f42d3 100644 --- a/src/Sylius/Bundle/ApiBundle/Serializer/CommandDenormalizer.php +++ b/src/Sylius/Bundle/ApiBundle/Serializer/CommandDenormalizer.php @@ -40,7 +40,7 @@ public function denormalize($data, $type, $format = null, array $context = []) $previousException = $exception->getPrevious(); if ($previousException instanceof NotNormalizableValueException) { throw new InvalidRequestArgumentException( - sprintf('Request field "%s" should be of type "%s".', $previousException->getPath(), implode(', ', $previousException->getExpectedTypes())) + sprintf('Request field "%s" should be of type "%s".', $previousException->getPath(), implode(', ', $previousException->getExpectedTypes())), ); } diff --git a/src/Sylius/Bundle/ApiBundle/spec/Serializer/CommandDenormalizerSpec.php b/src/Sylius/Bundle/ApiBundle/spec/Serializer/CommandDenormalizerSpec.php index e8a9b75a2c9..252f75e4b11 100644 --- a/src/Sylius/Bundle/ApiBundle/spec/Serializer/CommandDenormalizerSpec.php +++ b/src/Sylius/Bundle/ApiBundle/spec/Serializer/CommandDenormalizerSpec.php @@ -14,15 +14,11 @@ namespace spec\Sylius\Bundle\ApiBundle\Serializer; use PhpSpec\ObjectBehavior; -use Prophecy\Argument; use Sylius\Bundle\ApiBundle\Command\Account\RegisterShopUser; -use Sylius\Bundle\ApiBundle\Command\Account\VerifyCustomerAccount; use Sylius\Bundle\ApiBundle\Exception\InvalidRequestArgumentException; -use Sylius\Component\Core\Model\Customer; use Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException; use Symfony\Component\Serializer\Exception\NotNormalizableValueException; use Symfony\Component\Serializer\Exception\UnexpectedValueException; -use Symfony\Component\Serializer\NameConverter\NameConverterInterface; use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; diff --git a/src/Sylius/Bundle/CoreBundle/Fixture/Factory/PromotionExampleFactory.php b/src/Sylius/Bundle/CoreBundle/Fixture/Factory/PromotionExampleFactory.php index 9f28d425e60..90c17fab735 100644 --- a/src/Sylius/Bundle/CoreBundle/Fixture/Factory/PromotionExampleFactory.php +++ b/src/Sylius/Bundle/CoreBundle/Fixture/Factory/PromotionExampleFactory.php @@ -16,7 +16,6 @@ use Faker\Factory; use Faker\Generator; use Sylius\Bundle\CoreBundle\Fixture\OptionsResolver\LazyOption; -use Sylius\Component\Channel\Model\ChannelInterface; use Sylius\Component\Channel\Repository\ChannelRepositoryInterface; use Sylius\Component\Core\Formatter\StringInflector; use Sylius\Component\Core\Model\PromotionCouponInterface; @@ -197,7 +196,7 @@ private static function getCouponNormalizer(?FactoryInterface $couponFactory): \ }; } - /** @return iterable */ + /** @return iterable */ private function getLocales(): iterable { if (null === $this->localeRepository) { diff --git a/src/Sylius/Bundle/CoreBundle/Validator/Constraints/ChannelCodeCollection.php b/src/Sylius/Bundle/CoreBundle/Validator/Constraints/ChannelCodeCollection.php index 2288e489e6d..0d4cb81f422 100644 --- a/src/Sylius/Bundle/CoreBundle/Validator/Constraints/ChannelCodeCollection.php +++ b/src/Sylius/Bundle/CoreBundle/Validator/Constraints/ChannelCodeCollection.php @@ -19,9 +19,13 @@ final class ChannelCodeCollection extends Constraint { /** @var array */ public array $constraints = []; + public bool $allowExtraFields = false; + public bool $allowMissingFields = false; + public ?string $extraFieldsMessage = null; + public ?string $missingFieldsMessage = null; public function validatedBy(): string diff --git a/src/Sylius/Bundle/CoreBundle/Validator/Constraints/ChannelCodeCollectionValidator.php b/src/Sylius/Bundle/CoreBundle/Validator/Constraints/ChannelCodeCollectionValidator.php index db1e2fd7e8a..94e9939588d 100644 --- a/src/Sylius/Bundle/CoreBundle/Validator/Constraints/ChannelCodeCollectionValidator.php +++ b/src/Sylius/Bundle/CoreBundle/Validator/Constraints/ChannelCodeCollectionValidator.php @@ -28,7 +28,7 @@ public function __construct(private ChannelRepositoryInterface $channelRepositor { } - /** @param null|array $value */ + /** @param mixed $value */ public function validate($value, Constraint $constraint): void { if (!$constraint instanceof ChannelCodeCollection) { diff --git a/src/Sylius/Bundle/CoreBundle/Validator/Constraints/CustomerGroupCodeExistsValidator.php b/src/Sylius/Bundle/CoreBundle/Validator/Constraints/CustomerGroupCodeExistsValidator.php index 4f028fc20a0..ae6009d2f83 100644 --- a/src/Sylius/Bundle/CoreBundle/Validator/Constraints/CustomerGroupCodeExistsValidator.php +++ b/src/Sylius/Bundle/CoreBundle/Validator/Constraints/CustomerGroupCodeExistsValidator.php @@ -26,7 +26,7 @@ public function __construct(private CustomerGroupRepositoryInterface $customerGr { } - public function validate(mixed$value, Constraint $constraint): void + public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof CustomerGroupCodeExists) { throw new UnexpectedTypeException($constraint, CustomerGroupCodeExists::class); diff --git a/tests/Api/Admin/AdminUsersTest.php b/tests/Api/Admin/AdminUsersTest.php index 336351628c8..716537cc47a 100644 --- a/tests/Api/Admin/AdminUsersTest.php +++ b/tests/Api/Admin/AdminUsersTest.php @@ -34,8 +34,8 @@ public function it_allows_admin_users_to_log_in(): void server: self::CONTENT_TYPE_HEADER, content: json_encode([ 'email' => 'api@example.com', - 'password' => 'sylius' - ], JSON_THROW_ON_ERROR), + 'password' => 'sylius', + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -54,7 +54,7 @@ public function it_sends_administrator_password_reset_email(): void server: self::CONTENT_TYPE_HEADER, content: json_encode([ 'email' => 'api@example.com', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -116,7 +116,7 @@ public function it_creates_an_administrator(): void 'firstName' => 'John', 'lastName' => 'Api', 'localeCode' => 'ga_IE', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -147,7 +147,7 @@ public function it_updates_an_administrator(): void 'firstName' => 'John', 'lastName' => 'Api', 'localeCode' => 'ga_IE', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/CatalogPromotionsTest.php b/tests/Api/Admin/CatalogPromotionsTest.php index 32a2af7aeb5..5b9de01a71a 100644 --- a/tests/Api/Admin/CatalogPromotionsTest.php +++ b/tests/Api/Admin/CatalogPromotionsTest.php @@ -114,7 +114,7 @@ public function it_creates_a_catalog_promotion(): void 'enabled' => true, 'exclusive' => false, 'priority' => 100, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -134,7 +134,7 @@ public function it_does_not_create_a_catalog_promotion_without_required_data(): method: 'POST', uri: '/api/v2/admin/catalog-promotions', server: $header, - content: json_encode([], JSON_THROW_ON_ERROR), + content: json_encode([], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -157,7 +157,7 @@ public function it_does_not_create_a_catalog_promotion_with_taken_code(): void content: json_encode([ 'name' => 'Mugs discount', 'code' => 'mugs_discount', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -182,7 +182,7 @@ public function it_does_not_create_a_catalog_promotion_with_end_date_earlier_tha 'code' => 'catalog_promotion', 'startDate' => '2021-11-04 10:42:00', 'endDate' => '2021-10-04 10:42:00', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -275,7 +275,7 @@ public function it_does_not_create_a_catalog_promotion_with_invalid_scopes(): vo ]], 'enabled' => true, 'exclusive' => false, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -373,7 +373,7 @@ public function it_does_not_create_a_catalog_promotion_with_invalid_actions(): v ]], 'enabled' => true, 'exclusive' => false, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -424,7 +424,7 @@ public function it_updates_catalog_promotion(): void 'enabled' => true, 'exclusive' => false, 'priority' => 1000, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/ChannelPriceHistoryConfigTest.php b/tests/Api/Admin/ChannelPriceHistoryConfigTest.php index 2f03cd1fe67..70b02677edd 100644 --- a/tests/Api/Admin/ChannelPriceHistoryConfigTest.php +++ b/tests/Api/Admin/ChannelPriceHistoryConfigTest.php @@ -33,7 +33,7 @@ public function it_gets_a_channel_price_history_config(): void $this->assertResponse( $this->client->getResponse(), 'admin/get_channel_price_history_config_response', - Response::HTTP_OK + Response::HTTP_OK, ); } @@ -54,13 +54,13 @@ public function it_updates_a_channel_price_history_config(): void 'taxonsExcludedFromShowingLowestPrice' => [ sprintf('/api/v2/admin/taxons/%s', $brandTaxon->getCode()), ], - ], JSON_THROW_ON_ERROR) + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( $this->client->getResponse(), 'admin/put_channel_price_history_config_response', - Response::HTTP_OK + Response::HTTP_OK, ); } } diff --git a/tests/Api/Admin/ChannelPricingLogEntryTest.php b/tests/Api/Admin/ChannelPricingLogEntryTest.php index bf216259243..d044c7849b5 100644 --- a/tests/Api/Admin/ChannelPricingLogEntryTest.php +++ b/tests/Api/Admin/ChannelPricingLogEntryTest.php @@ -58,7 +58,7 @@ public function it_gets_single_channel_pricing_log_entry(): void $this->assertResponse( $this->client->getResponse(), 'admin/get_channel_pricing_log_entry_response', - Response::HTTP_OK + Response::HTTP_OK, ); } @@ -76,7 +76,7 @@ public function it_gets_all_channel_pricing_log_entries(): void $this->assertResponse( $this->client->getResponse(), 'admin/get_channel_pricing_log_entries_response', - Response::HTTP_OK + Response::HTTP_OK, ); } @@ -98,7 +98,7 @@ public function it_gets_filtered_channel_pricing_log_entries(): void $this->assertResponse( $this->client->getResponse(), 'admin/get_filtered_channel_pricing_log_entries_response', - Response::HTTP_OK + Response::HTTP_OK, ); } } diff --git a/tests/Api/Admin/ChannelsTest.php b/tests/Api/Admin/ChannelsTest.php index 7591bea4863..85d348992f5 100644 --- a/tests/Api/Admin/ChannelsTest.php +++ b/tests/Api/Admin/ChannelsTest.php @@ -95,7 +95,7 @@ public function it_prevents_deleting_the_only_channel(): void $this->assertResponse( $this->client->getResponse(), 'admin/channel/delete_channel_that_cannot_be_deleted', - Response::HTTP_UNPROCESSABLE_ENTITY + Response::HTTP_UNPROCESSABLE_ENTITY, ); } @@ -148,8 +148,7 @@ public function it_creates_a_channel(): void 'accountVerificationRequired' => true, 'shippingAddressInCheckoutRequired' => false, 'menuTaxon' => null, - - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -183,7 +182,7 @@ public function it_updates_an_existing_channel(): void 'description' => 'different description', 'hostname' => 'updated-hostname.com', 'color' => 'blue', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -214,9 +213,9 @@ public function it_updates_a_shop_billing_data(): void 'countryCode' => 'DE', 'street' => 'Different Street', 'city' => 'different City', - 'postcode' => '12-124' - ] - ], JSON_THROW_ON_ERROR), + 'postcode' => '12-124', + ], + ], \JSON_THROW_ON_ERROR), ); $this->assertResponseCode( diff --git a/tests/Api/Admin/CountriesTest.php b/tests/Api/Admin/CountriesTest.php index 648557d4752..17a1665e473 100644 --- a/tests/Api/Admin/CountriesTest.php +++ b/tests/Api/Admin/CountriesTest.php @@ -72,7 +72,7 @@ public function it_creates_a_country(): void content: json_encode([ 'code' => 'IE', 'enabled' => true, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -101,8 +101,8 @@ public function it_updates_an_existing_country(): void 'code' => 'US-WA', 'name' => 'Washington', 'country' => $country->getCode(), - ]] - ], JSON_THROW_ON_ERROR), + ]], + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/CurrenciesTest.php b/tests/Api/Admin/CurrenciesTest.php index 3e24e198f6c..7507107fc59 100644 --- a/tests/Api/Admin/CurrenciesTest.php +++ b/tests/Api/Admin/CurrenciesTest.php @@ -71,7 +71,7 @@ public function it_creates_a_currency(): void server: $header, content: json_encode([ 'code' => 'KRW', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/CustomerGroupsTest.php b/tests/Api/Admin/CustomerGroupsTest.php index 5492e840d95..055416bce40 100644 --- a/tests/Api/Admin/CustomerGroupsTest.php +++ b/tests/Api/Admin/CustomerGroupsTest.php @@ -76,7 +76,7 @@ public function it_creates_a_customer_group(): void content: json_encode([ 'name' => 'Special', 'code' => 'special', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -102,7 +102,7 @@ public function it_updates_an_existing_customer_group(): void server: $header, content: json_encode([ 'name' => 'Very Important People', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/CustomersTest.php b/tests/Api/Admin/CustomersTest.php index 614ec6bf5da..c1358231879 100644 --- a/tests/Api/Admin/CustomersTest.php +++ b/tests/Api/Admin/CustomersTest.php @@ -78,11 +78,11 @@ public function it_creates_a_customer(): void 'email' => 'api@example.com', 'firstName' => 'John', 'lastName' => 'Doe', - 'birthday' => "2023-10-24T11:00:00.000Z", + 'birthday' => '2023-10-24T11:00:00.000Z', 'gender' => 'm', 'phoneNumber' => '+48123456789', 'subscribedToNewsletter' => true, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -114,12 +114,12 @@ public function it_creates_a_customer_with_user(): void 'email' => 'api@example.com', 'firstName' => 'John', 'lastName' => 'Doe', - 'birthday' => "2023-10-24T11:00:00.000Z", + 'birthday' => '2023-10-24T11:00:00.000Z', 'gender' => 'm', 'group' => '/api/v2/admin/customer-groups/' . $group->getCode(), 'phoneNumber' => '+48123456789', 'subscribedToNewsletter' => true, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -141,13 +141,13 @@ public function it_does_not_allow_creating_a_customer_with_invalid_email(): void server: $header, content: json_encode([ 'email' => 'api@com', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( $this->client->getResponse(), 'admin/customer/post_customer_with_invalid_email_response', - Response::HTTP_UNPROCESSABLE_ENTITY + Response::HTTP_UNPROCESSABLE_ENTITY, ); } @@ -165,13 +165,13 @@ public function it_does_not_allow_creating_a_customer_with_invalid_name(): void 'email' => 'api@example.com', 'firstName' => 'J', 'lastName' => 'D', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( $this->client->getResponse(), 'admin/customer/post_customer_with_invalid_name_response', - Response::HTTP_UNPROCESSABLE_ENTITY + Response::HTTP_UNPROCESSABLE_ENTITY, ); } @@ -188,13 +188,13 @@ public function it_does_not_allow_creating_a_customer_with_invalid_gender(): voi content: json_encode([ 'email' => 'api@example.com', 'gender' => 'a', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( $this->client->getResponse(), 'admin/customer/post_customer_with_invalid_gender_response', - Response::HTTP_UNPROCESSABLE_ENTITY + Response::HTTP_UNPROCESSABLE_ENTITY, ); } @@ -223,12 +223,12 @@ public function it_updates_customer(): void 'email' => 'api@example.com', 'firstName' => 'John', 'lastName' => 'Lim', - 'birthday' => "2023-09-24T11:00:00.000Z", + 'birthday' => '2023-09-24T11:00:00.000Z', 'gender' => 'f', 'group' => '/api/v2/admin/customer-groups/' . $group->getCode(), 'phoneNumber' => '+48987654321', 'subscribedToNewsletter' => true, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -253,13 +253,13 @@ public function it_does_not_allow_updating_a_customer_with_invalid_gender(): voi server: $header, content: json_encode([ 'gender' => 'a', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( $this->client->getResponse(), 'admin/customer/update_customer_with_invalid_gender_response', - Response::HTTP_UNPROCESSABLE_ENTITY + Response::HTTP_UNPROCESSABLE_ENTITY, ); } } diff --git a/tests/Api/Admin/ExchangeRatesTest.php b/tests/Api/Admin/ExchangeRatesTest.php index 73ec8eaca18..d515e130590 100644 --- a/tests/Api/Admin/ExchangeRatesTest.php +++ b/tests/Api/Admin/ExchangeRatesTest.php @@ -87,9 +87,9 @@ public function it_creates_an_exchange_rate(): void server: $header, content: json_encode([ 'ratio' => '3.2', - "sourceCurrency" => "/api/v2/admin/currencies/CNY", - "targetCurrency" => "/api/v2/admin/currencies/PLN", - ], JSON_THROW_ON_ERROR), + 'sourceCurrency' => '/api/v2/admin/currencies/CNY', + 'targetCurrency' => '/api/v2/admin/currencies/PLN', + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -112,14 +112,13 @@ public function it_updates_an_existing_exchange_rate(): void /** @var ExchangeRateInterface $exchangeRate */ $exchangeRate = $fixtures['exchange_rate_CNYUSD']; - $this->client->request( method: 'PUT', uri: '/api/v2/admin/exchange-rates/' . $exchangeRate->getId(), server: $header, content: json_encode([ 'ratio' => '0.25', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/LocalesTest.php b/tests/Api/Admin/LocalesTest.php index 5bb92fe6102..40a83f2a858 100644 --- a/tests/Api/Admin/LocalesTest.php +++ b/tests/Api/Admin/LocalesTest.php @@ -36,13 +36,13 @@ public function it_does_not_allow_creating_a_locale_with_invalid_code(): void $header, json_encode([ 'code' => 'lol', - ], JSON_THROW_ON_ERROR) + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( $this->client->getResponse(), 'admin/post_locale_with_invalid_code_response', - Response::HTTP_UNPROCESSABLE_ENTITY + Response::HTTP_UNPROCESSABLE_ENTITY, ); } @@ -102,7 +102,7 @@ public function it_creates_a_locale(): void server: $header, content: json_encode([ 'code' => 'is_IS', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/OrdersTest.php b/tests/Api/Admin/OrdersTest.php index 089b4218b23..ac20eefa0fe 100644 --- a/tests/Api/Admin/OrdersTest.php +++ b/tests/Api/Admin/OrdersTest.php @@ -115,14 +115,14 @@ public function it_updates_a_billing_address_of_placed_order(): void content: json_encode([ 'firstName' => 'Updated: Adam', 'lastName' => 'Updated: Handley', - 'company'=> 'Updated: FMŻ', + 'company' => 'Updated: FMŻ', 'street' => 'Updated: Kościuszki 21', 'countryCode' => 'Updated: FR', 'city' => 'Updated: Bordeaux', 'postcode' => 'Updated: 99-999', 'phoneNumber' => 'Updated: 911213969', 'provinceCode' => 'Updated: PL-WP', - 'provinceName' => 'Updated: wielkopolskie' + 'provinceName' => 'Updated: wielkopolskie', ]), ); @@ -221,7 +221,7 @@ public function it_updated_a_shipping_address_of_placed_order(): void 'postcode' => 'Updated: 00-001', 'phoneNumber' => 'Updated: 48222333444', 'provinceCode' => 'Updated: PL-MA', - 'provinceName' => 'Updated: mazowieckie' + 'provinceName' => 'Updated: mazowieckie', ]), ); diff --git a/tests/Api/Admin/PaymentMethodsTest.php b/tests/Api/Admin/PaymentMethodsTest.php index a12bb285cf8..b81c89d770f 100644 --- a/tests/Api/Admin/PaymentMethodsTest.php +++ b/tests/Api/Admin/PaymentMethodsTest.php @@ -14,7 +14,6 @@ namespace Sylius\Tests\Api\Admin; use Sylius\Component\Core\Model\PaymentMethodInterface; -use Sylius\Component\Core\Model\ShippingMethodInterface; use Sylius\Tests\Api\JsonApiTestCase; use Sylius\Tests\Api\Utils\AdminUserLoginTrait; use Symfony\Component\HttpFoundation\Response; diff --git a/tests/Api/Admin/ProductAssociationTypesTest.php b/tests/Api/Admin/ProductAssociationTypesTest.php index b67d965ee5f..fdf50247cf3 100644 --- a/tests/Api/Admin/ProductAssociationTypesTest.php +++ b/tests/Api/Admin/ProductAssociationTypesTest.php @@ -90,8 +90,8 @@ public function it_creates_product_association_type(): void 'translations' => ['en_US' => [ 'name' => 'test', 'description' => 'test description', - ]] - ], JSON_THROW_ON_ERROR), + ]], + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -142,10 +142,10 @@ public function it_updates_product_association_type(): void ], 'de_DE' => [ 'name' => 'test', - 'description' => 'test description' + 'description' => 'test description', ], - ] - ], JSON_THROW_ON_ERROR), + ], + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/ProductAttributesTest.php b/tests/Api/Admin/ProductAttributesTest.php index 7e2cfc6b635..2e2321ee93f 100644 --- a/tests/Api/Admin/ProductAttributesTest.php +++ b/tests/Api/Admin/ProductAttributesTest.php @@ -113,7 +113,7 @@ public function it_creates_a_text_product_attribute(): void 'name' => 'Material', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -142,7 +142,7 @@ public function it_creates_a_textarea_product_attribute(): void 'name' => 'Material', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -171,7 +171,7 @@ public function it_creates_a_checkbox_product_attribute(): void 'name' => 'New', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -200,7 +200,7 @@ public function it_creates_an_integer_product_attribute(): void 'name' => 'Pages', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -229,7 +229,7 @@ public function it_creates_a_float_product_attribute(): void 'name' => 'Display size', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -258,7 +258,7 @@ public function it_creates_a_percent_product_attribute(): void 'name' => 'Damage reduction', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -290,7 +290,7 @@ public function it_creates_a_datetime_product_attribute(): void 'name' => 'Published at', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -322,7 +322,7 @@ public function it_creates_a_date_product_attribute(): void 'name' => 'Published at', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -365,7 +365,7 @@ public function it_creates_a_select_product_attribute(): void 'name' => 'Material', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -413,7 +413,7 @@ public function it_does_not_create_a_product_attribute_with_unregistered_type(): 'name' => 'Test', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -446,7 +446,7 @@ public function it_does_not_create_a_text_product_attribute_with_invalid_configu 'name' => 'Material', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -489,7 +489,7 @@ public function it_does_not_create_a_select_product_attribute_with_disabled_mult 'name' => 'Material', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -532,7 +532,7 @@ public function it_does_not_create_a_select_product_attribute_with_invalid_max_e 'name' => 'Material', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -574,7 +574,7 @@ public function it_does_not_create_a_select_product_attribute_with_invalid_min_e 'name' => 'Material', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -607,7 +607,7 @@ public function it_updates_a_product_attribute(): void 'fr_FR' => 'fait la main', ], '0afb4e88-cd08-11ec-bcd4-0242ac120005' => [ - 'fr_FR' => 'coffret cadeau', + 'fr_FR' => 'coffret cadeau', 'en_US' => 'gift wrapping', 'pl_PL' => 'pakowanie na prezent', ], @@ -632,8 +632,8 @@ public function it_updates_a_product_attribute(): void 'pl_PL' => [ 'name' => 'Dodatkowe informacje', ], - ] - ], JSON_THROW_ON_ERROR), + ], + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -661,7 +661,7 @@ public function it_does_not_update_the_code_and_type_of_existing_product_attribu content: json_encode([ 'code' => 'NEW_CODE', 'type' => TextAreaAttributeType::TYPE, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/ProductImagesTest.php b/tests/Api/Admin/ProductImagesTest.php index ff3deddb554..70fba28b0c5 100644 --- a/tests/Api/Admin/ProductImagesTest.php +++ b/tests/Api/Admin/ProductImagesTest.php @@ -239,7 +239,7 @@ public function it_updates_only_the_type_and_variants_of_the_existing_product_im sprintf('/api/v2/admin/product-variants/%s', $productVariantBlue->getCode()), sprintf('/api/v2/admin/product-variants/%s', $productVariantRed->getCode()), ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -269,7 +269,7 @@ public function it_prevents_product_image_update_with_unrelated_variant(): void 'productVariants' => [ sprintf('/api/v2/admin/product-variants/%s', $productVariant->getCode()), ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/ProductReviewsTest.php b/tests/Api/Admin/ProductReviewsTest.php index 1e3f5b4e544..1129fe27e91 100644 --- a/tests/Api/Admin/ProductReviewsTest.php +++ b/tests/Api/Admin/ProductReviewsTest.php @@ -121,7 +121,7 @@ public function it_updates_a_product_review(): void 'title' => 'Bestest product!', 'comment' => 'I\'ve never bought anything better.', 'rating' => 5, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/ProductVariantsTest.php b/tests/Api/Admin/ProductVariantsTest.php index bba428d9708..f188c065a9e 100644 --- a/tests/Api/Admin/ProductVariantsTest.php +++ b/tests/Api/Admin/ProductVariantsTest.php @@ -129,7 +129,7 @@ public function it_creates_a_product_variant_with_all_optional_data(): void 'taxCategory' => '/api/v2/admin/tax-categories/default', 'shippingCategory' => '/api/v2/admin/shipping-categories/default', 'shippingRequired' => true, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -162,7 +162,7 @@ public function it_creates_a_product_variant_enabled_by_default_with_translation 'channelCode' => 'WEB', 'price' => 4000, ]], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -195,7 +195,7 @@ public function it_does_not_allow_to_create_product_variant_with_invalid_channel 'channelCode' => 'NON-EXISTING-CHANNEL', 'price' => 4000, ]], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNPROCESSABLE_ENTITY); @@ -221,9 +221,9 @@ public function it_does_not_allow_to_create_product_variant_without_channel_code 'code' => 'CUP', 'product' => '/api/v2/admin/products/MUG_SW', 'channelPricings' => [ - 'NON-EXISTING-CHANNEL' => ['price' => 4000] + 'NON-EXISTING-CHANNEL' => ['price' => 4000], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNPROCESSABLE_ENTITY); @@ -251,7 +251,7 @@ public function it_does_not_allow_to_create_product_variant_without_product(): v 'channelCode' => 'WEB', 'price' => 4000, ]], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNPROCESSABLE_ENTITY); @@ -287,7 +287,7 @@ public function it_does_not_allow_to_create_product_variant_with_invalid_locale_ 'name' => 'Yellow mug', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNPROCESSABLE_ENTITY); @@ -343,7 +343,7 @@ public function it_updates_the_existing_product_variant(): void 'taxCategory' => '/api/v2/admin/tax-categories/special', 'shippingCategory' => '/api/v2/admin/shipping-categories/special', 'shippingRequired' => false, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -385,7 +385,7 @@ public function it_does_not_allow_to_update_product_variant_with_invalid_locale_ 'name' => 'Yellow mug', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNPROCESSABLE_ENTITY); @@ -416,7 +416,7 @@ public function it_does_not_allow_to_update_product_variant_without_translation_ 'name' => 'Tasse', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/ProductsTest.php b/tests/Api/Admin/ProductsTest.php index 003f07416e3..61610200a06 100644 --- a/tests/Api/Admin/ProductsTest.php +++ b/tests/Api/Admin/ProductsTest.php @@ -115,7 +115,7 @@ public function it_creates_a_product(): void 'metaDescription' => 'Opis kubka', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -167,7 +167,7 @@ public function it_does_not_create_a_product_with_invalid_translation_locale(): 'name' => 'Kubek', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -194,9 +194,9 @@ public function it_does_not_create_a_product_when_locale_differs_from_key(): voi 'slug' => 'mug', 'name' => 'Mug', 'locale' => 'locale', - ] + ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -234,7 +234,7 @@ public function it_updates_the_existing_product(): void [ '@id' => sprintf( '/api/v2/admin/product-attribute-values/%s', - $product->getAttributeByCodeAndLocale('MATERIAL', 'en_US')->getId() + $product->getAttributeByCodeAndLocale('MATERIAL', 'en_US')->getId(), ), 'attribute' => '/api/v2/admin/product-attributes/MATERIAL', 'value' => 'Cotton', @@ -243,7 +243,7 @@ public function it_updates_the_existing_product(): void [ '@id' => sprintf( '/api/v2/admin/product-attribute-values/%s', - $product->getAttributeByCodeAndLocale('MATERIAL', 'pl_PL')->getId() + $product->getAttributeByCodeAndLocale('MATERIAL', 'pl_PL')->getId(), ), 'attribute' => '/api/v2/admin/product-attributes/MATERIAL', 'value' => 'Bawełna', @@ -252,7 +252,7 @@ public function it_updates_the_existing_product(): void [ 'attribute' => '/api/v2/admin/product-attributes/dishwasher_safe', 'value' => true, - ] + ], ], 'translations' => [ 'en_US' => [ @@ -274,7 +274,7 @@ public function it_updates_the_existing_product(): void 'metaDescription' => 'Opis czapki', ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/PromotionCouponsTest.php b/tests/Api/Admin/PromotionCouponsTest.php index 2396a8b8e62..4a4d8c30891 100644 --- a/tests/Api/Admin/PromotionCouponsTest.php +++ b/tests/Api/Admin/PromotionCouponsTest.php @@ -80,7 +80,7 @@ public function it_creates_a_promotion_coupon(): void 'reusableFromCancelledOrders' => false, 'expiresAt' => '23-12-2023', 'promotion' => 'api/v2/admin/promotions/' . $promotion->getCode(), - ], JSON_THROW_ON_ERROR) + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -108,7 +108,7 @@ public function it_updates_a_promotion_coupon(): void 'perCustomerUsageLimit' => 5, 'reusableFromCancelledOrders' => false, 'expiresAt' => '2020-01-01 12:00:00', - ], JSON_THROW_ON_ERROR) + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/PromotionsTest.php b/tests/Api/Admin/PromotionsTest.php index 1f6d68b30a4..b80d3e06134 100644 --- a/tests/Api/Admin/PromotionsTest.php +++ b/tests/Api/Admin/PromotionsTest.php @@ -84,7 +84,7 @@ public function it_gets_promotion_coupons(): void $this->client->request( method: 'GET', uri: sprintf('/api/v2/admin/promotions/%s/promotion-coupons', $promotion->getCode()), - server: $header + server: $header, ); $this->assertResponse( @@ -121,8 +121,8 @@ public function it_creates_promotion(): void 'priority' => 22, 'appliesToDiscounted' => false, 'exclusive' => true, - "usageLimit" => 3, - "couponBased" => true, + 'usageLimit' => 3, + 'couponBased' => true, 'startsAt' => '2023-10-04 12:30:00', 'endsAt' => '2023-11-04 12:30:00', 'translations' => ['en_US' => [ @@ -132,31 +132,31 @@ public function it_creates_promotion(): void [ 'type' => CartQuantityRuleChecker::TYPE, 'configuration' => [ - 'count' => 6 + 'count' => 6, ], ], [ 'type' => CustomerGroupRuleChecker::TYPE, 'configuration' => [ - 'group_code' => 'vip' + 'group_code' => 'vip', ], ], [ 'type' => NthOrderRuleChecker::TYPE, 'configuration' => [ - 'nth' => 2 + 'nth' => 2, ], ], [ 'type' => ShippingCountryRuleChecker::TYPE, 'configuration' => [ - 'country' => 'US' + 'country' => 'US', ], ], [ 'type' => HasTaxonRuleChecker::TYPE, 'configuration' => [ - 'taxons' => ['MUGS', 'CAPS'] + 'taxons' => ['MUGS', 'CAPS'], ], ], [ @@ -169,7 +169,7 @@ public function it_creates_promotion(): void 'MOBILE' => [ 'taxon' => 'CAPS', 'amount' => 2000, - ] + ], ], ], [ @@ -186,7 +186,7 @@ public function it_creates_promotion(): void ], 'MOBILE' => [ 'amount' => 222, - ] + ], ], ], ], @@ -243,7 +243,7 @@ public function it_creates_promotion(): void ], ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -263,7 +263,7 @@ public function it_does_not_create_a_promotion_without_required_data(): void method: 'POST', uri: '/api/v2/admin/promotions', server: $header, - content: json_encode([], JSON_THROW_ON_ERROR), + content: json_encode([], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -273,7 +273,6 @@ public function it_does_not_create_a_promotion_without_required_data(): void ); } - /** @test */ public function it_does_not_create_a_promotion_with_taken_code(): void { @@ -287,7 +286,7 @@ public function it_does_not_create_a_promotion_with_taken_code(): void content: json_encode([ 'name' => '50% Off on your first order', 'code' => '50_off', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -312,7 +311,7 @@ public function it_does_not_create_a_promotion_with_end_date_earlier_than_start_ 'code' => 'tshirts_discount', 'startsAt' => '2023-12-04 12:30:00', 'endsAt' => '2023-11-04 12:30:00', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -339,31 +338,31 @@ public function it_does_not_create_a_promotion_with_invalid_rules(): void [ 'type' => CartQuantityRuleChecker::TYPE, 'configuration' => [ - 'count' => 'invalid' + 'count' => 'invalid', ], ], [ 'type' => CustomerGroupRuleChecker::TYPE, 'configuration' => [ - 'group_code' => 'wrong' + 'group_code' => 'wrong', ], ], [ 'type' => NthOrderRuleChecker::TYPE, 'configuration' => [ - 'nth' => 'invalid' + 'nth' => 'invalid', ], ], [ 'type' => ShippingCountryRuleChecker::TYPE, 'configuration' => [ - 'country' => 'wrong' + 'country' => 'wrong', ], ], [ 'type' => HasTaxonRuleChecker::TYPE, 'configuration' => [ - 'taxons' => ['wrong'] + 'taxons' => ['wrong'], ], ], [ @@ -372,7 +371,7 @@ public function it_does_not_create_a_promotion_with_invalid_rules(): void 'WEB' => [ 'taxon' => 'wrong', 'amount' => 'invalid', - ] + ], ], ], [ @@ -385,11 +384,11 @@ public function it_does_not_create_a_promotion_with_invalid_rules(): void 'type' => ItemTotalRuleChecker::TYPE, 'configuration' => [ 'MOBILE' => [ - ] + ], ], ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -425,7 +424,7 @@ public function it_does_not_create_a_promotion_with_invalid_actions(): void 'type' => UnitFixedDiscountPromotionActionCommand::TYPE, 'configuration' => [ 'WEB' => [ - 'filters' => 'invalid' + 'filters' => 'invalid', ], ], ], @@ -449,7 +448,7 @@ public function it_does_not_create_a_promotion_with_invalid_actions(): void ], ], ], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -477,13 +476,13 @@ public function it_updates_promotion(): void 'code' => 'new_code', 'appliesToDiscounted' => true, 'exclusive' => true, - "usageLimit" => 11, - "couponBased" => false, + 'usageLimit' => 11, + 'couponBased' => false, 'rules' => [ [ 'type' => CartQuantityRuleChecker::TYPE, 'configuration' => [ - 'count' => 1 + 'count' => 1, ], ], ], @@ -507,7 +506,7 @@ public function it_updates_promotion(): void '@id' => sprintf('/api/v2/admin/promotion-translations/%s', $promotion->getTranslation('en_US')->getId()), 'label' => 'Christmas', ]], - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -532,7 +531,7 @@ public function it_updates_promotion_to_last_priority_when_priority_is_minus_one server: $header, content: json_encode([ 'priority' => -1, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/ProvincesTest.php b/tests/Api/Admin/ProvincesTest.php index 11b3001ff84..1d7b7ff4666 100644 --- a/tests/Api/Admin/ProvincesTest.php +++ b/tests/Api/Admin/ProvincesTest.php @@ -59,7 +59,7 @@ public function it_updates_an_existing_province(): void server: $header, content: json_encode([ 'abbreviation' => 'Minn.', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/ShippingCategoriesTest.php b/tests/Api/Admin/ShippingCategoriesTest.php index 068e53ad8a7..b3bcabcbbe4 100644 --- a/tests/Api/Admin/ShippingCategoriesTest.php +++ b/tests/Api/Admin/ShippingCategoriesTest.php @@ -72,7 +72,7 @@ public function it_creates_a_shipping_category(): void content: json_encode([ 'code' => 'ultra', 'name' => 'Ultra', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -98,7 +98,7 @@ public function it_updates_an_existing_shipping_category(): void server: $header, content: json_encode([ 'name' => 'Not so default', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/TaxCategoriesTest.php b/tests/Api/Admin/TaxCategoriesTest.php index 9be4474306c..cec3e2db9a4 100644 --- a/tests/Api/Admin/TaxCategoriesTest.php +++ b/tests/Api/Admin/TaxCategoriesTest.php @@ -72,7 +72,7 @@ public function it_creates_a_tax_category(): void content: json_encode([ 'code' => 'ultra', 'name' => 'Ultra', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -98,7 +98,7 @@ public function it_updates_an_existing_tax_category(): void server: $header, content: json_encode([ 'name' => 'Not so default', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/TaxRatesTest.php b/tests/Api/Admin/TaxRatesTest.php index 57503c36b30..7cfbc83ad26 100644 --- a/tests/Api/Admin/TaxRatesTest.php +++ b/tests/Api/Admin/TaxRatesTest.php @@ -81,7 +81,7 @@ public function it_creates_a_new_tax_rate(): void 'amount' => '0.9', 'includedInPrice' => true, 'calculator' => 'default', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -111,7 +111,7 @@ public function it_updates_an_existing_tax_rate(): void 'amount' => '0.3', 'includedInPrice' => true, 'calculator' => 'default', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/TaxonImagesTest.php b/tests/Api/Admin/TaxonImagesTest.php index 3d8cc56a299..5d4140b6aeb 100644 --- a/tests/Api/Admin/TaxonImagesTest.php +++ b/tests/Api/Admin/TaxonImagesTest.php @@ -149,7 +149,7 @@ public function it_updates_only_the_type_of_the_existing_taxon_image(): void 'type' => 'logo', 'owner' => sprintf('/api/v2/admin/taxons/%s', $taxon->getCode()), 'path' => 'logo.jpg', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/Admin/TaxonsTest.php b/tests/Api/Admin/TaxonsTest.php index 7713c2fc2ba..e1106c6edb1 100644 --- a/tests/Api/Admin/TaxonsTest.php +++ b/tests/Api/Admin/TaxonsTest.php @@ -76,9 +76,9 @@ public function it_creates_a_taxon(): void 'en_US' => [ 'name' => 'Watches', 'slug' => 'watches', - ] - ] - ], JSON_THROW_ON_ERROR), + ], + ], + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -125,9 +125,9 @@ public function it_does_not_create_a_taxon_with_taken_code(): void 'en_US' => [ 'name' => 'Watches', 'slug' => 'watches', - ] - ] - ], JSON_THROW_ON_ERROR), + ], + ], + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -160,7 +160,7 @@ public function it_updates_the_existing_taxon(): void ], ], 'enabled' => false, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( diff --git a/tests/Api/JsonApiGenericRequestValidationTestCase.php b/tests/Api/JsonApiGenericRequestValidationTestCase.php index e1fea5c43fe..198d3995728 100644 --- a/tests/Api/JsonApiGenericRequestValidationTestCase.php +++ b/tests/Api/JsonApiGenericRequestValidationTestCase.php @@ -24,7 +24,7 @@ public function it_returns_a_bad_request_response_code_if_request_body_is_not_va method: 'POST', uri: '/api/v2/shop/orders', server: self::CONTENT_TYPE_HEADER, - content: 'Malformed JSON: the provided JSON payload is not properly formatted.' + content: 'Malformed JSON: the provided JSON payload is not properly formatted.', ); $this->assertResponse( diff --git a/tests/Api/Shop/AddressesPostTest.php b/tests/Api/Shop/AddressesPostTest.php index 95f1f228efd..424909fd568 100644 --- a/tests/Api/Shop/AddressesPostTest.php +++ b/tests/Api/Shop/AddressesPostTest.php @@ -37,7 +37,7 @@ public function it_denies_access_to_a_create_an_address_for_not_authenticated_us method: 'POST', uri: '/api/v2/shop/addresses', server: self::CONTENT_TYPE_HEADER, - content: json_encode($bodyRequest, JSON_THROW_ON_ERROR), + content: json_encode($bodyRequest, \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -63,7 +63,7 @@ public function it_creates_new_address_for_logged_customer_with_country_with_pro method: 'POST', uri: '/api/v2/shop/addresses', server: $header, - content: json_encode($bodyRequest, JSON_THROW_ON_ERROR), + content: json_encode($bodyRequest, \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -92,7 +92,7 @@ public function it_creates_new_address_for_logged_customer_without_province(): v method: 'POST', uri: '/api/v2/shop/addresses', server: $header, - content: json_encode($bodyRequest, JSON_THROW_ON_ERROR), + content: json_encode($bodyRequest, \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -121,7 +121,7 @@ public function it_creates_new_address_for_logged_customer_with_country_with_cus method: 'POST', uri: '/api/v2/shop/addresses', server: $header, - content: json_encode($bodyRequest, JSON_THROW_ON_ERROR), + content: json_encode($bodyRequest, \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); diff --git a/tests/Api/Shop/CustomersTest.php b/tests/Api/Shop/CustomersTest.php index f6731374c3c..1e23409a125 100644 --- a/tests/Api/Shop/CustomersTest.php +++ b/tests/Api/Shop/CustomersTest.php @@ -35,7 +35,7 @@ public function it_returns_small_amount_of_data_on_customer_update(): void method: 'PUT', uri: '/api/v2/shop/customers/' . $customer->getId(), server: $header, - content: json_encode(['firstName' => 'John'], JSON_THROW_ON_ERROR), + content: json_encode(['firstName' => 'John'], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -58,7 +58,7 @@ public function it_registers_customers(): void 'email' => 'shop@example.com', 'password' => 'sylius', 'subscribedToNewsletter' => true, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -77,8 +77,8 @@ public function it_allows_customer_to_log_in(): void server: self::CONTENT_TYPE_HEADER, content: json_encode([ 'email' => 'oliver@doe.com', - 'password' => 'sylius' - ], JSON_THROW_ON_ERROR), + 'password' => 'sylius', + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -104,8 +104,8 @@ public function it_allows_customer_to_update_its_data(): void 'firstName' => 'John', 'lastName' => 'Wick', 'gender' => 'm', - 'subscribedToNewsletter' => true - ], JSON_THROW_ON_ERROR), + 'subscribedToNewsletter' => true, + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); diff --git a/tests/Api/Shop/OrdersTest.php b/tests/Api/Shop/OrdersTest.php index cf2e2c51574..bcf6bb2fc1a 100644 --- a/tests/Api/Shop/OrdersTest.php +++ b/tests/Api/Shop/OrdersTest.php @@ -184,7 +184,7 @@ public function it_allows_to_add_items_to_order(): void content: json_encode([ 'productVariant' => '/api/v2/shop/product-variants/MUG_BLUE', 'quantity' => 3, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -230,7 +230,7 @@ public function it_allows_to_patch_orders_payment_method(): void server: array_merge($authentication, self::PATCH_CONTENT_TYPE_HEADER), content: json_encode([ 'paymentMethod' => '/api/v2/shop/payment-methods/CASH_ON_DELIVERY', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -268,7 +268,7 @@ public function it_validates_if_order_is_cancelled_when_trying_to_patch_orders_p server: array_merge($authentication, self::PATCH_CONTENT_TYPE_HEADER), content: json_encode([ 'paymentMethod' => '/api/v2/shop/payment-methods/CASH_ON_DELIVERY', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -326,15 +326,15 @@ public function it_allows_to_replace_orders_address(): void $country = $fixtures['country_US']; $billingAddress = [ - 'firstName'=> 'Jane', - 'lastName'=> 'Doe', - 'phoneNumber'=> '666111333', - 'company'=> 'Potato Corp.', - 'countryCode'=> $country->getCode(), + 'firstName' => 'Jane', + 'lastName' => 'Doe', + 'phoneNumber' => '666111333', + 'company' => 'Potato Corp.', + 'countryCode' => $country->getCode(), 'provinceCode' => 'US-MI', - 'street'=> 'Top secret', - 'city'=> 'Nebraska', - 'postcode'=> '12343', + 'street' => 'Top secret', + 'city' => 'Nebraska', + 'postcode' => '12343', ]; $this->client->request( @@ -344,7 +344,7 @@ public function it_allows_to_replace_orders_address(): void content: json_encode([ 'email' => 'oliver@doe.com', 'billingAddress' => $billingAddress, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -417,7 +417,7 @@ public function it_prevents_from_adding_an_item_to_the_cart_if_product_variant_i server: self::CONTENT_TYPE_HEADER, content: json_encode([ 'quantity' => 3, - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -444,7 +444,7 @@ public function it_prevents_from_adding_an_item_to_the_cart_if_quantity_is_missi server: self::CONTENT_TYPE_HEADER, content: json_encode([ 'productVariant' => 'MUG_BLUE', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -486,13 +486,13 @@ public function it_returns_unprocessable_entity_status_if_trying_to_assign_shipp method: 'PATCH', uri: sprintf('/api/v2/shop/orders/%s/shipments/%s', $tokenValue, '1237'), server: $this->headerBuilder()->withMergePatchJsonContentType()->build(), - content: json_encode(['shippingMethod' => 'api/v2/shop/shipping-methods/UPS']) + content: json_encode(['shippingMethod' => 'api/v2/shop/shipping-methods/UPS']), ); $this->assertResponse( $this->client->getResponse(), 'shop/assign_shipping_method_to_non_existing_shipment_response', - Response::HTTP_UNPROCESSABLE_ENTITY + Response::HTTP_UNPROCESSABLE_ENTITY, ); } @@ -507,7 +507,7 @@ public function it_returns_unprocessable_entity_status_if_trying_to_change_item_ method: 'PATCH', uri: sprintf('/api/v2/shop/orders/%s/items/%s', $tokenValue, 'invalid-item-id'), server: $this->headerBuilder()->withMergePatchJsonContentType()->build(), - content: json_encode(['quantity' => 5]) + content: json_encode(['quantity' => 5]), ); $this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNPROCESSABLE_ENTITY); diff --git a/tests/Api/Shop/ProductReviewsTest.php b/tests/Api/Shop/ProductReviewsTest.php index 8f82c31af11..6d8d36cccc0 100644 --- a/tests/Api/Shop/ProductReviewsTest.php +++ b/tests/Api/Shop/ProductReviewsTest.php @@ -76,7 +76,7 @@ public function it_creates_a_product_review(): void 'comment' => 'I\'ve never bought anything better.', 'email' => 'test@test.com', 'product' => '/api/v2/shop/products/' . $product->getCode(), - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponse( @@ -106,7 +106,7 @@ public function it_prevents_from_creating_a_product_review_with_non_existing_pro 'comment' => 'I\'ve never bought anything better.', 'email' => 'test@test.com', 'product' => '/api/v2/shop/products/NON-EXISTING-PRODUCT', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNPROCESSABLE_ENTITY); @@ -131,7 +131,7 @@ public function it_prevents_from_creating_a_product_review_if_no_product_provide 'rating' => 3, 'comment' => 'I\'ve never bought anything better.', 'email' => 'test@test.com', - ], JSON_THROW_ON_ERROR), + ], \JSON_THROW_ON_ERROR), ); $this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNPROCESSABLE_ENTITY); diff --git a/tests/Api/Shop/SendContactRequestTest.php b/tests/Api/Shop/SendContactRequestTest.php index 34897d60530..e852a5d05cd 100644 --- a/tests/Api/Shop/SendContactRequestTest.php +++ b/tests/Api/Shop/SendContactRequestTest.php @@ -33,8 +33,8 @@ public function it_sends_contact_request(): void server: self::CONTENT_TYPE_HEADER, content: json_encode([ 'email' => 'customer@email.com', - 'message' => 'Example of message' - ], JSON_THROW_ON_ERROR), + 'message' => 'Example of message', + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); @@ -59,8 +59,8 @@ public function it_sends_contact_request_as_logged_in_user(): void server: $header, content: json_encode([ 'email' => 'customer@email.com', - 'message' => 'Example of message' - ], JSON_THROW_ON_ERROR), + 'message' => 'Example of message', + ], \JSON_THROW_ON_ERROR), ); $response = $this->client->getResponse(); diff --git a/tests/Api/Utils/HeadersBuilder.php b/tests/Api/Utils/HeadersBuilder.php index 08f437b670d..b874699b4a8 100644 --- a/tests/Api/Utils/HeadersBuilder.php +++ b/tests/Api/Utils/HeadersBuilder.php @@ -21,9 +21,7 @@ class HeadersBuilder { - /** - * @var array - */ + /** @var array */ private array $headers = []; /** diff --git a/tests/Controller/AdminTaxonAjaxTest.php b/tests/Controller/AdminTaxonAjaxTest.php index d4da1401378..3ea5706cc5d 100644 --- a/tests/Controller/AdminTaxonAjaxTest.php +++ b/tests/Controller/AdminTaxonAjaxTest.php @@ -65,11 +65,11 @@ public function it_returns_specific_taxons_for_given_phrase(): void { Assert::assertNotEmpty( $this->loadFixturesFromFile('authentication/administrator.yml'), - 'Could not load administrator.yml' + 'Could not load administrator.yml', ); Assert::assertNotEmpty( $this->loadFixturesFromFile('resources/taxons.yml'), - 'Could not load taxons.yml' + 'Could not load taxons.yml', ); $this->authenticateAdminUser(); diff --git a/tests/Controller/SessionAwareAjaxTestCase.php b/tests/Controller/SessionAwareAjaxTestCase.php index ae1a1fa9cb1..e34d5edf2b8 100644 --- a/tests/Controller/SessionAwareAjaxTestCase.php +++ b/tests/Controller/SessionAwareAjaxTestCase.php @@ -1,5 +1,14 @@ get('request_stack'); + try { $requestStack->getSession(); } catch (SessionNotFoundException) { diff --git a/tests/Functional/AbstractOrmTestCase.php b/tests/Functional/AbstractOrmTestCase.php index 54d68a9f4d1..320ccbff477 100644 --- a/tests/Functional/AbstractOrmTestCase.php +++ b/tests/Functional/AbstractOrmTestCase.php @@ -1,5 +1,14 @@ DriverMock::class, + 'driverClass' => DriverMock::class, 'wrapperClass' => ConnectionMock::class, - 'user'=> 'sylius', + 'user' => 'sylius', 'password' => 'sylius', ], $config); } diff --git a/tests/Functional/Bundles/ApiBundle/CommandHandler/SendAccountRegistrationEmailHandlerTest.php b/tests/Functional/Bundles/ApiBundle/CommandHandler/SendAccountRegistrationEmailHandlerTest.php index 64e6b513da2..1a123d0c045 100644 --- a/tests/Functional/Bundles/ApiBundle/CommandHandler/SendAccountRegistrationEmailHandlerTest.php +++ b/tests/Functional/Bundles/ApiBundle/CommandHandler/SendAccountRegistrationEmailHandlerTest.php @@ -61,15 +61,15 @@ public function it_sends_account_registration_email_with_hostname(): void $sendAccountRegistrationEmailHandler = new SendAccountRegistrationEmailHandler( $userRepository->reveal(), $channelRepository->reveal(), - $emailSender + $emailSender, ); $sendAccountRegistrationEmailHandler( new SendAccountRegistrationEmail( - 'user@example.com', - 'en_US', - 'CHANNEL_CODE' - ) + 'user@example.com', + 'en_US', + 'CHANNEL_CODE', + ), ); self::assertEmailCount(1); @@ -114,15 +114,15 @@ public function it_sends_account_registration_email_without_hostname(): void $sendAccountRegistrationEmailHandler = new SendAccountRegistrationEmailHandler( $userRepository->reveal(), $channelRepository->reveal(), - $emailSender + $emailSender, ); $sendAccountRegistrationEmailHandler( new SendAccountRegistrationEmail( - 'user@example.com', - 'en_US', - 'CHANNEL_CODE' - ) + 'user@example.com', + 'en_US', + 'CHANNEL_CODE', + ), ); self::assertEmailCount(1); diff --git a/tests/Functional/Bundles/ApiBundle/CommandHandler/SendAccountVerificationEmailHandlerTest.php b/tests/Functional/Bundles/ApiBundle/CommandHandler/SendAccountVerificationEmailHandlerTest.php index db6379ad88b..b1b5ec2a7f0 100644 --- a/tests/Functional/Bundles/ApiBundle/CommandHandler/SendAccountVerificationEmailHandlerTest.php +++ b/tests/Functional/Bundles/ApiBundle/CommandHandler/SendAccountVerificationEmailHandlerTest.php @@ -58,15 +58,15 @@ public function it_sends_account_verification_token_email_without_hostname(): vo $sendAccountVerificationEmailHandler = new SendAccountVerificationEmailHandler( $userRepository->reveal(), $channelRepository->reveal(), - $emailSender + $emailSender, ); $sendAccountVerificationEmailHandler( new SendAccountVerificationEmail( - 'user@example.com', - 'en_US', - 'CHANNEL_CODE' - ) + 'user@example.com', + 'en_US', + 'CHANNEL_CODE', + ), ); self::assertEmailCount(1); @@ -108,15 +108,15 @@ public function it_sends_account_verification_token_email_with_hostname(): void $sendAccountVerificationEmailHandler = new SendAccountVerificationEmailHandler( $userRepository->reveal(), $channelRepository->reveal(), - $emailSender + $emailSender, ); $sendAccountVerificationEmailHandler( new SendAccountVerificationEmail( - 'user@example.com', - 'en_US', - 'CHANNEL_CODE' - ) + 'user@example.com', + 'en_US', + 'CHANNEL_CODE', + ), ); self::assertEmailCount(1); diff --git a/tests/Functional/Bundles/ApiBundle/CommandHandler/SendResetPasswordEmailHandlerTest.php b/tests/Functional/Bundles/ApiBundle/CommandHandler/SendResetPasswordEmailHandlerTest.php index 3f5e31ddf20..e281e4c9434 100644 --- a/tests/Functional/Bundles/ApiBundle/CommandHandler/SendResetPasswordEmailHandlerTest.php +++ b/tests/Functional/Bundles/ApiBundle/CommandHandler/SendResetPasswordEmailHandlerTest.php @@ -58,13 +58,13 @@ public function it_sends_password_reset_token_email_without_hostname(): void $resetPasswordEmailHandler = new SendResetPasswordEmailHandler( $emailSender, $channelRepository->reveal(), - $userRepository->reveal() + $userRepository->reveal(), ); $resetPasswordEmailHandler(new SendResetPasswordEmail( 'user@example.com', 'CHANNEL_CODE', - 'en_US' + 'en_US', )); self::assertEmailCount(1); @@ -106,13 +106,13 @@ public function it_sends_password_reset_token_email_with_hostname(): void $resetPasswordEmailHandler = new SendResetPasswordEmailHandler( $emailSender, $channelRepository->reveal(), - $userRepository->reveal() + $userRepository->reveal(), ); $resetPasswordEmailHandler(new SendResetPasswordEmail( 'user@example.com', 'CHANNEL_CODE', - 'en_US' + 'en_US', )); self::assertEmailCount(1); diff --git a/tests/Functional/Bundles/LocaleBundle/Context/LocaleResolvingTest.php b/tests/Functional/Bundles/LocaleBundle/Context/LocaleResolvingTest.php index 6007f62522c..063907713d0 100644 --- a/tests/Functional/Bundles/LocaleBundle/Context/LocaleResolvingTest.php +++ b/tests/Functional/Bundles/LocaleBundle/Context/LocaleResolvingTest.php @@ -31,7 +31,7 @@ public function it_ignores_accept_language_header_when_locale_is_present_in_url( uri: '/en_US/', server: [ 'HTTP_ACCEPT_LANGUAGE' => 'pl_PL', - ] + ], ); $this->bootKernel(); @@ -55,7 +55,7 @@ public function it_sets_locale_based_on_accept_language_header_when_no_locale_in uri: '/admin/login', server: [ 'HTTP_ACCEPT_LANGUAGE' => 'pl_PL', - ] + ], ); $this->bootKernel(); diff --git a/tests/Functional/CartCollectorTest.php b/tests/Functional/CartCollectorTest.php index 076073e1e7b..f4ac5a66b47 100644 --- a/tests/Functional/CartCollectorTest.php +++ b/tests/Functional/CartCollectorTest.php @@ -136,7 +136,7 @@ public function it_collects_cart_data(): void ], $collector->getStates()); $this->assertSame( array_map(fn (OrderItemInterface $item) => $item->getId(), $cart->getItems()->toArray()), - array_column($collector->getItems(), 'id') + array_column($collector->getItems(), 'id'), ); } diff --git a/tests/Functional/Doctrine/Dump/CompositeKeysModel.php b/tests/Functional/Doctrine/Dump/CompositeKeysModel.php index b0afac50aa6..bcf3ba8f47a 100644 --- a/tests/Functional/Doctrine/Dump/CompositeKeysModel.php +++ b/tests/Functional/Doctrine/Dump/CompositeKeysModel.php @@ -1,17 +1,26 @@ $eligibleCatalogPromotion->getStartDate(), - $eligibleCatalogPromotions + $eligibleCatalogPromotions, ); foreach ($actualDateTimes as $actualDateTime) { diff --git a/tests/Functional/ImageUploaderTest.php b/tests/Functional/ImageUploaderTest.php index 970b8ff8ec6..a5e0a1942a2 100644 --- a/tests/Functional/ImageUploaderTest.php +++ b/tests/Functional/ImageUploaderTest.php @@ -16,9 +16,9 @@ use PHPUnit\Framework\Assert; use Sylius\Component\Core\Model\ProductImage; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use Symfony\Component\BrowserKit\Client; use Symfony\Component\HttpFoundation\File\Exception\FileException; use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\BrowserKit\Client; final class ImageUploaderTest extends WebTestCase { @@ -31,7 +31,7 @@ public function it_sanitizes_file_content_if_it_is_svg_mime_type(): void self::$client = static::createClient(); $imageUploader = self::$kernel->getContainer()->get('sylius.image_uploader'); - $fileSystem = self::$kernel->getContainer()->get('gaufrette.sylius_image_filesystem'); + $fileSystem = self::$kernel->getContainer()->get('gaufrette.sylius_image_filesystem'); $file = new UploadedFile(__DIR__ . '/../Resources/xss.svg', 'xss.svg'); Assert::assertStringContainsString('getContent($file)); diff --git a/tests/Functional/OrderByIdentifierSqlWalkerTest.php b/tests/Functional/OrderByIdentifierSqlWalkerTest.php index a277a27e000..e91ed16679c 100644 --- a/tests/Functional/OrderByIdentifierSqlWalkerTest.php +++ b/tests/Functional/OrderByIdentifierSqlWalkerTest.php @@ -1,5 +1,14 @@ generateSql( - 'select u from Sylius\Tests\Functional\Doctrine\Dump\Model u' - ) + 'select u from Sylius\Tests\Functional\Doctrine\Dump\Model u', + ), ); self::assertStringEndsWith( 'ORDER BY m0_.email DESC, m0_.id ASC', $this->generateSql( - 'select u from Sylius\Tests\Functional\Doctrine\Dump\Model u order by u.email desc' - ) + 'select u from Sylius\Tests\Functional\Doctrine\Dump\Model u order by u.email desc', + ), ); self::assertStringEndsWith( 'ORDER BY m0_.email DESC, m0_.id ASC', $this->generateSql( - 'select u.id, (CASE WHEN u.id = 1 THEN \'yolo\' ELSE u.email END) AS HIDDEN yoloOrEmail from Sylius\Tests\Functional\Doctrine\Dump\Model u order by u.email desc' - ) + 'select u.id, (CASE WHEN u.id = 1 THEN \'yolo\' ELSE u.email END) AS HIDDEN yoloOrEmail from Sylius\Tests\Functional\Doctrine\Dump\Model u order by u.email desc', + ), ); } @@ -50,22 +59,22 @@ public function it_appends_order_by_identifier_composite_to_the_query(): void self::assertStringEndsWith( 'ORDER BY c0_.email ASC, c0_.organization_name ASC', $this->generateSql( - 'select u from Sylius\Tests\Functional\Doctrine\Dump\CompositeKeysModel u' - ) + 'select u from Sylius\Tests\Functional\Doctrine\Dump\CompositeKeysModel u', + ), ); self::assertStringEndsWith( 'ORDER BY c0_.description DESC, c0_.email ASC, c0_.organization_name ASC', $this->generateSql( - 'select u from Sylius\Tests\Functional\Doctrine\Dump\CompositeKeysModel u order by u.description desc' - ) + 'select u from Sylius\Tests\Functional\Doctrine\Dump\CompositeKeysModel u order by u.description desc', + ), ); self::assertStringEndsWith( 'ORDER BY c0_.description DESC, c0_.email ASC, c0_.organization_name ASC', $this->generateSql( - 'select (CASE WHEN u.email = \'admin@example.com\' THEN \'yolo\' ELSE u.email END) AS HIDDEN yoloOrEmail from Sylius\Tests\Functional\Doctrine\Dump\CompositeKeysModel u order by u.description desc' - ) + 'select (CASE WHEN u.email = \'admin@example.com\' THEN \'yolo\' ELSE u.email END) AS HIDDEN yoloOrEmail from Sylius\Tests\Functional\Doctrine\Dump\CompositeKeysModel u order by u.description desc', + ), ); } @@ -75,8 +84,8 @@ public function it_does_not_append_order_by_identifier_to_the_query_if_query_is_ self::assertStringEndsWith( 'GROUP BY m0_.email', $this->generateSql( - 'select u from Sylius\Tests\Functional\Doctrine\Dump\Model u group by u.email' - ) + 'select u from Sylius\Tests\Functional\Doctrine\Dump\Model u group by u.email', + ), ); } @@ -86,8 +95,8 @@ public function it_does_not_append_order_by_identifier_to_the_query_if_aggregate self::assertStringEndsWith( 'FROM model m0_', $this->generateSql( - 'select max(u) from Sylius\Tests\Functional\Doctrine\Dump\Model u' - ) + 'select max(u) from Sylius\Tests\Functional\Doctrine\Dump\Model u', + ), ); } diff --git a/tests/Functional/SalesDataProviderTest.php b/tests/Functional/SalesDataProviderTest.php index 34f9805af49..bc0f0e95e2a 100644 --- a/tests/Functional/SalesDataProviderTest.php +++ b/tests/Functional/SalesDataProviderTest.php @@ -96,7 +96,7 @@ public function it_provides_year_sales_summary_grouped_per_month(): void $this->assertSame($expectedPeriods, $salesSummary->getIntervals()); $this->assertSame( ['70.00', '40.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00'], - $salesSummary->getSales() + $salesSummary->getSales(), ); } @@ -116,7 +116,7 @@ public function it_provides_years_sales_summary_grouped_per_month(): void '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '20.00', '70.00', '40.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', ], - $salesSummary->getSales() + $salesSummary->getSales(), ); } @@ -133,7 +133,7 @@ public function it_provides_different_data_for_each_channel_and_only_paid_orders $this->assertSame($expectedMonths, $salesSummary->getIntervals()); $this->assertSame( ['330.00'], - $salesSummary->getSales() + $salesSummary->getSales(), ); } @@ -156,7 +156,7 @@ private function getExpectedPeriods(\DateTimeInterface $startDate, \DateTimeInte $interval = new \DatePeriod( $startDate, \DateInterval::createFromDateString($interval), - $endDate + $endDate, ); /** @var \DateTimeInterface $date */ diff --git a/tests/Functional/UpdatingUserPasswordEncoderTest.php b/tests/Functional/UpdatingUserPasswordEncoderTest.php index 7b0bb8406f5..560ebe1529c 100644 --- a/tests/Functional/UpdatingUserPasswordEncoderTest.php +++ b/tests/Functional/UpdatingUserPasswordEncoderTest.php @@ -43,7 +43,7 @@ protected function setUp(): void ], [], [], - PurgeMode::createDeleteMode() + PurgeMode::createDeleteMode(), ); } @@ -127,7 +127,7 @@ public function oauth_user_factory_is_not_overridden(): void AbstractResourceOwner::class, [ 'getName' => 'resourceProviderName', - ] + ], ); $responseMock = $this->createConfiguredMock( @@ -137,7 +137,7 @@ public function oauth_user_factory_is_not_overridden(): void 'getResourceOwner' => $resourceOwnerMock, 'getAccessToken' => 'LongAccessToken', 'getRefreshToken' => 'LongRefreshToken', - ] + ], ); $oAuthUserProvider->connect($shopUser, $responseMock); diff --git a/tests/Functional/app/AppKernel.php b/tests/Functional/app/AppKernel.php index c5620c5fce5..44ee0b23f92 100644 --- a/tests/Functional/app/AppKernel.php +++ b/tests/Functional/app/AppKernel.php @@ -13,8 +13,8 @@ namespace Sylius\Tests\Functional\app; -use Symfony\Component\Config\Loader\LoaderInterface; use App\Kernel; +use Symfony\Component\Config\Loader\LoaderInterface; class AppKernel extends Kernel { diff --git a/tests/Model/OrderAdjustmentsRecalculationTest.php b/tests/Model/OrderAdjustmentsRecalculationTest.php index 5a362773313..0fb0e645c5f 100644 --- a/tests/Model/OrderAdjustmentsRecalculationTest.php +++ b/tests/Model/OrderAdjustmentsRecalculationTest.php @@ -23,6 +23,7 @@ final class OrderAdjustmentsRecalculationTest extends TestCase { private Order $order; + private OrderItemInterface $item; protected function setUp(): void diff --git a/tests/Twig/RedirectPathExtensionTest.php b/tests/Twig/RedirectPathExtensionTest.php index 336aa08d8cd..d6467958d4b 100644 --- a/tests/Twig/RedirectPathExtensionTest.php +++ b/tests/Twig/RedirectPathExtensionTest.php @@ -1,5 +1,14 @@