Skip to content

Commit 8497472

Browse files
driesvintsfabpot
authored andcommitted
Fix constant accessor
1 parent 7068bd7 commit 8497472

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ public function setEtag(string $etag = null, bool $weak = false): object
949949
*/
950950
public function setCache(array $options): object
951951
{
952-
if ($diff = array_diff(array_keys($options), array_keys(static::HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES))) {
952+
if ($diff = array_diff(array_keys($options), array_keys(self::HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES))) {
953953
throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', $diff)));
954954
}
955955

Tests/ResponseTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,12 @@ public function testSetCache()
672672

673673
$this->assertFalse($response->headers->hasCacheControlDirective(str_replace('_', '-', $directive)));
674674
}
675+
676+
$response = new DefaultResponse();
677+
678+
$options = ['etag' => '"whatever"'];
679+
$response->setCache($options);
680+
$this->assertSame($response->getEtag(), '"whatever"');
675681
}
676682

677683
public function testSendContent()

0 commit comments

Comments
 (0)