Add coupons to payload in PromotionCouponsTest

This commit is contained in:
Wojdylak 2023-11-23 16:04:37 +01:00
parent ae13ab3969
commit 854393e293
3 changed files with 20 additions and 10 deletions

View file

@ -26,7 +26,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
/** @test */
public function it_gets_a_promotion_coupon(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionCouponInterface $coupon */
@ -48,7 +48,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
/** @test */
public function it_gets_promotion_coupons(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
$this->client->request(method: 'GET', uri: '/api/v2/admin/promotion-coupons', server: $header);
@ -63,7 +63,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
/** @test */
public function it_creates_a_promotion_coupon(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionInterface $promotion */
@ -93,7 +93,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
/** @test */
public function it_updates_a_promotion_coupon(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionCouponInterface $coupon */
@ -121,7 +121,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
/** @test */
public function it_removes_a_promotion_coupon(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionCouponInterface $coupon */

View file

@ -6,7 +6,9 @@
"code": "50_off",
"name": "50% Off on your first order",
"description": "Get 50% off of your first purchase",
"channels": ["\/api\/v2\/admin\/channels\/MOBILE"],
"channels": [
"\/api\/v2\/admin\/channels\/MOBILE"
],
"priority": 1,
"exclusive": true,
"appliesToDiscounted": false,

View file

@ -10,7 +10,10 @@
"code": "dollar_off",
"name": "1 dollar off each item",
"description": "Get 1 dollar off every item when buying more than 10",
"channels": ["\/api\/v2\/admin\/channels\/WEB", "\/api\/v2\/admin\/channels\/MOBILE"],
"channels": [
"\/api\/v2\/admin\/channels\/WEB",
"\/api\/v2\/admin\/channels\/MOBILE"
],
"priority": 2,
"exclusive": false,
"appliesToDiscounted": true,
@ -19,7 +22,10 @@
"couponBased": true,
"startsAt": null,
"endsAt": null,
"coupons": [],
"coupons": [
"\/api\/v2\/admin\/promotion-coupons\/XYZ1",
"\/api\/v2\/admin\/promotion-coupons\/XYZ2"
],
"rules": [],
"actions": [],
"createdAt": @date@,
@ -40,7 +46,9 @@
"code": "50_off",
"name": "50% Off on your first order",
"description": "Get 50% off of your first purchase",
"channels": ["\/api\/v2\/admin\/channels\/MOBILE"],
"channels": [
"\/api\/v2\/admin\/channels\/MOBILE"
],
"priority": 1,
"exclusive": true,
"appliesToDiscounted": false,
@ -67,7 +75,7 @@
"hydra:totalItems": 2,
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "/api/v2/admin/promotions{?coupons.code,coupons.code[],order[priority]}",
"hydra:template": "\/api\/v2\/admin\/promotions{?coupons.code,coupons.code[],order[priority]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{