Merge branch '1.13' into 2.0

* 1.13:
  Exclude PHP 8.0/Symfony 6.4 from workflows' matrixes
  [Maintenance] Fix postgres behats
  Fix product name's casing in the Behat scenario
  Add the sylius-labs/suite-tags-extension package
  [Dependencies] Change possible versions of doctrine/persistence
  [CI] Update Symfony versions in build
  [Behat][UI] Add strong typing in the CartContext class
  [ECS] Apply another ecs fixes
  [ECS] Apply ecs fixes
  [ECS] Apply ecs fixes in the tests directory
  [ECS] Add checking in the tests directory
This commit is contained in:
Grzegorz Sadowski 2023-12-05 13:04:16 +01:00
commit 5526e0603c
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
80 changed files with 449 additions and 330 deletions

View file

@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
php: [ "8.2" ]
symfony: [ "^6.3" ]
symfony: [ "^6.4" ]
mysql: [ "8.0" ]
env:

View file

@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
php: [ "8.1" ]
symfony: [ "^6.3" ]
symfony: [ "^6.4" ]
mysql: [ "8.0" ]
env:

View file

@ -4,7 +4,7 @@
"include": [
{
"php": "8.2",
"symfony": "~6.3.0",
"symfony": "^6.4",
"api-platform": "^2.7.10"
}
]
@ -13,8 +13,9 @@
"include": [
{
"php": "8.2",
"symfony": "~6.3.0",
"mariadb": "10.4.10"
"symfony": "^6.4",
"mariadb": "10.4.10",
"dbal": "^3.0"
}
]
},
@ -22,7 +23,7 @@
"include": [
{
"php": "8.2",
"symfony": "~6.3.0",
"symfony": "^6.4",
"api-platform": "^2.7.10",
"mysql": "8.0",
"twig": "^3.3"
@ -33,7 +34,7 @@
"include": [
{
"php": "8.2",
"symfony": "~6.3.0",
"symfony": "^6.4",
"postgres": "14.6"
}
]
@ -42,7 +43,15 @@
"include": [
{
"php": "8.2",
"symfony": "~6.3.0"
"symfony": "^6.4"
}
]
},
"packages-swiftmailer": {
"include": [
{
"php": "8.0",
"symfony": "^5.4"
}
]
}
@ -50,29 +59,29 @@
"full": {
"static-checks": {
"php": [ "8.2" ],
"symfony": [ "~6.3.0" ],
"symfony": [ "^6.4" ],
"api-platform": [ "^2.7.10" ]
},
"e2e-mariadb": {
"php": [ "8.2" ],
"symfony": [ "~6.3.0" ],
"symfony": [ "^6.4" ],
"mariadb": [ "10.4.10" ]
},
"e2e-mysql": {
"php": [ "8.2" ],
"symfony": [ "~6.3.0" ],
"symfony": [ "^6.4" ],
"api-platform": [ "^2.7.10" ],
"mysql": [ "5.7", "8.0" ],
"twig": [ "^3.3" ]
},
"e2e-pgsql": {
"php": [ "8.2" ],
"symfony": [ "~6.3.0" ],
"symfony": [ "^6.4" ],
"postgres": [ "13.9", "14.6" ]
},
"packages": {
"php": [ "8.2" ],
"symfony": [ "~6.3.0" ]
"symfony": [ "^6.4" ]
}
}
}

View file

@ -42,7 +42,7 @@
"doctrine/inflector": "^1.4 || ^2.0",
"doctrine/migrations": "^3.5.5",
"doctrine/orm": "^2.13",
"doctrine/persistence": "^2.3",
"doctrine/persistence": "^2.3 || ^3.0",
"egulias/email-validator": "^3.1",
"enshrined/svg-sanitize": "^0.16",
"fakerphp/faker": "^1.10",
@ -225,12 +225,12 @@
"rector/rector": "^0.18.0",
"sylius-labs/coding-standard": "^4.2",
"sylius-labs/suite-tags-extension": "~0.1",
"symfony/browser-kit": "^6.3.2",
"symfony/debug-bundle": "^6.3.2",
"symfony/dotenv": "^6.3.0",
"symfony/browser-kit": "^6.4",
"symfony/debug-bundle": "^6.4",
"symfony/dotenv": "^6.4",
"symfony/flex": "^2.2",
"symfony/runtime": "^6.3.2",
"symfony/web-profiler-bundle": "^6.3.2",
"symfony/runtime": "^6.4",
"symfony/web-profiler-bundle": "^6.4",
"symplify/monorepo-builder": "^11.0"
},
"suggest": {

View file

@ -22,7 +22,7 @@ return static function (ECSConfig $config): void {
$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',

View file

@ -343,7 +343,7 @@ final class ManagingCountriesContext implements Context
{
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.',
);
}

View file

@ -97,7 +97,6 @@ final class ManagingOrdersContext implements Context
$this->client->addFilter('checkoutCompletedAt[before]', $dateTime);
}
/**
* @When I filter by product :productName
* @When I filter by products :firstProduct and :secondProduct
@ -147,7 +146,7 @@ final class ManagingOrdersContext implements Context
*/
public function iSpecifyFilterTotalBeingLessThan(string $total): void
{
$this->client->addFilter('total[lt]', $total. '00');
$this->client->addFilter('total[lt]', $total . '00');
}
/**
@ -488,7 +487,7 @@ final class ManagingOrdersContext implements Context
*/
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 @@ final class ManagingOrdersContext implements Context
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',

