Skip to content

Commit d032b19

Browse files
author
Prabhu Ram
committed
MC-37603: [Graphql]Item belonging to one customer's wishlist can be updated and added to a different customer's wishlist
- Fixed issue and added coverage
1 parent 9594805 commit d032b19

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/DeleteProductsFromWishlistTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testDeleteWishlistItemFromWishlist(): void
6464
public function testUnauthorizedWishlistItemDelete()
6565
{
6666
$wishlist = $this->getWishlist();
67-
$wishlistItem = $wishlist['customer']['wishlist']['items'][0];
67+
$wishlistItem = $wishlist['customer']['wishlist']['items_v2'][0];
6868
$wishlist2 = $this->getWishlist('customer_two@example.com');
6969
$wishlist2Id = $wishlist2['customer']['wishlist']['id'];
7070
$query = $this->getQuery((int) $wishlist2Id, (int) $wishlistItem['id']);
@@ -75,8 +75,8 @@ public function testUnauthorizedWishlistItemDelete()
7575
$this->getHeaderMap('customer_two@example.com')
7676
);
7777
self::assertEquals(1, $response['removeProductsFromWishlist']['wishlist']['items_count']);
78-
self::assertNotEmpty($response['removeProductsFromWishlist']['wishlist']['items'], 'empty wish list items');
79-
self::assertCount(1, $response['removeProductsFromWishlist']['wishlist']['items']);
78+
self::assertNotEmpty($response['removeProductsFromWishlist']['wishlist']['items_v2'], 'empty wish list items');
79+
self::assertCount(1, $response['removeProductsFromWishlist']['wishlist']['items_v2']);
8080
self::assertEquals(
8181
'The wishlist item with ID "'.$wishlistItem['id'].'" does not belong to the wishlist',
8282
$response['removeProductsFromWishlist']['user_errors'][0]['message']

dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/UpdateProductsFromWishlistTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,21 @@ public function testUpdateSimpleProductFromWishlist(): void
6767
public function testUnauthorizedWishlistItemUpdate()
6868
{
6969
$wishlist = $this->getWishlist();
70-
$wishlistItem = $wishlist['customer']['wishlist']['items'][0];
70+
$wishlistItem = $wishlist['customer']['wishlist']['items_v2'][0];
7171
$wishlist2 = $this->getWishlist('customer_two@example.com');
7272
$wishlist2Id = $wishlist2['customer']['wishlist']['id'];
7373
$qty = 2;
74-
$updateWishlistQuery = $this->getQueryWithNoDescription((int) $wishlist2Id, (int) $wishlistItem['id'], $qty);
74+
$description = 'New Description';
75+
$updateWishlistQuery = $this->getQuery((int) $wishlist2Id, (int) $wishlistItem['id'], $qty, $description);
7576
$response = $this->graphQlMutation(
7677
$updateWishlistQuery,
7778
[],
7879
'',
7980
$this->getHeaderMap('customer_two@example.com')
8081
);
8182
self::assertEquals(1, $response['updateProductsInWishlist']['wishlist']['items_count']);
82-
self::assertNotEmpty($response['updateProductsInWishlist']['wishlist']['items'], 'empty wish list items');
83-
self::assertCount(1, $response['updateProductsInWishlist']['wishlist']['items']);
83+
self::assertNotEmpty($response['updateProductsInWishlist']['wishlist']['items_v2'], 'empty wish list items');
84+
self::assertCount(1, $response['updateProductsInWishlist']['wishlist']['items_v2']);
8485
self::assertEquals(
8586
'The wishlist item with ID "'.$wishlistItem['id'].'" does not belong to the wishlist',
8687
$response['updateProductsInWishlist']['user_errors'][0]['message']

0 commit comments

Comments
 (0)