Dropped MySQL manual type configuration
Nothing but default settings is really working now: - most formats are no longer available on MySQL formats - for downloadable doc our links are in most cases broken and nobody noticed this, so I assume nobody is using this - anyway most current installations don't have troubles with internet access what was main motivation for this configuration directive
This commit is contained in:
parent
eac01ea7f7
commit
d7c3b58337
@ -31,6 +31,7 @@ phpMyAdmin - ChangeLog
|
||||
+ rfe #1385 Hide tables, functions, procedures, events and views in navigation tree
|
||||
+ rfe #1321 Export view as if it was a table
|
||||
+ Dropped configuration directive: SQP
|
||||
+ Dropped configuration directive: MySQLManual*
|
||||
|
||||
4.0.6.0 (not yet released)
|
||||
- bug #4036 Call to undefined function mb_detect_encoding (clarify the doc)
|
||||
|
||||
@ -1836,35 +1836,6 @@ Tabs display settings
|
||||
* ``tbl_change.php``
|
||||
* ``sql.php``
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
.. config:option:: $cfg['MySQLManualBase']
|
||||
|
||||
:type: string
|
||||
:default: ``'http://dev.mysql.com/doc/refman'``
|
||||
|
||||
If set to an :term:`URL` which points to
|
||||
the MySQL documentation (type depends on
|
||||
:config:option:`$cfg['MySQLManualType']`), appropriate help links are
|
||||
generated.
|
||||
|
||||
See `MySQL Documentation page <http://dev.mysql.com/doc/>`_ for more
|
||||
information about MySQL manuals and their types.
|
||||
|
||||
.. config:option:: $cfg['MySQLManualType']
|
||||
|
||||
:type: string
|
||||
:default: ``'viewable'``
|
||||
|
||||
Type of MySQL documentation:
|
||||
|
||||
* viewable - "viewable online", current one used on MySQL website
|
||||
* searchable - "Searchable, with user comments"
|
||||
* chapters - "HTML, one page per chapter"
|
||||
* big - "HTML, all on one page"
|
||||
* none - do not show documentation links
|
||||
|
||||
Languages
|
||||
---------
|
||||
|
||||
|
||||
@ -443,64 +443,32 @@ class PMA_Util
|
||||
public static function getMySQLDocuURL($chapter, $link, $anchor = '') {
|
||||
global $cfg;
|
||||
|
||||
if (($cfg['MySQLManualType'] == 'none') || empty($cfg['MySQLManualBase'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Fixup for newly used names:
|
||||
$chapter = str_replace('_', '-', strtolower($chapter));
|
||||
$link = str_replace('_', '-', strtolower($link));
|
||||
|
||||
switch ($cfg['MySQLManualType']) {
|
||||
case 'chapters':
|
||||
if (empty($chapter)) {
|
||||
$chapter = 'index';
|
||||
}
|
||||
if (empty($anchor)) {
|
||||
$anchor = $link;
|
||||
}
|
||||
$url = $cfg['MySQLManualBase'] . '/' . $chapter . '.html#' . $anchor;
|
||||
break;
|
||||
case 'big':
|
||||
if (empty($anchor)) {
|
||||
$anchor = $link;
|
||||
}
|
||||
$url = $cfg['MySQLManualBase'] . '#' . $anchor;
|
||||
break;
|
||||
case 'searchable':
|
||||
if (empty($link)) {
|
||||
$link = 'index';
|
||||
}
|
||||
$url = $cfg['MySQLManualBase'] . '/' . $link . '.html';
|
||||
if (! empty($anchor)) {
|
||||
$url .= '#' . $anchor;
|
||||
}
|
||||
break;
|
||||
case 'viewable':
|
||||
default:
|
||||
if (empty($link)) {
|
||||
$link = 'index';
|
||||
}
|
||||
$mysql = '5.5';
|
||||
$lang = 'en';
|
||||
if (defined('PMA_MYSQL_INT_VERSION')) {
|
||||
if (PMA_MYSQL_INT_VERSION >= 50600) {
|
||||
$mysql = '5.6';
|
||||
} else if (PMA_MYSQL_INT_VERSION >= 50500) {
|
||||
$mysql = '5.5';
|
||||
} else if (PMA_MYSQL_INT_VERSION >= 50100) {
|
||||
$mysql = '5.1';
|
||||
} else {
|
||||
$mysql = '5.0';
|
||||
}
|
||||
}
|
||||
$url = $cfg['MySQLManualBase']
|
||||
. '/' . $mysql . '/' . $lang . '/' . $link . '.html';
|
||||
if (! empty($anchor)) {
|
||||
$url .= '#' . $anchor;
|
||||
}
|
||||
break;
|
||||
if (empty($link)) {
|
||||
$link = 'index';
|
||||
}
|
||||
$mysql = '5.5';
|
||||
$lang = 'en';
|
||||
if (defined('PMA_MYSQL_INT_VERSION')) {
|
||||
if (PMA_MYSQL_INT_VERSION >= 50600) {
|
||||
$mysql = '5.6';
|
||||
} else if (PMA_MYSQL_INT_VERSION >= 50500) {
|
||||
$mysql = '5.5';
|
||||
} else if (PMA_MYSQL_INT_VERSION >= 50100) {
|
||||
$mysql = '5.1';
|
||||
} else {
|
||||
$mysql = '5.0';
|
||||
}
|
||||
}
|
||||
$url = 'http://dev.mysql.com/doc/refman/'
|
||||
. $mysql . '/' . $lang . '/' . $link . '.html';
|
||||
if (! empty($anchor)) {
|
||||
$url .= '#' . $anchor;
|
||||
}
|
||||
|
||||
return PMA_linkURL($url);
|
||||
}
|
||||
|
||||
|
||||
@ -2244,32 +2244,6 @@ $cfg['Import']['xls_empty_rows'] = true;
|
||||
*/
|
||||
$cfg['Import']['xlsx_col_names'] = false;
|
||||
|
||||
/**
|
||||
* Link to the official MySQL documentation.
|
||||
* Be sure to include no trailing slash on the path.
|
||||
* See http://dev.mysql.com/doc/ for more information
|
||||
* about MySQL manuals and their types.
|
||||
*
|
||||
* @global string $cfg['MySQLManualBase']
|
||||
*/
|
||||
$cfg['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman';
|
||||
|
||||
/**
|
||||
* Type of MySQL documentation:
|
||||
* viewable - "viewable online", current one used on MySQL website
|
||||
* searchable - "Searchable, with user comments"
|
||||
* chapters - "HTML, one page per chapter"
|
||||
* chapters_old - "HTML, one page per chapter",
|
||||
* format used prior to MySQL 5.0 release
|
||||
* big - "HTML, all on one page"
|
||||
* old - old style used in phpMyAdmin 2.3.0 and sooner
|
||||
* none - do not show documentation links
|
||||
*
|
||||
* @global string $cfg['MySQLManualType']
|
||||
*/
|
||||
$cfg['MySQLManualType'] = 'viewable';
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* PDF options
|
||||
*/
|
||||
|
||||
@ -42,8 +42,6 @@ class PMA_DbSearch_Test extends PHPUnit_Framework_TestCase
|
||||
$this->object = new PMA_DbSearch('pma_test');
|
||||
$GLOBALS['server'] = 0;
|
||||
$GLOBALS['cfg']['ServerDefault'] = 1;
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'viewable';
|
||||
$GLOBALS['cfg']['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman';
|
||||
$GLOBALS['cfg']['ShowHint'] = true;
|
||||
$GLOBALS['db'] = 'pma';
|
||||
}
|
||||
|
||||
@ -42,30 +42,28 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
$_POST['zoom_submit'] = 'zoom';
|
||||
|
||||
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['PMA_PHP_SELF'] = 'index.php';
|
||||
$GLOBALS['pmaThemeImage'] = 'themes/dot.gif';
|
||||
$GLOBALS['is_ajax_request'] = false;
|
||||
$GLOBALS['cfgRelation'] = PMA_getRelationsParam();
|
||||
$GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
|
||||
|
||||
|
||||
$GLOBALS['cfg']['ServerDefault'] = 1;
|
||||
$GLOBALS['cfg']['maxRowPlotLimit'] = 500;
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = false;
|
||||
$GLOBALS['cfg']['ServerDefault'] = 1;
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'viewable';
|
||||
$GLOBALS['cfg']['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman';
|
||||
$GLOBALS['cfg']['ActionLinksMode'] = 'both';
|
||||
$GLOBALS['cfg']['ForeignKeyMaxLimit'] = 100;
|
||||
$GLOBALS['cfg']['InitialSlidersState'] = 'closed';
|
||||
$GLOBALS['cfg']['MaxRows'] = 25;
|
||||
$GLOBALS['cfg']['TabsMode'] = 'text';
|
||||
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
||||
$columns =array(
|
||||
array(
|
||||
'Field' => 'Field1',
|
||||
@ -82,7 +80,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
$dbi->expects($this->any())->method('getColumns')
|
||||
->will($this->returnValue($columns));
|
||||
|
||||
|
||||
$show_create_table = "CREATE TABLE `pma_bookmark` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
@ -92,7 +90,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `foreign_field` (`foreign_db`,`foreign_table`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Bookmarks'";
|
||||
|
||||
|
||||
$dbi->expects($this->any())->method('fetchValue')
|
||||
->will($this->returnValue($show_create_table));
|
||||
|
||||
@ -107,7 +105,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -148,7 +146,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
'Do a "query by example"',
|
||||
$form
|
||||
);
|
||||
|
||||
|
||||
//$this->_searchType == 'normal'
|
||||
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "normal");
|
||||
$url_goto = "http://phpmyadmin.net";
|
||||
@ -161,7 +159,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
'Do a "query by example"',
|
||||
$form
|
||||
);
|
||||
|
||||
|
||||
//$this->_searchType == 'replace'
|
||||
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "replace");
|
||||
$url_goto = "http://phpmyadmin.net";
|
||||
@ -193,15 +191,15 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertContains(
|
||||
__('Table Search'),
|
||||
$html
|
||||
);
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Zoom Search'),
|
||||
$html
|
||||
);
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Find and Replace'),
|
||||
$html
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -223,7 +221,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
json_encode($data),
|
||||
$html
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -239,15 +237,15 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
$replaceWith = "Column";
|
||||
$charSet = "UTF-8";
|
||||
$tableSearch->replace($columnIndex, $find, $replaceWith, $charSet);
|
||||
|
||||
|
||||
$sql_query = $GLOBALS['sql_query'];
|
||||
$result = "UPDATE `PMA`.`PMA_BookMark` SET `Field1` = "
|
||||
. "REPLACE(`Field1`, 'Field', 'Column') "
|
||||
$result = "UPDATE `PMA`.`PMA_BookMark` SET `Field1` = "
|
||||
. "REPLACE(`Field1`, 'Field', 'Column') "
|
||||
. "WHERE `Field1` LIKE '%Field%' COLLATE UTF-8_bin";
|
||||
$this->assertEquals(
|
||||
$result,
|
||||
$sql_query
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -267,7 +265,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
__('Replace with:'),
|
||||
$html
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -283,9 +281,9 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
'replace_value',
|
||||
'count'
|
||||
);
|
||||
|
||||
|
||||
$dbi = $GLOBALS['dbi'];
|
||||
|
||||
|
||||
$dbi->expects($this->at(3))->method('fetchRow')
|
||||
->will($this->returnValue($value));
|
||||
|
||||
@ -293,20 +291,20 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
|
||||
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
|
||||
$columnIndex = 0;
|
||||
$find = "Field";
|
||||
$replaceWith = "Column";
|
||||
$charSet = "UTF-8";
|
||||
|
||||
|
||||
$html = $tableSearch->getReplacePreview(
|
||||
$columnIndex,
|
||||
$find,
|
||||
$replaceWith,
|
||||
$columnIndex,
|
||||
$find,
|
||||
$replaceWith,
|
||||
$charSet
|
||||
);
|
||||
|
||||
|
||||
$this->assertContains(
|
||||
'<form method="post" action="tbl_find_replace.php"',
|
||||
$html
|
||||
@ -327,7 +325,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
__('Replaced string'),
|
||||
$html
|
||||
);
|
||||
|
||||
|
||||
$this->assertContains(
|
||||
'<td>value</td>',
|
||||
$html
|
||||
@ -339,7 +337,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertContains(
|
||||
'<td class="right">count</td>',
|
||||
$html
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -355,16 +353,16 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
$_POST['orderByColumn'] = "name";
|
||||
$_POST['order'] = "asc";
|
||||
$_POST['customWhereClause'] = "name='pma'";
|
||||
|
||||
|
||||
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
|
||||
|
||||
|
||||
$sql = $tableSearch->buildSqlQuery();
|
||||
$result = "SELECT DISTINCT * FROM `PMA` WHERE name='pma' ORDER BY `name` asc";
|
||||
$this->assertEquals(
|
||||
$result,
|
||||
$sql
|
||||
);
|
||||
|
||||
|
||||
unset($_POST['customWhereClause']);
|
||||
$sql = $tableSearch->buildSqlQuery();
|
||||
$result = "SELECT DISTINCT * FROM `PMA` ORDER BY `name` asc";
|
||||
@ -372,7 +370,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
$result,
|
||||
$sql
|
||||
);
|
||||
|
||||
|
||||
$_POST['criteriaValues'] = array(
|
||||
'value1',
|
||||
'value2',
|
||||
@ -410,19 +408,19 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
"char7",
|
||||
);
|
||||
$_POST['criteriaColumnOperators'] = array(
|
||||
"!=",
|
||||
">",
|
||||
"IS NULL",
|
||||
"!=",
|
||||
">",
|
||||
"IS NULL",
|
||||
"LIKE %...%",
|
||||
"REGEXP ^...$",
|
||||
"REGEXP ^...$",
|
||||
"IN (...)",
|
||||
"BETWEEN"
|
||||
"BETWEEN"
|
||||
);
|
||||
|
||||
$sql = $tableSearch->buildSqlQuery();
|
||||
$result = "SELECT DISTINCT * FROM `PMA` WHERE `name` != 'value1' AND `id` > value2 "
|
||||
. "AND `index` IS NULL AND `index2` LIKE '%value4%' AND `index3` REGEXP ^value5$ "
|
||||
. "AND `index4` IN (value6) AND `index5` BETWEEN value7 "
|
||||
$result = "SELECT DISTINCT * FROM `PMA` WHERE `name` != 'value1' AND `id` > value2 "
|
||||
. "AND `index` IS NULL AND `index2` LIKE '%value4%' AND `index3` REGEXP ^value5$ "
|
||||
. "AND `index4` IN (value6) AND `index5` BETWEEN value7 "
|
||||
. "AND value8 ORDER BY `name` asc";
|
||||
$this->assertEquals(
|
||||
$result,
|
||||
|
||||
@ -40,61 +40,59 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['server'] = 0;
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = false;
|
||||
$GLOBALS['cfg']['ServerDefault'] = 1;
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'viewable';
|
||||
$GLOBALS['cfg']['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman';
|
||||
$GLOBALS['cfg']['ActionLinksMode'] = 'both';
|
||||
$GLOBALS['cfg']['MaxExactCount'] = 100;
|
||||
$GLOBALS['cfg']['MaxExactCountViews'] = 100;
|
||||
$GLOBALS['cfg']['Server']['pmadb'] = "pmadb";
|
||||
$GLOBALS['cfg']['Server']['table_uiprefs'] = "pma__table_uiprefs";
|
||||
|
||||
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
$GLOBALS['pmaThemeImage'] = 'themes/dot.gif';
|
||||
$GLOBALS['is_ajax_request'] = false;
|
||||
$GLOBALS['cfgRelation'] = PMA_getRelationsParam();
|
||||
$GLOBALS['pma'] = new DataBasePMAMock();
|
||||
$GLOBALS['pma']->databases = new DataBaseMock();
|
||||
|
||||
|
||||
PMA_Table::$cache["PMA"]["PMA_BookMark"] = array(
|
||||
'ENGINE' => true,
|
||||
'Create_time' => true,
|
||||
'TABLE_TYPE' => true,
|
||||
'Comment' => true,
|
||||
);
|
||||
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
||||
$sql_isView_true = "SELECT TABLE_NAME
|
||||
FROM information_schema.VIEWS
|
||||
WHERE TABLE_SCHEMA = 'PMA'
|
||||
AND TABLE_NAME = 'PMA_BookMark'";
|
||||
|
||||
|
||||
$sql_isView_false = "SELECT TABLE_NAME
|
||||
FROM information_schema.VIEWS
|
||||
WHERE TABLE_SCHEMA = 'PMA'
|
||||
AND TABLE_NAME = 'PMA_BookMark_2'";
|
||||
|
||||
|
||||
$sql_isUpdatableView_true = "SELECT TABLE_NAME
|
||||
FROM information_schema.VIEWS
|
||||
WHERE TABLE_SCHEMA = 'PMA'
|
||||
AND TABLE_NAME = 'PMA_BookMark'
|
||||
AND IS_UPDATABLE = 'YES'";
|
||||
|
||||
|
||||
$sql_isUpdatableView_false = "SELECT TABLE_NAME
|
||||
FROM information_schema.VIEWS
|
||||
WHERE TABLE_SCHEMA = 'PMA'
|
||||
AND TABLE_NAME = 'PMA_BookMark_2'
|
||||
AND IS_UPDATABLE = 'YES'";
|
||||
|
||||
|
||||
$sql_analyzeStructure_true = "SELECT COLUMN_NAME, DATA_TYPE
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = 'PMA'
|
||||
AND TABLE_NAME = 'PMA_BookMark'";
|
||||
|
||||
|
||||
$getUniqueColumns_sql = "select unique column";
|
||||
|
||||
|
||||
$fetchResult = array(
|
||||
array(
|
||||
$sql_isView_true,
|
||||
@ -181,11 +179,11 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
||||
$dbi->expects($this->any())->method('fetchResult')
|
||||
->will($this->returnValueMap($fetchResult));
|
||||
|
||||
@ -197,40 +195,40 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
$databases[$database_name]['SCHEMA_MAX_DATA_LENGTH'] = 10;
|
||||
$databases[$database_name]['SCHEMA_INDEX_LENGTH'] = 10;
|
||||
$databases[$database_name]['SCHEMA_LENGTH'] = 10;
|
||||
|
||||
|
||||
$dbi->expects($this->any())->method('getTablesFull')
|
||||
->will($this->returnValue($databases));
|
||||
|
||||
->will($this->returnValue($databases));
|
||||
|
||||
$dbi->expects($this->any())->method('isSystemSchema')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$dbi->expects($this->any())->method('numRows')
|
||||
->will($this->returnValue(20));
|
||||
|
||||
->will($this->returnValue(20));
|
||||
|
||||
$dbi->expects($this->any())->method('tryQuery')
|
||||
->will($this->returnValue(10));
|
||||
->will($this->returnValue(10));
|
||||
|
||||
$triggers = array(
|
||||
array("name" => "name1", "create"=>"crate1"),
|
||||
array("name" => "name2", "create"=>"crate2"),
|
||||
array("name" => "name3", "create"=>"crate3"),
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
$dbi->expects($this->any())->method('getTriggers')
|
||||
->will($this->returnValue($triggers));
|
||||
|
||||
->will($this->returnValue($triggers));
|
||||
|
||||
$dbi->expects($this->any())->method('query')
|
||||
->will($this->returnValue("executed"));
|
||||
->will($this->returnValue("executed"));
|
||||
|
||||
$dbi->expects($this->any())->method('getTableIndexesSql')
|
||||
->will($this->returnValue($getUniqueColumns_sql));
|
||||
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
|
||||
//RunKit, we test:
|
||||
//1. without Runkit, PMA_DRIZZLE = true;
|
||||
//2. with Runkit, PMA_DRIZZLE = false;
|
||||
|
||||
|
||||
if (!defined("PMA_DRIZZLE")) {
|
||||
define("PMA_DRIZZLE", true);
|
||||
}
|
||||
@ -251,7 +249,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
runkit_constant_redefine("PMA_DRIZZLE", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test object creating
|
||||
*
|
||||
@ -346,11 +344,11 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
$table->errors[] = "error1";
|
||||
$table->errors[] = "error2";
|
||||
$table->errors[] = "error3";
|
||||
|
||||
|
||||
$table->messages[] = "messages1";
|
||||
$table->messages[] = "messages2";
|
||||
$table->messages[] = "messages3";
|
||||
|
||||
|
||||
$this->assertEquals(
|
||||
"error3",
|
||||
$table->getLastError()
|
||||
@ -393,7 +391,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
array('te\\st', false),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for isView
|
||||
*
|
||||
@ -428,7 +426,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
false,
|
||||
PMA_Table::isUpdatableView()
|
||||
);
|
||||
|
||||
|
||||
//validate that it is the same as DBI fetchResult
|
||||
$this->assertEquals(
|
||||
true,
|
||||
@ -451,7 +449,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
false,
|
||||
PMA_Table::analyzeStructure()
|
||||
);
|
||||
|
||||
|
||||
//validate that it is the same as DBI fetchResult
|
||||
$show_create_table = PMA_Table::analyzeStructure('PMA', 'PMA_BookMark');
|
||||
$this->assertEquals(
|
||||
@ -471,14 +469,14 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
false,
|
||||
PMA_Table::isMerge()
|
||||
);
|
||||
|
||||
|
||||
//validate that it is Merge?
|
||||
$result = PMA_Table::isMerge('PMA', 'PMA_BookMark');
|
||||
$this->assertEquals(
|
||||
'',
|
||||
$result
|
||||
);
|
||||
|
||||
|
||||
$table = 'PMA_BookMark';
|
||||
$db = 'PMA';
|
||||
PMA_Table::$cache[$db][$table] = array('table_name' => "PMA_BookMark");
|
||||
@ -519,19 +517,19 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
* @return void
|
||||
*/
|
||||
public function testSGetToolTip()
|
||||
{
|
||||
{
|
||||
$table = 'PMA_BookMark';
|
||||
$db = 'PMA';
|
||||
|
||||
|
||||
PMA_Table::$cache[$db][$table] = array('Comment' => "Comment222");
|
||||
|
||||
|
||||
PMA_Table::$cache[$db][$table]['ExactRows'] = 10;
|
||||
$result = PMA_Table::sGetToolTip($db, $table);
|
||||
|
||||
$result = PMA_Table::sGetToolTip($db, $table);
|
||||
|
||||
$this->assertEquals(
|
||||
'Comment222 (10 Rows)',
|
||||
$result
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -540,10 +538,10 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
* @return void
|
||||
*/
|
||||
public function testGenerateAlter()
|
||||
{
|
||||
{
|
||||
$table = 'PMA_BookMark';
|
||||
$db = 'PMA';
|
||||
|
||||
|
||||
//parameter
|
||||
$oldcol = 'name';
|
||||
$newcol = 'new_name';
|
||||
@ -559,28 +557,28 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
$field_primary = 'new_name';
|
||||
$index = array('new_name');
|
||||
$move_to = 'new_name';
|
||||
|
||||
|
||||
$result = PMA_Table::generateAlter(
|
||||
$oldcol, $newcol, $type, $length,
|
||||
$attribute, $collation, $null, $default_type, $default_value,
|
||||
$extra, $comment, $field_primary, $index, $move_to
|
||||
);
|
||||
);
|
||||
|
||||
$expect = "";
|
||||
if (PMA_DRIZZLE) {
|
||||
$expect = "`name` `new_name` VARCHAR(2) new_name "
|
||||
. "COLLATE charset1 NULL DEFAULT 'VARCHAR' "
|
||||
$expect = "`name` `new_name` VARCHAR(2) new_name "
|
||||
. "COLLATE charset1 NULL DEFAULT 'VARCHAR' "
|
||||
. "AUTO_INCREMENT COMMENT 'PMA comment' AFTER `new_name`";
|
||||
} else {
|
||||
$expect = "`name` `new_name` VARCHAR(2) new_name CHARACTER "
|
||||
. "SET charset1 NULL DEFAULT 'VARCHAR' "
|
||||
$expect = "`name` `new_name` VARCHAR(2) new_name CHARACTER "
|
||||
. "SET charset1 NULL DEFAULT 'VARCHAR' "
|
||||
. "AUTO_INCREMENT COMMENT 'PMA comment' AFTER `new_name`";
|
||||
}
|
||||
|
||||
|
||||
$this->assertEquals(
|
||||
$expect,
|
||||
$result
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -589,12 +587,12 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
* @return void
|
||||
*/
|
||||
public function testRename()
|
||||
{
|
||||
{
|
||||
$table = 'PMA_BookMark';
|
||||
$db = 'PMA';
|
||||
|
||||
|
||||
$table = new PMA_Table($table, $db);
|
||||
|
||||
|
||||
//rename to same name
|
||||
$table_new = 'PMA_BookMark';
|
||||
$result = $table->rename($table_new);
|
||||
@ -602,7 +600,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
true,
|
||||
$result
|
||||
);
|
||||
|
||||
|
||||
//isValidName
|
||||
//space in table name
|
||||
$table_new = 'PMA_BookMark ';
|
||||
@ -625,7 +623,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
false,
|
||||
$result
|
||||
);
|
||||
|
||||
|
||||
|
||||
$table_new = 'PMA_BookMark_new';
|
||||
$db_new = 'PMA_new';
|
||||
@ -638,7 +636,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(
|
||||
"Table PMA_BookMark has been renamed to PMA_BookMark_new.",
|
||||
$table->getLastMessage()
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -648,10 +646,10 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
* @return void
|
||||
*/
|
||||
public function testGetUniqueColumns()
|
||||
{
|
||||
{
|
||||
$table = 'PMA_BookMark';
|
||||
$db = 'PMA';
|
||||
|
||||
|
||||
$table = new PMA_Table($table, $db);
|
||||
$return = $table->getUniqueColumns();
|
||||
$expect = array(
|
||||
@ -662,19 +660,19 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(
|
||||
$expect,
|
||||
$return
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for getIndexedColumns
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetIndexedColumns()
|
||||
{
|
||||
{
|
||||
$table = 'PMA_BookMark';
|
||||
$db = 'PMA';
|
||||
|
||||
|
||||
$table = new PMA_Table($table, $db);
|
||||
$return = $table->getIndexedColumns();
|
||||
$expect = array(
|
||||
@ -688,7 +686,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(
|
||||
$expect,
|
||||
$return
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -698,10 +696,10 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
* @return void
|
||||
*/
|
||||
public function testGetColumns()
|
||||
{
|
||||
{
|
||||
$table = 'PMA_BookMark';
|
||||
$db = 'PMA';
|
||||
|
||||
|
||||
$table = new PMA_Table($table, $db);
|
||||
$return = $table->getColumns();
|
||||
$expect = array(
|
||||
@ -716,7 +714,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
$expect,
|
||||
$return
|
||||
);
|
||||
|
||||
|
||||
$return = $table->getReservedColumnNames();
|
||||
$expect = array(
|
||||
'ACCESSIBLE',
|
||||
@ -726,7 +724,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(
|
||||
$expect,
|
||||
$return
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -737,7 +735,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
public function testCountRecords()
|
||||
{
|
||||
$table = 'PMA_BookMark';
|
||||
$db = 'PMA';
|
||||
$db = 'PMA';
|
||||
PMA_Table::$cache[$db][$table] = array('Comment' => "Comment222");
|
||||
|
||||
$return = PMA_Table::countRecords($db, $table, false, true);
|
||||
@ -745,7 +743,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(
|
||||
$expect,
|
||||
$return
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -754,30 +752,30 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
* @return void
|
||||
*/
|
||||
public function testSetUiProp()
|
||||
{
|
||||
{
|
||||
$table_name = 'PMA_BookMark';
|
||||
$db = 'PMA';
|
||||
|
||||
|
||||
$table = new PMA_Table($table_name, $db);
|
||||
|
||||
|
||||
$property = PMA_Table::PROP_COLUMN_ORDER;
|
||||
$value = "UiProp_value";
|
||||
$table_create_time = null;
|
||||
$table->setUiProp($property, $value, $table_create_time);
|
||||
|
||||
|
||||
//set UI prop successfully
|
||||
$this->assertEquals(
|
||||
$value,
|
||||
$table->uiprefs[$property]
|
||||
);
|
||||
|
||||
$table->uiprefs[$property]
|
||||
);
|
||||
|
||||
//removeUiProp
|
||||
$table->removeUiProp($property);
|
||||
$is_define_property = isset($table->uiprefs[$property]) ? true : false;
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$is_define_property
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -788,42 +786,42 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
public function testMoveCopy()
|
||||
{
|
||||
$source_table = 'PMA_BookMark';
|
||||
$source_db = 'PMA';
|
||||
$source_db = 'PMA';
|
||||
$target_table = 'PMA_BookMark_new';
|
||||
$target_db = 'PMA_new';
|
||||
$what = "dataonly";
|
||||
$move = true;
|
||||
$mode = "one_table";
|
||||
|
||||
|
||||
$_REQUEST['drop_if_exists'] = true;
|
||||
|
||||
$return = PMA_Table::moveCopy(
|
||||
$source_db, $source_table, $target_db,
|
||||
$target_table, $what, $move, $mode
|
||||
);
|
||||
|
||||
|
||||
//successully
|
||||
$expect = true;
|
||||
$this->assertEquals(
|
||||
$expect,
|
||||
$return
|
||||
);
|
||||
);
|
||||
$sql_query = "INSERT INTO `PMA_new`.`PMA_BookMark_new` SELECT * FROM `PMA`.`PMA_BookMark`";
|
||||
$this->assertContains(
|
||||
$sql_query,
|
||||
$GLOBALS['sql_query']
|
||||
);
|
||||
);
|
||||
$sql_query = "DROP VIEW `PMA`.`PMA_BookMark`";
|
||||
$this->assertContains(
|
||||
$sql_query,
|
||||
$GLOBALS['sql_query']
|
||||
);
|
||||
|
||||
|
||||
$return = PMA_Table::moveCopy(
|
||||
$source_db, $source_table, $target_db,
|
||||
$target_table, $what, false, $mode
|
||||
);
|
||||
|
||||
|
||||
//successully
|
||||
$expect = true;
|
||||
$this->assertEquals(
|
||||
@ -834,7 +832,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertContains(
|
||||
$sql_query,
|
||||
$GLOBALS['sql_query']
|
||||
);
|
||||
);
|
||||
$sql_query = "DROP VIEW `PMA`.`PMA_BookMark`";
|
||||
$this->assertNotContains(
|
||||
$sql_query,
|
||||
@ -844,7 +842,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Tests behaviour of PMA_Table class with Runkit and PMA_Drizzle = false
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
@ -859,25 +857,25 @@ class PMA_Table_Runkit_Test extends PMA_Table_Test
|
||||
protected function setUp()
|
||||
{
|
||||
//we test:
|
||||
//1. without Runkit, PMA_DRIZZLE = false;
|
||||
//2. with Runkit, PMA_DRIZZLE = true;
|
||||
//1. without Runkit, PMA_DRIZZLE = false;
|
||||
//2. with Runkit, PMA_DRIZZLE = true;
|
||||
if (!defined("PMA_DRIZZLE")) {
|
||||
define("PMA_DRIZZLE", false);
|
||||
}
|
||||
|
||||
|
||||
parent::setUp();
|
||||
|
||||
|
||||
//RunKit
|
||||
if (PMA_HAS_RUNKIT) {
|
||||
runkit_constant_redefine("PMA_DRIZZLE", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//mock PMA
|
||||
Class DataBasePMAMock
|
||||
{
|
||||
var $databases;
|
||||
var $databases;
|
||||
}
|
||||
|
||||
//mock $GLOBALS['pma']->databases
|
||||
@ -886,6 +884,6 @@ Class DataBaseMock
|
||||
function exists($name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* we must set $GLOBALS['server'] here
|
||||
* since 'check_user_privileges.lib.php' will use it globally
|
||||
@ -48,38 +48,37 @@ class ImportCsv_Test extends PHPUnit_Framework_TestCase
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$GLOBALS['plugin_param'] = "csv";
|
||||
$this->object = new ImportCsv();
|
||||
{
|
||||
$GLOBALS['plugin_param'] = "csv";
|
||||
$this->object = new ImportCsv();
|
||||
|
||||
//setting
|
||||
//setting
|
||||
$GLOBALS['finished'] = false;
|
||||
$GLOBALS['read_limit'] = 100000000;
|
||||
$GLOBALS['offset'] = 0;
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = false;
|
||||
$GLOBALS['cfg']['ServerDefault'] = 0;
|
||||
$GLOBALS['cfg']['AllowUserDropDatabase'] = false;
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'none';
|
||||
$GLOBALS['cfg']['ShowHint'] = true;
|
||||
|
||||
|
||||
$GLOBALS['import_file'] = 'test/test_data/db_test.csv';
|
||||
$GLOBALS['import_text'] = 'ImportCsv_Test';
|
||||
$GLOBALS['compression'] = 'none';
|
||||
$GLOBALS['compression'] = 'none';
|
||||
$GLOBALS['read_multiply'] = 10;
|
||||
$GLOBALS['import_type'] = 'Xml';
|
||||
$GLOBALS['pmaThemeImage'] = 'image';
|
||||
$GLOBALS['import_handle'] = @fopen($GLOBALS['import_file'], 'r');
|
||||
|
||||
|
||||
//seperator for csv
|
||||
$GLOBALS['csv_terminated'] = "\015";
|
||||
$GLOBALS['csv_enclosed'] = '"';
|
||||
$GLOBALS['csv_escaped'] = '"';
|
||||
$GLOBALS['csv_new_line'] = 'auto';
|
||||
|
||||
|
||||
//$_SESSION
|
||||
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
|
||||
|
||||
//Mock DBI
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
@ -98,7 +97,7 @@ class ImportCsv_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
unset($this->object);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for getProperties
|
||||
*
|
||||
@ -112,13 +111,13 @@ class ImportCsv_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(
|
||||
__('CSV'),
|
||||
$properties->getText()
|
||||
);
|
||||
);
|
||||
$this->assertEquals(
|
||||
'csv',
|
||||
$properties->getExtension()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for doImport
|
||||
*
|
||||
@ -131,31 +130,31 @@ class ImportCsv_Test extends PHPUnit_Framework_TestCase
|
||||
//$sql_query_disabled will show the import SQL detail
|
||||
global $sql_query, $sql_query_disabled;
|
||||
$sql_query_disabled = false;
|
||||
|
||||
|
||||
//Test function called
|
||||
$this->object->doImport();
|
||||
|
||||
|
||||
//asset that all sql are executed
|
||||
$this->assertContains(
|
||||
'CREATE DATABASE IF NOT EXISTS `CSV_DB` DEFAULT CHARACTER',
|
||||
$sql_query
|
||||
);
|
||||
);
|
||||
$this->assertContains(
|
||||
'SET utf8 COLLATE utf8_general_ci',
|
||||
$sql_query
|
||||
);
|
||||
);
|
||||
$this->assertContains(
|
||||
'CREATE TABLE IF NOT EXISTS `CSV_DB`.`TBL_NAME`',
|
||||
$sql_query
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
true,
|
||||
$GLOBALS['finished']
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for getProperties for Table param
|
||||
*
|
||||
@ -165,19 +164,19 @@ class ImportCsv_Test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetPropertiesForTable()
|
||||
{
|
||||
$GLOBALS['plugin_param'] = 'table';
|
||||
$this->object = new ImportCsv();
|
||||
$GLOBALS['plugin_param'] = 'table';
|
||||
$this->object = new ImportCsv();
|
||||
$properties = $this->object->getProperties();
|
||||
$this->assertEquals(
|
||||
__('CSV'),
|
||||
$properties->getText()
|
||||
);
|
||||
);
|
||||
$this->assertEquals(
|
||||
'csv',
|
||||
$properties->getExtension()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for doImport for _getAnalyze = false, should be OK as well
|
||||
*
|
||||
@ -190,29 +189,29 @@ class ImportCsv_Test extends PHPUnit_Framework_TestCase
|
||||
//$sql_query_disabled will show the import SQL detail
|
||||
global $sql_query, $sql_query_disabled;
|
||||
$sql_query_disabled = false;
|
||||
|
||||
|
||||
//Test function called
|
||||
$this->object->doImport();
|
||||
|
||||
|
||||
//asset that all sql are executed
|
||||
$this->assertContains(
|
||||
'CREATE DATABASE IF NOT EXISTS `CSV_DB` DEFAULT CHARACTER',
|
||||
$sql_query
|
||||
);
|
||||
);
|
||||
$this->assertContains(
|
||||
'SET utf8 COLLATE utf8_general_ci',
|
||||
$sql_query
|
||||
);
|
||||
);
|
||||
$this->assertContains(
|
||||
'CREATE TABLE IF NOT EXISTS `CSV_DB`.`TBL_NAME`',
|
||||
$sql_query
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
true,
|
||||
$GLOBALS['finished']
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* we must set $GLOBALS['server'] here
|
||||
* since 'check_user_privileges.lib.php' will use it globally
|
||||
*/
|
||||
$GLOBALS['server'] = 0;
|
||||
$GLOBALS['plugin_param'] = "table";
|
||||
$GLOBALS['plugin_param'] = "table";
|
||||
|
||||
/*
|
||||
* Include to test.
|
||||
@ -48,23 +48,22 @@ class ImportLdi_Test extends PHPUnit_Framework_TestCase
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
//setting
|
||||
{
|
||||
//setting
|
||||
$GLOBALS['finished'] = false;
|
||||
$GLOBALS['read_limit'] = 100000000;
|
||||
$GLOBALS['offset'] = 0;
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = false;
|
||||
$GLOBALS['cfg']['ServerDefault'] = 0;
|
||||
$GLOBALS['cfg']['AllowUserDropDatabase'] = false;
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'none';
|
||||
|
||||
|
||||
$GLOBALS['import_file'] = 'test/test_data/db_test_ldi.csv';
|
||||
$GLOBALS['import_text'] = 'ImportLdi_Test';
|
||||
$GLOBALS['compression'] = 'none';
|
||||
$GLOBALS['compression'] = 'none';
|
||||
$GLOBALS['read_multiply'] = 10;
|
||||
$GLOBALS['import_type'] = 'csv';
|
||||
$GLOBALS['import_handle'] = @fopen($GLOBALS['import_file'], 'r');
|
||||
|
||||
|
||||
//setting for Ldi
|
||||
$GLOBALS['cfg']['Import']['ldi_replace'] = false;
|
||||
$GLOBALS['cfg']['Import']['ldi_ignore'] = false;
|
||||
@ -75,29 +74,29 @@ class ImportLdi_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['Import']['ldi_columns'] = '';
|
||||
$GLOBALS['cfg']['Import']['ldi_local_option'] = false;
|
||||
$GLOBALS['table'] = "phpmyadmintest";
|
||||
|
||||
|
||||
//Mock DBI
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
||||
$dbi->expects($this->any())->method('tryQuery')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
|
||||
$dbi->expects($this->any())->method('numRows')
|
||||
->will($this->returnValue(10));
|
||||
|
||||
|
||||
$fetchRowResult = array(
|
||||
"PMA_row",
|
||||
"ON"
|
||||
);
|
||||
|
||||
|
||||
$dbi->expects($this->any())->method('fetchRow')
|
||||
->will($this->returnValue($fetchRowResult));
|
||||
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$this->object = new ImportLdi();
|
||||
|
||||
$this->object = new ImportLdi();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,7 +110,7 @@ class ImportLdi_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
unset($this->object);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for getProperties
|
||||
*
|
||||
@ -125,13 +124,13 @@ class ImportLdi_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(
|
||||
__('CSV using LOAD DATA'),
|
||||
$properties->getText()
|
||||
);
|
||||
);
|
||||
$this->assertEquals(
|
||||
'ldi',
|
||||
$properties->getExtension()
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for getProperties for ldi_local_option = auto
|
||||
*
|
||||
@ -147,7 +146,7 @@ class ImportLdi_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(
|
||||
true,
|
||||
$GLOBALS['cfg']['Import']['ldi_local_option']
|
||||
);
|
||||
);
|
||||
$this->assertEquals(
|
||||
__('CSV using LOAD DATA'),
|
||||
$properties->getText()
|
||||
@ -155,9 +154,9 @@ class ImportLdi_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(
|
||||
'ldi',
|
||||
$properties->getExtension()
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for doImport
|
||||
*
|
||||
@ -170,22 +169,22 @@ class ImportLdi_Test extends PHPUnit_Framework_TestCase
|
||||
//$sql_query_disabled will show the import SQL detail
|
||||
global $sql_query, $sql_query_disabled;
|
||||
$sql_query_disabled = false;
|
||||
|
||||
|
||||
//Test function called
|
||||
$this->object->doImport();
|
||||
|
||||
|
||||
//asset that all sql are executed
|
||||
$this->assertContains(
|
||||
"LOAD DATA INFILE 'test/test_data/db_test_ldi.csv' INTO TABLE `phpmyadmintest`",
|
||||
$sql_query
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
true,
|
||||
$GLOBALS['finished']
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for doImport : invalid import file
|
||||
*
|
||||
@ -197,22 +196,22 @@ class ImportLdi_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
global $import_file;
|
||||
$import_file = 'none';
|
||||
|
||||
|
||||
//Test function called
|
||||
$this->object->doImport();
|
||||
$this->object->doImport();
|
||||
|
||||
// We handle only some kind of data!
|
||||
$this->assertContains(
|
||||
__('This plugin does not support compressed imports!'),
|
||||
$GLOBALS['message']->__toString()
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
true,
|
||||
$GLOBALS['error']
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for doImport with LDI setting
|
||||
*
|
||||
@ -223,12 +222,12 @@ class ImportLdi_Test extends PHPUnit_Framework_TestCase
|
||||
public function testDoImportLDISetting()
|
||||
{
|
||||
global $ldi_local_option, $ldi_replace, $ldi_ignore, $ldi_terminated, $ldi_enclosed,
|
||||
$ldi_escaped, $ldi_new_line, $skip_queries, $ldi_columns;
|
||||
$ldi_escaped, $ldi_new_line, $skip_queries, $ldi_columns;
|
||||
|
||||
//$sql_query_disabled will show the import SQL detail
|
||||
global $sql_query, $sql_query_disabled;
|
||||
$sql_query_disabled = false;
|
||||
|
||||
|
||||
|
||||
$ldi_local_option = true;
|
||||
$ldi_replace = true;
|
||||
@ -237,7 +236,7 @@ class ImportLdi_Test extends PHPUnit_Framework_TestCase
|
||||
$ldi_enclosed = ')';
|
||||
$ldi_new_line = 'newline_mark';
|
||||
$skip_queries = true;
|
||||
|
||||
|
||||
//Test function called
|
||||
$this->object->doImport();
|
||||
|
||||
@ -247,25 +246,25 @@ class ImportLdi_Test extends PHPUnit_Framework_TestCase
|
||||
"LOAD DATA LOCAL INFILE 'test/test_data/db_test_ldi.csv' REPLACE INTO TABLE `phpmyadmintest`",
|
||||
$sql_query
|
||||
);
|
||||
|
||||
|
||||
//FIELDS TERMINATED
|
||||
$this->assertContains(
|
||||
"FIELDS TERMINATED BY ','",
|
||||
$sql_query
|
||||
);
|
||||
|
||||
|
||||
//LINES TERMINATED
|
||||
$this->assertContains(
|
||||
"LINES TERMINATED BY 'newline_mark'",
|
||||
$sql_query
|
||||
);
|
||||
|
||||
|
||||
//IGNORE
|
||||
$this->assertContains(
|
||||
"IGNORE 1 LINES",
|
||||
$sql_query
|
||||
);
|
||||
|
||||
|
||||
$this->assertEquals(
|
||||
true,
|
||||
$GLOBALS['finished']
|
||||
|
||||
@ -58,7 +58,6 @@ class ImportOds_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = false;
|
||||
$GLOBALS['cfg']['ServerDefault'] = 0;
|
||||
$GLOBALS['cfg']['AllowUserDropDatabase'] = false;
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'none';
|
||||
|
||||
$GLOBALS['import_file'] = 'test/test_data/db_test.ods';
|
||||
|
||||
|
||||
@ -35,8 +35,6 @@ class PMA_BuildHtmlForDb_Test extends PHPUnit_Framework_TestCase
|
||||
$cfg['ShowFunctionFields'] = false;
|
||||
$GLOBALS['server'] = 0;
|
||||
$cfg['ServerDefault'] = 1;
|
||||
$cfg['MySQLManualType'] = 'viewable';
|
||||
$cfg['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman';
|
||||
|
||||
$GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
|
||||
@ -41,15 +41,14 @@ class PMA_DisplayExport_Test extends PHPUnit_Framework_TestCase
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
{
|
||||
//$GLOBALS
|
||||
$GLOBALS['cfg']['MaxRows'] = 10;
|
||||
$GLOBALS['cfg']['ServerDefault'] = "PMA_server";
|
||||
$GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
|
||||
$GLOBALS['cfg']['LimitChars'] = 100;
|
||||
$GLOBALS['cfg']['ActionLinksMode'] = 'icons';
|
||||
$GLOBALS['cfg']['Server']['host'] = "localhost";
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'viewable';
|
||||
$GLOBALS['cfg']['Server']['host'] = "localhost";
|
||||
$GLOBALS['cfg']['Server']['user'] = "pma_user";
|
||||
$GLOBALS['cfg']['ShowHint'] = true;
|
||||
$GLOBALS['cfg']['ActionLinksMode'] = 'icons';
|
||||
@ -61,16 +60,16 @@ class PMA_DisplayExport_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
|
||||
$GLOBALS['PMA_recoding_engine'] = "InnerDB";
|
||||
$GLOBALS['server'] = 0;
|
||||
|
||||
|
||||
$GLOBALS['table'] = "table";
|
||||
$GLOBALS['pmaThemeImage'] = 'image';
|
||||
$GLOBALS['db'] = "PMA";
|
||||
|
||||
|
||||
//$_SESSION
|
||||
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
$_SESSION['relation'][$GLOBALS['server']] = "";
|
||||
|
||||
|
||||
$pmaconfig = $this->getMockBuilder('PMA_Config')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -97,9 +96,9 @@ class PMA_DisplayExport_Test extends PHPUnit_Framework_TestCase
|
||||
|
||||
//Call the test function
|
||||
$html = PMA_getHtmlForHiddenInput(
|
||||
$export_type,
|
||||
$db,
|
||||
$table,
|
||||
$export_type,
|
||||
$db,
|
||||
$table,
|
||||
$single_table_str,
|
||||
$sql_query_str
|
||||
);
|
||||
@ -127,11 +126,11 @@ class PMA_DisplayExport_Test extends PHPUnit_Framework_TestCase
|
||||
* @return vgetUserValue
|
||||
*/
|
||||
public function testPMAGetHtmlForExportOptions()
|
||||
{
|
||||
{
|
||||
global $cfg;
|
||||
$cfg['Export']['method'] = "XML";
|
||||
$cfg['SaveDir'] = "/tmp";
|
||||
|
||||
|
||||
$export_type = "server";
|
||||
$db = "PMA";
|
||||
$table = "PMA_test";
|
||||
@ -141,7 +140,7 @@ class PMA_DisplayExport_Test extends PHPUnit_Framework_TestCase
|
||||
$unlim_num_rows_str = "unlim_num_rows_str";
|
||||
$single_table = "single_table";
|
||||
PMA_Table::$cache[$db][$table]['ENGINE'] = "MERGE";
|
||||
|
||||
|
||||
/* Scan for plugins */
|
||||
$export_list = PMA_getPlugins(
|
||||
"export",
|
||||
@ -150,15 +149,15 @@ class PMA_DisplayExport_Test extends PHPUnit_Framework_TestCase
|
||||
'export_type' => $export_type,
|
||||
'single_table' => isset($single_table)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
//Call the test function
|
||||
$html = PMA_getHtmlForExportOptions(
|
||||
$export_type,
|
||||
$db,
|
||||
$table,
|
||||
$multi_values_str,
|
||||
$num_tables_str,
|
||||
$export_type,
|
||||
$db,
|
||||
$table,
|
||||
$multi_values_str,
|
||||
$num_tables_str,
|
||||
$export_list,
|
||||
$unlim_num_rows_str
|
||||
);
|
||||
@ -225,7 +224,7 @@ class PMA_DisplayExport_Test extends PHPUnit_Framework_TestCase
|
||||
'user value for test',
|
||||
$html
|
||||
);
|
||||
|
||||
|
||||
//validate 6: PMA_getHtmlForExportOptionsFormat
|
||||
$this->assertContains(
|
||||
'<div class="exportoptions" id="format">',
|
||||
|
||||
@ -39,7 +39,6 @@ class PMA_Operations_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['db'] = 'db';
|
||||
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
|
||||
$GLOBALS['cfg'] = array(
|
||||
'MySQLManualType' => 'none',
|
||||
'ServerDefault' => 1,
|
||||
'ActionLinksMode' => 'icons',
|
||||
);
|
||||
|
||||
@ -52,7 +52,6 @@ class PMA_ServerEngines_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
|
||||
$GLOBALS['cfg']['LimitChars'] = 100;
|
||||
$GLOBALS['cfg']['DBG']['sql'] = false;
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'viewable';
|
||||
|
||||
$GLOBALS['table'] = "table";
|
||||
$GLOBALS['pmaThemeImage'] = 'image';
|
||||
|
||||
@ -60,7 +60,6 @@ class PMA_ServerStatusAdvisor_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['LimitChars'] = 100;
|
||||
$GLOBALS['cfg']['DBG']['sql'] = false;
|
||||
$GLOBALS['cfg']['Server']['host'] = "localhost";
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'viewable';
|
||||
$GLOBALS['cfg']['ShowHint'] = true;
|
||||
$GLOBALS['cfg']['ActionLinksMode'] = 'icons';
|
||||
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
|
||||
|
||||
@ -59,7 +59,6 @@ class PMA_ServerStatusMonitor_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['LimitChars'] = 100;
|
||||
$GLOBALS['cfg']['DBG']['sql'] = false;
|
||||
$GLOBALS['cfg']['Server']['host'] = "localhost";
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'viewable';
|
||||
$GLOBALS['cfg']['ShowHint'] = true;
|
||||
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
|
||||
$GLOBALS['server_master_status'] = false;
|
||||
|
||||
@ -56,7 +56,6 @@ class PMA_ServerStatusQueries_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['LimitChars'] = 100;
|
||||
$GLOBALS['cfg']['DBG']['sql'] = false;
|
||||
$GLOBALS['cfg']['Server']['host'] = "localhost";
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'viewable';
|
||||
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
|
||||
$GLOBALS['server_master_status'] = false;
|
||||
$GLOBALS['server_slave_status'] = false;
|
||||
|
||||
@ -60,7 +60,6 @@ class PMA_ServerStatus_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['LimitChars'] = 100;
|
||||
$GLOBALS['cfg']['DBG']['sql'] = false;
|
||||
$GLOBALS['cfg']['Server']['host'] = "localhost";
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'viewable';
|
||||
$GLOBALS['cfg']['ShowHint'] = true;
|
||||
$GLOBALS['cfg']['ActionLinksMode'] = 'icons';
|
||||
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
|
||||
|
||||
@ -59,7 +59,6 @@ class PMA_ServerStatusVariables_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['LimitChars'] = 100;
|
||||
$GLOBALS['cfg']['DBG']['sql'] = false;
|
||||
$GLOBALS['cfg']['Server']['host'] = "localhost";
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'viewable';
|
||||
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
|
||||
$GLOBALS['server_master_status'] = false;
|
||||
$GLOBALS['server_slave_status'] = false;
|
||||
|
||||
@ -51,7 +51,6 @@ class PMA_ServerVariables_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['LimitChars'] = 100;
|
||||
$GLOBALS['cfg']['DBG']['sql'] = false;
|
||||
$GLOBALS['cfg']['Server']['host'] = "localhost";
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'viewable';
|
||||
$GLOBALS['cfg']['ActionLinksMode'] = 'icons';
|
||||
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
|
||||
|
||||
|
||||
@ -35,7 +35,6 @@ class PMA_Transformation_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['db'] = 'db';
|
||||
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
|
||||
$GLOBALS['cfg'] = array(
|
||||
'MySQLManualType' => 'none',
|
||||
'ServerDefault' => 1,
|
||||
'ActionLinksMode' => 'icons',
|
||||
);
|
||||
@ -145,7 +144,7 @@ class PMA_Transformation_Test extends PHPUnit_Framework_TestCase
|
||||
* @return void
|
||||
*/
|
||||
public function testGetMime()
|
||||
{
|
||||
{
|
||||
$_SESSION['relation'][$GLOBALS['server']]['commwork'] = true;
|
||||
$_SESSION['relation'][$GLOBALS['server']]['db'] = "pmadb";
|
||||
$_SESSION['relation'][$GLOBALS['server']]['column_info'] = "column_info";
|
||||
|
||||
@ -28,8 +28,6 @@ class PMA_RTN_GetEditorForm_Test extends PHPUnit_Framework_TestCase
|
||||
$cfg['ShowFunctionFields'] = false;
|
||||
$GLOBALS['server'] = 0;
|
||||
$cfg['ServerDefault'] = 1;
|
||||
$cfg['MySQLManualType'] = 'viewable';
|
||||
$cfg['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman';
|
||||
|
||||
$GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
|
||||
@ -31,8 +31,6 @@ class PMA_RTN_GetExecuteForm_Test extends PHPUnit_Framework_TestCase
|
||||
$cfg['DefaultFunctions']['FUNC_NUMBER'] = '';
|
||||
$cfg['DefaultFunctions']['FUNC_DATE'] = '';
|
||||
$cfg['DefaultFunctions']['FUNC_SPATIAL'] = 'GeomFromText';
|
||||
$cfg['MySQLManualType'] = 'viewable';
|
||||
$cfg['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user