@@ -2559,12 +2559,28 @@ public function testValidateMin()
2559
2559
$ v = new Validator ($ trans , ['foo ' => '3 ' ], ['foo ' => 'Min:3 ' ]);
2560
2560
$ this ->assertFalse ($ v ->passes ());
2561
2561
2562
+ // an equal value qualifies.
2563
+ $ v = new Validator ($ trans , ['foo ' => '3 ' ], ['foo ' => 'Numeric|Min:3 ' ]);
2564
+ $ this ->assertTrue ($ v ->passes ());
2565
+
2562
2566
$ v = new Validator ($ trans , ['foo ' => 'anc ' ], ['foo ' => 'Min:3 ' ]);
2563
2567
$ this ->assertTrue ($ v ->passes ());
2564
2568
2565
2569
$ v = new Validator ($ trans , ['foo ' => '2 ' ], ['foo ' => 'Numeric|Min:3 ' ]);
2566
2570
$ this ->assertFalse ($ v ->passes ());
2567
2571
2572
+ // '2.001' is considered as a float when the "Numeric" rule exists.
2573
+ $ v = new Validator ($ trans , ['foo ' => '2.001 ' ], ['foo ' => 'Numeric|Min:3 ' ]);
2574
+ $ this ->assertFalse ($ v ->passes ());
2575
+
2576
+ // '2.001' is a string of length 5 in absence of the "Numeric" rule.
2577
+ $ v = new Validator ($ trans , ['foo ' => '2.001 ' ], ['foo ' => 'Min:3 ' ]);
2578
+ $ this ->assertTrue ($ v ->passes ());
2579
+
2580
+ // '20' is a string of length 2 in absence of the "Numeric" rule.
2581
+ $ v = new Validator ($ trans , ['foo ' => '20 ' ], ['foo ' => 'Min:3 ' ]);
2582
+ $ this ->assertFalse ($ v ->passes ());
2583
+
2568
2584
$ v = new Validator ($ trans , ['foo ' => '5 ' ], ['foo ' => 'Numeric|Min:3 ' ]);
2569
2585
$ this ->assertTrue ($ v ->passes ());
2570
2586
@@ -2597,6 +2613,18 @@ public function testValidateMax()
2597
2613
$ v = new Validator ($ trans , ['foo ' => '211 ' ], ['foo ' => 'Numeric|Max:100 ' ]);
2598
2614
$ this ->assertFalse ($ v ->passes ());
2599
2615
2616
+ // an equal value qualifies.
2617
+ $ v = new Validator ($ trans , ['foo ' => '3 ' ], ['foo ' => 'Numeric|Max:3 ' ]);
2618
+ $ this ->assertTrue ($ v ->passes ());
2619
+
2620
+ // '2.001' is considered as a float when the "Numeric" rule exists.
2621
+ $ v = new Validator ($ trans , ['foo ' => '2.001 ' ], ['foo ' => 'Numeric|Max:3 ' ]);
2622
+ $ this ->assertTrue ($ v ->passes ());
2623
+
2624
+ // '2.001' is a string of length 5 in absence of the "Numeric" rule.
2625
+ $ v = new Validator ($ trans , ['foo ' => '2.001 ' ], ['foo ' => 'Max:3 ' ]);
2626
+ $ this ->assertFalse ($ v ->passes ());
2627
+
2600
2628
$ v = new Validator ($ trans , ['foo ' => '22 ' ], ['foo ' => 'Numeric|Max:33 ' ]);
2601
2629
$ this ->assertTrue ($ v ->passes ());
2602
2630
0 commit comments