public function generateIndexSelector() { $html_options = ''; foreach (PMA_Index::getIndexChoices() as $each_index_choice) { if ($each_index_choice === 'PRIMARY' && $this->_choice !== 'PRIMARY' && PMA_Index::getPrimary($this->_table, $this->_schema)) { // skip PRIMARY if there is already one in the table continue; } $html_options .= '<option value="' . $each_index_choice . '"' . ($this->_choice == $each_index_choice ? ' selected="selected"' : '') . '>' . $each_index_choice . '</option>' . "\n"; } return $html_options; }
/** * Test for getIndexChoices * * @return void */ public function testGetIndexChoices() { $index_choices = PMA_Index::getIndexChoices(); $this->assertEquals(5, count($index_choices)); $this->assertEquals('PRIMARY,INDEX,UNIQUE,SPATIAL,FULLTEXT', implode(",", $index_choices)); }