Add tests for array of field names in rule

This commit is contained in:
Vance Lucas 2013-01-31 17:36:40 -06:00
parent 1c387a67c0
commit 33c92a3f24

View File

@ -22,6 +22,20 @@ class ValidateTest extends \PHPUnit_Framework_TestCase
$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()
{
$v = new Validator(array('name' => 'Chester Tester'));