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