Move declarations of globals into functions, so that unit tests are possible

This commit is contained in:
Rouslan Placella 2011-07-13 18:42:10 +01:00
parent 8eaaa70f21
commit d3fa11c19b
4 changed files with 71 additions and 45 deletions

View File

@ -9,6 +9,40 @@ if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Sets required globals
*/
function PMA_EVN_setGlobals()
{
global $event_status, $event_type, $event_interval;
$event_status = array(
'query' => array('ENABLE',
'DISABLE',
'DISABLE ON SLAVE'),
'display' => array('ENABLED',
'DISABLED',
'SLAVESIDE_DISABLED')
);
$event_type = array('RECURRING',
'ONE TIME');
$event_interval = array('YEAR',
'QUARTER',
'MONTH',
'DAY',
'HOUR',
'MINUTE',
'WEEK',
'SECOND',
'YEAR_MONTH',
'DAY_HOUR',
'DAY_MINUTE',
'DAY_SECOND',
'HOUR_MINUTE',
'HOUR_SECOND',
'MINUTE_SECOND');
}
/**
* This function is defined in: rte_routines.lib.php, rte_triggers.lib.php and
* rte_events.lib.php. It is used to retreive some language strings that are
@ -40,6 +74,7 @@ function PMA_RTE_main()
{
global $db;
PMA_EVN_setGlobals();
/**
* Process all requests
*/

View File

@ -71,51 +71,6 @@ $titles = PMA_buildActionTitles();
*/
$errors = array();
// Some definitions for triggers
$action_timings = array('BEFORE',
'AFTER');
$event_manipulations = array('INSERT',
'UPDATE',
'DELETE');
// Some definitions for routines
$param_directions = array('IN',
'OUT',
'INOUT');
$param_opts_num = array('UNSIGNED',
'ZEROFILL',
'UNSIGNED ZEROFILL');
$param_sqldataaccess = array('NO SQL',
'CONTAINS SQL',
'READS SQL DATA',
'MODIFIES SQL DATA');
// Some definitions for events
$event_status = array(
'query' => array('ENABLE',
'DISABLE',
'DISABLE ON SLAVE'),
'display' => array('ENABLED',
'DISABLED',
'SLAVESIDE_DISABLED')
);
$event_type = array('RECURRING',
'ONE TIME');
$event_interval = array('YEAR',
'QUARTER',
'MONTH',
'DAY',
'HOUR',
'MINUTE',
'WEEK',
'SECOND',
'YEAR_MONTH',
'DAY_HOUR',
'DAY_MINUTE',
'DAY_SECOND',
'HOUR_MINUTE',
'HOUR_SECOND',
'MINUTE_SECOND');
/**
* The below function is defined in rte_routines.lib.php,
* rte_triggers.lib.php and rte_events.lib.php

View File

@ -9,6 +9,25 @@ if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Sets required globals
*/
function PMA_RTN_setGlobals()
{
global $param_directions, $param_opts_num, $param_sqldataaccess;
$param_directions = array('IN',
'OUT',
'INOUT');
$param_opts_num = array('UNSIGNED',
'ZEROFILL',
'UNSIGNED ZEROFILL');
$param_sqldataaccess = array('NO SQL',
'CONTAINS SQL',
'READS SQL DATA',
'MODIFIES SQL DATA');
}
/**
* This function is defined in: rte_routines.lib.php, rte_triggers.lib.php and
* rte_events.lib.php. It is used to retreive some language strings that are
@ -40,6 +59,7 @@ function PMA_RTE_main()
{
global $db;
PMA_RTN_setGlobals();
/**
* Process all requests
*/

View File

@ -9,6 +9,21 @@ if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Sets required globals
*/
function PMA_TRI_setGlobals()
{
global $action_timings, $event_manipulations;
// Some definitions for triggers
$action_timings = array('BEFORE',
'AFTER');
$event_manipulations = array('INSERT',
'UPDATE',
'DELETE');
}
/**
* This function is defined in: rte_routines.lib.php, rte_triggers.lib.php and
* rte_events.lib.php. It is used to retreive some language strings that are
@ -40,6 +55,7 @@ function PMA_RTE_main()
{
global $db, $table;
PMA_TRI_setGlobals();
/**
* Process all requests
*/