use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
use Symfony\Component\HttpFoundation\InputBag;
use Symfony\Component\HttpFoundation\Tests\Fixtures\FooEnum;
class InputBagTest extends TestCase
{ use ExpectDeprecationTrait;
public function testGet() { $bag =
new InputBag(['foo' => 'bar', 'null' => null, 'int' => 1, 'float' => 1.0, 'bool' => false, 'stringable' =>
new class() implements \Stringable
{ public function __toString(): string
{ return 'strval';
} }]);
$this->
assertSame('bar',
$bag->
get('foo'
), '->get() gets the value of a string parameter'
);
$this->
assertSame('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'
);
$this->
assertSame(1,
$bag->
get('int'
), '->get() gets the value of an int parameter'
);
$this->
assertSame(1.0,
$bag->
get('float'
), '->get() gets the value of a float parameter'
);