You are here

public function ParameterBagTest::testGet in Zircon Profile 8

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

@covers Symfony\Component\HttpFoundation\ParameterBag::get

File

vendor/symfony/http-foundation/Tests/ParameterBagTest.php, line 72

Class

ParameterBagTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testGet() {
  $bag = new ParameterBag(array(
    'foo' => 'bar',
    'null' => null,
  ));
  $this
    ->assertEquals('bar', $bag
    ->get('foo'), '->get() gets the value of a parameter');
  $this
    ->assertEquals('default', $bag
    ->get('unknown', 'default'), '->get() returns second argument as default if a parameter is not defined');
  $this
    ->assertNull($bag
    ->get('null', 'default'), '->get() returns null if null is set');
}