* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
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(),
"",
),
array(
array('foo' => 'bar', 'a' => 'b'),
array(),
array(),
"",
),
array(
array('a' => 'quote"', 'b' => ''),
array(),
array(),
"",
),
array(
array('a' => "quotes'\""),
array(),
array(),
"",
),
array(
array('foo' => 'bar', 'a' => 'b'),
array('a' => 'c'),
array(),
"",
),
// strict equality check
array(
array('foo' => 'bar', 'a' => '0'),
array('a' => ''),
array(),
"",
),
);
}
/**
* @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);
}
}