Skip to content

Commit f873398

Browse files
committed
MC-32201: Reorder functionality (test coverage)
1 parent ade9a6f commit f873398

File tree

6 files changed

+12
-96
lines changed

6 files changed

+12
-96
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\TestFramework\TestCase\GraphQlAbstract;
1515

1616
/**
17+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1718
* Test Reorder with and without products overlay in shopping cart.
1819
*/
1920
class ReorderConfigurableWithVariationsTest extends GraphQlAbstract

dev/tests/integration/testsuite/Magento/Sales/_files/order_with_1_qty_product_rollback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
require __DIR__ . '/../../../Magento/Sales/_files/order_with_two_simple_products_rollback.php';
7+
require __DIR__ . '/../../../Magento/Sales/_files/order_with_two_simple_products_qty_10_rollback.php';

dev/tests/integration/testsuite/Magento/Sales/_files/order_with_different_types_of_product_rollback.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
*/
66

77
require __DIR__ . '/../../../Magento/Customer/_files/customer_rollback.php';
8+
require __DIR__ . '/../../../Magento/Catalog/_files/product_simple_without_custom_options_rollback.php';
9+
require __DIR__ . '/../../../Magento/ConfigurableProduct/_files/product_configurable_rollback.php';
10+
require __DIR__ . '/../../../Magento/GraphQl/Catalog/_files/virtual_product_rollback.php';
11+
require __DIR__ . '/../../../Magento/Bundle/_files/bundle_product_radio_required_option_rollback.php';
812
require __DIR__ . '/../../../Magento/Downloadable/_files/product_downloadable_rollback.php';
9-
require 'default_rollback.php';

dev/tests/integration/testsuite/Magento/Sales/_files/order_with_simple_product_rollback.php

Lines changed: 3 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -6,94 +6,6 @@
66

77
use Magento\Sales\Api\OrderRepositoryInterface;
88

