Sfoglia il codice sorgente

[HttpKernel] fixed invalid test

According to ResponseHeaderBag::computeCacheControlValue(), a response with an ETag but no explicit Cache-Control header should have a sensible Cache-Control of "private, must-revalidate" set. According to Response::isCacheable(), a response that includes a private Cache-Controls is not considered cacheable. Therefore, in order for this test response to be cacheable and stored, it requires an explicit Cache-Control of public.
Kris Wallsmith 14 anni fa
parent
commit
3e131f5b70

+ 1 - 0
tests/Symfony/Tests/Component/HttpKernel/HttpCache/HttpCacheTest.php

@@ -168,6 +168,7 @@ class HttpCacheTest extends HttpCacheTestCase
                     $response->setContent('private data');
                 }
             } else {
+                $response->headers->set('Cache-Control', 'public');
                 $response->setETag('"public tag"');
                 if (in_array('"public tag"', $etags)) {
                     $response->setStatusCode(304);