From 56c233fc4a455d33d2e679b59132b8a7a1cf1832 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 21 Jun 2017 15:29:25 +0300 Subject: Implement #193: Validating entire arrays in a single function call --- tests/codeigniter/libraries/Form_validation_test.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/codeigniter') diff --git a/tests/codeigniter/libraries/Form_validation_test.php b/tests/codeigniter/libraries/Form_validation_test.php index ab0e1fc0a..afd070e05 100644 --- a/tests/codeigniter/libraries/Form_validation_test.php +++ b/tests/codeigniter/libraries/Form_validation_test.php @@ -43,7 +43,6 @@ class Form_validation_test extends CI_TestCase { // Empty, not required $this->assertTrue($this->run_rules($rules, array('foo' => ''))); - // Not required, but also not empty $this->assertTrue($this->run_rules($rules, array('foo' => '123'))); $this->assertFalse($this->run_rules($rules, array('foo' => 'bar'))); @@ -56,6 +55,13 @@ class Form_validation_test extends CI_TestCase { $this->assertFalse($this->run_rules($rules, array('foo' => 'bar'))); } + public function test_rule_is_array() + { + $rules = array(array('field' => 'foo', 'label' => 'Foo', 'rules' => 'is_array')); + $this->assertTrue($this->run_rules($rules, array('foo' => array('1', '2')))); + $this->assertFalse($this->run_rules($rules, array('foo' => ''))); + } + public function test_rule_matches() { $rules = array( -- cgit v1.2.3-24-g4f1b