9-
require __DIR__ . '/../../../Magento/Customer/_files/customer.php';
10-
require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php';
11-
require __DIR__ . '/../../../Magento/Catalog/_files/product_simple_without_custom_options.php';
12-
13-
/** \Magento\Customer\Model\Customer $customer */
14-
$addressData = include __DIR__ . '/../../../Magento/Sales/_files/address_data.php';
15-
$billingAddress = $objectManager->create(\Magento\Sales\Model\Order\Address::class, ['data' => $addressData]);
16-
$billingAddress->setAddressType('billing');
17-
$shippingAddress = clone $billingAddress;
18-
$shippingAddress->setId(null)->setAddressType('shipping');
19-
20-
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
21-
$payment = $objectManager->create(\Magento\Sales\Model\Order\Payment::class);
22-
$payment->setMethod('checkmo');
23-
$customerIdFromFixture = 1;
24-
25-
$optionValuesByType = [
26-
'field' => 'Test value',
27-
'date_time' => [
28-
'year' => '2015',
29-
'month' => '9',
30-
'day' => '9',
31-
'hour' => '2',
32-
'minute' => '2',
33-
'day_part' => 'am',
34-
'date_internal' => '',
35-
],
36-
'drop_down' => '3-1-select',
37-
'radio' => '4-1-radio',
38-
];
39-
40-
$requestInfo = ['options' => [], 'qty' => 1];
41-
$productOptions = $product->getOptions();
42-
foreach ($productOptions as $option) {
43-
$requestInfo['options'][$option->getOptionId()] = $optionValuesByType[$option->getType()];
44-
}
45-
46-
/** @var \Magento\Sales\Model\Order\Item $orderItem */
47-
$orderItem = $objectManager->create(\Magento\Sales\Model\Order\Item::class);
48-
$orderItem->setProductId($product->getId());
49-
$orderItem->setQtyOrdered(1);
50-
$orderItem->setBasePrice($product->getPrice());
51-
$orderItem->setPrice($product->getPrice());
52-
$orderItem->setRowTotal($product->getPrice());
53-
$orderItem->setProductType($product->getTypeId());
54-
$orderItem->setProductOptions(['info_buyRequest' => $requestInfo]);
55-
$orderItem->setName($product->getName());
56-
$orderItem->setSku($product->getSku());
57-
$orderItem->setStoreId(0);
58-
// create second order item
59-
60-
$orderItem2 = $objectManager->create(\Magento\Sales\Model\Order\Item::class);
61-
$requestInfo = [
62-
'qty' => 1
63-
];
64-
$orderItem2->setProductId($secondProduct->getId())
65-
->setQtyOrdered(1)
66-
->setBasePrice($secondProduct->getPrice())
67-
->setPrice($secondProduct->getPrice())
68-
->setRowTotal($secondProduct->getPrice())
69-
->setProductType($secondProduct->getTypeId())
70-
->setName($secondProduct->getName())
71-
->setSku($secondProduct->getSku())
72-
->setStoreId(0)
73-
->setProductId($secondProduct->getId())
74-
->setSku($secondProductSku)
75-
->setProductOptions(['info_buyRequest' => $requestInfo]);
76-
77-
/** @var \Magento\Sales\Model\Order $order */
78-
$order = $objectManager->create(\Magento\Sales\Model\Order::class);
79-
$order->setIncrementId('100001001');
80-
$order->setState(\Magento\Sales\Model\Order::STATE_NEW);
81-
$order->setStatus($order->getConfig()->getStateDefaultStatus(\Magento\Sales\Model\Order::STATE_NEW));
82-
$order->setCustomerIsGuest(false);
83-
$order->setCustomerId($customer->getId());
84-
$order->setCustomerEmail($customer->getEmail());
85-
$order->setCustomerFirstname($customer->getName());
86-
$order->setCustomerLastname($customer->getLastname());
87-
$order->setBillingAddress($billingAddress);
88-
$order->setShippingAddress($shippingAddress);
89-
$order->setAddresses([$billingAddress, $shippingAddress]);
90-
$order->setPayment($payment);
91-
$order->addItem($orderItem);
92-
$order->addItem($orderItem2);
93-
$order->setStoreId($objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->getStore()->getId());
94-
$order->setSubtotal(100);
95-
$order->setBaseSubtotal(100);
96-
$order->setBaseGrandTotal(100);
97-
98-
$orderRepository = $objectManager->create(OrderRepositoryInterface::class);
99-
$orderRepository->save($order);
9+
require __DIR__ . '/../../../Magento/Customer/_files/customer_rollback.php';
10+
require __DIR__ . '/../../../Magento/Catalog/_files/product_simple_rollback.php';
11+
require __DIR__ . '/../../../Magento/Catalog/_files/product_simple_without_custom_options_rollback.php';

dev/tests/integration/testsuite/Magento/Sales/_files/order_with_two_configurable_variations.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@
5252
$orderConfigurableItem->setParentItemId(null);
5353
$orderConfigurableItem->setProductType('configurable');
5454
$configurableVariations = [];
55-
foreach (array_values($configurableProduct->getExtensionAttributes()->getConfigurableProductLinks())
56-
as $key => $variationId
57-
) {
55+
$producLinks = array_values($configurableProduct->getExtensionAttributes()->getConfigurableProductLinks());
56+
foreach ($producLinks as $key => $variationId) {
5857
$simpleProductId = current($configurableProduct->getExtensionAttributes()->getConfigurableProductLinks());
5958

6059
/** @var \Magento\Catalog\Api\Data\ProductInterface $simpleProduct */

dev/tests/integration/testsuite/Magento/Sales/_files/order_with_two_configurable_variations_rollback.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
*/
66

77
require __DIR__ . '/../../../Magento/Customer/_files/customer_rollback.php';
8+
require __DIR__ . '/../../../Magento/ConfigurableProduct/_files/product_configurable_rollback.php';
89
require 'default_rollback.php';

0 commit comments

Comments
 (0)