Merge branch 'master' of github.com:phpmyadmin/phpmyadmin
This commit is contained in:
commit
58bf42a4a5
@ -61,6 +61,7 @@ class PMA_Footer
|
||||
$this->_scripts = new PMA_Scripts();
|
||||
$this->_isMinimal = false;
|
||||
$this->_addDefaultScripts();
|
||||
unset($POST);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -445,7 +445,7 @@ function PMA_DBI_get_tables_full($database, $table = false,
|
||||
// added BINARY in the WHERE clause to force a case sensitive
|
||||
// comparison (if we are looking for the db Aa we don't want
|
||||
// to find the db aa)
|
||||
$this_databases = array_map('sqlAddSlashes', $databases);
|
||||
$this_databases = array_map('PMA_Util::sqlAddSlashes', $databases);
|
||||
|
||||
if (PMA_DRIZZLE) {
|
||||
$engine_info = PMA_Util::cacheGet('drizzle_engines', true);
|
||||
|
||||
@ -18,6 +18,18 @@ if (! defined('PHPMYADMIN')) {
|
||||
*/
|
||||
$GLOBALS['dummy_queries'] = array(
|
||||
array('query' => 'SELECT 1', 'result' => array(array('1'))),
|
||||
array(
|
||||
'query' => 'SELECT CURRENT_USER();',
|
||||
'result' => array(array('pma_test@localhost')),
|
||||
),
|
||||
array(
|
||||
'query' => 'SELECT COUNT(*) FROM mysql.user',
|
||||
'result' => false,
|
||||
),
|
||||
array(
|
||||
'query' => 'SHOW MASTER LOGS',
|
||||
'result' => false,
|
||||
),
|
||||
array(
|
||||
'query' => 'SHOW STORAGE ENGINES',
|
||||
'result' => array(
|
||||
@ -160,8 +172,49 @@ $GLOBALS['dummy_queries'] = array(
|
||||
array('o', 'text/plain', 'sql'),
|
||||
)
|
||||
),
|
||||
);
|
||||
array(
|
||||
'query' => 'SELECT TABLE_NAME FROM information_schema.VIEWS WHERE TABLE_SCHEMA = \'pma_test\' AND TABLE_NAME = \'table1\'',
|
||||
'result' => array(),
|
||||
),
|
||||
array(
|
||||
'query' => 'SELECT *, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`, `TABLE_TYPE` AS `TABLE_TYPE`, `ENGINE` AS `Engine`, `ENGINE` AS `Type`, `VERSION` AS `Version`, `ROW_FORMAT` AS `Row_format`, `TABLE_ROWS` AS `Rows`, `AVG_ROW_LENGTH` AS `Avg_row_length`, `DATA_LENGTH` AS `Data_length`, `MAX_DATA_LENGTH` AS `Max_data_length`, `INDEX_LENGTH` AS `Index_length`, `DATA_FREE` AS `Data_free`, `AUTO_INCREMENT` AS `Auto_increment`, `CREATE_TIME` AS `Create_time`, `UPDATE_TIME` AS `Update_time`, `CHECK_TIME` AS `Check_time`, `TABLE_COLLATION` AS `Collation`, `CHECKSUM` AS `Checksum`, `CREATE_OPTIONS` AS `Create_options`, `TABLE_COMMENT` AS `Comment` FROM `information_schema`.`TABLES` t WHERE BINARY `TABLE_SCHEMA` IN (\'pma_test\') AND t.`TABLE_NAME` = \'table1\' ORDER BY Name ASC',
|
||||
'columns' => array('TABLE_CATALOG', 'TABLE_SCHEMA', 'TABLE_NAME', 'TABLE_TYPE', 'ENGINE', 'VERSION', 'ROW_FORMAT', 'TABLE_ROWS', 'AVG_ROW_LENGTH', 'DATA_LENGTH', 'MAX_DATA_LENGTH', 'INDEX_LENGTH', 'DATA_FREE', 'AUTO_INCREMENT', 'CREATE_TIME', 'UPDATE_TIME', 'CHECK_TIME', 'TABLE_COLLATION', 'CHECKSUM', 'CREATE_OPTIONS', 'TABLE_COMMENT', 'Db', 'Name', 'TABLE_TYPE', 'Engine', 'Type', 'Version', 'Row_format', 'Rows', 'Avg_row_length', 'Data_length', 'Max_data_length', 'Index_length', 'Data_free', 'Auto_increment', 'Create_time', 'Update_time', 'Check_time', 'Collation', 'Checksum', 'Create_options', 'Comment'),
|
||||
'result' => array(
|
||||
array('def', 'smash', 'issues_issue', 'BASE TABLE', 'InnoDB', '10', 'Compact', '9136', '862', '7880704', '0', '1032192', '420478976', '155862', '2012-08-29 13:28:28', 'NULL', 'NULL', 'utf8_general_ci', 'NULL', '', '', 'smash', 'issues_issue', 'BASE TABLE', 'InnoDB', 'InnoDB', '10', 'Compact', '9136', '862', '7880704', '0', '1032192', '420478976', '155862', '2012-08-29 13:28:28', 'NULL', 'NULL', 'utf8_general_ci', 'NULL'),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'query' => 'SELECT COUNT(*) FROM `pma_test`.`table1`',
|
||||
'result' => array(array(0)),
|
||||
),
|
||||
array(
|
||||
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES` WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\' AND PRIVILEGE_TYPE=\'TRIGGER\'',
|
||||
'result' => array(),
|
||||
),
|
||||
array(
|
||||
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES` WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\' AND PRIVILEGE_TYPE=\'TRIGGER\' AND TABLE_SCHEMA=\'pma\\\\_test\'',
|
||||
|
||||
'result' => array(),
|
||||
),
|
||||
array(
|
||||
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`TABLE_PRIVILEGES` WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\' AND PRIVILEGE_TYPE=\'TRIGGER\' AND TABLE_SCHEMA=\'pma\\\\_test\' AND TABLE_NAME=\'table1\'',
|
||||
'result' => array(),
|
||||
),
|
||||
array(
|
||||
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES` WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\' AND PRIVILEGE_TYPE=\'EVENT\'',
|
||||
'result' => array(),
|
||||
),
|
||||
array(
|
||||
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES` WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\' AND PRIVILEGE_TYPE=\'EVENT\' AND TABLE_SCHEMA=\'pma\\\\_test\'',
|
||||
|
||||
'result' => array(),
|
||||
),
|
||||
array(
|
||||
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`TABLE_PRIVILEGES` WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\' AND PRIVILEGE_TYPE=\'EVENT\' AND TABLE_SCHEMA=\'pma\\\\_test\' AND TABLE_NAME=\'table1\'',
|
||||
'result' => array(),
|
||||
),
|
||||
|
||||
);
|
||||
/**
|
||||
* Current database.
|
||||
*/
|
||||
|
||||
@ -504,7 +504,7 @@ if (isset($_REQUEST['report']) || isset($_REQUEST['report_export'])) {
|
||||
. '<option value="schema_and_data"'
|
||||
. ($selection_both ? ' selected="selected"' : '') . '>'
|
||||
. __('Structure and data') . '</option>'
|
||||
'</select>';
|
||||
. '</select>';
|
||||
$str2 = '<input type="text" name="date_from" value="'
|
||||
. htmlspecialchars($_REQUEST['date_from']) . '" size="19" />';
|
||||
$str3 = '<input type="text" name="date_to" value="'
|
||||
|
||||
@ -7,6 +7,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . dirname(realpath("../inde
|
||||
// Setting constants for testing
|
||||
define('PHPMYADMIN', 1);
|
||||
define('TESTSUITE', 1);
|
||||
define('PMA_MYSQL_INT_VERSION', 55000);
|
||||
|
||||
session_start();
|
||||
|
||||
|
||||
@ -170,7 +170,7 @@ class PMA_DbSearch_test extends PHPUnit_Framework_TestCase
|
||||
<input type="radio" name="criteriaSearchType" id="criteriaSearchType_3" value="3" />
|
||||
<label for="criteriaSearchType_3">the exact phrase</label><br />
|
||||
<input type="radio" name="criteriaSearchType" id="criteriaSearchType_4" value="4" />
|
||||
<label for="criteriaSearchType_4">as regular expression <a href="./url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Fregexp.html&server=0&lang=en&token=token" target="mysql_doc"><img src="themes/dot.gifb_help.png" title="Documentation" alt="Documentation" /></a></label><br />
|
||||
<label for="criteriaSearchType_4">as regular expression <a href="./url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.6%2Fen%2Fregexp.html&server=0&lang=en&token=token" target="mysql_doc"><img src="themes/dot.gifb_help.png" title="Documentation" alt="Documentation" /></a></label><br />
|
||||
</td></tr><tr><td class="right vtop">Inside tables:</td><td rowspan="2"><select name="criteriaTables[]" size="6" multiple="multiple"><option value="table1">table1</option><option value="table2">table2</option></select></td></tr><tr><td class="right vbottom"><a href="db_search.php?0=param1&1=param2&selectall=1&server=0&lang=en&token=token#db_search" onclick="setSelectOptions(\'db_search\', \'criteriaTables[]\', true); return false;">Select All</a> / <a href="db_search.php?0=param1&1=param2&unselectall=1&server=0&lang=en&token=token#db_search" onclick="setSelectOptions(\'db_search\', \'criteriaTables[]\', false); return false;">Unselect All</a></td></tr><tr><td class="right">Inside column:</td><td><input type="text" name="criteriaColumnName" size="60"value="" /></td></tr></table></fieldset><fieldset class="tblFooters"><input type="submit" name="submit_search" value="Go" id="buttonGo" /></fieldset></form><!-- These two table-image and table-link elements display the table name in browse search results --><div id="table-info"><a class="item" id="table-link" ></a></div><div id="browse-results"><!-- this browse-results div is used to load the browse and delete results in the db search --></div><br class="clearfloat" /><div id="sqlqueryform"><!-- this sqlqueryform div is used to load the delete form in the db search --></div><!-- toggle query box link--><a id="togglequerybox"></a>',
|
||||
$this->object->getSelectionForm($url_params)
|
||||
);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Tests for displaing results
|
||||
* Tests for Footer class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
@ -16,8 +16,15 @@ require_once 'libraries/url_generating.lib.php';
|
||||
require_once 'libraries/php-gettext/gettext.inc';
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/Theme.class.php';
|
||||
require_once 'libraries/Error_Handler.class.php';
|
||||
require_once 'libraries/vendor_config.php';
|
||||
|
||||
class PMA_Footer_test extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* Tests for Footer class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class PMA_Footer_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
@ -41,6 +48,8 @@ class PMA_Footer_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
$GLOBALS['lang'] = 'en';
|
||||
$GLOBALS['collation_connection'] = 'utf8_general_ci';
|
||||
$GLOBALS['cfg']['Error_Handler']['gather'] = false;
|
||||
$GLOBALS['cfg']['Error_Handler']['display'] = false;
|
||||
$GLOBALS['server'] = '1';
|
||||
$_SESSION[' PMA_token '] = 'token';
|
||||
$_GET['reload_left_frame'] = '1';
|
||||
@ -48,6 +57,7 @@ class PMA_Footer_test extends PHPUnit_Framework_TestCase
|
||||
$this->object = new PMA_Footer();
|
||||
unset($GLOBALS['error_message']);
|
||||
unset($GLOBALS['sql_query']);
|
||||
$GLOBALS['error_handler'] = new PMA_Error_Handler();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,6 +91,8 @@ class PMA_Footer_test extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* Test for _getDebugMessage
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @group medium
|
||||
*/
|
||||
public function testGetDebugMessage()
|
||||
@ -110,6 +122,8 @@ class PMA_Footer_test extends PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Test for _getSelfLink
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetSelfLink()
|
||||
{
|
||||
@ -128,6 +142,8 @@ class PMA_Footer_test extends PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Test for _getSelfLink
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetSelfLinkWithImage()
|
||||
{
|
||||
@ -146,32 +162,32 @@ class PMA_Footer_test extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Test for disable
|
||||
// */
|
||||
// public function testDisable()
|
||||
// {
|
||||
//
|
||||
// $GLOBALS['lang'] = 'en';
|
||||
// $GLOBALS['collation_connection'] = 'utf8_general_ci';
|
||||
// $GLOBALS['server'] = '1';
|
||||
// $_SESSION[' PMA_token '] = 'token';
|
||||
// $GLOBALS['reload'] = '1';
|
||||
// $GLOBALS['focus_querywindow'] = 'main_pane_left';
|
||||
//
|
||||
// $footer = new PMA_Footer();
|
||||
//
|
||||
// $class = get_class( $footer );
|
||||
// $reflection = new ReflectionClass( $class );
|
||||
// $priv_attr = $reflection->getProperties( ReflectionProperty::IS_PRIVATE );
|
||||
// $privates = array();
|
||||
// $parseable = unserialize(str_replace("\0$class\0", "\0*\0", serialize($footer)));
|
||||
// foreach($priv_attr as $attribute)
|
||||
// {
|
||||
// $aname = $attribute->name;
|
||||
// $privates[$aname] = $parseable->$aname;
|
||||
// }
|
||||
//
|
||||
// $this->assertFalse($priv_attr[3]->_isEnable);
|
||||
// }
|
||||
/**
|
||||
* Test for disable
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDisable()
|
||||
{
|
||||
$footer = new PMA_Footer();
|
||||
$footer->disable();
|
||||
$this->assertEquals(
|
||||
'',
|
||||
$footer->getDisplay()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for displaying footer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDisplay()
|
||||
{
|
||||
$footer = new PMA_Footer();
|
||||
$this->assertContains(
|
||||
'Open new phpMyAdmin window',
|
||||
$footer->getDisplay()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
104
test/classes/PMA_Menu_test.php
Normal file
104
test/classes/PMA_Menu_test.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Test for PMA_Menu class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/sanitizing.lib.php';
|
||||
require_once 'libraries/core.lib.php';
|
||||
require_once 'libraries/Menu.class.php';
|
||||
require_once 'libraries/Table.class.php';
|
||||
require_once 'libraries/database_interface.lib.php';
|
||||
require_once 'libraries/Tracker.class.php';
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/Theme.class.php';
|
||||
require_once 'libraries/url_generating.lib.php';
|
||||
require_once 'libraries/vendor_config.php';
|
||||
require_once 'libraries/select_lang.lib.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
|
||||
/**
|
||||
* Test for PMA_Menu class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class PMA_Menu_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Configures global environment.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setup()
|
||||
{
|
||||
if (!defined('PMA_IS_WINDOWS')) {
|
||||
define('PMA_IS_WINDOWS', false);
|
||||
}
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = false;
|
||||
$GLOBALS['server'] = 0;
|
||||
$GLOBALS['cfg']['ServerDefault'] = 1;
|
||||
$GLOBALS['lang'] = 'en';
|
||||
$GLOBALS['cfg']['Server']['verbose'] = 'verbose host';
|
||||
$GLOBALS['cfg']['NavigationBarIconic'] = 'both';
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
$GLOBALS['pmaThemePath'] = $_SESSION['PMA_Theme']->getPath();
|
||||
$GLOBALS['pmaThemeImage'] = 'theme/';
|
||||
$GLOBALS['cfg']['DefaultTabServer'] = 'main.php';
|
||||
$GLOBALS['cfg']['DefaultTabDatabase'] = 'db_structure.php';
|
||||
$GLOBALS['cfg']['DefaultTabTable'] = 'sql.php';
|
||||
$GLOBALS['cfg']['OBGzip'] = false;
|
||||
$GLOBALS['cfg']['NaturalOrder'] = true;
|
||||
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
|
||||
$GLOBALS['server'] = 'server';
|
||||
$GLOBALS['db'] = 'pma_test';
|
||||
$GLOBALS['table'] = 'table1';
|
||||
}
|
||||
|
||||
/**
|
||||
* Server menu test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testServer()
|
||||
{
|
||||
$menu = new PMA_Menu('server', '', '');
|
||||
$this->assertContains(
|
||||
'floating_menubar',
|
||||
$menu->getDisplay()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Database menu test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testDatabase()
|
||||
{
|
||||
$menu = new PMA_Menu('server', 'pma_test', '');
|
||||
$this->assertContains(
|
||||
'floating_menubar',
|
||||
$menu->getDisplay()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Table menu test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testTable()
|
||||
{
|
||||
$menu = new PMA_Menu('server', 'pma_test', 'table1');
|
||||
$this->assertContains(
|
||||
'floating_menubar',
|
||||
$menu->getDisplay()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -322,11 +322,6 @@ class PMA_Types_Drizzle_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetColumns()
|
||||
{
|
||||
|
||||
if (! defined('PMA_MYSQL_INT_VERSION')) {
|
||||
define('PMA_MYSQL_INT_VERSION', 20120130);
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
0 => 'INT',
|
||||
@ -358,8 +353,6 @@ class PMA_Types_Drizzle_test extends PHPUnit_Framework_TestCase
|
||||
'BLOB',
|
||||
'-',
|
||||
'ENUM',
|
||||
'-',
|
||||
'IPV6'
|
||||
),
|
||||
),
|
||||
$this->object->getColumns()
|
||||
|
||||
@ -285,11 +285,6 @@ class PMA_Types_MySQL_Test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetFunctionsClass($class, $output)
|
||||
{
|
||||
|
||||
if (! defined('PMA_MYSQL_INT_VERSION')) {
|
||||
define('PMA_MYSQL_INT_VERSION', 60000);
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
$output,
|
||||
$this->object->getFunctionsClass($class)
|
||||
|
||||
@ -23,11 +23,6 @@ class PMA_RTN_getExecuteForm_test extends PHPUnit_Framework_TestCase
|
||||
public function setUp()
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
if (! defined('PMA_MYSQL_INT_VERSION')) {
|
||||
define('PMA_MYSQL_INT_VERSION', 55000);
|
||||
}
|
||||
|
||||
$GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
|
||||
$GLOBALS['server'] = 0;
|
||||
$cfg['ServerDefault'] = 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user