Definition at line 10 of file ExceptionTest.php.
◆ providerForTestConstructInvalidHttpCode()
providerForTestConstructInvalidHttpCode |
( |
| ) |
|
Data provider for testConstructInvalidCode.
- Returns
- array
Definition at line 88 of file ExceptionTest.php.
91 return [[300], [600]];
◆ testConstruct()
Test Webapi exception construct.
Definition at line 15 of file ExceptionTest.php.
18 $details = [
'key1' =>
'value1',
'key2' =>
'value2'];
19 $apiException = new \Magento\Framework\Webapi\Exception(
22 \
Magento\Framework\Webapi\Exception::HTTP_UNAUTHORIZED,
26 $apiException->getHttpCode(),
28 'Exception code is set incorrectly in construct.' 31 $apiException->getMessage(),
33 'Exception message is set incorrectly in construct.' 35 $this->assertEquals($apiException->getCode(),
$code,
'Exception code is set incorrectly in construct.');
36 $this->assertEquals($apiException->getDetails(),
$details,
'Details are set incorrectly in construct.');
◆ testConstructInvalidHttpCode()
testConstructInvalidHttpCode |
( |
|
$httpCode | ) |
|
Test Webapi exception construct with invalid data.
@dataProvider providerForTestConstructInvalidHttpCode
Create \Magento\Framework\Webapi\Exception object with invalid code.
Valid codes range is from 400 to 599.
Definition at line 44 of file ExceptionTest.php.
46 $this->expectException(
'InvalidArgumentException');
47 $this->expectExceptionMessage(
"The specified HTTP code \"{$httpCode}\" is invalid.");
50 new \Magento\Framework\Webapi\Exception(
__(
'Message'), 0, $httpCode);
◆ testGetOriginatorReceiver()
testGetOriginatorReceiver |
( |
| ) |
|
Check that Webapi \Exception object with code 500 matches Receiver originator.
Definition at line 68 of file ExceptionTest.php.
70 $apiException = new \Magento\Framework\Webapi\Exception(
73 \
Magento\Framework\Webapi\Exception::HTTP_INTERNAL_ERROR
77 \
Magento\Webapi\Model\Soap\Fault::FAULT_CODE_RECEIVER,
78 $apiException->getOriginator(),
79 'Wrong Receiver originator detecting.'
◆ testGetOriginatorSender()
testGetOriginatorSender |
( |
| ) |
|
Check that Webapi \Exception object with code 401 matches Sender originator.
Definition at line 53 of file ExceptionTest.php.
55 $apiException = new \Magento\Framework\Webapi\Exception(
58 \
Magento\Framework\Webapi\Exception::HTTP_UNAUTHORIZED
62 \
Magento\Webapi\Model\Soap\Fault::FAULT_CODE_SENDER,
63 $apiException->getOriginator(),
64 'Wrong Sender originator detecting.'
The documentation for this class was generated from the following file: