|
@@ 114-124 (lines=11) @@
|
| 111 |
|
* |
| 112 |
|
* @expectedException Moip\Exceptions\UnautorizedException |
| 113 |
|
*/ |
| 114 |
|
public function testShouldRaiseUnautorizedException() |
| 115 |
|
{ |
| 116 |
|
if ($this->sandbox_mock == self::SANDBOX) { |
| 117 |
|
$this->markTestSkipped('Only testable in Mock mode'); |
| 118 |
|
|
| 119 |
|
return; |
| 120 |
|
} |
| 121 |
|
$body = '{ "ERROR" : "Token or Key are invalids" }'; // the body is not processed in any way, i'm putting this for completeness |
| 122 |
|
$this->mockHttpSession($body, 401); |
| 123 |
|
$this->moip->orders()->get('ORD-1AWC30TWYZMX'); |
| 124 |
|
} |
| 125 |
|
|
| 126 |
|
/** |
| 127 |
|
* MoipTest if UnexpectedException is thrown when 500 http status code is returned. |
|
@@ 131-140 (lines=10) @@
|
| 128 |
|
* |
| 129 |
|
* @expectedException Moip\Exceptions\UnexpectedException |
| 130 |
|
*/ |
| 131 |
|
public function testShouldRaiseUnexpectedException500() |
| 132 |
|
{ |
| 133 |
|
if ($this->sandbox_mock == self::SANDBOX) { |
| 134 |
|
$this->markTestSkipped('Only testable in Mock mode'); |
| 135 |
|
|
| 136 |
|
return; |
| 137 |
|
} |
| 138 |
|
$this->mockHttpSession('error', 500); // the body isn't processed |
| 139 |
|
$this->moip->orders()->get('ORD-1AWC30TWYZMX'); |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
/** |
| 143 |
|
* MoipTest if UnexpectedException is thrown when a Requests_Exception is thrown. |