Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
InvoiceAddCommentTest.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
19  const SERVICE_READ_NAME = 'salesInvoiceCommentRepositoryV1';
20 
24  const SERVICE_VERSION = 'V1';
25 
31  public function testInvoiceAddComment()
32  {
35  $invoiceCollection = $objectManager->get(\Magento\Sales\Model\ResourceModel\Order\Invoice\Collection::class);
36  $invoice = $invoiceCollection->getFirstItem();
37 
38  $commentData = [
39  InvoiceCommentInterface::COMMENT => 'Hello world!',
45  ];
46 
47  $requestData = ['entity' => $commentData];
48  $serviceInfo = [
49  'rest' => [
50  'resourcePath' => '/V1/invoices/comments',
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 }
$objectManager
Definition: bootstrap.php:17
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
$invoice