|
@@ 44-63 (lines=20) @@
|
| 41 |
|
$this->assertEquals(strtotime('13.07.2003'), strtotime($newHeaders['last-modified'][0])); |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
public function testExtraHeaders() |
| 45 |
|
{ |
| 46 |
|
$event = $this->buildEvent(); |
| 47 |
|
$headers = array( |
| 48 |
|
'overwrite' => false, |
| 49 |
|
'cache_control' => array( |
| 50 |
|
'must_revalidate' => true, |
| 51 |
|
'proxy_revalidate' => true, |
| 52 |
|
'no_transform' => true, |
| 53 |
|
'stale_if_error' => '300', |
| 54 |
|
'stale_while_revalidate' => '400', |
| 55 |
|
), |
| 56 |
|
); |
| 57 |
|
$subscriber = $this->getCacheControl($headers); |
| 58 |
|
|
| 59 |
|
$subscriber->onKernelResponse($event); |
| 60 |
|
$newHeaders = $event->getResponse()->headers->all(); |
| 61 |
|
|
| 62 |
|
$this->assertEquals('must-revalidate, no-transform, proxy-revalidate, stale-if-error=300, stale-while-revalidate=400, private', $newHeaders['cache-control'][0]); |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
public function testCompoundHeaders() |
| 66 |
|
{ |
|
@@ 90-110 (lines=21) @@
|
| 87 |
|
$this->assertEquals('max-age=900, must-revalidate, no-transform, proxy-revalidate, public, s-maxage=300, stale-if-error=300, stale-while-revalidate=400', $newHeaders['cache-control'][0]); |
| 88 |
|
} |
| 89 |
|
|
| 90 |
|
public function testSetNoCacheHeaders() |
| 91 |
|
{ |
| 92 |
|
$event = $this->buildEvent(); |
| 93 |
|
$headers = array( |
| 94 |
|
'overwrite' => false, |
| 95 |
|
'cache_control' => array( |
| 96 |
|
'max_age' => '0', |
| 97 |
|
's_maxage' => '0', |
| 98 |
|
'private' => true, |
| 99 |
|
'no_cache' => true, |
| 100 |
|
'must_revalidate' => true, |
| 101 |
|
), |
| 102 |
|
'last_modified' => '13.07.2003', |
| 103 |
|
); |
| 104 |
|
$subscriber = $this->getCacheControl($headers); |
| 105 |
|
|
| 106 |
|
$subscriber->onKernelResponse($event); |
| 107 |
|
$newHeaders = $event->getResponse()->headers->all(); |
| 108 |
|
|
| 109 |
|
$this->assertEquals('max-age=0, must-revalidate, no-cache, private, s-maxage=0', $newHeaders['cache-control'][0]); |
| 110 |
|
} |
| 111 |
|
|
| 112 |
|
public function testMergeHeaders() |
| 113 |
|
{ |