Skip to content

Commit

Permalink
variable name according to the parameter name
Browse files Browse the repository at this point in the history
  • Loading branch information
philiplb committed Mar 23, 2016
1 parent 627b8f7 commit 310a2b0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/ValdiTests/ValidatorTest.php
Expand Up @@ -26,15 +26,15 @@ public function testIsValid() {
'e' => 'test',
'f' => '',
);
$validators = array(
$rules = array(
'a' => array('required'),
'b' => array(array('required')),
'c' => array('required'),
'd' => array('required', 'integer'),
'e' => array('required', 'integer', 'floating'),
'f' => array('required', 'integer'),
);
$read = $validator->isValid($validators, $data);
$read = $validator->isValid($rules, $data);
$expected = array(
'valid' => false,
'errors' => array(
Expand All @@ -50,11 +50,11 @@ public function testIsValid() {
'a' => 'a',
'b' => 'b',
);
$validators = array(
$rules = array(
'a' => array('required'),
'b' => array(array('required')),
);
$read = $validator->isValid($validators, $data);
$read = $validator->isValid($rules, $data);
$expected = array(
'valid' => true,
'errors' => array()
Expand All @@ -64,11 +64,11 @@ public function testIsValid() {

public function testInvalidRule() {
$validator = new Validator();
$validators = array(
$rules = array(
'a' => array('invalid')
);
try {
$read = $validator->isValid($validators, array());
$read = $validator->isValid($rules, array());
$this->fail();
} catch (ValidatorException $e) {
$read = $e->getMessage();
Expand All @@ -81,11 +81,11 @@ public function testInvalidRule() {

public function testAddValidator() {
$validator = new Validator();
$validators = array(
$rules = array(
'a' => array('test')
);
try {
$read = $validator->isValid($validators, array('a' => 1));
$read = $validator->isValid($rules, array('a' => 1));
$this->fail();
} catch (ValidatorException $e) {
$read = $e->getMessage();
Expand All @@ -96,13 +96,13 @@ public function testAddValidator() {
}

$validator->addValidator('test', new TestValidator());
$read = $validator->isValid($validators, array('a' => 1));
$read = $validator->isValid($rules, array('a' => 1));
$expected = array(
'valid' => false,
'errors' => array('a' => array('test'))
);
$this->assertSame($read, $expected);
$read = $validator->isValid($validators, array('a' => 2));
$read = $validator->isValid($rules, array('a' => 2));
$expected = array(
'valid' => true,
'errors' => array()
Expand Down

0 comments on commit 310a2b0

Please sign in to comment.