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
InvoiceGetTest.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Sales\Service\V1
;
7
8
use
Magento\TestFramework\TestCase\WebapiAbstract
;
9
13
class
InvoiceGetTest
extends
WebapiAbstract
14
{
15
const
RESOURCE_PATH
=
'/V1/invoices'
;
16
17
const
SERVICE_READ_NAME
=
'salesInvoiceRepositoryV1'
;
18
19
const
SERVICE_VERSION
=
'V1'
;
20
24
public
function
testInvoiceGet()
25
{
26
$objectManager
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
();
28
$invoiceCollection =
$objectManager
->get(\
Magento
\Sales\Model\
ResourceModel
\
Order
\
Invoice
\Collection::class);
29
$invoice
= $invoiceCollection->getFirstItem();
30
$expectedInvoiceData = [
31
'grand_total'
=>
'100.0000'
,
32
'subtotal'
=>
'100.0000'
,
33
'increment_id'
=>
$invoice
->getIncrementId(),
34
];
35
$serviceInfo = [
36
'rest'
=> [
37
'resourcePath'
=> self::RESOURCE_PATH .
'/'
.
$invoice
->getId(),
38
'httpMethod'
=>
\Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET
,
39
],
40
'soap'
=> [
41
'service'
=>
self::SERVICE_READ_NAME
,
42
'serviceVersion'
=>
self::SERVICE_VERSION
,
43
'operation'
=> self::SERVICE_READ_NAME .
'get'
,
44
],
45
];
46
$result
= $this->
_webApiCall
($serviceInfo, [
'id'
=>
$invoice
->getId()]);
47
foreach
($expectedInvoiceData as $field =>
$value
) {
48
$this->assertArrayHasKey($field,
$result
);
49
$this->assertEquals(
$value
,
$result
[$field]);
50
}
51
52
//check that nullable fields were marked as optional and were not sent
53
foreach
(
$result
as
$value
) {
54
$this->assertNotNull(
$value
);
55
}
56
}
57
}
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
$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\Model\Order\Invoice
Definition:
Invoice.php:25
Magento\Sales\Service\V1
Definition:
CreditmemoAddCommentTest.php:6
Magento\Framework\Webapi\Rest\Request\HTTP_METHOD_GET
const HTTP_METHOD_GET
Definition:
Request.php:19
$value
$value
Definition:
gender.phtml:16
$invoice
$invoice
Definition:
partial_invoice.php:22
Magento\Sales\Service\V1\InvoiceGetTest\SERVICE_VERSION
const SERVICE_VERSION
Definition:
InvoiceGetTest.php:19
Magento\Sales\Service\V1\InvoiceGetTest\RESOURCE_PATH
const RESOURCE_PATH
Definition:
InvoiceGetTest.php:15
Magento
Magento\TestFramework\TestCase\WebapiAbstract
Definition:
WebapiAbstract.php:19
Magento\Sales\Service\V1\InvoiceGetTest
Definition:
InvoiceGetTest.php:13
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125
Magento\Sales\Service\V1\InvoiceGetTest\SERVICE_READ_NAME
const SERVICE_READ_NAME
Definition:
InvoiceGetTest.php:17