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
CreditmemoCreateTest.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
CreditmemoCreateTest
extends
WebapiAbstract
15
{
16
const
RESOURCE_PATH
=
'/V1/creditmemo'
;
17
18
const
SERVICE_READ_NAME
=
'salesCreditmemoRepositoryV1'
;
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
$orderCollection
= $this->objectManager->get(\
Magento
\Sales\Model\
ResourceModel
\
Order
\Collection::class);
39
$order
=
$orderCollection
->getFirstItem();
40
42
$orderItem
= current(
$order
->getAllItems());
43
$items
= [
44
$orderItem
->getId() => [
'order_item_id'
=>
$orderItem
->getId(),
'qty'
=>
$orderItem
->getQtyInvoiced()],
45
];
46
$serviceInfo = [
47
'rest'
=> [
48
'resourcePath'
=>
self::RESOURCE_PATH
,
49
'httpMethod'
=>
\Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST
,
50
],
51
'soap'
=> [
52
'service'
=>
self::SERVICE_READ_NAME
,
53
'serviceVersion'
=>
self::SERVICE_VERSION
,
54
'operation'
=> self::SERVICE_READ_NAME .
'save'
,
55
],
56
];
57
$data
= [
58
'adjustment'
=>
null
,
59
'adjustment_negative'
=>
null
,
60
'adjustment_positive'
=>
null
,
61
'base_adjustment'
=>
null
,
62
'base_adjustment_negative'
=>
null
,
63
'base_adjustment_positive'
=>
null
,
64
'base_currency_code'
=>
null
,
65
'base_discount_amount'
=>
null
,
66
'base_grand_total'
=>
null
,
67
'base_discount_tax_compensation_amount'
=>
null
,
68
'base_shipping_amount'
=>
null
,
69
'base_shipping_discount_tax_compensation_amnt'
=>
null
,
70
'base_shipping_incl_tax'
=>
null
,
71
'base_shipping_tax_amount'
=>
null
,
72
'base_subtotal'
=>
null
,
73
'base_subtotal_incl_tax'
=>
null
,
74
'base_tax_amount'
=>
null
,
75
'base_to_global_rate'
=>
null
,
76
'base_to_order_rate'
=>
null
,
77
'billing_address_id'
=>
null
,
78
'created_at'
=>
null
,
79
'creditmemo_status'
=>
null
,
80
'discount_amount'
=>
null
,
81
'discount_description'
=>
null
,
82
'email_sent'
=>
null
,
83
'entity_id'
=>
null
,
84
'global_currency_code'
=>
null
,
85
'grand_total'
=>
null
,
86
'discount_tax_compensation_amount'
=>
null
,
87
'increment_id'
=>
null
,
88
'invoice_id'
=>
null
,
89
'order_currency_code'
=>
null
,
90
'order_id'
=>
$order
->getId(),
91
'shipping_address_id'
=>
null
,
92
'shipping_amount'
=>
null
,
93
'shipping_discount_tax_compensation_amount'
=>
null
,
94
'shipping_incl_tax'
=>
null
,
95
'shipping_tax_amount'
=>
null
,
96
'state'
=>
null
,
97
'store_currency_code'
=>
null
,
98
'store_id'
=>
null
,
99
'store_to_base_rate'
=>
null
,
100
'store_to_order_rate'
=>
null
,
101
'subtotal'
=>
null
,
102
'subtotal_incl_tax'
=>
null
,
103
'tax_amount'
=>
null
,
104
'transaction_id'
=>
null
,
105
'updated_at'
=>
null
,
106
'items'
=>
$items
,
107
];
108
$result
= $this->
_webApiCall
($serviceInfo, [
'entity'
=>
$data
]);
109
$this->assertNotEmpty(
$result
);
110
}
111
}
Magento\Sales\Model\Order
Definition:
Order.php:54
$result
$result
Definition:
product_configurable_not_available_rollback.php:26
Magento\Catalog\Model\ResourceModel\Product
Definition:
CollectionTest.php:6
Magento\TestFramework\TestCase\WebapiAbstract\_webApiCall
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
Definition:
WebapiAbstract.php:165
$orderItem
$orderItem
Definition:
order.php:30
Magento\Sales\Service\V1\CreditmemoCreateTest\setUp
setUp()
Definition:
CreditmemoCreateTest.php:27
$order
$order
Definition:
order.php:55
Magento\Sales\Service\V1
Definition:
CreditmemoAddCommentTest.php:6
Magento\Sales\Service\V1\CreditmemoCreateTest\SERVICE_READ_NAME
const SERVICE_READ_NAME
Definition:
CreditmemoCreateTest.php:18
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Sales\Service\V1\CreditmemoCreateTest\RESOURCE_PATH
const RESOURCE_PATH
Definition:
CreditmemoCreateTest.php:16
Magento\Sales\Service\V1\CreditmemoCreateTest\SERVICE_VERSION
const SERVICE_VERSION
Definition:
CreditmemoCreateTest.php:20
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\CreditmemoCreateTest
Definition:
CreditmemoCreateTest.php:14
$orderCollection
$orderCollection
Definition:
creditmemo_items_for_search.php:19
Magento\Sales\Service\V1\CreditmemoCreateTest\$objectManager
$objectManager
Definition:
CreditmemoCreateTest.php:25
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125
$items
$items
Definition:
order_rollback.php:21