From 330feaa675bfafabf23e026fef6c11aee109001c Mon Sep 17 00:00:00 2001 From: thinkingmedia Date: Sat, 2 Jul 2016 15:10:12 -0400 Subject: [PATCH] added test for Validator::isArray --- tests/TestCase/Validation/ValidatorTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/TestCase/Validation/ValidatorTest.php b/tests/TestCase/Validation/ValidatorTest.php index 48d33ff545a..c9f4df7b127 100644 --- a/tests/TestCase/Validation/ValidatorTest.php +++ b/tests/TestCase/Validation/ValidatorTest.php @@ -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 * @@ -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;