aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functions_acp/h_radio_test.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2011-02-01 14:09:52 +0100
committerJoas Schilling <nickvergessen@gmx.de>2011-02-01 14:09:52 +0100
commit6b00d7aa096b01ce6e59a8467f79eb193c25a35b (patch)
treecc3b4cdd973bc9aaf094145d318462704cd1fe6a /tests/functions_acp/h_radio_test.php
parent2b70f3d0e2c85f4ff639aec1077afff3154506dc (diff)
downloadforums-6b00d7aa096b01ce6e59a8467f79eb193c25a35b.tar
forums-6b00d7aa096b01ce6e59a8467f79eb193c25a35b.tar.gz
forums-6b00d7aa096b01ce6e59a8467f79eb193c25a35b.tar.bz2
forums-6b00d7aa096b01ce6e59a8467f79eb193c25a35b.tar.xz
forums-6b00d7aa096b01ce6e59a8467f79eb193c25a35b.zip
[ticket/9823] Update Unit tests to the new system and correct some minor issues
PHPBB3-9823
Diffstat (limited to 'tests/functions_acp/h_radio_test.php')
-rw-r--r--tests/functions_acp/h_radio_test.php121
1 files changed, 121 insertions, 0 deletions
diff --git a/tests/functions_acp/h_radio_test.php b/tests/functions_acp/h_radio_test.php
new file mode 100644
index 0000000000..924b502ede
--- /dev/null
+++ b/tests/functions_acp/h_radio_test.php
@@ -0,0 +1,121 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2010 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+require_once dirname(__FILE__) . 'user_mock.php';
+require_once dirname(__FILE__) . '../../phpBB/includes/functions_acp.php';
+
+class phpbb_functions_acp_h_radio_test extends phpbb_test_case
+{
+ public function h_radio_data()
+ {
+ return array(
+ array(
+ 'test_name',
+ array(
+ 'test' => 'TEST',
+ 'second' => 'SEC_OPTION',
+ ),
+ false,
+ false,
+ false,
+ '<label><input type="radio" name="test_name" value="test" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" class="radio" /> SEC_OPTION</label>',
+ ),
+ array(
+ 'test_name',
+ array(
+ 'test' => 'TEST',
+ 'second' => 'SEC_OPTION',
+ ),
+ 'test',
+ false,
+ false,
+ '<label><input type="radio" name="test_name" value="test" checked="checked" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" class="radio" /> SEC_OPTION</label>',
+ ),
+ array(
+ 'test_name',
+ array(
+ 'test' => 'TEST',
+ 'second' => 'SEC_OPTION',
+ ),
+ false,
+ 'test_id',
+ false,
+ '<label><input type="radio" name="test_name" id="test_id" value="test" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" class="radio" /> SEC_OPTION</label>',
+ ),
+ array(
+ 'test_name',
+ array(
+ 'test' => 'TEST',
+ 'second' => 'SEC_OPTION',
+ ),
+ 'test',
+ 'test_id',
+ false,
+ '<label><input type="radio" name="test_name" id="test_id" value="test" checked="checked" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" class="radio" /> SEC_OPTION</label>',
+ ),
+
+ array(
+ 'test_name',
+ array(
+ 'test' => 'TEST',
+ 'second' => 'SEC_OPTION',
+ ),
+ false,
+ false,
+ 'k',
+ '<label><input type="radio" name="test_name" value="test" accesskey="k" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" accesskey="k" class="radio" /> SEC_OPTION</label>',
+ ),
+ array(
+ 'test_name',
+ array(
+ 'test' => 'TEST',
+ 'second' => 'SEC_OPTION',
+ ),
+ 'test',
+ false,
+ 'k',
+ '<label><input type="radio" name="test_name" value="test" checked="checked" accesskey="k" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" accesskey="k" class="radio" /> SEC_OPTION</label>',
+ ),
+ array(
+ 'test_name',
+ array(
+ 'test' => 'TEST',
+ 'second' => 'SEC_OPTION',
+ ),
+ false,
+ 'test_id',
+ 'k',
+ '<label><input type="radio" name="test_name" id="test_id" value="test" accesskey="k" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" accesskey="k" class="radio" /> SEC_OPTION</label>',
+ ),
+ array(
+ 'test_name',
+ array(
+ 'test' => 'TEST',
+ 'second' => 'SEC_OPTION',
+ ),
+ 'test',
+ 'test_id',
+ 'k',
+ '<label><input type="radio" name="test_name" id="test_id" value="test" checked="checked" accesskey="k" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" accesskey="k" class="radio" /> SEC_OPTION</label>',
+ ),
+ );
+ }
+
+ /**
+ * @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));
+ }
+}