/**
  * Test for PMA_getHtmlForRelationalFieldSelection
  *
  * @return void
  */
 function testGetHtmlForRelationalFieldSelection()
 {
     $db = '';
     $table = '';
     $field = 'foo';
     $foreignData = array();
     $foreignData['disp_row'] = '';
     $fieldkey = 'bar';
     $current_value = '';
     $_REQUEST['rownumber'] = 1;
     $_REQUEST['foreign_filter'] = '5';
     $result = PMA_getHtmlForRelationalFieldSelection($db, $table, $field, $foreignData, $fieldkey, $current_value);
     $this->assertContains('<form class="ajax" ' . 'id="browse_foreign_form" name="browse_foreign_from" ' . 'action="browse_foreigners.php" method="post">', $result);
     $this->assertContains('<fieldset>', $result);
     $this->assertContains('<input type="hidden" name="field" value="foo" />', $result);
     $this->assertContains('<input type="hidden" name="fieldkey" value="bar" />', $result);
     $this->assertContains('<input type="hidden" name="rownumber" value="1" />', $result);
     $this->assertContains('<span class="formelement">', $result);
     $this->assertContains('<label for="input_foreign_filter">', $result);
     $this->assertContains('<input type="text" name="foreign_filter" ' . 'id="input_foreign_filter" ' . 'value="5" data-old="5" ' . '/>', $result);
     $this->assertContains('<input type="submit" name="submit_foreign_filter" value="Go" />', $result);
     $this->assertContains('<span class="formelement">', $result);
     $this->assertContains('<table width="100%" id="browse_foreign_table">', $result);
     $foreignData['disp_row'] = array();
     $foreignData['the_total'] = 5;
     $GLOBALS['cfg']['ShowAll'] = false;
     $result = PMA_getHtmlForRelationalFieldSelection($db, $table, $field, $foreignData, $fieldkey, $current_value);
     $this->assertContains('<table width="100%" id="browse_foreign_table">', $result);
     $this->assertContains('<th>', $result);
 }
require_once 'libraries/browse_foreigners.lib.php';
/**
 * Sets globals from $_REQUEST
 */
$request_params = array('data', 'field');
foreach ($request_params as $one_request_param) {
    if (isset($_REQUEST[$one_request_param])) {
        $GLOBALS[$one_request_param] = $_REQUEST[$one_request_param];
    }
}
PMA_Util::checkParameters(array('db', 'table', 'field'));
$response = PMA_Response::getInstance();
$response->getFooter()->setMinimal();
$header = $response->getHeader();
$header->disableMenu();
$header->setBodyId('body_browse_foreigners');
/**
 * Displays the frame
 */
$cfgRelation = PMA_getRelationsParam();
$foreigners = $cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : false;
$foreign_limit = PMA_getForeignLimit(isset($foreign_navig) ? $foreign_navig : null);
$foreignData = PMA_getForeignData($foreigners, $_REQUEST['field'], true, isset($_REQUEST['foreign_filter']) ? $_REQUEST['foreign_filter'] : '', isset($foreign_limit) ? $foreign_limit : null);
$code = PMA_getJsScriptToHandleSelectRelationalFields();
$header->getScripts()->addCode($code);
// HTML output
$html = PMA_getHtmlForRelationalFieldSelection($db, $table, $_REQUEST['field'], $foreignData, isset($fieldkey) ? $fieldkey : null, isset($data) ? $data : null);
$response->addHtml($html);
?>
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453