Skip to content

Commit

Permalink
added test for Validator::isArray
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkingmedia committed Jul 2, 2016
1 parent a9f6cc7 commit 330feaa
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/TestCase/Validation/ValidatorTest.php
Expand Up @@ -1545,6 +1545,17 @@ public function testInteger()
$this->assertNotEmpty($validator->errors(['username' => 'not integer']));
}

/**
* Tests the isArray proxy method
*/
public function testIsArray()
{
$validator = new Validator();
$validator->isArray('username');
$this->assertEmpty($validator->errors(['username' => [1, 2, 3]]));
$this->assertNotEmpty($validator->errors(['username' => 'is not an array']));
}

/**
* Tests the multiple proxy method
*
Expand Down Expand Up @@ -1603,6 +1614,15 @@ public function testHasAtMost()
$this->assertNotEmpty($validator->errors(['things' => ['_ids' => [1, 2, 3, 4]]]));
}

/**
* Tests that a rule in the Validator class exists and was configured as expected.
*
* @param Validator $validator
* @param string $method
* @param mixed $extra
* @param array $pass
* @param string|null $name
*/
protected function assertProxyMethod($validator, $method, $extra = null, $pass = [], $name = null)
{
$name = $name ?: $method;
Expand Down

0 comments on commit 330feaa

Please sign in to comment.