Skip to content

Commit 3ac33f5

Browse files
committed
MC-20636: MyAccount :: Order Details :: Order Details by Order Number
- CR and test fixes
1 parent 3ad41f3 commit 3ac33f5

File tree

1 file changed

+18
-35
lines changed

1 file changed

+18
-35
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/RetrieveOrdersByOrderNumberTest.php

Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ public function testGetCustomerOrderWithBundleProduct()
187187
'product_sku' => 'simple1',
188188
'product_name' => 'Simple Product1',
189189
'product_type'=> 'simple',
190-
'quantity_ordered'=> 1
190+
'quantity_ordered'=> 1,
191+
'discounts' => null
191192
]
192193
]
193194
],
@@ -198,7 +199,8 @@ public function testGetCustomerOrderWithBundleProduct()
198199
'product_sku' => 'simple2',
199200
'product_name' => 'Simple Product2',
200201
'product_type'=> 'simple',
201-
'quantity_ordered'=> 2
202+
'quantity_ordered'=> 2,
203+
'discounts' => null
202204
]
203205
]
204206
],
@@ -219,16 +221,6 @@ public function testGetCustomerOrderWithBundleProductWithTaxesAndDiscounts()
219221
{
220222
$qty = 4;
221223
$bundleSku = 'bundle-product-two-dropdown-options';
222-
$simpleProductSku = 'simple2';
223-
/** @var Product $simple */
224-
$simple = $this->productRepository->get($simpleProductSku);
225-
$stockData =[
226-
StockItemInterface::QTY => 200,
227-
StockItemInterface::MANAGE_STOCK =>true,
228-
StockItemInterface::IS_IN_STOCK =>true
229-
];
230-
$simple->setQuantityAndStockStatus($stockData);
231-
$this->productRepository->save($simple);
232224
/** @var Product $bundleProduct */
233225
$bundleProduct = $this->productRepository->get($bundleSku);
234226
/** @var $typeInstance \Magento\Bundle\Model\Product\Type */
@@ -241,7 +233,6 @@ public function testGetCustomerOrderWithBundleProductWithTaxesAndDiscounts()
241233
/** @var Selection $selection */
242234
$selection1 = $typeInstance->getSelectionsCollection([$option1->getId()], $bundleProduct)->getFirstItem();
243235
$selectionId1 = (int)$selection1->getSelectionId();
244-
245236
$selection2 = $typeInstance->getSelectionsCollection([$option2->getId()], $bundleProduct)->getLastItem();
246237
$selectionId2 = (int)$selection2->getSelectionId();
247238

@@ -259,22 +250,16 @@ public function testGetCustomerOrderWithBundleProductWithTaxesAndDiscounts()
259250

260251
$bundledItemInTheOrder = $customerOrderItems['items'][0];
261252
$this->assertEquals('bundle-product-two-dropdown-options-simple1-simple2', $bundledItemInTheOrder['product_sku']);
262-
$this->assertArrayHasKey('child_items', $bundledItemInTheOrder);
263-
$childItemInTheOrder = $bundledItemInTheOrder['child_items'][0];
264-
$this->assertNotEmpty($childItemInTheOrder);
265-
$this->assertEquals('simple1', $childItemInTheOrder['product_sku']);
266-
$this->assertEquals(
267-
0,
268-
$childItemInTheOrder['discounts'][0]['amount']['value']
269-
);
270-
$this->assertEquals(
271-
'USD',
272-
$childItemInTheOrder['discounts'][0]['amount']['currency']
273-
);
274-
$this->assertEquals(
275-
'null',
276-
$childItemInTheOrder['discounts'][0]['label']
277-
);
253+
$this->assertArrayHasKey('bundle_options', $bundledItemInTheOrder);
254+
$childItemsInTheOrder = $bundledItemInTheOrder['bundle_options'];
255+
$this->assertNotEmpty($childItemsInTheOrder);
256+
$this->assertCount(2, $childItemsInTheOrder);
257+
$this->assertEquals('Drop Down Option 1', $childItemsInTheOrder[0]['label']);
258+
$this->assertEquals('Drop Down Option 2', $childItemsInTheOrder[1]['label']);
259+
260+
$this->assertEquals('simple1', $childItemsInTheOrder[0]['items'][0]['product_sku']);
261+
$this->assertEquals('simple2', $childItemsInTheOrder[1]['items'][0]['product_sku']);
262+
278263
$this->assertTotalsOnBundleProductWithTaxesAndDiscounts($customerOrderItems);
279264
$this->deleteOrder();
280265
}
@@ -369,10 +354,6 @@ private function assertTotalsOnBundleProductWithTaxesAndDiscounts(array $custome
369354
2,
370355
$customerOrderItem['total']['shipping_handling']['discounts'][0]['amount']['value']
371356
);
372-
$this->assertEquals(
373-
'USD',
374-
$customerOrderItem['total']['shipping_handling']['discounts'][0]['amount']['currency']
375-
);
376357
$this->assertEquals(
377358
'null',
378359
$customerOrderItem['total']['shipping_handling']['discounts'][0]['label']
@@ -1477,15 +1458,16 @@ private function getCustomerOrderQueryBundleProduct($orderNumber)
14771458
product_url_key
14781459
product_sale_price{value}
14791460
quantity_ordered
1480-
__typename
1461+
discounts{amount{value} label}
14811462
... on BundleOrderItem{
14821463
bundle_options{
14831464
__typename
14841465
label
1485-
items{ product_sku product_name product_type quantity_ordered}
1466+
items{product_sku product_name product_type quantity_ordered discounts{amount{value}}
14861467
}
14871468
}
14881469
}
1470+
}
14891471
total {
14901472
base_grand_total{value currency}
14911473
grand_total{value currency}
@@ -1498,6 +1480,7 @@ private function getCustomerOrderQueryBundleProduct($orderNumber)
14981480
amount_including_tax{value}
14991481
amount_excluding_tax{value}
15001482
total_amount{value}
1483+
discounts{amount{value} label}
15011484
taxes {amount{value} title rate}
15021485
}
15031486
discounts {amount{value currency} label}

0 commit comments

Comments
 (0)