Skip to content

Commit

Permalink
minor #15583 [Api][Test] Update promotion test response check (Wojdylak)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.13 branch.

Discussion
----------

| Q               | A                                                            |
|-----------------|--------------------------------------------------------------|
| Branch?         | 1.13
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | N/A
| License         | MIT


Commits
-------
  [Api][Test] Update promotion test response check
  • Loading branch information
NoResponseMate committed Dec 1, 2023
2 parents 15ad91a + 9d6f54e commit ba0e65d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
6 changes: 2 additions & 4 deletions tests/Api/Admin/PromotionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public function it_does_not_create_a_promotion_with_end_date_earlier_than_start_
/** @test */
public function it_does_not_create_a_promotion_with_invalid_rules(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'promotion/channel.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);

$this->client->request(
Expand Down Expand Up @@ -380,7 +380,7 @@ public function it_does_not_create_a_promotion_with_invalid_rules(): void
/** @test */
public function it_does_not_create_a_promotion_with_invalid_actions(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'promotion/channel.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);

$this->client->request(
Expand Down Expand Up @@ -419,8 +419,6 @@ public function it_does_not_create_a_promotion_with_invalid_actions(): void
'WEB' => [
'percentage' => 110,
],
'MOBILE' => [
],
],
],
[
Expand Down
23 changes: 23 additions & 0 deletions tests/Api/DataFixtures/ORM/promotion/channel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Sylius\Component\Core\Model\Channel:
channel_web:
code: 'WEB'
name: 'Web Channel'
hostname: 'localhost'
contactEmail: 'web@sylius.com'
description: 'Lorem ipsum'
baseCurrency: '@currency_usd'
defaultLocale: '@locale_en'
locales: ['@locale_en', '@locale_pl']
color: 'black'
enabled: true
taxCalculationStrategy: 'order_items_based'

Sylius\Component\Currency\Model\Currency:
currency_usd:
code: 'USD'

Sylius\Component\Locale\Model\Locale:
locale_en:
code: 'en_US'
locale_pl:
code: 'pl_PL'
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
"message": "This value should be of type numeric.",
"code": @string@
},
{
"propertyPath": "actions[0].configuration[MOBILE]",
"message": "This field is missing.",
"code": @string@
},
{
"propertyPath": "actions[1].configuration[WEB][amount]",
"message": "This field is missing.",
Expand All @@ -24,11 +19,6 @@
"message": "This value should be of type array|(Traversable&ArrayAccess).",
"code": null
},
{
"propertyPath": "actions[1].configuration[MOBILE]",
"message": "This field is missing.",
"code": @string@
},
{
"propertyPath": "actions[2].configuration[percentage]",
"message": "The percentage discount must be between 0% and 100%.",
Expand All @@ -39,11 +29,6 @@
"message": "The percentage discount must be between 0% and 100%.",
"code": @string@
},
{
"propertyPath": "actions[3].configuration[MOBILE][percentage]",
"message": "This field is missing.",
"code": @string@
},
{
"propertyPath": "actions[4].configuration[percentage]",
"message": "This field is missing.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
"message": "Taxon with code wrong does not exist.",
"code": null
},
{
"propertyPath": "rules[5].configuration[MOBILE]",
"message": "This field is missing.",
"code": @string@
},
{
"propertyPath": "rules[6].configuration[product_code]",
"message": "Product with code wrong does not exist.",
Expand All @@ -55,8 +50,8 @@
"code": @string@
},
{
"propertyPath": "rules[7].configuration[MOBILE][amount]",
"message": "This field is missing.",
"propertyPath": "rules[7].configuration[MOBILE]",
"message": "This field was not expected.",
"code": @string@
}
]
Expand Down

0 comments on commit ba0e65d

Please sign in to comment.