Added test for prepending field labels

This commit is contained in:
Tom Oude Rengerink 2020-10-26 12:45:34 +01:00
parent bfa24585de
commit 9f29a1b99a

View File

@ -12,6 +12,19 @@ class ErrorMessagesTest extends BaseTestCase
$this->assertSame(array("Name is required"), $v->errors('name')); $this->assertSame(array("Name is required"), $v->errors('name'));
} }
/**
* Test the disabling of prepending the field labels
* to error messages.
*/
public function testErrorMessageExcludeFieldName()
{
$v = new Validator(array());
$v->setPrependLabels(false);
$v->rule('required', 'name');
$v->validate();
$this->assertSame(array("is required"), $v->errors('name'));
}
public function testAccurateErrorMessageParams() public function testAccurateErrorMessageParams()
{ {
$v = new Validator(array('num' => 5)); $v = new Validator(array('num' => 5));