File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change 8
8
9
9
namespace Inhere \ValidateTest ;
10
10
11
+ use Inhere \Validate \Validation ;
12
+ use PHPUnit \Framework \TestCase ;
13
+
11
14
/**
12
15
* Class ScopedValidatorsTest
13
16
* @package Inhere\ValidateTest
14
17
*/
15
- class ScopedValidatorsTest
18
+ class ScopedValidatorsTest extends TestCase
16
19
{
20
+ /**
21
+ * lt, lte, ...
22
+ */
23
+ public function testFiledCompare ()
24
+ {
25
+ $ v = Validation::make ([
26
+ 'name ' => 'tom ' ,
27
+ 'age ' => 34 ,
28
+ 'tags ' => ['funny ' , 'smile ' ],
29
+ ]);
30
+
31
+ // lt
32
+ $ this ->assertTrue ($ v ->ltFieldValidator (23 , 'age ' ));
33
+ $ this ->assertFalse ($ v ->ltFieldValidator ('23 ' , 'age ' ));
34
+ $ this ->assertFalse ($ v ->ltFieldValidator (34 , 'age ' ));
35
+
36
+ // lte
37
+ $ this ->assertTrue ($ v ->lteFieldValidator (23 , 'age ' ));
38
+ $ this ->assertTrue ($ v ->lteFieldValidator (34 , 'age ' ));
39
+ $ this ->assertFalse ($ v ->lteFieldValidator ('34 ' , 'age ' ));
17
40
41
+ // gte
42
+ $ this ->assertTrue ($ v ->gteFieldValidator (43 , 'age ' ));
43
+ $ this ->assertTrue ($ v ->gteFieldValidator (34 , 'age ' ));
44
+ $ this ->assertFalse ($ v ->gteFieldValidator ('34 ' , 'age ' ));
45
+ }
18
46
}
You can’t perform that action at this time.
0 commit comments