@@ 324-342 (lines=19) @@ | ||
321 | $this->assertEquals('This field is required', $this->validator->getFirstError('username')); |
|
322 | } |
|
323 | ||
324 | public function testGetParamErrors() |
|
325 | { |
|
326 | $this->assertEquals([], $this->validator->getParamErrors('username')); |
|
327 | ||
328 | $this->validator->setErrors([ |
|
329 | 'param' => [ |
|
330 | 'Required' |
|
331 | ], |
|
332 | 'username' => [ |
|
333 | 'This field is required', |
|
334 | 'Only letters and numbers are allowed' |
|
335 | ] |
|
336 | ]); |
|
337 | ||
338 | $this->assertEquals([ |
|
339 | 'This field is required', |
|
340 | 'Only letters and numbers are allowed' |
|
341 | ], $this->validator->getParamErrors('username')); |
|
342 | } |
|
343 | ||
344 | public function testGetParamRuleError() |
|
345 | { |
|
@@ 399-414 (lines=16) @@ | ||
396 | ], $this->validator->getDefaultMessages()); |
|
397 | } |
|
398 | ||
399 | public function testSetParamErrors() |
|
400 | { |
|
401 | $this->assertEquals([], $this->validator->getErrors()); |
|
402 | ||
403 | $this->validator->setParamErrors('username', [ |
|
404 | 'notBlank' => 'Required', |
|
405 | 'length' => 'Too short!' |
|
406 | ]); |
|
407 | ||
408 | $this->assertEquals([ |
|
409 | 'username' => [ |
|
410 | 'notBlank' => 'Required', |
|
411 | 'length' => 'Too short!' |
|
412 | ] |
|
413 | ], $this->validator->getErrors()); |
|
414 | } |
|
415 | ||
416 | public function testSetStoreErrorsWithRules() |
|
417 | { |