Simplify RTN/EVN/TRI tests using new dummy dbi
This commit is contained in:
parent
25b28000c8
commit
ccd9578580
@ -107,7 +107,27 @@ $GLOBALS['dummy_queries'] = array(
|
||||
array('o', 'int(11)', 'NO', 'MUL', 'NULL', '', 'select,insert,update,references', ''),
|
||||
)
|
||||
),
|
||||
|
||||
array(
|
||||
'query' => 'SELECT * FROM information_schema.CHARACTER_SETS',
|
||||
'columns' => array('CHARACTER_SET_NAME', 'DEFAULT_COLLATE_NAME', 'DESCRIPTION', 'MAXLEN'),
|
||||
'result' => array(
|
||||
array('utf8', 'utf8_general_ci', 'UTF-8 Unicode', 3),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'query' => 'SELECT * FROM information_schema.COLLATIONS',
|
||||
'columns' => array(
|
||||
'COLLATION_NAME', 'CHARACTER_SET_NAME', 'ID', 'IS_DEFAULT', 'IS_COMPILED', 'SORTLEN'
|
||||
),
|
||||
'result' => array(
|
||||
array('utf8_general_ci', 'utf8', 33, 'Yes', 'Yes', 1),
|
||||
array('utf8_bin', 'utf8', 83, '', 'Yes', 1),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'query' => 'SELECT `TABLE_NAME` FROM `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=\'\' AND `TABLE_TYPE`=\'BASE TABLE\'',
|
||||
'result' => array(),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
@ -355,3 +375,15 @@ function PMA_DBI_num_fields($result)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns last error message or false if no errors occured
|
||||
*
|
||||
* @param resource $link mysql link
|
||||
*
|
||||
* @return string|bool $error or false
|
||||
*/
|
||||
function PMA_DBI_getError($link = null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -17,12 +17,6 @@ class PMA_EVN_getEditorForm_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
if (! function_exists('PMA_DBI_get_tables')) {
|
||||
function PMA_DBI_get_tables($db)
|
||||
{
|
||||
return array('table1', 'table`2');
|
||||
}
|
||||
}
|
||||
$GLOBALS['tear_down']['token'] = false;
|
||||
$GLOBALS['tear_down']['server'] = false;
|
||||
if (! isset($_SESSION[' PMA_token '])) {
|
||||
|
||||
@ -5,11 +5,15 @@
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
$GLOBALS['server'] = 0;
|
||||
require_once 'libraries/CommonFunctions.class.php';
|
||||
require_once 'libraries/php-gettext/gettext.inc';
|
||||
require_once 'libraries/url_generating.lib.php';
|
||||
require_once './libraries/Types.class.php';
|
||||
require_once 'libraries/Theme.class.php';
|
||||
require_once 'libraries/database_interface.lib.php';
|
||||
require_once 'libraries/Tracker.class.php';
|
||||
require_once 'libraries/mysql_charsets.lib.php';
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
@ -22,47 +26,19 @@ class PMA_RTN_getEditorForm_test extends PHPUnit_Framework_TestCase
|
||||
global $cfg;
|
||||
|
||||
$cfg['ShowFunctionFields'] = false;
|
||||
$GLOBALS['server'] = 0;
|
||||
$cfg['ServerDefault'] = 1;
|
||||
$GLOBALS['lang'] = 'en';
|
||||
$_SESSION[' PMA_token '] = 'token';
|
||||
$cfg['MySQLManualType'] = 'viewable';
|
||||
$cfg['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman';
|
||||
|
||||
$GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
$GLOBALS['pmaThemePath'] = $_SESSION['PMA_Theme']->getPath();
|
||||
$GLOBALS['pmaThemeImage'] = 'theme/';
|
||||
|
||||
if (! function_exists('PMA_generateCharsetDropdownBox')) {
|
||||
function PMA_generateCharsetDropdownBox()
|
||||
{
|
||||
}
|
||||
}
|
||||
if (! defined('PMA_CSDROPDOWN_CHARSET')) {
|
||||
define('PMA_CSDROPDOWN_CHARSET', '');
|
||||
}
|
||||
if (! function_exists('PMA_DBI_get_tables')) {
|
||||
function PMA_DBI_get_tables($db)
|
||||
{
|
||||
return array('table1', 'table`2');
|
||||
}
|
||||
}
|
||||
$GLOBALS['tear_down']['token'] = false;
|
||||
$GLOBALS['tear_down']['server'] = false;
|
||||
if (! isset($_SESSION[' PMA_token '])) {
|
||||
$_SESSION[' PMA_token '] = '';
|
||||
$GLOBALS['tear_down']['token'] = true;
|
||||
}
|
||||
if (! isset($GLOBALS['cfg']['ServerDefault'])) {
|
||||
$GLOBALS['cfg']['ServerDefault'] = '';
|
||||
$GLOBALS['tear_down']['server'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
if ($GLOBALS['tear_down']['token']) {
|
||||
unset($_SESSION[' PMA_token ']);
|
||||
}
|
||||
if ($GLOBALS['tear_down']['server']) {
|
||||
unset($GLOBALS['cfg']['ServerDefault']);
|
||||
}
|
||||
unset($GLOBALS['tear_down']);
|
||||
$_SESSION[' PMA_token '] = 'token';
|
||||
}
|
||||
|
||||
public function testgetParameterRow_empty()
|
||||
|
||||
@ -5,11 +5,14 @@
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
$GLOBALS['server'] = 0;
|
||||
require_once 'libraries/CommonFunctions.class.php';
|
||||
require_once 'libraries/sqlparser.lib.php';
|
||||
require_once 'libraries/php-gettext/gettext.inc';
|
||||
require_once 'libraries/url_generating.lib.php';
|
||||
require_once './libraries/Types.class.php';
|
||||
require_once 'libraries/database_interface.lib.php';
|
||||
require_once 'libraries/Tracker.class.php';
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
@ -21,61 +24,24 @@ class PMA_RTN_getExecuteForm_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
$GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
|
||||
|
||||
if (! defined('PMA_MYSQL_INT_VERSION')) {
|
||||
define('PMA_MYSQL_INT_VERSION', 51000);
|
||||
define('PMA_MYSQL_INT_VERSION', 55000);
|
||||
}
|
||||
|
||||
if (! function_exists('PMA_generateCharsetDropdownBox')) {
|
||||
function PMA_generateCharsetDropdownBox()
|
||||
{
|
||||
}
|
||||
}
|
||||
if (! defined('PMA_CSDROPDOWN_CHARSET')) {
|
||||
define('PMA_CSDROPDOWN_CHARSET', '');
|
||||
}
|
||||
if (! function_exists('PMA_DBI_get_tables')) {
|
||||
function PMA_DBI_get_tables($db)
|
||||
{
|
||||
return array('table1', 'table`2');
|
||||
}
|
||||
}
|
||||
$GLOBALS['tear_down']['token'] = false;
|
||||
$GLOBALS['tear_down']['server'] = false;
|
||||
$GLOBALS['tear_down']['default'] = false;
|
||||
if (! isset($_SESSION[' PMA_token '])) {
|
||||
$_SESSION[' PMA_token '] = '';
|
||||
$GLOBALS['tear_down']['token'] = true;
|
||||
}
|
||||
if (! isset($GLOBALS['cfg']['ServerDefault'])) {
|
||||
$GLOBALS['cfg']['ServerDefault'] = '';
|
||||
$GLOBALS['tear_down']['server'] = true;
|
||||
}
|
||||
$GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
|
||||
$GLOBALS['server'] = 0;
|
||||
$cfg['ServerDefault'] = 1;
|
||||
$GLOBALS['lang'] = 'en';
|
||||
$_SESSION[' PMA_token '] = 'token';
|
||||
$GLOBALS['cfg']['ServerDefault'] = '';
|
||||
$cfg['ShowFunctionFields'] = true;
|
||||
if (! isset($GLOBALS['cfg']['DefaultFunctions'])) {
|
||||
$cfg['DefaultFunctions']['FUNC_NUMBER'] = '';
|
||||
$cfg['DefaultFunctions']['FUNC_DATE'] = '';
|
||||
$cfg['DefaultFunctions']['FUNC_SPATIAL'] = 'GeomFromText';
|
||||
$GLOBALS['tear_down']['default'] = true;
|
||||
}
|
||||
$cfg['DefaultFunctions']['FUNC_NUMBER'] = '';
|
||||
$cfg['DefaultFunctions']['FUNC_DATE'] = '';
|
||||
$cfg['DefaultFunctions']['FUNC_SPATIAL'] = 'GeomFromText';
|
||||
$cfg['MySQLManualType'] = 'viewable';
|
||||
$cfg['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman';
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
if ($GLOBALS['tear_down']['token']) {
|
||||
unset($_SESSION[' PMA_token ']);
|
||||
}
|
||||
if ($GLOBALS['tear_down']['server']) {
|
||||
unset($GLOBALS['cfg']['ServerDefault']);
|
||||
}
|
||||
if ($GLOBALS['tear_down']['default']) {
|
||||
unset($GLOBALS['cfg']['DefaultFunctions']);
|
||||
}
|
||||
unset($GLOBALS['tear_down']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider provider_1
|
||||
*/
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
require_once 'libraries/php-gettext/gettext.inc';
|
||||
require_once 'libraries/url_generating.lib.php';
|
||||
require_once 'libraries/CommonFunctions.class.php';
|
||||
require_once 'libraries/database_interface.lib.php';
|
||||
require_once 'libraries/Tracker.class.php';
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
@ -17,33 +19,8 @@ class PMA_TRI_getEditorForm_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
if (! function_exists('PMA_DBI_fetch_result')) {
|
||||
function PMA_DBI_fetch_result($query)
|
||||
{
|
||||
return array('table1', 'table`2');
|
||||
}
|
||||
}
|
||||
$GLOBALS['tear_down']['token'] = false;
|
||||
$GLOBALS['tear_down']['server'] = false;
|
||||
if (! isset($_SESSION[' PMA_token '])) {
|
||||
$_SESSION[' PMA_token '] = '';
|
||||
$GLOBALS['tear_down']['token'] = true;
|
||||
}
|
||||
if (! isset($GLOBALS['cfg']['ServerDefault'])) {
|
||||
$GLOBALS['cfg']['ServerDefault'] = '';
|
||||
$GLOBALS['tear_down']['server'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
if ($GLOBALS['tear_down']['token']) {
|
||||
unset($_SESSION[' PMA_token ']);
|
||||
}
|
||||
if ($GLOBALS['tear_down']['server']) {
|
||||
unset($GLOBALS['cfg']['ServerDefault']);
|
||||
}
|
||||
unset($GLOBALS['tear_down']);
|
||||
$_SESSION[' PMA_token '] = 'token';
|
||||
$GLOBALS['cfg']['ServerDefault'] = '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -20,18 +20,15 @@ require_once 'libraries/php-gettext/gettext.inc';
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/rte/rte_triggers.lib.php';
|
||||
require_once 'libraries/database_interface.lib.php';
|
||||
require_once 'libraries/Tracker.class.php';
|
||||
|
||||
|
||||
class PMA_TRI_getQueryFromRequest_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
if (! function_exists('PMA_DBI_get_tables')) {
|
||||
function PMA_DBI_get_tables($db)
|
||||
{
|
||||
return array('table1', 'table`2');
|
||||
}
|
||||
}
|
||||
$GLOBALS['db'] = 'pma_test';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user