Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
api-functional
testsuite
Magento
Sales
Service
V1
ShipmentCreateTest.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Sales\Service\V1
;
8
9
use
Magento\TestFramework\TestCase\WebapiAbstract
;
10
14
class
ShipmentCreateTest
extends
WebapiAbstract
15
{
16
const
RESOURCE_PATH
=
'/V1/shipment'
;
17
18
const
SERVICE_READ_NAME
=
'salesShipmentRepositoryV1'
;
19
20
const
SERVICE_VERSION
=
'V1'
;
21
25
protected
$objectManager
;
26
27
protected
function
setUp
()
28
{
29
$this->objectManager =
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
();
30
}
31
35
public
function
testInvoke()
36
{
38
$order
= $this->objectManager->create(\
Magento
\Sales\Model\Order::class)->loadByIncrementId(
'100000001'
);
39
$orderItem
= current(
$order
->getAllItems());
40
$items
= [
41
[
42
'order_item_id'
=>
$orderItem
->getId(),
43
'qty'
=>
$orderItem
->getQtyOrdered(),
44
'additional_data'
=>
null
,
45
'description'
=>
null
,
46
'entity_id'
=> 1,
47
'name'
=>
null
,
48
'parent_id'
=>
null
,
49
'price'
=>
null
,
50
'product_id'
=>
null
,
51
'row_total'
=>
null
,
52
'sku'
=>
'simple'
,
53
'weight'
=>
null
,
54
],
55
];
56
$serviceInfo = [
57
'rest'
=> [
58
'resourcePath'
=>
self::RESOURCE_PATH
,
59
'httpMethod'
=>
\Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST
,
60
],
61
'soap'
=> [
62
'service'
=>
self::SERVICE_READ_NAME
,
63
'serviceVersion'
=>
self::SERVICE_VERSION
,
64
'operation'
=> self::SERVICE_READ_NAME .
'save'
,
65
],
66
];
67
$data
= [
68
'order_id'
=>
$order
->getId(),
69
'entity_id'
=>
null
,
70
'store_id'
=>
null
,
71
'total_weight'
=>
null
,
72
'total_qty'
=>
null
,
73
'email_sent'
=>
null
,
74
'customer_id'
=>
null
,
75
'shipping_address_id'
=>
null
,
76
'billing_address_id'
=>
null
,
77
'shipment_status'
=>
null
,
78
'increment_id'
=>
null
,
79
'created_at'
=>
null
,
80
'updated_at'
=>
null
,
81
'shipping_label'
=>
null
,
82
'tracks'
=> [
83
[
84
'carrier_code'
=>
'UPS'
,
85
'order_id'
=>
$order
->getId(),
86
'title'
=>
'ground'
,
87
'description'
=>
null
,
88
'track_number'
=>
'12345678'
,
89
'parent_id'
=>
null
,
90
'created_at'
=>
null
,
91
'updated_at'
=>
null
,
92
'qty'
=>
null
,
93
'weight'
=> null
94
]
95
],
96
'items'
=>
$items
,
97
'comments'
=> [
98
[
99
'comment'
=>
'Shipment-related comment.'
,
100
'is_customer_notified'
=>
null
,
101
'is_visible_on_front'
=>
null
,
102
'parent_id'
=> null
103
]
104
],
105
];
106
$result
= $this->
_webApiCall
($serviceInfo, [
'entity'
=>
$data
]);
107
$this->assertNotEmpty(
$result
);
108
}
109
}
$result
$result
Definition:
product_configurable_not_available_rollback.php:26
Magento\Sales\Service\V1\ShipmentCreateTest\SERVICE_VERSION
const SERVICE_VERSION
Definition:
ShipmentCreateTest.php:20
Magento\Sales\Service\V1\ShipmentCreateTest\setUp
setUp()
Definition:
ShipmentCreateTest.php:27
Magento\TestFramework\TestCase\WebapiAbstract\_webApiCall
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
Definition:
WebapiAbstract.php:165
$orderItem
$orderItem
Definition:
order.php:30
$order
$order
Definition:
order.php:55
Magento\Sales\Service\V1
Definition:
CreditmemoAddCommentTest.php:6
Magento\Sales\Service\V1\ShipmentCreateTest\$objectManager
$objectManager
Definition:
ShipmentCreateTest.php:25
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Framework\Webapi\Rest\Request\HTTP_METHOD_POST
const HTTP_METHOD_POST
Definition:
Request.php:22
Magento
Magento\TestFramework\TestCase\WebapiAbstract
Definition:
WebapiAbstract.php:19
Magento\Sales\Service\V1\ShipmentCreateTest\RESOURCE_PATH
const RESOURCE_PATH
Definition:
ShipmentCreateTest.php:16
Magento\Sales\Service\V1\ShipmentCreateTest
Definition:
ShipmentCreateTest.php:14
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125
Magento\Sales\Service\V1\ShipmentCreateTest\SERVICE_READ_NAME
const SERVICE_READ_NAME
Definition:
ShipmentCreateTest.php:18
$items
$items
Definition:
order_rollback.php:21