33 public function testGetList()
36 $quote = $this->objectManager->create(Quote::class);
37 $quote->load(
'test_order_item_with_items_and_custom_options',
'reserved_order_id');
40 $customOptionProcessor = $this->objectManager->get(CustomOptionProcessor::class);
44 $customOptionProcessor->processOptions(
$item);
46 'item_id' => (int)
$item->getItemId(),
47 'sku' =>
$item->getSku(),
48 'name' =>
$item->getName(),
49 'price' => (float)
$item->getPrice(),
50 'qty' => (float)
$item->getQty(),
51 'product_type' =>
$item->getProductType(),
52 'quote_id' =>
$item->getQuoteId(),
55 if (
$item->getProductOption() !==
null) {
58 $data[
'product_option'][
'extension_attributes'][
'custom_options'][] =
$option->getData();
66 'resourcePath' => self::RESOURCE_PATH .
$cartId .
'/items',
72 'operation' => self::SERVICE_NAME .
'GetList',
84 public function testAddItem()
87 $product = $this->objectManager->create(\
Magento\Catalog\Model\Product::class)->load(2);
90 $quote = $this->objectManager->create(Quote::class);
91 $quote->load(
'test_order_1',
'reserved_order_id');
95 'resourcePath' => self::RESOURCE_PATH .
$cartId .
'/items',
101 'operation' => self::SERVICE_NAME .
'Save',
107 "sku" => $productSku,
113 $this->assertTrue(
$quote->hasProductId(2));
114 $this->assertEquals(7,
$quote->getItemByProduct(
$product)->getQty());
120 public function testRemoveItem()
123 $quote = $this->objectManager->create(Quote::class);
124 $quote->load(
'test_order_item_with_items',
'reserved_order_id');
126 $product = $this->objectManager->create(\
Magento\Catalog\Model\Product::class);
132 'resourcePath' => self::RESOURCE_PATH .
$cartId .
'/items/' . $itemId,
138 'operation' => self::SERVICE_NAME .
'DeleteById',
147 $quote = $this->objectManager->create(Quote::class);
148 $quote->load(
'test_order_item_with_items',
'reserved_order_id');
155 public function testUpdateItem()
158 $quote = $this->objectManager->create(Quote::class);
159 $quote->load(
'test_order_item_with_items',
'reserved_order_id');
161 $product = $this->objectManager->create(\
Magento\Catalog\Model\Product::class);
167 'resourcePath' => self::RESOURCE_PATH .
$cartId .
'/items/' . $itemId,
173 'operation' => self::SERVICE_NAME .
'Save',
177 if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) {
194 $quote = $this->objectManager->create(Quote::class);
195 $quote->load(
'test_order_item_with_items',
'reserved_order_id');
196 $this->assertTrue(
$quote->hasProductId(1));
198 $this->assertEquals(5,
$item->getQty());
199 $this->assertEquals($itemId,
$item->getItemId());
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
static getObjectManager()