Skip to content

Commit 330feaa

Browse files
author
thinkingmedia
committed
added test for Validator::isArray
1 parent a9f6cc7 commit 330feaa

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/TestCase/Validation/ValidatorTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,6 +1545,17 @@ public function testInteger()
15451545
$this->assertNotEmpty($validator->errors(['username' => 'not integer']));
15461546
}
15471547

1548+
/**
1549+
* Tests the isArray proxy method
1550+
*/
1551+
public function testIsArray()
1552+
{
1553+
$validator = new Validator();
1554+
$validator->isArray('username');
1555+
$this->assertEmpty($validator->errors(['username' => [1, 2, 3]]));
1556+
$this->assertNotEmpty($validator->errors(['username' => 'is not an array']));
1557+
}
1558+
15481559
/**
15491560
* Tests the multiple proxy method
15501561
*
@@ -1603,6 +1614,15 @@ public function testHasAtMost()
16031614
$this->assertNotEmpty($validator->errors(['things' => ['_ids' => [1, 2, 3, 4]]]));
16041615
}
16051616

1617+
/**
1618+
* Tests that a rule in the Validator class exists and was configured as expected.
1619+
*
1620+
* @param Validator $validator
1621+
* @param string $method
1622+
* @param mixed $extra
1623+
* @param array $pass
1624+
* @param string|null $name
1625+
*/
16061626
protected function assertProxyMethod($validator, $method, $extra = null, $pass = [], $name = null)
16071627
{
16081628
$name = $name ?: $method;

0 commit comments

Comments
 (0)