You are here

public function ParameterBagTest::testGetBoolean 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::testGetBoolean()

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

File

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

Class

ParameterBagTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testGetBoolean() {
  $parameters = array(
    'string_true' => 'true',
    'string_false' => 'false',
  );
  $bag = new ParameterBag($parameters);
  $this
    ->assertTrue($bag
    ->getBoolean('string_true'), '->getBoolean() gets the string true as boolean true');
  $this
    ->assertFalse($bag
    ->getBoolean('string_false'), '->getBoolean() gets the string false as boolean false');
  $this
    ->assertFalse($bag
    ->getBoolean('unknown'), '->getBoolean() returns false if a parameter is not defined');
}