Skip to content

Commit b5f3840

Browse files
authored
[9.x] Add some tests to testIntegerMethod and testFloatMethod (HttpRequestTest.php) (#46080)
* Add some tests to testIntegerMethod and testFloatMethod (HttpRequestTest.php) * delete unnesessary tests * add tests
1 parent 48d0b26 commit b5f3840

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/Http/HttpRequestTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ public function testIntegerMethod()
607607
'nan' => 'nan',
608608
'mixed' => '1ab',
609609
'underscore_notation' => '2_000',
610+
'null' => null,
610611
]);
611612
$this->assertSame(123, $request->integer('int'));
612613
$this->assertSame(456, $request->integer('raw_int'));
@@ -616,6 +617,8 @@ public function testIntegerMethod()
616617
$this->assertSame(1, $request->integer('mixed'));
617618
$this->assertSame(2, $request->integer('underscore_notation'));
618619
$this->assertSame(123456, $request->integer('unknown_key', 123456));
620+
$this->assertSame(0, $request->integer('null'));
621+
$this->assertSame(0, $request->integer('null', 123456));
619622
}
620623

621624
public function testFloatMethod()
@@ -629,6 +632,7 @@ public function testFloatMethod()
629632
'nan' => 'nan',
630633
'mixed' => '1.ab',
631634
'scientific_notation' => '1e3',
635+
'null' => null,
632636
]);
633637
$this->assertSame(1.23, $request->float('float'));
634638
$this->assertSame(45.6, $request->float('raw_float'));
@@ -639,6 +643,8 @@ public function testFloatMethod()
639643
$this->assertSame(1.0, $request->float('mixed'));
640644
$this->assertSame(1e3, $request->float('scientific_notation'));
641645
$this->assertSame(123.456, $request->float('unknown_key', 123.456));
646+
$this->assertSame(0.0, $request->float('null'));
647+
$this->assertSame(0.0, $request->float('null', 123.456));
642648
}
643649

644650
public function testCollectMethod()

0 commit comments

Comments
 (0)