You are here

public function HeaderBagTest::testCacheControlDirectiveAccessors in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Tests/HeaderBagTest.php \Symfony\Component\HttpFoundation\Tests\HeaderBagTest::testCacheControlDirectiveAccessors()

File

vendor/symfony/http-foundation/Tests/HeaderBagTest.php, line 140

Class

HeaderBagTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testCacheControlDirectiveAccessors() {
  $bag = new HeaderBag();
  $bag
    ->addCacheControlDirective('public');
  $this
    ->assertTrue($bag
    ->hasCacheControlDirective('public'));
  $this
    ->assertTrue($bag
    ->getCacheControlDirective('public'));
  $this
    ->assertEquals('public', $bag
    ->get('cache-control'));
  $bag
    ->addCacheControlDirective('max-age', 10);
  $this
    ->assertTrue($bag
    ->hasCacheControlDirective('max-age'));
  $this
    ->assertEquals(10, $bag
    ->getCacheControlDirective('max-age'));
  $this
    ->assertEquals('max-age=10, public', $bag
    ->get('cache-control'));
  $bag
    ->removeCacheControlDirective('max-age');
  $this
    ->assertFalse($bag
    ->hasCacheControlDirective('max-age'));
}