/** * Test for getRadioFields * * @return void */ function testGetRadioFieldsEscapeLabelEscapeLabelWithClass() { $name = "test_display_radio"; $choices = array('value_1' => 'choice_1', 'value_&2' => 'choice&_<2>'); $checked_choice = "value_2"; $class = "test_class"; $out = ""; foreach ($choices as $choice_value => $choice_label) { $html_field_id = $name . '_' . $choice_value; $out .= '<div class="' . $class . '">'; $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"'; if ($choice_value == $checked_choice) { $out .= ' checked="checked"'; } $out .= ' />' . "\n"; $out .= '<label for="' . $html_field_id . '">' . htmlspecialchars($choice_label) . '</label>'; $out .= '<br />'; $out .= '</div>'; $out .= "\n"; } $this->assertEquals(PMA\libraries\Util::getRadioFields($name, $choices, $checked_choice, true, true, $class), $out); }
/** * Test for PMA_getHtmlForNormalizetable * * @return void */ public function testPMAGetHtmlForNormalizetable() { $result = PMA_getHtmlForNormalizetable(); $this->assertContains('<form method="post" action="normalization.php"' . ' name="normalize" id="normalizeTable"', $result); $this->assertContains('<input type="hidden" name="step1" value="1">', $result); $choices = array('1nf' => __('First step of normalization (1NF)'), '2nf' => __('Second step of normalization (1NF+2NF)'), '3nf' => __('Third step of normalization (1NF+2NF+3NF)')); $html_tmp = PMA\libraries\Util::getRadioFields('normalizeTo', $choices, '1nf', true); $this->assertContains($html_tmp, $result); }