|
@@ 37-43 (lines=7) @@
|
| 34 |
|
* @throws \Psr\Container\ContainerExceptionInterface |
| 35 |
|
* @throws \Psr\Container\NotFoundExceptionInterface |
| 36 |
|
*/ |
| 37 |
|
public function testHtmlResponseIsCompressed(): void |
| 38 |
|
{ |
| 39 |
|
$middleware = (new HtmlCompressMiddlewareFactory())->__invoke(new MockContainer(false)); |
| 40 |
|
$response = $middleware->process($this->request, new MockRequestHandler('text/html')); |
| 41 |
|
|
| 42 |
|
$this->assertEquals('test test', $response->getBody()->getContents()); |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
/** |
| 46 |
|
* @throws \Psr\Container\ContainerExceptionInterface |
|
@@ 49-55 (lines=7) @@
|
| 46 |
|
* @throws \Psr\Container\ContainerExceptionInterface |
| 47 |
|
* @throws \Psr\Container\NotFoundExceptionInterface |
| 48 |
|
*/ |
| 49 |
|
public function testJsonResponseIsNotCompressed(): void |
| 50 |
|
{ |
| 51 |
|
$middleware = (new HtmlCompressMiddlewareFactory())->__invoke(new MockContainer(false)); |
| 52 |
|
$response = $middleware->process($this->request, new MockRequestHandler('application/json')); |
| 53 |
|
|
| 54 |
|
$this->assertEquals('test' . PHP_EOL . 'test', $response->getBody()->getContents()); |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
/** |
| 58 |
|
* @throws \Psr\Container\ContainerExceptionInterface |
|
@@ 61-67 (lines=7) @@
|
| 58 |
|
* @throws \Psr\Container\ContainerExceptionInterface |
| 59 |
|
* @throws \Psr\Container\NotFoundExceptionInterface |
| 60 |
|
*/ |
| 61 |
|
public function testDebugHtmlResponseIsNotCompressed(): void |
| 62 |
|
{ |
| 63 |
|
$middleware = (new HtmlCompressMiddlewareFactory())->__invoke(new MockContainer(true)); |
| 64 |
|
$response = $middleware->process($this->request, new MockRequestHandler('text/html')); |
| 65 |
|
|
| 66 |
|
$this->assertEquals('test' . PHP_EOL . 'test', $response->getBody()->getContents()); |
| 67 |
|
} |
| 68 |
|
} |