| @@ 18-25 (lines=8) @@ | ||
| 15 | ||
| 16 | class CacheControlListenerTest extends WebTestCase |
|
| 17 | { |
|
| 18 | public function testIsCached() |
|
| 19 | { |
|
| 20 | $client = static::createClient(); |
|
| 21 | ||
| 22 | $client->request('GET', '/cached/42'); |
|
| 23 | $response = $client->getResponse(); |
|
| 24 | $this->assertEquals('public', $response->headers->get('Cache-Control')); |
|
| 25 | } |
|
| 26 | ||
| 27 | public function testNotCached() |
|
| 28 | { |
|
| @@ 27-34 (lines=8) @@ | ||
| 24 | $this->assertEquals('public', $response->headers->get('Cache-Control')); |
|
| 25 | } |
|
| 26 | ||
| 27 | public function testNotCached() |
|
| 28 | { |
|
| 29 | $client = static::createClient(); |
|
| 30 | ||
| 31 | $client->request('GET', '/noncached'); |
|
| 32 | $response = $client->getResponse(); |
|
| 33 | $this->assertEquals('no-cache', $response->headers->get('Cache-Control')); |
|
| 34 | } |
|
| 35 | } |
|
| 36 | ||
| @@ 64-71 (lines=8) @@ | ||
| 61 | $client->request('POST', '/tag/error'); |
|
| 62 | } |
|
| 63 | ||
| 64 | public function testConfigurationTagsAreSet() |
|
| 65 | { |
|
| 66 | $client = static::createClient(); |
|
| 67 | ||
| 68 | $client->request('GET', '/cached/51'); |
|
| 69 | $response = $client->getResponse(); |
|
| 70 | $this->assertEquals('area,area-51', $response->headers->get('X-Cache-Tags')); |
|
| 71 | } |
|
| 72 | ||
| 73 | public function testConfigurationTagsAreInvalidated() |
|
| 74 | { |
|
| @@ 89-96 (lines=8) @@ | ||
| 86 | $client->request('PUT', '/cached/51'); |
|
| 87 | } |
|
| 88 | ||
| 89 | public function testManualTagging() |
|
| 90 | { |
|
| 91 | $client = static::createClient(); |
|
| 92 | ||
| 93 | $client->request('GET', '/tag_manual'); |
|
| 94 | $response = $client->getResponse(); |
|
| 95 | $this->assertEquals('manual-tag,sub-tag,sub-items,manual-items', $response->headers->get('X-Cache-Tags')); |
|
| 96 | } |
|
| 97 | ||
| 98 | public function testTwigExtension() |
|
| 99 | { |
|
| @@ 98-105 (lines=8) @@ | ||
| 95 | $this->assertEquals('manual-tag,sub-tag,sub-items,manual-items', $response->headers->get('X-Cache-Tags')); |
|
| 96 | } |
|
| 97 | ||
| 98 | public function testTwigExtension() |
|
| 99 | { |
|
| 100 | $client = static::createClient(); |
|
| 101 | ||
| 102 | $client->request('GET', '/tag_twig'); |
|
| 103 | $response = $client->getResponse(); |
|
| 104 | $this->assertEquals('tag-from-twig', $response->headers->get('X-Cache-Tags')); |
|
| 105 | } |
|
| 106 | ||
| 107 | protected function tearDown() |
|
| 108 | { |
|