View file

@ -358,7 +358,8 @@ final class ManagingPaymentMethodsContext implements Context
public function thisPaymentMethodNameShouldStillBeNamed(string $paymentMethodName): void
{
Assert::inArray(
$paymentMethodName, $this->getPaymentMethodNamesFromCollection(),
$paymentMethodName,
$this->getPaymentMethodNamesFromCollection(),
sprintf('Payment method with name %s does not exist', $paymentMethodName),
);
}

View file

@ -339,7 +339,7 @@ final class ManagingPromotionCouponsContext implements Context
$coupons = $this->responseChecker->getCollectionItemsWithValue(
$this->client->subResourceIndex(Resources::PROMOTIONS, Resources::PROMOTION_COUPONS, $promotion->getCode()),
'code',
$code
$code,
);
Assert::count($coupons, 1);

View file

@ -177,7 +177,7 @@ final class ManagingPromotionsContext implements Context
public function iAddTheActionConfiguredWithAmountForChannel(
string $actionType,
int $amount,
ChannelInterface $channel
ChannelInterface $channel,
): void {
$actionTypeMapping = [
'Order fixed discount' => FixedDiscountPromotionActionCommand::TYPE,
@ -214,8 +214,8 @@ final class ManagingPromotionsContext implements Context
/**
* @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 @@ final class ManagingPromotionsContext implements Context
public function iAddTheItemTotalRuleConfiguredWithTwoChannel(
int $firstAmount,
ChannelInterface $firstChannel,
int$secondAmount,
int $secondAmount,
ChannelInterface $secondChannel,
): void {
$this->addToRequestRule(
@ -640,7 +640,7 @@ final class ManagingPromotionsContext implements Context
public function thePromotionShouldBeAvailableFromTo(
PromotionInterface $promotion,
\DateTimeInterface $startsDate,
\DateTimeInterface $endsDate
\DateTimeInterface $endsDate,
): void {
Assert::true(
$this->responseChecker->hasItemWithValues(
@ -650,7 +650,7 @@ final class ManagingPromotionsContext implements Context
'startsAt' => $startsDate->format('Y-m-d H:i:s'),
'endsAt' => $endsDate->format('Y-m-d H:i:s'),
],
)
),
);
}
@ -680,6 +680,7 @@ final class ManagingPromotionsContext implements Context
),
);
}
/**
* @Then I should be notified that it is in use and cannot be deleted
*/
@ -836,7 +837,7 @@ final class ManagingPromotionsContext implements Context
$this->client->updateRequestData($data);
}
private function getActions(): array
private function getActions(): array
{
return $this->client->getContent()['actions'];
}

View file

@ -193,7 +193,7 @@ final class PromotionContext implements Context
[
'code' => $couponCode,
'usage_limit' => $usageLimit,
]
],
],
couponBased: true,
startsAt: (new \DateTime('-3 day'))->format('Y-m-d'),

View file

