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
module-dhl
Test
Unit
Model
Validator
ResponseErrorProcessorTest.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Dhl\Test\Unit\Model\Validator
;
8
9
use
Magento\Dhl\Model\Validator\ResponseErrorProcessor
;
10
use
Magento\Shipping\Model\Simplexml\Element
;
11
use
Magento\Framework\TestFramework\Unit\Helper\ObjectManager
;
12
13
class
ResponseErrorProcessorTest
extends
\PHPUnit\Framework\TestCase
14
{
18
private
$objectManager;
19
23
private
$responseErrorProcessor;
24
25
protected
function
setUp
()
26
{
27
$this->objectManager =
new
ObjectManager
($this);
28
29
$this->responseErrorProcessor = $this->objectManager->getObject(ResponseErrorProcessor::class);
30
}
31
38
public
function
testProcess
(
$data
)
39
{
40
$xml = $this->getXml(
$data
[
'file'
]);
41
42
$result
= $this->responseErrorProcessor->process($xml,
$data
[
'isShippingLabel'
]);
43
44
$this->assertEquals(
$data
[
'errorMessage'
],
$result
->render());
45
$this->assertNotNull(
$result
->getArguments()[0]);
46
}
47
54
private
function
getXml($file)
55
{
56
$rawXml =
file_get_contents
(
__DIR__
.
'/_files/'
. $file);
57
return
simplexml_load_string($rawXml, Element::class);
58
}
59
63
public
function
processProvider
()
64
{
65
return
[
66
[
67
[
68
'file'
=>
'invalidDHLResponse.xml'
,
69
'errorMessage'
=>
'Error #111 : Error in parsing request XML'
,
70
'isShippingLabel'
=>
false
,
71
],
72
],
73
[
74
[
75
'file'
=>
'invalidDHLResponseForShippingLabel.xml'
,
76
'errorMessage'
=>
'Error #123 : Error in shipping request XML'
,
77
'isShippingLabel'
=>
true
,
78
],
79
],
80
[
81
[
82
'file'
=>
'invalidDHLResponseForQuoteResponse.xml'
,
83
'errorMessage'
=>
'Error #321 : Error in quote request XML'
,
84
'isShippingLabel'
=>
false
,
85
],
86
],
87
];
88
}
89
}
$result
$result
Definition:
product_configurable_not_available_rollback.php:26
Magento\Dhl\Model\Validator\ResponseErrorProcessor
Definition:
ResponseErrorProcessor.php:12
Magento\Dhl\Test\Unit\Model\Validator
Definition:
ResponseErrorProcessorTest.php:7
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
Magento\Shipping\Model\Simplexml\Element
Definition:
Element.php:12
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Dhl\Test\Unit\Model\Validator\ResponseErrorProcessorTest\processProvider
processProvider()
Definition:
ResponseErrorProcessorTest.php:63
Magento\Dhl\Test\Unit\Model\Validator\ResponseErrorProcessorTest\setUp
setUp()
Definition:
ResponseErrorProcessorTest.php:25
Magento\Dhl\Test\Unit\Model\Validator\ResponseErrorProcessorTest\testProcess
testProcess($data)
Definition:
ResponseErrorProcessorTest.php:38
Magento\Framework\TestFramework\Unit\Helper\ObjectManager
Definition:
ObjectManager.php:13
Magento\Framework\Filesystem\Driver\file_get_contents
file_get_contents()
Definition:
http_mock.php:15
Magento\Dhl\Test\Unit\Model\Validator\ResponseErrorProcessorTest
Definition:
ResponseErrorProcessorTest.php:13