/** * Returns the html for Table footer * * @param bool $is_allowUserDropDatabase Allow user drop database * @param bool $is_superuser User status * @param Array $databases_count Database count * @param string $column_order column order * @param array $replication_types replication types * @param string $first_database First database * * @return string */ function PMA_getHtmlForTableFooter($is_allowUserDropDatabase, $is_superuser, $databases_count, $column_order, $replication_types, $first_database) { $html = '<tfoot><tr>' . "\n"; if ($is_superuser || $is_allowUserDropDatabase) { $html .= ' <th></th>' . "\n"; } $html .= ' <th>' . __('Total') . ': <span id="databases_count">' . $databases_count . '</span></th>' . "\n"; $html .= PMA_getHtmlForColumnOrder($column_order, $first_database); foreach ($replication_types as $type) { if ($GLOBALS["server_" . $type . "_status"]) { $html .= ' <th></th>' . "\n"; } } if ($is_superuser) { $html .= ' <th></th>' . "\n"; } $html .= '</tr>' . "\n"; $html .= '</tfoot>' . "\n"; return $html; }
/** * Test for PMA_getHtmlForColumnOrder * * @return void */ public function testPMAGetHtmlForColumnOrder() { //Mock DBI $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock(); $GLOBALS['dbi'] = $dbi; $column_order = array("first_database" => array('format' => 'byte', 'footer' => '10333')); $first_database = array("first_database" => "db1"); $html = PMA_getHtmlForColumnOrder($column_order, $first_database); $stat = $column_order["first_database"]; list($value, $unit) = PMA_Util::formatByteDown($stat['footer'], 3, 1); $this->assertContains($value, $html); $this->assertContains($unit, $html); }