From 633ff5b21432a5d370af5a9366ed68db9c4ff68e Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Tue, 7 Apr 2020 19:49:21 +0200 Subject: [PATCH] Fix constant accessor --- src/Symfony/Component/HttpFoundation/Response.php | 2 +- src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index fe35832f87ed0..ddfd1826e46cd 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -949,7 +949,7 @@ public function setEtag(string $etag = null, bool $weak = false): object */ public function setCache(array $options): object { - if ($diff = array_diff(array_keys($options), array_keys(static::HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES))) { + if ($diff = array_diff(array_keys($options), array_keys(self::HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES))) { throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', $diff))); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index 73a6936807215..2dea5c2b2aecf 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -672,6 +672,12 @@ public function testSetCache() $this->assertFalse($response->headers->hasCacheControlDirective(str_replace('_', '-', $directive))); } + + $response = new DefaultResponse(); + + $options = ['etag' => '"whatever"']; + $response->setCache($options); + $this->assertSame($response->getEtag(), '"whatever"'); } public function testSendContent() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy