public function ParameterBagTest::testGetInt

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

File

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

Class

ParameterBagTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testGetInt() {
  $bag = new ParameterBag(array(
    'digits' => '0123',
  ));
  $this
    ->assertEquals(123, $bag
    ->getInt('digits'), '->getInt() gets a value of parameter as integer');
  $this
    ->assertEquals(0, $bag
    ->getInt('unknown'), '->getInt() returns zero if a parameter is not defined');
}