@ -237,7 +237,7 @@ final class ManagingPromotionsContext implements Context
*/
public function iAddTheActionConfiguredWithoutAPercentageValueForChannel(
string $actionType,
ChannelInterface $channel
ChannelInterface $channel,
): void {
$this->createPage->addAction($actionType);
$this->createPage->fillActionOptionForChannel($channel->getCode(), 'Percentage', '');

View file

@ -67,7 +67,7 @@ final class CartContext implements Context
* @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 @@ final class CartContext implements Context
* @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 @@ final class CartContext implements Context
* @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 @@ final class CartContext implements Context
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @Then my discount should be :promotionsTotal
*/
public function myDiscountShouldBe($promotionsTotal)
public function myDiscountShouldBe(string $promotionsTotal): void
{
$this->summaryPage->open();
@ -220,7 +220,7 @@ final class CartContext implements Context
/**
* @Given /^there should be no shipping fee$/
*/
public function thereShouldBeNoShippingFee()
public function thereShouldBeNoShippingFee(): void
{
$this->summaryPage->open();
@ -236,7 +236,7 @@ final class CartContext implements Context
/**
* @Given /^there should be no discount$/
*/
public function thereShouldBeNoDiscount()
public function thereShouldBeNoDiscount(): void
{
$this->summaryPage->open();
@ -254,7 +254,7 @@ final class CartContext implements Context
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
* @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 @@ final class CartContext implements Context
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @When I clear my cart
*/
public function iClearMyCart()
public function iClearMyCart(): void
{
$this->summaryPage->clearCart();
}
@ -477,9 +481,9 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @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 @@ final class CartContext implements Context
/**
* @Then my cart's total should be :total
*/
public function myCartSTotalShouldBe($total)
public function myCartSTotalShouldBe(string $total): void
{
$this->summaryPage->open();

View file

@ -13,12 +13,7 @@ declare(strict_types=1);
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
{

View file

@ -25,7 +25,7 @@ use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
final class PromotionCouponPromotionFilter extends AbstractContextAwareFilter
{
const PROPERTY = 'promotion';
public const PROPERTY = 'promotion';
/** @param array<array-key, mixed> $properties */
public function __construct(

View file

@ -19,8 +19,9 @@ use ApiPlatform\OpenApi\OpenApi;
/** @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

View file

@ -40,7 +40,7 @@ final class CommandDenormalizer implements ContextAwareDenormalizerInterface
$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())),
);
}

View file

@ -14,15 +14,11 @@ declare(strict_types=1);
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;

View file

@ -172,7 +172,7 @@ class PromotionExampleFactory extends AbstractExampleFactory implements ExampleF
};
}
/** @return iterable<null|string> */
/** @return iterable<string|null> */
private function getLocales(): iterable
{
/** @var LocaleInterface[] $locales */

View file

@ -19,9 +19,13 @@ final class ChannelCodeCollection extends Constraint
{
/** @var array<Constraint> */
public array $constraints = [];
public bool $allowExtraFields = false;
public bool $allowMissingFields = false;
public ?string $extraFieldsMessage = null;
public ?string $missingFieldsMessage = null;
public function validatedBy(): string

View file

@ -28,7 +28,7 @@ final class ChannelCodeCollectionValidator extends ConstraintValidator
{
}
/** @param null|array<array-key, mixed> $value */
/** @param mixed $value */
public function validate($value, Constraint $constraint): void
{
if (!$constraint instanceof ChannelCodeCollection) {

View file

@ -26,7 +26,7 @@ final class CustomerGroupCodeExistsValidator extends ConstraintValidator
{
}
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);

View file

@ -34,8 +34,8 @@ final class AdminUsersTest extends JsonApiTestCase
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 @@ final class AdminUsersTest extends JsonApiTestCase
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 @@ final class AdminUsersTest extends JsonApiTestCase
'firstName' => 'John',
'lastName' => 'Api',
'localeCode' => 'ga_IE',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -147,7 +147,7 @@ final class AdminUsersTest extends JsonApiTestCase
'firstName' => 'John',
'lastName' => 'Api',
'localeCode' => 'ga_IE',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -114,7 +114,7 @@ final class CatalogPromotionsTest extends JsonApiTestCase
'enabled' => true,
'exclusive' => false,
'priority' => 100,
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -134,7 +134,7 @@ final class CatalogPromotionsTest extends JsonApiTestCase
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 @@ final class CatalogPromotionsTest extends JsonApiTestCase
content: json_encode([
'name' => 'Mugs discount',
'code' => 'mugs_discount',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -182,7 +182,7 @@ final class CatalogPromotionsTest extends JsonApiTestCase
'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 @@ final class CatalogPromotionsTest extends JsonApiTestCase
]],
'enabled' => true,
'exclusive' => false,
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -373,7 +373,7 @@ final class CatalogPromotionsTest extends JsonApiTestCase
]],
'enabled' => true,
'exclusive' => false,
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -424,7 +424,7 @@ final class CatalogPromotionsTest extends JsonApiTestCase
'enabled' => true,
'exclusive' => false,
'priority' => 1000,
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -33,7 +33,7 @@ final class ChannelPriceHistoryConfigTest extends JsonApiTestCase
$this->assertResponse(
$this->client->getResponse(),
'admin/get_channel_price_history_config_response',
Response::HTTP_OK
Response::HTTP_OK,
);
}
@ -54,13 +54,13 @@ final class ChannelPriceHistoryConfigTest extends JsonApiTestCase
'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,
);
}
}

View file

@ -58,7 +58,7 @@ final class ChannelPricingLogEntryTest extends JsonApiTestCase
$this->assertResponse(
$this->client->getResponse(),
'admin/get_channel_pricing_log_entry_response',
Response::HTTP_OK
Response::HTTP_OK,
);
}
@ -76,7 +76,7 @@ final class ChannelPricingLogEntryTest extends JsonApiTestCase
$this->assertResponse(
$this->client->getResponse(),
'admin/get_channel_pricing_log_entries_response',
Response::HTTP_OK
Response::HTTP_OK,
);
}
@ -98,7 +98,7 @@ final class ChannelPricingLogEntryTest extends JsonApiTestCase
$this->assertResponse(
$this->client->getResponse(),
'admin/get_filtered_channel_pricing_log_entries_response',
Response::HTTP_OK
Response::HTTP_OK,
);
}
}

View file

@ -95,7 +95,7 @@ final class ChannelsTest extends JsonApiTestCase
$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 @@ final class ChannelsTest extends JsonApiTestCase
'accountVerificationRequired' => true,
'shippingAddressInCheckoutRequired' => false,
'menuTaxon' => null,
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -183,7 +182,7 @@ final class ChannelsTest extends JsonApiTestCase
'description' => 'different description',
'hostname' => 'updated-hostname.com',
'color' => 'blue',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -214,9 +213,9 @@ final class ChannelsTest extends JsonApiTestCase
'countryCode' => 'DE',
'street' => 'Different Street',
'city' => 'different City',
'postcode' => '12-124'
]
], JSON_THROW_ON_ERROR),
'postcode' => '12-124',
],
], \JSON_THROW_ON_ERROR),
);
$this->assertResponseCode(

View file

@ -72,7 +72,7 @@ final class CountriesTest extends JsonApiTestCase
content: json_encode([
'code' => 'IE',
'enabled' => true,
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -101,8 +101,8 @@ final class CountriesTest extends JsonApiTestCase
'code' => 'US-WA',
'name' => 'Washington',
'country' => $country->getCode(),
]]
], JSON_THROW_ON_ERROR),
]],
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -71,7 +71,7 @@ final class CurrenciesTest extends JsonApiTestCase
server: $header,
content: json_encode([
'code' => 'KRW',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -76,7 +76,7 @@ final class CustomerGroupsTest extends JsonApiTestCase
content: json_encode([
'name' => 'Special',
'code' => 'special',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -102,7 +102,7 @@ final class CustomerGroupsTest extends JsonApiTestCase
server: $header,
content: json_encode([
'name' => 'Very Important People',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -78,11 +78,11 @@ final class CustomersTest extends JsonApiTestCase
'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 @@ final class CustomersTest extends JsonApiTestCase
'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 @@ final class CustomersTest extends JsonApiTestCase
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 @@ final class CustomersTest extends JsonApiTestCase
'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 @@ final class CustomersTest extends JsonApiTestCase
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 @@ final class CustomersTest extends JsonApiTestCase
'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 @@ final class CustomersTest extends JsonApiTestCase
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,
);
}
}

View file

@ -87,9 +87,9 @@ final class ExchangeRatesTest extends JsonApiTestCase
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 @@ final class ExchangeRatesTest extends JsonApiTestCase
/** @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(

View file

@ -36,13 +36,13 @@ final class LocalesTest extends JsonApiTestCase
$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 @@ final class LocalesTest extends JsonApiTestCase
server: $header,
content: json_encode([
'code' => 'is_IS',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -115,14 +115,14 @@ final class OrdersTest extends JsonApiTestCase
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 @@ final class OrdersTest extends JsonApiTestCase
'postcode' => 'Updated: 00-001',
'phoneNumber' => 'Updated: 48222333444',
'provinceCode' => 'Updated: PL-MA',
'provinceName' => 'Updated: mazowieckie'
'provinceName' => 'Updated: mazowieckie',
]),
);

View file

@ -14,7 +14,6 @@ declare(strict_types=1);
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;

View file

@ -90,8 +90,8 @@ final class ProductAssociationTypesTest extends JsonApiTestCase
'translations' => ['en_US' => [
'name' => 'test',
'description' => 'test description',
]]
], JSON_THROW_ON_ERROR),
]],
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -142,10 +142,10 @@ final class ProductAssociationTypesTest extends JsonApiTestCase
],
'de_DE' => [
'name' => 'test',
'description' => 'test description'
'description' => 'test description',
],
]
], JSON_THROW_ON_ERROR),
],
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -113,7 +113,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'Material',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -142,7 +142,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'Material',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -171,7 +171,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'New',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -200,7 +200,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'Pages',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -229,7 +229,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'Display size',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -258,7 +258,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'Damage reduction',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -290,7 +290,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'Published at',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -322,7 +322,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'Published at',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -365,7 +365,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'Material',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -413,7 +413,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'Test',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -446,7 +446,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'Material',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -489,7 +489,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'Material',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -532,7 +532,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'Material',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -574,7 +574,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'name' => 'Material',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -607,7 +607,7 @@ final class ProductAttributesTest extends JsonApiTestCase
'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 @@ final class ProductAttributesTest extends JsonApiTestCase
'pl_PL' => [
'name' => 'Dodatkowe informacje',
],
]
], JSON_THROW_ON_ERROR),
],
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -661,7 +661,7 @@ final class ProductAttributesTest extends JsonApiTestCase
content: json_encode([
'code' => 'NEW_CODE',
'type' => TextAreaAttributeType::TYPE,
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -239,7 +239,7 @@ final class ProductImagesTest extends JsonApiTestCase
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 @@ final class ProductImagesTest extends JsonApiTestCase
'productVariants' => [
sprintf('/api/v2/admin/product-variants/%s', $productVariant->getCode()),
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -121,7 +121,7 @@ final class ProductReviewsTest extends JsonApiTestCase
'title' => 'Bestest product!',
'comment' => 'I\'ve never bought anything better.',
'rating' => 5,
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -129,7 +129,7 @@ final class ProductVariantsTest extends JsonApiTestCase
'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 @@ final class ProductVariantsTest extends JsonApiTestCase
'channelCode' => 'WEB',
'price' => 4000,
]],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -195,7 +195,7 @@ final class ProductVariantsTest extends JsonApiTestCase
'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 @@ final class ProductVariantsTest extends JsonApiTestCase
'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 @@ final class ProductVariantsTest extends JsonApiTestCase
'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 @@ final class ProductVariantsTest extends JsonApiTestCase
'name' => 'Yellow mug',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNPROCESSABLE_ENTITY);
@ -343,7 +343,7 @@ final class ProductVariantsTest extends JsonApiTestCase
'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 @@ final class ProductVariantsTest extends JsonApiTestCase
'name' => 'Yellow mug',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNPROCESSABLE_ENTITY);
@ -416,7 +416,7 @@ final class ProductVariantsTest extends JsonApiTestCase
'name' => 'Tasse',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -115,7 +115,7 @@ final class ProductsTest extends JsonApiTestCase
'metaDescription' => 'Opis kubka',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -167,7 +167,7 @@ final class ProductsTest extends JsonApiTestCase
'name' => 'Kubek',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -194,9 +194,9 @@ final class ProductsTest extends JsonApiTestCase
'slug' => 'mug',
'name' => 'Mug',
'locale' => 'locale',
]
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -234,7 +234,7 @@ final class ProductsTest extends JsonApiTestCase
[
'@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 @@ final class ProductsTest extends JsonApiTestCase
[
'@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 @@ final class ProductsTest extends JsonApiTestCase
[
'attribute' => '/api/v2/admin/product-attributes/dishwasher_safe',
'value' => true,
]
],
],
'translations' => [
'en_US' => [
@ -274,7 +274,7 @@ final class ProductsTest extends JsonApiTestCase
'metaDescription' => 'Opis czapki',
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -80,7 +80,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
'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 @@ final class PromotionCouponsTest extends JsonApiTestCase
'perCustomerUsageLimit' => 5,
'reusableFromCancelledOrders' => false,
'expiresAt' => '2020-01-01 12:00:00',
], JSON_THROW_ON_ERROR)
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -84,7 +84,7 @@ final class PromotionsTest extends JsonApiTestCase
$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 @@ final class PromotionsTest extends JsonApiTestCase
'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 @@ final class PromotionsTest extends JsonApiTestCase
[
'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 @@ final class PromotionsTest extends JsonApiTestCase
'MOBILE' => [
'taxon' => 'CAPS',
'amount' => 2000,
]
],
],
],
[
@ -186,7 +186,7 @@ final class PromotionsTest extends JsonApiTestCase
],
'MOBILE' => [
'amount' => 222,
]
],
],
],
],
@ -243,7 +243,7 @@ final class PromotionsTest extends JsonApiTestCase
],
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -263,7 +263,7 @@ final class PromotionsTest extends JsonApiTestCase
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 @@ final class PromotionsTest extends JsonApiTestCase
);
}
/** @test */
public function it_does_not_create_a_promotion_with_taken_code(): void
{
@ -287,7 +286,7 @@ final class PromotionsTest extends JsonApiTestCase
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 @@ final class PromotionsTest extends JsonApiTestCase
'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 @@ final class PromotionsTest extends JsonApiTestCase
[
'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 @@ final class PromotionsTest extends JsonApiTestCase
'WEB' => [
'taxon' => 'wrong',
'amount' => 'invalid',
]
],
],
],
[
@ -385,11 +384,11 @@ final class PromotionsTest extends JsonApiTestCase
'type' => ItemTotalRuleChecker::TYPE,
'configuration' => [
'MOBILE' => [
]
],
],
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -425,7 +424,7 @@ final class PromotionsTest extends JsonApiTestCase
'type' => UnitFixedDiscountPromotionActionCommand::TYPE,
'configuration' => [
'WEB' => [
'filters' => 'invalid'
'filters' => 'invalid',
],
],
],
@ -449,7 +448,7 @@ final class PromotionsTest extends JsonApiTestCase
],
],
],
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -477,13 +476,13 @@ final class PromotionsTest extends JsonApiTestCase
'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 @@ final class PromotionsTest extends JsonApiTestCase
'@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 @@ final class PromotionsTest extends JsonApiTestCase
server: $header,
content: json_encode([
'priority' => -1,
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -59,7 +59,7 @@ final class ProvincesTest extends JsonApiTestCase
server: $header,
content: json_encode([
'abbreviation' => 'Minn.',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -72,7 +72,7 @@ final class ShippingCategoriesTest extends JsonApiTestCase
content: json_encode([
'code' => 'ultra',
'name' => 'Ultra',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -98,7 +98,7 @@ final class ShippingCategoriesTest extends JsonApiTestCase
server: $header,
content: json_encode([
'name' => 'Not so default',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -72,7 +72,7 @@ final class TaxCategoriesTest extends JsonApiTestCase
content: json_encode([
'code' => 'ultra',
'name' => 'Ultra',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -98,7 +98,7 @@ final class TaxCategoriesTest extends JsonApiTestCase
server: $header,
content: json_encode([
'name' => 'Not so default',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -81,7 +81,7 @@ final class TaxRatesTest extends JsonApiTestCase
'amount' => '0.9',
'includedInPrice' => true,
'calculator' => 'default',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -111,7 +111,7 @@ final class TaxRatesTest extends JsonApiTestCase
'amount' => '0.3',
'includedInPrice' => true,
'calculator' => 'default',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -149,7 +149,7 @@ final class TaxonImagesTest extends JsonApiTestCase
'type' => 'logo',
'owner' => sprintf('/api/v2/admin/taxons/%s', $taxon->getCode()),
'path' => 'logo.jpg',
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -76,9 +76,9 @@ final class TaxonsTest extends JsonApiTestCase
'en_US' => [
'name' => 'Watches',
'slug' => 'watches',
]
]
], JSON_THROW_ON_ERROR),
],
],
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -125,9 +125,9 @@ final class TaxonsTest extends JsonApiTestCase
'en_US' => [
'name' => 'Watches',
'slug' => 'watches',
]
]
], JSON_THROW_ON_ERROR),
],
],
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
@ -160,7 +160,7 @@ final class TaxonsTest extends JsonApiTestCase
],
],
'enabled' => false,
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(

View file

@ -24,7 +24,7 @@ final class JsonApiGenericRequestValidationTestCase extends JsonApiTestCase
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(

View file

@ -37,7 +37,7 @@ final class AddressesPostTest extends JsonApiTestCase
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 @@ final class AddressesPostTest extends JsonApiTestCase
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 @@ final class AddressesPostTest extends JsonApiTestCase
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 @@ final class AddressesPostTest extends JsonApiTestCase
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();

View file

@ -35,7 +35,7 @@ final class CustomersTest extends JsonApiTestCase
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 @@ final class CustomersTest extends JsonApiTestCase
'email' => 'shop@example.com',
'password' => 'sylius',
'subscribedToNewsletter' => true,
], JSON_THROW_ON_ERROR),
], \JSON_THROW_ON_ERROR),
);
$response = $this->client->getResponse();
@ -77,8 +77,8 @@ final class CustomersTest extends JsonApiTestCase
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 @@ final class CustomersTest extends JsonApiTestCase
'firstName' => 'John',
'lastName' => 'Wick',
'gender' => 'm',
'subscribedToNewsletter' => true
], JSON_THROW_ON_ERROR),
'subscribedToNewsletter' => true,
], \JSON_THROW_ON_ERROR),
);
$response = $this->client->getResponse();

