public function testSetAssociativeArray() { $bag =
new HeaderBag();
$bag->
set('foo',
['bad-assoc-index' => 'value'
]);
$this->
assertSame('value',
$bag->
get('foo'
));
$this->
assertSame(['value'
],
$bag->
all('foo'
), 'assoc indices of multi-valued headers are ignored'
);
} public function testContains() { $bag =
new HeaderBag(['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'
);
}