Skip to content

Commit

Permalink
Added test for prepending field labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Oude Rengerink committed Oct 26, 2020
1 parent bfa2458 commit 9f29a1b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/Valitron/ErrorMessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ public function testErrorMessageIncludesFieldName()
$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()
{
$v = new Validator(array('num' => 5));
Expand Down

0 comments on commit 9f29a1b

Please sign in to comment.