File tree Expand file tree Collapse file tree
system/Validation/StrictRules
tests/system/Validation/StrictRules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,10 +81,14 @@ public function greater_than($str, string $min): bool
8181 /**
8282 * Equal to or Greater than
8383 *
84- * @param mixed $str
84+ * @param mixed $str expects int|string
8585 */
8686 public function greater_than_equal_to ($ str , string $ min ): bool
8787 {
88+ if (is_int ($ str )) {
89+ $ str = (string ) $ str ;
90+ }
91+
8892 return $ this ->nonStrictRules ->greater_than_equal_to ($ str , $ min );
8993 }
9094
Original file line number Diff line number Diff line change @@ -84,4 +84,26 @@ public function providePermitEmptyCasesStrict(): Generator
8484 ],
8585 ];
8686 }
87+
88+ /**
89+ * @dataProvider provideGreaterThanEqualStrict
90+ *
91+ * @param int $value
92+ */
93+ public function testGreaterThanEqualStrict ($ value , string $ param , bool $ expected ): void
94+ {
95+ $ this ->validation ->setRules (['foo ' => "greater_than_equal_to[ {$ param }] " ]);
96+
97+ $ data = ['foo ' => $ value ];
98+ $ this ->assertSame ($ expected , $ this ->validation ->run ($ data ));
99+ }
100+
101+ public function provideGreaterThanEqualStrict (): Generator
102+ {
103+ yield from [
104+ [0 , '0 ' , true ],
105+ [1 , '0 ' , true ],
106+ [-1 , '0 ' , false ],
107+ ];
108+ }
87109}
You can’t perform that action at this time.
0 commit comments