public function ResponseTest::testIsPrivate in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/Tests/ResponseTest.php \Symfony\Component\HttpFoundation\Tests\ResponseTest::testIsPrivate()
File
- vendor/
symfony/ http-foundation/ Tests/ ResponseTest.php, line 311
Class
Namespace
Symfony\Component\HttpFoundation\TestsCode
public function testIsPrivate() {
$response = new Response();
$response->headers
->set('Cache-Control', 'max-age=100');
$response
->setPrivate();
$this
->assertEquals(100, $response->headers
->getCacheControlDirective('max-age'), '->isPrivate() adds the private Cache-Control directive when set to true');
$this
->assertTrue($response->headers
->getCacheControlDirective('private'), '->isPrivate() adds the private Cache-Control directive when set to true');
$response = new Response();
$response->headers
->set('Cache-Control', 'public, max-age=100');
$response
->setPrivate();
$this
->assertEquals(100, $response->headers
->getCacheControlDirective('max-age'), '->isPrivate() adds the private Cache-Control directive when set to true');
$this
->assertTrue($response->headers
->getCacheControlDirective('private'), '->isPrivate() adds the private Cache-Control directive when set to true');
$this
->assertFalse($response->headers
->hasCacheControlDirective('public'), '->isPrivate() removes the public Cache-Control directive');
}