@@ -132,8 +132,6 @@ public function testRequiredWith(): void
132132 ['userId ' , 'requiredWith ' , ['status ' , 'someField ' ]],
133133 ]);
134134
135- // var_dump($v->getErrors());
136-
137135 $ this ->assertCount (1 , $ v ->getErrors ());
138136 $ this ->assertFalse ($ v ->inError ('targetId ' ));
139137 $ this ->assertTrue ($ v ->inError ('userId ' ));
@@ -155,8 +153,6 @@ public function testRequiredWithAll(): void
155153 ['userId ' , 'requiredWithAll ' , ['status ' , 'someField ' ]],
156154 ]);
157155
158- // var_dump($v->getErrors());
159-
160156 $ this ->assertCount (1 , $ v ->getErrors ());
161157 $ this ->assertTrue ($ v ->inError ('targetId ' ));
162158 $ this ->assertFalse ($ v ->inError ('userId ' ));
@@ -178,8 +174,6 @@ public function testRequiredWithout(): void
178174 ['userId ' , 'requiredWithout ' , ['status ' , 'someField ' ]],
179175 ]);
180176
181- // var_dump($v->getErrors());
182-
183177 $ this ->assertCount (1 , $ v ->getErrors ());
184178 $ this ->assertTrue ($ v ->inError ('userId ' ));
185179 $ this ->assertFalse ($ v ->inError ('targetId ' ));
@@ -201,8 +195,6 @@ public function testRequiredWithoutAll(): void
201195 ['userId ' , 'requiredWithoutAll ' , ['status ' , 'someField ' ]],
202196 ]);
203197
204- // var_dump($v->getErrors());
205-
206198 $ this ->assertCount (1 , $ v ->getErrors ());
207199 $ this ->assertTrue ($ v ->inError ('targetId ' ));
208200 $ this ->assertFalse ($ v ->inError ('userId ' ));
@@ -388,7 +380,6 @@ public function testValidateJson(): void
388380 ['log_data1 ' , 'json ' , false ],
389381 ])->validate ();
390382
391- // var_dump($v->getErrors());
392383 $ this ->assertTrue ($ v ->isOk ());
393384 $ this ->assertFalse ($ v ->failed ());
394385
@@ -434,7 +425,6 @@ protected function someRules(): array
434425 function () {
435426 echo " use custom validate to check userId \n" ;
436427
437- // var_dump($value, $data);
438428 // echo __LINE__ . "\n";
439429
440430 return false ;
@@ -469,7 +459,6 @@ public function testArrayValidate(): void
469459 ['options.opt1, options.opt4 ' , 'bool ' ],
470460 ['options.opt1, options.opt4 ' , 'in ' , [true , false ]],
471461 ]);
472- // var_dump($v->getErrors());die;
473462
474463 $ this ->assertTrue ($ v ->isOk ());
475464 $ this ->assertFalse ($ v ->failed ());
@@ -532,7 +521,6 @@ public function testDistinct(): void
532521 ['users.*.id ' , 'distinct ' ],
533522 ]);
534523
535- // var_dump($v->getErrors());
536524 $ this ->assertFalse ($ v ->isOk ());
537525 $ this ->assertCount (1 , $ v ->getErrors ());
538526 $ this ->assertTrue ($ v ->inError ('tags ' ));
@@ -555,15 +543,32 @@ public function testEach(): void
555543 ['users.*.name ' , 'each ' , 'string ' , 'min ' => 5 ],
556544 ]);
557545
558- // var_dump($v->getErrors());
559546 $ this ->assertFalse ($ v ->isOk ());
560547 $ this ->assertCount (1 , $ v ->getErrors ());
561548 $ this ->assertTrue ($ v ->inError ('users.*.name ' ));
562549 }
563550
564- /**
565- * @covers \Inhere\Validate\RuleValidation::getMessage()
566- */
551+ public function testMultiLevelData (): void
552+ {
553+ $ v = RuleValidation::check ([
554+ 'prod ' => [
555+ 'key0 ' => 'val0 ' ,
556+ [
557+ 'attr ' => [
558+ 'wid ' => 1
559+ ]
560+ ]
561+ ]
562+ ], [
563+ ['prod.*.attr ' , 'each ' , 'required ' ],
564+ // ['prod.*.attr.wid', 'each', 'required'],
565+ ['prod.0.attr.wid ' , 'number ' ],
566+ ]);
567+
568+ $ this ->assertTrue ($ v ->isOk ());
569+ $ this ->assertNotEmpty ($ v ->getSafeData ());
570+ }
571+
567572 public function testGetMessage (): void
568573 {
569574 $ v = Validation::check ([
@@ -572,7 +577,7 @@ public function testGetMessage(): void
572577 ['inTest ' , 'in ' , [1 , 2 ]],
573578 ]);
574579
575- $ this ->assertFalse ($ v ->ok ());
580+ $ this ->assertFalse ($ v ->isOk ());
576581 $ this ->assertEquals ('in test must in (1,2) ' , $ v ->firstError ());
577582 }
578583
@@ -585,7 +590,7 @@ public function testValidatorAlias(): void
585590 ['arrTest ' , 'array ' ],
586591 ]);
587592
588- $ this ->assertTrue ($ v ->ok ());
593+ $ this ->assertTrue ($ v ->isOk ());
589594
590595 $ v = Validation::make ([
591596 'arrVal ' => 'string ' ,
0 commit comments