View file

@ -184,7 +184,7 @@ final class OrdersTest extends JsonApiTestCase
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 @@ final class OrdersTest extends JsonApiTestCase
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 @@ final class OrdersTest extends JsonApiTestCase
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 @@ final class OrdersTest extends JsonApiTestCase
$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 @@ final class OrdersTest extends JsonApiTestCase
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 @@ final class OrdersTest extends JsonApiTestCase
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 @@ final class OrdersTest extends JsonApiTestCase
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 @@ final class OrdersTest extends JsonApiTestCase
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 @@ final class OrdersTest extends JsonApiTestCase
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);

View file

@ -76,7 +76,7 @@ final class ProductReviewsTest extends JsonApiTestCase
'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 @@ final class ProductReviewsTest extends JsonApiTestCase
'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 @@ final class ProductReviewsTest extends JsonApiTestCase
'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);

View file

@ -33,8 +33,8 @@ final class SendContactRequestTest extends JsonApiTestCase
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 @@ final class SendContactRequestTest extends JsonApiTestCase
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();

View file

@ -21,9 +21,7 @@ use Symfony\Component\Security\Core\User\UserInterface as BaseUserInterface;
class HeadersBuilder
{
/**
* @var array<string, string>
*/
/** @var array<string, string> */
private array $headers = [];
/**

View file

@ -65,11 +65,11 @@ final class AdminTaxonAjaxTest extends SessionAwareAjaxTestCase
{
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();

View file

@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Tests\Controller;
@ -15,6 +24,7 @@ abstract class SessionAwareAjaxTestCase extends JsonApiTestCase
parent::setUp();
$requestStack = self::getContainer()->get('request_stack');
try {
$requestStack->getSession();
} catch (SessionNotFoundException) {

View file

@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Tests\Functional;
@ -31,9 +40,9 @@ abstract class AbstractOrmTestCase extends TestCase
protected function getTestOrmConnection($config): Connection
{
return DriverManager::getConnection([
'driverClass' => DriverMock::class,
'driverClass' => DriverMock::class,
'wrapperClass' => ConnectionMock::class,
'user'=> 'sylius',
'user' => 'sylius',
'password' => 'sylius',
], $config);
}

View file

@ -61,15 +61,15 @@ final class SendAccountRegistrationEmailHandlerTest extends KernelTestCase
$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 @@ final class SendAccountRegistrationEmailHandlerTest extends KernelTestCase
$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);

View file

@ -58,15 +58,15 @@ final class SendAccountVerificationEmailHandlerTest extends KernelTestCase
$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 @@ final class SendAccountVerificationEmailHandlerTest extends KernelTestCase
$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);

View file

@ -58,13 +58,13 @@ final class SendResetPasswordEmailHandlerTest extends KernelTestCase
$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 @@ final class SendResetPasswordEmailHandlerTest extends KernelTestCase
$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);

View file

@ -31,7 +31,7 @@ final class LocaleResolvingTest extends KernelTestCase
uri: '/en_US/',
server: [
'HTTP_ACCEPT_LANGUAGE' => 'pl_PL',
]
],
);
$this->bootKernel();
@ -55,7 +55,7 @@ final class LocaleResolvingTest extends KernelTestCase
uri: '/admin/login',
server: [
'HTTP_ACCEPT_LANGUAGE' => 'pl_PL',
]
],
);
$this->bootKernel();

View file

@ -136,7 +136,7 @@ final class CartCollectorTest extends KernelTestCase
], $collector->getStates());
$this->assertSame(
array_map(fn (OrderItemInterface $item) => $item->getId(), $cart->getItems()->toArray()),
array_column($collector->getItems(), 'id')
array_column($collector->getItems(), 'id'),
);
}

View file

@ -1,17 +1,26 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Tests\Functional\Doctrine\Dump;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Table;
/**
* @Entity
*
* @Table(name="composite_keys_model")
*/
class CompositeKeysModel
@ -19,12 +28,14 @@ class CompositeKeysModel
public function __construct(
/**
* @Column(length=250)
*
* @Id
*/
public string $email,
/**
* @Column(type="string", name="organization_name")
*
* @Id
*/
public string $organizationName,

View file

@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Tests\Functional\Doctrine\Dump;
@ -12,6 +21,7 @@ use Doctrine\ORM\Mapping\Table;
/**
* @Entity
*
* @Table(name="model")
*/
class Model
@ -19,7 +29,9 @@ class Model
public function __construct(
/**
* @Column(type="integer")
*
* @Id
*
* @GeneratedValue
*/
public int $id,
@ -27,7 +39,7 @@ class Model
/**
* @Column(length=250)
*/
public string $email
public string $email,
) {
}
}

View file

@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Tests\Functional\Doctrine\Mock;

View file

@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Tests\Functional\Doctrine\Mock;

View file

@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Tests\Functional\Doctrine\Mock;

View file

@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Tests\Functional\Doctrine\Mock;

View file

@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Tests\Functional\Doctrine\Mock;

View file

@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Tests\Functional\Doctrine\Mock;

View file

@ -54,7 +54,7 @@ final class EligibleCatalogPromotionsProcessorTest extends WebTestCase
$actualDateTimes = array_map(
fn (CatalogPromotionInterface $eligibleCatalogPromotion) => $eligibleCatalogPromotion->getStartDate(),
$eligibleCatalogPromotions
$eligibleCatalogPromotions,
);
foreach ($actualDateTimes as $actualDateTime) {

View file

@ -16,9 +16,9 @@ namespace Sylius\Tests\Functional;
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 @@ final class ImageUploaderTest extends WebTestCase
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('<script', $this->getContent($file));

View file

@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Tests\Functional;
@ -25,22 +34,22 @@ final class OrderByIdentifierSqlWalkerTest extends AbstractOrmTestCase
self::assertStringEndsWith(
'ORDER BY m0_.id ASC',
$this->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 @@ final class OrderByIdentifierSqlWalkerTest extends AbstractOrmTestCase
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 @@ final class OrderByIdentifierSqlWalkerTest extends AbstractOrmTestCase
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 @@ final class OrderByIdentifierSqlWalkerTest extends AbstractOrmTestCase
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',
),
);
}

