From 33c92a3f24d60bd9e970b4b53e7b4368af3d2c81 Mon Sep 17 00:00:00 2001 From: Vance Lucas Date: Thu, 31 Jan 2013 17:36:40 -0600 Subject: [PATCH] Add tests for array of field names in rule --- tests/Valitron/Validate.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Valitron/Validate.php b/tests/Valitron/Validate.php index 4f4fb9f..6a79c95 100644 --- a/tests/Valitron/Validate.php +++ b/tests/Valitron/Validate.php @@ -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'));