public function HeaderBagTest::testGet in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/Tests/HeaderBagTest.php \Symfony\Component\HttpFoundation\Tests\HeaderBagTest::testGet()
@covers Symfony\Component\HttpFoundation\HeaderBag::get
File
- vendor/
symfony/ http-foundation/ Tests/ HeaderBagTest.php, line 97
Class
Namespace
Symfony\Component\HttpFoundation\TestsCode
public function testGet() {
$bag = new HeaderBag(array(
'foo' => 'bar',
'fuzz' => 'bizz',
));
$this
->assertEquals('bar', $bag
->get('foo'), '->get return current value');
$this
->assertEquals('bar', $bag
->get('FoO'), '->get key in case insensitive');
$this
->assertEquals(array(
'bar',
), $bag
->get('foo', 'nope', false), '->get return the value as array');
// defaults
$this
->assertNull($bag
->get('none'), '->get unknown values returns null');
$this
->assertEquals('default', $bag
->get('none', 'default'), '->get unknown values returns default');
$this
->assertEquals(array(
'default',
), $bag
->get('none', 'default', false), '->get unknown values returns default as array');
$bag
->set('foo', 'bor', false);
$this
->assertEquals('bar', $bag
->get('foo'), '->get return first value');
$this
->assertEquals(array(
'bar',
'bor',
), $bag
->get('foo', 'nope', false), '->get return all values as array');
}