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
InvoiceAddCommentTest.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Sales\Service\V1
;
7
8
use
Magento\Sales\Api\Data\InvoiceCommentInterface
;
9
use
Magento\TestFramework\TestCase\WebapiAbstract
;
10
14
class
InvoiceAddCommentTest
extends
WebapiAbstract
15
{
19
const
SERVICE_READ_NAME
=
'salesInvoiceCommentRepositoryV1'
;
20
24
const
SERVICE_VERSION
=
'V1'
;
25
31
public
function
testInvoiceAddComment()
32
{
33
$objectManager
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
();
35
$invoiceCollection =
$objectManager
->get(\
Magento
\Sales\Model\
ResourceModel
\
Order
\
Invoice
\Collection::class);
36
$invoice
= $invoiceCollection->getFirstItem();
37
38
$commentData = [
39
InvoiceCommentInterface::COMMENT
=>
'Hello world!'
,
40
InvoiceCommentInterface::ENTITY_ID
=>
null
,
41
InvoiceCommentInterface::CREATED_AT
=>
null
,
42
InvoiceCommentInterface::PARENT_ID
=>
$invoice
->getId(),
43
InvoiceCommentInterface::IS_VISIBLE_ON_FRONT
=> 1,
44
InvoiceCommentInterface::IS_CUSTOMER_NOTIFIED
=> 1,
45
];
46
47
$requestData
= [
'entity'
=> $commentData];
48
$serviceInfo = [
49
'rest'
=> [
50
'resourcePath'
=>
'/V1/invoices/comments'
,
51
'httpMethod'
=>
\Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST
,
52
],
53
'soap'
=> [
54
'service'
=>
self::SERVICE_READ_NAME
,
55
'serviceVersion'
=>
self::SERVICE_VERSION
,
56
'operation'
=> self::SERVICE_READ_NAME .
'save'
,
57
],
58
];
59
60
$result
= $this->
_webApiCall
($serviceInfo,
$requestData
);
61
$this->assertNotEmpty(
$result
);
62
}
63
}
Magento\Sales\Api\Data\CommentInterface\COMMENT
const COMMENT
Definition:
CommentInterface.php:24
Magento\Sales\Model\Order
Definition:
Order.php:54
$result
$result
Definition:
product_configurable_not_available_rollback.php:26
Magento\Sales\Service\V1\InvoiceAddCommentTest
Definition:
InvoiceAddCommentTest.php:14
Magento\Catalog\Model\ResourceModel\Product
Definition:
CollectionTest.php:6
Magento\Sales\Service\V1\InvoiceAddCommentTest\SERVICE_READ_NAME
const SERVICE_READ_NAME
Definition:
InvoiceAddCommentTest.php:19
$requestData
$requestData
Definition:
order_configurable_product.php:31
$objectManager
$objectManager
Definition:
bootstrap.php:17
Magento\TestFramework\TestCase\WebapiAbstract\_webApiCall
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
Definition:
WebapiAbstract.php:165
Magento\Sales\Api\Data\InvoiceCommentInterface
Definition:
InvoiceCommentInterface.php:18
Magento\Sales\Model\Order\Invoice
Definition:
Invoice.php:25
Magento\Sales\Api\Data\EntityInterface\ENTITY_ID
const ENTITY_ID
Definition:
EntityInterface.php:18
Magento\Sales\Service\V1
Definition:
CreditmemoAddCommentTest.php:6
Magento\Sales\Api\Data\CommentInterface\IS_VISIBLE_ON_FRONT
const IS_VISIBLE_ON_FRONT
Definition:
CommentInterface.php:19
Magento\Sales\Api\Data\EntityInterface\CREATED_AT
const CREATED_AT
Definition:
EntityInterface.php:23
Magento\Sales\Api\Data\InvoiceCommentInterface\IS_CUSTOMER_NOTIFIED
const IS_CUSTOMER_NOTIFIED
Definition:
InvoiceCommentInterface.php:30
$invoice
$invoice
Definition:
partial_invoice.php:22
Magento\Sales\Service\V1\InvoiceAddCommentTest\SERVICE_VERSION
const SERVICE_VERSION
Definition:
InvoiceAddCommentTest.php:24
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\Api\Data\InvoiceCommentInterface\PARENT_ID
const PARENT_ID
Definition:
InvoiceCommentInterface.php:26
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125