mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Merge branch '1.13' into 1.14
* 1.13: [API] Apply statistics constraints sequentially to fix 500 error when using an undefined parameter Fix OrderAdjustmentsRecalculationTest
This commit is contained in:
commit
f1f6dbbade
3 changed files with 18 additions and 28 deletions
|
|
@ -90,19 +90,21 @@ final class GetStatisticsAction
|
||||||
private function createInputDataConstraints(): array
|
private function createInputDataConstraints(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
new SymfonyConstraints\Collection([
|
new SymfonyConstraints\Sequentially([
|
||||||
'channelCode' => new Constraints\Code(),
|
new SymfonyConstraints\Collection([
|
||||||
'startDate' => [
|
'channelCode' => new Constraints\Code(),
|
||||||
new SymfonyConstraints\NotBlank(),
|
'startDate' => [
|
||||||
new SymfonyConstraints\DateTime('Y-m-d\TH:i:s', message: 'sylius.date_time.invalid'),
|
new SymfonyConstraints\NotBlank(),
|
||||||
],
|
new SymfonyConstraints\DateTime('Y-m-d\TH:i:s', message: 'sylius.date_time.invalid'),
|
||||||
'interval' => new SymfonyConstraints\Choice(choices: array_keys($this->intervalsMap), multiple: false),
|
],
|
||||||
'endDate' => [
|
'interval' => new SymfonyConstraints\Choice(choices: array_keys($this->intervalsMap), multiple: false),
|
||||||
new SymfonyConstraints\NotBlank(),
|
'endDate' => [
|
||||||
new SymfonyConstraints\DateTime('Y-m-d\TH:i:s', message: 'sylius.date_time.invalid'),
|
new SymfonyConstraints\NotBlank(),
|
||||||
],
|
new SymfonyConstraints\DateTime('Y-m-d\TH:i:s', message: 'sylius.date_time.invalid'),
|
||||||
|
],
|
||||||
|
]),
|
||||||
|
new SymfonyConstraints\Expression(expression: 'value["startDate"] < value["endDate"]', message: 'sylius.statistics.end_date.invalid'),
|
||||||
]),
|
]),
|
||||||
new SymfonyConstraints\Expression(expression: 'value["startDate"] < value["endDate"]', message: 'sylius.statistics.end_date.invalid'),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -262,10 +262,6 @@ final class StatisticsTest extends JsonApiTestCase
|
||||||
'propertyPath' => '[endDate]',
|
'propertyPath' => '[endDate]',
|
||||||
'message' => 'This field is missing.',
|
'message' => 'This field is missing.',
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'propertyPath' => '',
|
|
||||||
'message' => 'The start date must be earlier than the end date.',
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -288,10 +284,6 @@ final class StatisticsTest extends JsonApiTestCase
|
||||||
'propertyPath' => '[endDate]',
|
'propertyPath' => '[endDate]',
|
||||||
'message' => 'This field is missing.',
|
'message' => 'This field is missing.',
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'propertyPath' => '',
|
|
||||||
'message' => 'The start date must be earlier than the end date.',
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -355,10 +347,6 @@ final class StatisticsTest extends JsonApiTestCase
|
||||||
'propertyPath' => '[endDate]',
|
'propertyPath' => '[endDate]',
|
||||||
'message' => 'This value should not be blank.',
|
'message' => 'This value should not be blank.',
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'propertyPath' => '',
|
|
||||||
'message' => 'The start date must be earlier than the end date.',
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -392,10 +380,6 @@ final class StatisticsTest extends JsonApiTestCase
|
||||||
'propertyPath' => '[startDate]',
|
'propertyPath' => '[startDate]',
|
||||||
'message' => 'The date time is not valid ISO 8601 date time in Y-m-d\TH:i:s format.',
|
'message' => 'The date time is not valid ISO 8601 date time in Y-m-d\TH:i:s format.',
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'propertyPath' => '',
|
|
||||||
'message' => 'The start date must be earlier than the end date.',
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,10 @@ final class OrderAdjustmentsRecalculationTest extends TestCase
|
||||||
|
|
||||||
private OrderItemInterface $item;
|
private OrderItemInterface $item;
|
||||||
|
|
||||||
|
private OrderItemUnit $unitNumberOne;
|
||||||
|
|
||||||
|
private OrderItemUnit $unitNumberTwo;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$neutralAdjustment = $this->createAdjustment(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT, -150, true);
|
$neutralAdjustment = $this->createAdjustment(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT, -150, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue