public function HeaderBagTest::testContains

@covers Symfony\Component\HttpFoundation\HeaderBag::contains

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php, line 82

Class

HeaderBagTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testContains() {
  $bag = new HeaderBag(array(
    'foo' => 'bar',
    'fuzz' => 'bizz',
  ));
  $this
    ->assertTrue($bag
    ->contains('foo', 'bar'), '->contains first value');
  $this
    ->assertTrue($bag
    ->contains('fuzz', 'bizz'), '->contains second value');
  $this
    ->assertFalse($bag
    ->contains('nope', 'nope'), '->contains unknown value');
  $this
    ->assertFalse($bag
    ->contains('foo', 'nope'), '->contains unknown value');

  // Multiple values
  $bag
    ->set('foo', 'bor', false);
  $this
    ->assertTrue($bag
    ->contains('foo', 'bar'), '->contains first value');
  $this
    ->assertTrue($bag
    ->contains('foo', 'bor'), '->contains second value');
  $this
    ->assertFalse($bag
    ->contains('foo', 'nope'), '->contains unknown value');
}