summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/libraries
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2017-06-22 13:45:50 +0200
committerAndrey Andreev <narf@devilix.net>2017-06-22 13:45:50 +0200
commit0c06ba0c587b5ef97718bc3b19c6dba163b7acb0 (patch)
treef653d045eeddcc31d972a3580f8b952891a70477 /tests/codeigniter/libraries
parenta2a49fcc322acd5ded3c0664d64bbebe982815f5 (diff)
Implement #2436 (access to FV processed data)
Diffstat (limited to 'tests/codeigniter/libraries')
-rw-r--r--tests/codeigniter/libraries/Form_validation_test.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/codeigniter/libraries/Form_validation_test.php b/tests/codeigniter/libraries/Form_validation_test.php
index afd070e05..ebb14983e 100644
--- a/tests/codeigniter/libraries/Form_validation_test.php
+++ b/tests/codeigniter/libraries/Form_validation_test.php
@@ -610,6 +610,24 @@ class Form_validation_test extends CI_TestCase {
$this->assertEquals('?&gt;', $this->form_validation->encode_php_tags('?>'));
}
+ public function test_validated_data_assignment()
+ {
+ $_POST = $post_original = array('foo' => ' bar ', 'bar' => 'baz');
+
+ $this->form_validation->set_data($_POST);
+ $this->form_validation->set_rules('foo', 'Foo', 'required|trim');
+
+ $data_processed = NULL;
+ $validation_result = $this->form_validation->run('', $data_processed);
+
+ $this->assertTrue($validation_result);
+ $this->assertEquals($post_original, $_POST);
+ $this->assertEquals(array('foo' => 'bar', 'bar' => 'baz'), $data_processed);
+
+ $this->form_validation->reset_validation();
+ $_POST = array();
+ }
+
/**
* Run rules
*