File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
system/Validation/StrictRules
tests/system/Validation/StrictRules Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -81,10 +81,14 @@ public function greater_than($str, string $min): bool
81
81
/**
82
82
* Equal to or Greater than
83
83
*
84
- * @param mixed $str
84
+ * @param mixed $str expects int|string
85
85
*/
86
86
public function greater_than_equal_to ($ str , string $ min ): bool
87
87
{
88
+ if (is_int ($ str )) {
89
+ $ str = (string ) $ str ;
90
+ }
91
+
88
92
return $ this ->nonStrictRules ->greater_than_equal_to ($ str , $ min );
89
93
}
90
94
Original file line number Diff line number Diff line change @@ -84,4 +84,26 @@ public function providePermitEmptyCasesStrict(): Generator
84
84
],
85
85
];
86
86
}
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
+ }
87
109
}
You can’t perform that action at this time.
0 commit comments