View file

@ -96,7 +96,7 @@ final class SalesDataProviderTest extends WebTestCase
$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 @@ final class SalesDataProviderTest extends WebTestCase
'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 @@ final class SalesDataProviderTest extends WebTestCase
$this->assertSame($expectedMonths, $salesSummary->getIntervals());
$this->assertSame(
['330.00'],
$salesSummary->getSales()
$salesSummary->getSales(),
);
}
@ -156,7 +156,7 @@ final class SalesDataProviderTest extends WebTestCase
$interval = new \DatePeriod(
$startDate,
\DateInterval::createFromDateString($interval),
$endDate
$endDate,
);
/** @var \DateTimeInterface $date */

View file

@ -43,7 +43,7 @@ final class UpdatingUserPasswordEncoderTest extends AbstractWebTestCase
],
[],
[],
PurgeMode::createDeleteMode()
PurgeMode::createDeleteMode(),
);
}
@ -127,7 +127,7 @@ final class UpdatingUserPasswordEncoderTest extends AbstractWebTestCase
AbstractResourceOwner::class,
[
'getName' => 'resourceProviderName',
]
],
);
$responseMock = $this->createConfiguredMock(
@ -137,7 +137,7 @@ final class UpdatingUserPasswordEncoderTest extends AbstractWebTestCase
'getResourceOwner' => $resourceOwnerMock,
'getAccessToken' => 'LongAccessToken',
'getRefreshToken' => 'LongRefreshToken',
]
],
);
$oAuthUserProvider->connect($shopUser, $responseMock);

View file

@ -13,8 +13,8 @@ declare(strict_types=1);
namespace Sylius\Tests\Functional\app;
use Symfony\Component\Config\Loader\LoaderInterface;
use App\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{

View file

@ -23,6 +23,7 @@ use Sylius\Component\Order\Model\OrderItemUnit;
final class OrderAdjustmentsRecalculationTest extends TestCase
{
private Order $order;
private OrderItemInterface $item;
protected function setUp(): void

View file

@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Tests\Twig;