1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-10 10:44:20 +02:00

[ticket/17100] Reuse form_macros in ACP and fix tests

PHPBB3-17100
This commit is contained in:
Marc Alexander
2023-01-30 16:48:18 +01:00
parent 015472ab91
commit 6473167d6e
12 changed files with 135 additions and 121 deletions

View File

@@ -34,7 +34,18 @@ class phpbb_functions_acp_built_select_test extends phpbb_test_case
'second' => 'SEC_OPTION',
),
false,
'<option value="test">TEST</option><option value="second">SEC_OPTION</option>',
[
[
'value' => 'test',
'label' => 'TEST',
'selected' => false,
],
[
'value' => 'second',
'label' => 'SEC_OPTION',
'selected' => false,
],
],
),
array(
array(
@@ -42,7 +53,18 @@ class phpbb_functions_acp_built_select_test extends phpbb_test_case
'second' => 'SEC_OPTION',
),
'test',
'<option value="test" selected="selected">TEST</option><option value="second">SEC_OPTION</option>',
[
[
'value' => 'test',
'label' => 'TEST',
'selected' => true,
],
[
'value' => 'second',
'label' => 'SEC_OPTION',
'selected' => false,
],
],
),
array(
array(
@@ -50,7 +72,18 @@ class phpbb_functions_acp_built_select_test extends phpbb_test_case
'second' => 'SEC_OPTION',
),
'second',
'<option value="test">TEST</option><option value="second" selected="selected">SEC_OPTION</option>',
[
[
'value' => 'test',
'label' => 'TEST',
'selected' => false,
],
[
'value' => 'second',
'label' => 'SEC_OPTION',
'selected' => true,
],
],
),
);
}
@@ -60,6 +93,10 @@ class phpbb_functions_acp_built_select_test extends phpbb_test_case
*/
public function test_build_select($option_ary, $option_default, $expected)
{
global $language;
$language = new phpbb_mock_lang();
$this->assertEquals($expected, build_select($option_ary, $option_default));
}
}