mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-31 07:01:54 +00:00
Add tests for array of field names in rule
This commit is contained in:
parent
1c387a67c0
commit
33c92a3f24
@ -22,6 +22,20 @@ class ValidateTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertSame(1, count($v->errors('name')));
|
$this->assertSame(1, count($v->errors('name')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testArrayOfFieldsToValidate()
|
||||||
|
{
|
||||||
|
$v = new Validator(array('name' => 'Chester Tester', 'email' => 'chester@tester.com'));
|
||||||
|
$v->rule('required', array('name', 'email'));
|
||||||
|
$this->assertTrue($v->validate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testArrayOfFieldsToValidateOneEmpty()
|
||||||
|
{
|
||||||
|
$v = new Validator(array('name' => 'Chester Tester', 'email' => ''));
|
||||||
|
$v->rule('required', array('name', 'email'));
|
||||||
|
$this->assertFalse($v->validate());
|
||||||
|
}
|
||||||
|
|
||||||
public function testRequiredValid()
|
public function testRequiredValid()
|
||||||
{
|
{
|
||||||
$v = new Validator(array('name' => 'Chester Tester'));
|
$v = new Validator(array('name' => 'Chester Tester'));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user