diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2012-11-29 14:41:48 -0500 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2012-11-29 14:42:06 -0500 |
commit | 3e907265d5782c535d43e503c32390cfde8dc4a8 (patch) | |
tree | 554524b1888e3ef6642f727ab37fbc87adbba915 /tests/functions | |
parent | 2a39df1a53ae4d9798bcba9ceee610190702cc4b (diff) | |
download | forums-3e907265d5782c535d43e503c32390cfde8dc4a8.tar forums-3e907265d5782c535d43e503c32390cfde8dc4a8.tar.gz forums-3e907265d5782c535d43e503c32390cfde8dc4a8.tar.bz2 forums-3e907265d5782c535d43e503c32390cfde8dc4a8.tar.xz forums-3e907265d5782c535d43e503c32390cfde8dc4a8.zip |
[ticket/11095] Docs and tests for phpbb_build_hidden_fields_for_query_params.
PHPBB3-11095
Diffstat (limited to 'tests/functions')
-rw-r--r-- | tests/functions/build_hidden_fields_for_query_params_test.php | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/functions/build_hidden_fields_for_query_params_test.php b/tests/functions/build_hidden_fields_for_query_params_test.php new file mode 100644 index 0000000000..ef2f5744d3 --- /dev/null +++ b/tests/functions/build_hidden_fields_for_query_params_test.php @@ -0,0 +1,71 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_build_hidden_fields_for_query_params_test extends phpbb_test_case +{ + public function build_hidden_fields_for_query_params_test_data() + { + return array( + // get + // post + // exclude + // expected + array( + array('foo' => 'bar'), + array(), + array(), + "<input type='hidden' name=\"foo\" value=\"bar\" />", + ), + array( + array('foo' => 'bar', 'a' => 'b'), + array(), + array(), + "<input type='hidden' name=\"foo\" value=\"bar\" /><input type='hidden' name=\"a\" value=\"b\" />", + ), + array( + array('a' => 'quote"', 'b' => '<less>'), + array(), + array(), + "<input type='hidden' name=\"a\" value='quote\"' /><input type='hidden' name=\"b\" value=\"<less>\" />", + ), + array( + array('a' => "quotes'\""), + array(), + array(), + "<input type='hidden' name=\"a\" value=\"quotes'"\" />", + ), + array( + array('foo' => 'bar', 'a' => 'b'), + array('a' => 'c'), + array(), + "<input type='hidden' name=\"foo\" value=\"bar\" />", + ), + // strict equality check + array( + array('foo' => 'bar', 'a' => '0'), + array('a' => ''), + array(), + "<input type='hidden' name=\"foo\" value=\"bar\" />", + ), + ); + } + + /** + * @dataProvider build_hidden_fields_for_query_params_test_data + */ + public function test_build_hidden_fields_for_query_params($get, $post, $exclude, $expected) + { + $request = new phpbb_mock_request($get, $post); + $result = phpbb_build_hidden_fields_for_query_params($request, $exclude); + + $this->assertEquals($expected, $result); + } +} |