Skip to content

Commit b99e9dd

Browse files
committed
GraphQL-606: [Test coverage] Add virtual product to cart
1 parent e2854aa commit b99e9dd

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ class AddVirtualProductToCartTest extends GraphQlAbstract
2828
*/
2929
private $getMaskedQuoteIdByReservedOrderId;
3030

31+
protected function setUp()
32+
{
33+
$objectManager = Bootstrap::getObjectManager();
34+
$this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class);
35+
$this->getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
36+
}
37+
3138
/**
3239
* @magentoApiDataFixture Magento/Customer/_files/customer.php
3340
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/virtual_product.php
@@ -83,6 +90,7 @@ public function testNonExistentProductToCart()
8390
}
8491

8592
/**
93+
* _security
8694
* @magentoApiDataFixture Magento/Customer/_files/customer.php
8795
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/virtual_product.php
8896
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
@@ -102,9 +110,10 @@ public function testAddVirtualProductToGuestCart()
102110
}
103111

104112
/**
113+
* _security
105114
* @magentoApiDataFixture Magento/Customer/_files/three_customers.php
106115
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/virtual_product.php
107-
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
116+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
108117
*/
109118
public function testAddVirtualProductToAnotherCustomerCart()
110119
{
@@ -120,15 +129,10 @@ public function testAddVirtualProductToAnotherCustomerCart()
120129
$this->graphQlMutation($query, [], '', $this->getHeaderMap('customer2@search.example.com'));
121130
}
122131

123-
protected function setUp()
124-
{
125-
$objectManager = Bootstrap::getObjectManager();
126-
$this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class);
127-
$this->getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
128-
}
129-
130132
/**
131133
* @param string $maskedQuoteId
134+
* @param string $sku
135+
* @param int $qty
132136
* @return string
133137
*/
134138
private function getQuery(string $maskedQuoteId, string $sku, int $qty): string
@@ -140,8 +144,8 @@ private function getQuery(string $maskedQuoteId, string $sku, int $qty): string
140144
cartItems: [
141145
{
142146
data: {
143-
qty: $qty
144-
sku: "$sku"
147+
qty: {$qty}
148+
sku: "{$sku}"
145149
}
146150
}
147151
]

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public function testNonExistentProductToCart()
8383
}
8484

8585
/**
86+
* _security
8687
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/virtual_product.php
8788
* @magentoApiDataFixture Magento/Customer/_files/customer.php
8889
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
@@ -117,8 +118,8 @@ private function getQuery(string $maskedQuoteId, string $sku, int $qty): string
117118
cartItems: [
118119
{
119120
data: {
120-
qty: $qty
121-
sku: "$sku"
121+
qty: {$qty}
122+
sku: "{$sku}"
122123
}
123124
}
124125
]

0 commit comments

Comments
 (0)