-
Notifications
You must be signed in to change notification settings - Fork 263
Expand file tree
/
Copy pathRemoveEncodingFilterTest.php
More file actions
52 lines (42 loc) · 1.29 KB
/
RemoveEncodingFilterTest.php
File metadata and controls
52 lines (42 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace Proxy\Filter;
use PHPUnit\Framework\TestCase;
use Laminas\Diactoros\Request;
use Laminas\Diactoros\Response;
class RemoveEncodingFilterTest extends TestCase
{
/**
* @var RemoveEncodingFilter
*/
private $filter;
public function setUp(): Void
{
$this->filter = new RemoveEncodingFilter();
}
/**
* @test
*/
public function filter_removes_transfer_encoding()
{
$request = new Request();
$response = new Response('php://memory', 200, [RemoveEncodingFilter::TRANSFER_ENCODING => 'foo']);
$next = function () use ($response) {
return $response;
};
$response = call_user_func($this->filter, $request, $next);
$this->assertFalse($response->hasHeader(RemoveEncodingFilter::TRANSFER_ENCODING));
}
/**
* @test
*/
public function filter_removes_content_encoding()
{
$request = new Request();
$response = new Response('php://memory', 200, [RemoveEncodingFilter::TRANSFER_ENCODING => 'foo']);
$next = function () use ($response) {
return $response;
};
$response = call_user_func($this->filter, $request, $next);
$this->assertFalse($response->hasHeader(RemoveEncodingFilter::CONTENT_ENCODING));
}
}