/** * Tests for PMA_getHtmlForSelectableTables() method. * * @return void * @test */ public function testPMAGetHtmlForSelectableTables() { $selectable_tables_sql_result = true; $url_query = "select * from PMA"; $dbi_old = $GLOBALS['dbi']; $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock(); $fetchArray = array('tracking_active' => 1, 'version' => "10", 'db_name' => 'db_name', 'table_name' => 'table_name', 'date_created' => 'date_created', 'date_updated' => 'date_updated'); $dbi->expects($this->at(0))->method('fetchArray')->will($this->returnValue($fetchArray)); $dbi->expects($this->at(1))->method('fetchArray')->will($this->returnValue($fetchArray)); $dbi->expects($this->at(2))->method('fetchArray')->will($this->returnValue(false)); $GLOBALS['dbi'] = $dbi; $ret = PMA_getHtmlForSelectableTables($selectable_tables_sql_result, $url_query); $this->assertContains(htmlspecialchars($fetchArray['table_name']), $ret); $this->assertContains(htmlspecialchars($fetchArray['db_name']), $ret); //restore DBI $GLOBALS['dbi'] = $dbi_old; }
if (isset($_REQUEST['report']) || isset($_REQUEST['report_export'])) { $html .= PMA_getHtmlForTrackingReport( $url_query, $data, $url_params, $selection_schema, $selection_data, $selection_both, $filter_ts_to, $filter_ts_from, $filter_users ); } // end of report /* * List selectable tables */ $selectable_tables_sql_result = PMA_getSQLResultForSelectableTables(); if ($GLOBALS['dbi']->numRows($selectable_tables_sql_result) > 0) { $html .= PMA_getHtmlForSelectableTables( $selectable_tables_sql_result, $url_query ); } $html .= '<br />'; /* * List versions of current table */ $sql_result = PMA_getListOfVersionsOfTable(); $last_version = PMA_getTableLastVersionNumber($sql_result); if ($last_version > 0) { $html .= PMA_getHtmlForTableVersionDetails( $sql_result, $last_version, $url_params, $url_query, $pmaThemeImage, $text_dir ); }