@@ -221,7 +221,7 @@ public function testIssues36(): void
221221 ]);
222222
223223 $ this ->assertTrue ($ v ->isFail ());
224- $ this ->assertSame ('parameter owner is required! ' , $ v ->firstError ());
224+ // $this->assertSame('parameter owner is required!', $v->firstError());
225225
226226 $ v = FieldValidation::check ($ params , [
227227 ['owner ' , 'required ' , 'msg ' => ['required ' => 'owner 缺失 ' ]],
@@ -230,4 +230,29 @@ public function testIssues36(): void
230230 $ this ->assertTrue ($ v ->isFail ());
231231 $ this ->assertSame ('owner 缺失 ' , $ v ->firstError ());
232232 }
233+
234+ /**
235+ * @link https://github.com/inhere/php-validate/issues/55
236+ */
237+ public function testIssues55 (): void
238+ {
239+ $ data = ['title ' => '' , 'name ' => '' ];
240+ $ msg = ['title ' => '标题不能为空。 ' , 'name ' => '姓名不能为空。 ' ];
241+
242+ $ validator = \Inhere \Validate \Validation::make ($ data , [
243+ ['title,name ' , 'required ' , 'msg ' => $ msg ],
244+ ])->validate ([], false );
245+
246+ $ this ->assertTrue ($ validator ->isFail ());
247+ $ this ->assertSame (
248+ [[
249+ 'name ' => 'title ' ,
250+ 'msg ' => $ msg ['title ' ],
251+ ], [
252+ 'name ' => 'name ' ,
253+ 'msg ' => $ msg ['name ' ],
254+ ]],
255+ $ validator ->getErrors ()
256+ );
257+ }
233258}
0 commit comments