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