diff --git a/tests/functions_acp/all_tests.php b/tests/functions_acp/all_tests.php index 6b2d676e60..d5f0c86dc9 100644 --- a/tests/functions_acp/all_tests.php +++ b/tests/functions_acp/all_tests.php @@ -16,6 +16,7 @@ require_once 'test_framework/framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; require_once 'functions_acp/build_select.php'; +require_once 'functions_acp/h_radio.php'; class phpbb_functions_acp_all_tests { @@ -29,6 +30,7 @@ class phpbb_functions_acp_all_tests $suite = new PHPUnit_Framework_TestSuite('phpBB Network Functions'); $suite->addTestSuite('phpbb_functions_acp_built_select_test'); + $suite->addTestSuite('phpbb_functions_acp_h_radio_test'); return $suite; } diff --git a/tests/functions_acp/h_radio.php b/tests/functions_acp/h_radio.php new file mode 100644 index 0000000000..6550c8f818 --- /dev/null +++ b/tests/functions_acp/h_radio.php @@ -0,0 +1,122 @@ + 'TEST', + 'second' => 'SEC_OPTION', + ), + false, + false, + false, + '', + ), + array( + 'test_name', + array( + 'test' => 'TEST', + 'second' => 'SEC_OPTION', + ), + 'test', + false, + false, + '', + ), + array( + 'test_name', + array( + 'test' => 'TEST', + 'second' => 'SEC_OPTION', + ), + false, + 'test_id', + false, + '', + ), + array( + 'test_name', + array( + 'test' => 'TEST', + 'second' => 'SEC_OPTION', + ), + 'test', + 'test_id', + false, + '', + ), + + array( + 'test_name', + array( + 'test' => 'TEST', + 'second' => 'SEC_OPTION', + ), + false, + false, + 'k', + '', + ), + array( + 'test_name', + array( + 'test' => 'TEST', + 'second' => 'SEC_OPTION', + ), + 'test', + false, + 'k', + '', + ), + array( + 'test_name', + array( + 'test' => 'TEST', + 'second' => 'SEC_OPTION', + ), + false, + 'test_id', + 'k', + '', + ), + array( + 'test_name', + array( + 'test' => 'TEST', + 'second' => 'SEC_OPTION', + ), + 'test', + 'test_id', + 'k', + '', + ), + ); + } + + /** + * @dataProvider h_radio_data + */ + public function test_h_radio($name, $input_ary, $input_default, $id, $key, $expected) + { + global $user; + + $user->lang =new phpbb_mock_lang(); + + $this->assertEquals($expected, h_radio($name, $input_ary, $input_default, $id, $key)); + } +} diff --git a/tests/functions_acp/user_mock.php b/tests/functions_acp/user_mock.php new file mode 100644 index 0000000000..c7f62fc39b --- /dev/null +++ b/tests/functions_acp/user_mock.php @@ -0,0 +1,33 @@ +