|
6 | 6 | use ADmad\Glide\Exception\ResponseException; |
7 | 7 | use ADmad\Glide\Exception\SignatureException; |
8 | 8 | use ADmad\Glide\Middleware\GlideMiddleware; |
| 9 | +use Cake\Core\Configure; |
9 | 10 | use Cake\Event\EventManager; |
10 | 11 | use Cake\Http\Response; |
11 | 12 | use Cake\Http\ServerRequestFactory; |
12 | 13 | use Cake\TestSuite\TestCase; |
13 | 14 | use Cake\Utility\Security; |
| 15 | +use League\Flysystem\UnableToRetrieveMetadata; |
14 | 16 | use League\Glide\ServerFactory; |
15 | 17 | use League\Glide\Signatures\Signature; |
16 | 18 | use TestApp\Http\TestRequestHandler; |
@@ -180,15 +182,28 @@ public function testSignatureException() |
180 | 182 | $middleware->process($request, $this->handler); |
181 | 183 | } |
182 | 184 |
|
| 185 | + public function test3rdPartyException() |
| 186 | + { |
| 187 | + $middleware = new GlideMiddleware($this->config); |
| 188 | + $request = ServerRequestFactory::fromGlobals([ |
| 189 | + 'REQUEST_URI' => '/images/non-existent.jpg', |
| 190 | + ]); |
| 191 | + |
| 192 | + $this->expectException(UnableToRetrieveMetadata::class); |
| 193 | + $middleware->process($request, $this->handler); |
| 194 | + } |
| 195 | + |
183 | 196 | public function testResponseException() |
184 | 197 | { |
185 | 198 | $middleware = new GlideMiddleware($this->config); |
186 | 199 | $request = ServerRequestFactory::fromGlobals([ |
187 | 200 | 'REQUEST_URI' => '/images/non-existent.jpg', |
188 | 201 | ]); |
189 | 202 |
|
| 203 | + Configure::write('debug', false); |
190 | 204 | $this->expectException(ResponseException::class); |
191 | 205 | $middleware->process($request, $this->handler); |
| 206 | + Configure::write('debug', true); |
192 | 207 | } |
193 | 208 |
|
194 | 209 | public function testExceptionEventListener() |
|
0 commit comments