Example #1
0
 /**
  * returns theme object loaded from given folder
  * or false if theme is invalid
  *
  * @static
  * @param   string  path to theme
  * @return  object  PMA_Theme
  */
 function load($folder)
 {
     $theme = new PMA_Theme();
     $theme->setPath($folder);
     if (!$theme->loadInfo()) {
         return false;
     }
     $theme->checkImgPath();
     return $theme;
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  * @return void
  */
 protected function setUp()
 {
     $this->object = new PMA_Error('2', 'Compile Error', 'error.txt', 15);
     $GLOBALS['pmaThemeImage'] = 'image';
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
 }
 /**
  * SetUp for test cases
  *
  * @return void
  */
 public function setup()
 {
     $GLOBALS['server'] = 0;
     $GLOBALS['cfg']['DefaultTabDatabase'] = 'db_structure.php';
     $GLOBALS['cfg']['MaxNavigationItems'] = 250;
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
 }
 /**
  * Prepares environment for the test.
  *
  * @return void
  */
 public function setUp()
 {
     //$_REQUEST
     $_REQUEST['log'] = "index1";
     $_REQUEST['pos'] = 3;
     //$GLOBALS
     $GLOBALS['cfg']['MaxRows'] = 10;
     $GLOBALS['server'] = 1;
     $GLOBALS['cfg']['ServerDefault'] = "server";
     $GLOBALS['cfg']['RememberSorting'] = true;
     $GLOBALS['cfg']['SQP'] = array();
     $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
     $GLOBALS['cfg']['ShowSQL'] = true;
     $GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
     $GLOBALS['cfg']['LimitChars'] = 100;
     $GLOBALS['cfg']['Server']['DisableIS'] = false;
     $GLOBALS['table'] = "table";
     $GLOBALS['pmaThemeImage'] = 'image';
     //$_SESSION
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
     $table = $this->getMockBuilder('PMA_Table')->disableOriginalConstructor()->getMock();
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->any())->method('getTable')->will($this->returnValue($table));
     $GLOBALS['dbi'] = $dbi;
     $container = Container::getDefaultContainer();
     $container->set('db', 'db');
     $container->set('table', 'table');
     $container->set('dbi', $GLOBALS['dbi']);
     $this->response = new \PMA\Test\Stubs\PMA_Response();
     $container->set('PMA_Response', $this->response);
     $container->alias('response', 'PMA_Response');
 }
 /**
  * Test for setUp
  *
  * @return void
  */
 public function setUp()
 {
     //$GLOBALS
     $GLOBALS['cfg']['MaxRows'] = 10;
     $GLOBALS['cfg']['ServerDefault'] = "server";
     $GLOBALS['cfg']['RememberSorting'] = true;
     $GLOBALS['cfg']['SQP'] = array();
     $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
     $GLOBALS['cfg']['ShowSQL'] = true;
     $GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
     $GLOBALS['cfg']['LimitChars'] = 100;
     $GLOBALS['cfg']['DBG']['sql'] = false;
     $GLOBALS['cfg']['Server']['host'] = "localhost";
     $GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
     $GLOBALS['replication_info']['master']['status'] = false;
     $GLOBALS['replication_info']['slave']['status'] = false;
     $GLOBALS['table'] = "table";
     $GLOBALS['pmaThemeImage'] = 'image';
     //$_SESSION
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
     //Mock DBI
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     //this data is needed when PMA_ServerStatusData constructs
     $server_status = array("Aborted_clients" => "0", "Aborted_connects" => "0", "Com_delete_multi" => "0", "Com_create_function" => "0", "Com_empty_query" => "0");
     $server_variables = array("auto_increment_increment" => "1", "auto_increment_offset" => "1", "automatic_sp_privileges" => "ON", "back_log" => "50", "big_tables" => "OFF");
     $fetchResult = array(array("SHOW GLOBAL STATUS", 0, 1, null, 0, $server_status), array("SHOW GLOBAL VARIABLES", 0, 1, null, 0, $server_variables));
     $dbi->expects($this->any())->method('fetchResult')->will($this->returnValueMap($fetchResult));
     $GLOBALS['dbi'] = $dbi;
     $this->ServerStatusData = new PMA_ServerStatusData();
     $upTime = "10h";
     $this->ServerStatusData->status['Uptime'] = $upTime;
     $this->ServerStatusData->used_queries = array("Com_change_db" => "15", "Com_select" => "12", "Com_set_option" => "54", "Com_show_databases" => "16", "Com_show_status" => "14", "Com_show_tables" => "13");
 }
    /**
     * Test for buildSQPCssData
     */
    public function testBuildSQPCssData(){
        $this->assertEquals(
            $this->object->buildSQPCssData(),
            '.syntax_comment {color: #808000;}
.syntax_comment_mysql {}
.syntax_comment_ansi {}
.syntax_comment_c {}
.syntax_digit {}
.syntax_digit_hex {color: teal;}
.syntax_digit_integer {color: teal;}
.syntax_digit_float {color: aqua;}
.syntax_punct {color: fuchsia;}
.syntax_alpha {}
.syntax_alpha_columnType {color: #f90;}
.syntax_alpha_columnAttrib {color: #00f;}
.syntax_alpha_reservedWord {color: #909;}
.syntax_alpha_functionName {color: #f00;}
.syntax_alpha_identifier {color: black;}
.syntax_alpha_charset {color: #6495ed;}
.syntax_alpha_variable {color: #800000;}
.syntax_quote {color: #008000;}
.syntax_quote_double {}
.syntax_quote_single {}
.syntax_quote_backtick {}
.syntax_indent0 {margin-left: 0em;}
.syntax_indent1 {margin-left: 1em;}
.syntax_indent2 {margin-left: 2em;}
.syntax_indent3 {margin-left: 3em;}
.syntax_indent4 {margin-left: 4em;}
.syntax_indent5 {margin-left: 5em;}
.syntax_indent6 {margin-left: 6em;}
.syntax_indent7 {margin-left: 7em;}
'
        );
    }
 /**
  * Set up
  *
  * @return void
  */
 public function setUp()
 {
     //session_start();
     // cleaning constants
     if (PMA_HAS_RUNKIT) {
         $this->oldIISvalue = 'non-defined';
         $defined_constants = get_defined_constants(true);
         $user_defined_constants = $defined_constants['user'];
         if (array_key_exists('PMA_IS_IIS', $user_defined_constants)) {
             $this->oldIISvalue = PMA_IS_IIS;
             runkit_constant_redefine('PMA_IS_IIS', null);
         } else {
             runkit_constant_add('PMA_IS_IIS', null);
         }
         $this->oldSIDvalue = 'non-defined';
         if (array_key_exists('SID', $user_defined_constants)) {
             $this->oldSIDvalue = SID;
             runkit_constant_redefine('SID', null);
         } else {
             runkit_constant_add('SID', null);
         }
     }
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $GLOBALS['server'] = 0;
     $GLOBALS['PMA_Config'] = new PMA_Config();
     $GLOBALS['PMA_Config']->enableBc();
 }
 /**
  * Set up global environment.
  *
  * @return void
  */
 public function setup()
 {
     $GLOBALS['table'] = 'table';
     $GLOBALS['db'] = 'db';
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION[' PMA_token '] = 'token';
     $GLOBALS['cfg'] = array(
         'MySQLManualType' => 'none',
         'AjaxEnable' => true,
         'ServerDefault' => 1,
         'PropertiesIconic' => true,
     );
     $GLOBALS['server'] = 1;
     $GLOBALS['cfg']['Server']['pmadb'] = 'pmadb';
     $GLOBALS['cfg']['Server']['user'] = '******';
     $GLOBALS['cfg']['Server']['bookmarktable'] = '';
     $GLOBALS['cfg']['Server']['relation'] = '';
     $GLOBALS['cfg']['Server']['table_info'] = '';
     $GLOBALS['cfg']['Server']['table_coords'] = '';
     $GLOBALS['cfg']['Server']['designer_coords'] = '';
     $GLOBALS['cfg']['Server']['column_info'] = 'column_info';
     $GLOBALS['cfg']['DBG']['sql'] = false;
     // need to clear relation test cache
     unset($_SESSION['relation']);
 }
 /**
  * prepares environment for tests
  *
  * @return void
  */
 public function setUp()
 {
     $GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
     $GLOBALS['cfg']['Server']['user'] = '******';
     $GLOBALS['cfg']['Server']['DisableIS'] = true;
     $GLOBALS['cfg']['MaxRows'] = 10;
     $GLOBALS['cfg']['ServerDefault'] = "PMA_server";
     $GLOBALS['cfg']['ActionLinksMode'] = 'icons';
     $GLOBALS['pmaThemeImage'] = 'image';
     $GLOBALS['cfg']['CharEditing'] = '';
     $GLOBALS['cfg']['LimitChars'] = 50;
     $GLOBALS['db'] = 'PMA_db';
     $GLOBALS['table'] = 'PMA_table';
     //$_SESSION
     $GLOBALS['server'] = 1;
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
     $_SESSION['relation'][1] = array('PMA_VERSION' => PMA_VERSION, 'centralcolumnswork' => true, 'relwork' => 1, 'db' => 'phpmyadmin', 'relation' => 'relation', 'central_columns' => 'pma_central_columns');
     // mock DBI
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $GLOBALS['dbi'] = $dbi;
     // set some common expectations
     $dbi->expects($this->any())->method('selectDb')->will($this->returnValue(true));
     $dbi->expects($this->any())->method('getColumns')->will($this->returnValue(array("id" => array("Type" => "integer", "Null" => "NO"), "col1" => array("Type" => 'varchar(100)', "Null" => "YES"), "col2" => array("Type" => 'DATETIME', "Null" => "NO"))));
     $dbi->expects($this->any())->method('getColumnNames')->will($this->returnValue(array("id", "col1", "col2")));
     $dbi->expects($this->any())->method('tryQuery')->will($this->returnValue(true));
     $dbi->expects($this->any())->method('getTables')->will($this->returnValue(array("PMA_table", "PMA_table1", "PMA_table2")));
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  * @return void
  */
 protected function setUp()
 {
     $_SERVER['SCRIPT_NAME'] = 'index.php';
     $GLOBALS['PMA_PHP_SELF'] = 'index.php';
     $GLOBALS['db'] = '';
     $GLOBALS['table'] = '';
     $GLOBALS['text_dir'] = 'ltr';
     $GLOBALS['pmaThemeImage'] = 'image';
     $GLOBALS['PMA_Config'] = new PMA_Config();
     $GLOBALS['PMA_Config']->enableBc();
     $GLOBALS['collation_connection'] = 'utf8_general_ci';
     $GLOBALS['cfg']['Error_Handler']['gather'] = false;
     $GLOBALS['cfg']['Error_Handler']['display'] = false;
     $GLOBALS['cfg']['Server']['verbose'] = 'verbose host';
     $GLOBALS['cfg']['DefaultTabDatabase'] = 'db_structure.php';
     $GLOBALS['server'] = '1';
     $_GET['reload_left_frame'] = '1';
     $GLOBALS['focus_querywindow'] = 'main_pane_left';
     $this->object = new PMA_Footer();
     unset($GLOBALS['error_message']);
     unset($GLOBALS['sql_query']);
     $GLOBALS['error_handler'] = new PMA_Error_Handler();
     unset($_POST);
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
 }
 /**
  * Prepares environment for the test.
  *
  * @return void
  */
 public function setUp()
 {
     //$_REQUEST
     $_REQUEST['log'] = "index1";
     $_REQUEST['pos'] = 3;
     $_REQUEST['mr_adduser'] = "******";
     //$GLOBALS
     $GLOBALS['cfg']['MaxRows'] = 10;
     $GLOBALS['cfg']['ServerDefault'] = "server";
     $GLOBALS['cfg']['RememberSorting'] = true;
     $GLOBALS['cfg']['SQP'] = array();
     $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
     $GLOBALS['cfg']['ShowSQL'] = true;
     $GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
     $GLOBALS['cfg']['LimitChars'] = 100;
     $GLOBALS['cfg']['DBG']['sql'] = false;
     $GLOBALS['cfg']['ShowHint'] = true;
     $GLOBALS['table'] = "table";
     $GLOBALS['url_params'] = array();
     $GLOBALS['pmaThemeImage'] = 'image';
     //$_SESSION
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
     //Mock DBI
     $slave_host = array(array('Server_id' => 'Server_id1', 'Host' => 'Host1'), array('Server_id' => 'Server_id2', 'Host' => 'Host2'));
     $fetchResult = array(array("SHOW SLAVE HOSTS", null, null, null, 0, $slave_host));
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->any())->method('fetchResult')->will($this->returnValueMap($fetchResult));
     $fields_info = array("Host" => array("Field" => "host", "Type" => "char(60)", "Null" => "NO"));
     $dbi->expects($this->any())->method('getColumns')->will($this->returnValue($fields_info));
     $GLOBALS['dbi'] = $dbi;
 }
Example #12
0
 /**
  * prepares environment for tests
  *
  * @return void
  */
 public function setUp()
 {
     $GLOBALS['cfg']['LimitChars'] = 50;
     $GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
     $GLOBALS['cfg']['ServerDefault'] = "PMA_server";
     $GLOBALS['pmaThemeImage'] = 'image';
     $GLOBALS['cfg']['ShowHint'] = true;
     $GLOBALS['cfg']['CharEditing'] = '';
     $GLOBALS['cfg']['ActionLinksMode'] = 'icons';
     $GLOBALS['db'] = 'PMA_db';
     $GLOBALS['table'] = 'PMA_table';
     $GLOBALS['server'] = 1;
     //$_SESSION
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
     //mock DBI
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $GLOBALS['dbi'] = $dbi;
     // set expectations
     $dbi->expects($this->any())->method('selectDb')->will($this->returnValue(true));
     $dbi->expects($this->any())->method('getColumns')->will($this->returnValue(array("id" => array("Type" => "integer"), "col1" => array("Type" => 'varchar(100)'), "col2" => array("Type" => 'DATETIME'))));
     $dbi->expects($this->any())->method('getColumnNames')->will($this->returnValue(array("id", "col1", "col2")));
     $map = array(array('PMA_db', 'PMA_table1', null, array()), array('PMA_db', 'PMA_table', null, array(array('Key_name' => 'PRIMARY', 'Column_name' => 'id'))), array('PMA_db', 'PMA_table2', null, array(array('Key_name' => 'PRIMARY', 'Column_name' => 'id'), array('Key_name' => 'PRIMARY', 'Column_name' => 'col1'))));
     $dbi->expects($this->any())->method('getTableIndexes')->will($this->returnValueMap($map));
     $dbi->expects($this->any())->method('tryQuery')->will($this->returnValue(true));
     $dbi->expects($this->any())->method('fetchResult')->will($this->returnValue(array(0)));
 }
 /**
  * Test for setUp
  *
  * @return void
  */
 public function setUp()
 {
     //$_REQUEST
     $_REQUEST['log'] = "index1";
     $_REQUEST['pos'] = 3;
     //$GLOBALS
     $GLOBALS['cfg']['MaxRows'] = 10;
     $GLOBALS['cfg']['ServerDefault'] = "server";
     $GLOBALS['cfg']['RememberSorting'] = true;
     $GLOBALS['cfg']['SQP'] = array();
     $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
     $GLOBALS['cfg']['ShowSQL'] = true;
     $GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
     $GLOBALS['cfg']['LimitChars'] = 100;
     $GLOBALS['cfg']['DBG']['sql'] = false;
     $GLOBALS['cfg']['Server']['host'] = "localhost";
     $GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
     $GLOBALS['server_master_status'] = false;
     $GLOBALS['server_slave_status'] = false;
     $GLOBALS['table'] = "table";
     $GLOBALS['pmaThemeImage'] = 'image';
     //$_SESSION
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
     //Mock DBI
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     //this data is needed when PMA_ServerStatusData constructs
     $server_status = array("Aborted_clients" => "0", "Aborted_connects" => "0", "Com_delete_multi" => "0", "Com_create_function" => "0", "Com_empty_query" => "0");
     $server_variables = array("auto_increment_increment" => "1", "auto_increment_offset" => "1", "automatic_sp_privileges" => "ON", "back_log" => "50", "big_tables" => "OFF");
     $fetchResult = array(array("SHOW GLOBAL STATUS", 0, 1, null, 0, $server_status), array("SHOW GLOBAL VARIABLES", 0, 1, null, 0, $server_variables), array("SELECT concat('Com_', variable_name), variable_value " . "FROM data_dictionary.GLOBAL_STATEMENTS", 0, 1, null, 0, $server_status));
     $dbi->expects($this->any())->method('fetchResult')->will($this->returnValueMap($fetchResult));
     $GLOBALS['dbi'] = $dbi;
     $this->ServerStatusData = new PMA_ServerStatusData();
 }
 /**
  * Test for setUp
  *
  * @return void
  */
 public function setUp()
 {
     //$GLOBALS
     $GLOBALS['cfg']['MaxRows'] = 10;
     $GLOBALS['cfg']['ExecTimeLimit'] = 300;
     $GLOBALS['cfg']['ServerDefault'] = "PMA_server";
     $GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
     $GLOBALS['cfg']['LimitChars'] = 100;
     $GLOBALS['cfg']['ActionLinksMode'] = 'icons';
     $GLOBALS['cfg']['Server']['host'] = "localhost";
     $GLOBALS['cfg']['Server']['user'] = "******";
     $GLOBALS['cfg']['ShowHint'] = true;
     $GLOBALS['cfg']['ActionLinksMode'] = 'icons';
     $GLOBALS['cfg']['ZipDump'] = true;
     $GLOBALS['cfg']['GZipDump'] = false;
     $GLOBALS['cfg']['BZipDump'] = false;
     $GLOBALS['cfg']['Export']['asfile'] = true;
     $GLOBALS['cfg']['Export']['file_template_server'] = "file_template_server";
     $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();
     $pmaconfig->expects($this->any())->method('getUserValue')->will($this->returnValue('user value for test'));
     $GLOBALS['PMA_Config'] = $pmaconfig;
 }
 /**
  * Prepares environment for the test.
  *
  * @return void
  */
 public function setUp()
 {
     //$_REQUEST
     $_REQUEST['log'] = "index1";
     $_REQUEST['pos'] = 3;
     //$GLOBALS
     $GLOBALS['PMA_Config'] = new PMA_Config();
     $GLOBALS['PMA_Config']->enableBc();
     $GLOBALS['cfg']['MaxRows'] = 10;
     $GLOBALS['cfg']['MaxDbList'] = 100;
     $GLOBALS['cfg']['ServerDefault'] = "server";
     $GLOBALS['cfg']['RememberSorting'] = true;
     $GLOBALS['cfg']['SQP'] = array();
     $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
     $GLOBALS['cfg']['ShowSQL'] = true;
     $GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
     $GLOBALS['cfg']['LimitChars'] = 100;
     $GLOBALS['cfg']['DBG']['sql'] = false;
     $GLOBALS['cfg']['ActionLinksMode'] = "both";
     $GLOBALS['cfg']['DefaultTabDatabase'] = 'db_structure.php';
     $GLOBALS['table'] = "table";
     $GLOBALS['server_master_status'] = false;
     $GLOBALS['server_slave_status'] = false;
     $GLOBALS['pmaThemeImage'] = 'image';
     $GLOBALS['text_dir'] = "text_dir";
     //$_SESSION
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
 }
 /**
  * Test for setUp
  *
  * @return void
  */
 public function setUp()
 {
     //$_REQUEST
     $_REQUEST['log'] = "index1";
     $_REQUEST['pos'] = 3;
     //$GLOBALS
     $GLOBALS['cfg']['MaxRows'] = 10;
     $GLOBALS['cfg']['ServerDefault'] = "server";
     $GLOBALS['cfg']['RememberSorting'] = true;
     $GLOBALS['cfg']['SQP'] = array();
     $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
     $GLOBALS['cfg']['ShowSQL'] = true;
     $GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
     $GLOBALS['cfg']['LimitChars'] = 100;
     $GLOBALS['cfg']['DBG']['sql'] = false;
     $GLOBALS['cfg']['Server']['host'] = "localhost";
     $GLOBALS['cfg']['ActionLinksMode'] = 'icons';
     $GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
     $GLOBALS['table'] = "table";
     $GLOBALS['pmaThemeImage'] = 'image';
     //$_SESSION
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
     //Mock DBI
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     //this data is needed when PMA_ServerStatusData constructs
     $server_session_variable = array("auto_increment_increment" => "1", "auto_increment_offset" => "13", "automatic_sp_privileges" => "ON", "back_log" => "50", "big_tables" => "OFF");
     $server_global_variables = array("auto_increment_increment" => "0", "auto_increment_offset" => "12");
     $fetchResult = array(array("SHOW SESSION VARIABLES;", 0, 1, null, 0, $server_session_variable), array("SHOW GLOBAL VARIABLES;", 0, 1, null, 0, $server_global_variables));
     $dbi->expects($this->any())->method('fetchResult')->will($this->returnValueMap($fetchResult));
     $GLOBALS['dbi'] = $dbi;
 }
Example #17
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  * @return void
  */
 protected function setUp()
 {
     $GLOBALS['plugin_param'] = "csv";
     $this->object = new ImportCsv();
     //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']['ShowHint'] = true;
     $GLOBALS['import_file'] = 'test/test_data/db_test.csv';
     $GLOBALS['import_text'] = 'ImportCsv_Test';
     $GLOBALS['compression'] = 'none';
     $GLOBALS['read_multiply'] = 10;
     $GLOBALS['import_type'] = 'Xml';
     $GLOBALS['pmaThemeImage'] = 'image';
     $GLOBALS['import_handle'] = @fopen($GLOBALS['import_file'], 'r');
     //separator for csv
     $GLOBALS['csv_terminated'] = "\r";
     $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()->getMock();
     $GLOBALS['dbi'] = $dbi;
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  * @return void
  */
 protected function setUp()
 {
     $this->object = new PMA_Error_Handler();
     $GLOBALS['pmaThemeImage'] = 'image';
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
 }
 /**
  * Test for setUp
  *
  * @return void
  */
 public function setUp()
 {
     //$GLOBALS
     $GLOBALS['cfg']['MaxRows'] = 10;
     $GLOBALS['cfg']['ServerDefault'] = "server";
     $GLOBALS['cfg']['RememberSorting'] = true;
     $GLOBALS['cfg']['SQP'] = array();
     $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
     $GLOBALS['cfg']['ShowSQL'] = true;
     $GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
     $GLOBALS['cfg']['LimitChars'] = 100;
     $GLOBALS['cfg']['Server']['DisableIS'] = false;
     $GLOBALS['server'] = 0;
     $GLOBALS['cfg']['ActionLinksMode'] = "both";
     $GLOBALS['pmaThemeImage'] = 'image';
     //_SESSION
     $_SESSION['relation'][$GLOBALS['server']] = array('table_coords' => "table_name", 'displaywork' => 'displaywork', 'db' => "information_schema", 'table_info' => 'table_info', 'relwork' => 'relwork', 'commwork' => 'commwork', 'displaywork' => 'displaywork', 'pdfwork' => 'pdfwork', 'column_info' => 'column_info', 'relation' => 'relation', 'relwork' => 'relwork');
     //$_SESSION
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
     //Mock DBI
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->any())->method('query')->will($this->returnValue(true));
     $GLOBALS['dbi'] = $dbi;
 }
Example #20
0
 /**
  * Test for setUp
  *
  * @return void
  */
 public function setUp()
 {
     $GLOBALS['cfg']['Server']['host'] = "localhost";
     $GLOBALS['cfg']['ShowHint'] = true;
     $GLOBALS['cfg']['ActionLinksMode'] = 'icons';
     $GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
     $GLOBALS['replication_info']['master']['status'] = true;
     $GLOBALS['replication_info']['slave']['status'] = false;
     $GLOBALS['replication_types'] = array();
     $GLOBALS['table'] = "table";
     $GLOBALS['pmaThemeImage'] = 'image';
     //$_SESSION
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
     //Mock DBI
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     //this data is needed when PMA_ServerStatusData constructs
     $server_status = array("Aborted_clients" => "0", "Aborted_connects" => "0", "Com_delete_multi" => "0", "Com_create_function" => "0", "Com_empty_query" => "0", "Com_execute_sql" => 2, "Com_stmt_execute" => 2);
     $server_variables = array("auto_increment_increment" => "1", "auto_increment_offset" => "1", "automatic_sp_privileges" => "ON", "back_log" => "50", "big_tables" => "OFF");
     $fetchResult = array(array("SHOW GLOBAL STATUS", 0, 1, null, 0, $server_status), array("SHOW GLOBAL VARIABLES", 0, 1, null, 0, $server_variables), array("SELECT concat('Com_', variable_name), variable_value " . "FROM data_dictionary.GLOBAL_STATEMENTS", 0, 1, null, 0, $server_status));
     $dbi->expects($this->at(0))->method('tryQuery')->with('SHOW GLOBAL STATUS')->will($this->returnValue(true));
     $dbi->expects($this->at(1))->method('fetchRow')->will($this->returnValue(array("Aborted_clients", "0")));
     $dbi->expects($this->at(2))->method('fetchRow')->will($this->returnValue(array("Aborted_connects", "0")));
     $dbi->expects($this->at(3))->method('fetchRow')->will($this->returnValue(array("Com_delete_multi", "0")));
     $dbi->expects($this->at(4))->method('fetchRow')->will($this->returnValue(array("Com_create_function", "0")));
     $dbi->expects($this->at(5))->method('fetchRow')->will($this->returnValue(array("Com_empty_query", "0")));
     $dbi->expects($this->at(6))->method('fetchRow')->will($this->returnValue(false));
     $dbi->expects($this->at(7))->method('freeResult');
     $dbi->expects($this->any())->method('fetchResult')->will($this->returnValueMap($fetchResult));
     $GLOBALS['dbi'] = $dbi;
     $this->ServerStatusData = new PMA_ServerStatusData();
 }
 /**
  * Prepares environment for the test.
  *
  * @return void
  */
 public function setUp()
 {
     //Constants
     if (!defined("PMA_USR_BROWSER_AGENT")) {
         define("PMA_USR_BROWSER_AGENT", "other");
     }
     //$_REQUEST
     $_REQUEST['log'] = "index1";
     $_REQUEST['pos'] = 3;
     //$GLOBALS
     $GLOBALS['cfg']['MaxRows'] = 10;
     $GLOBALS['cfg']['SendErrorReports'] = "never";
     $GLOBALS['cfg']['ServerDefault'] = "server";
     $GLOBALS['cfg']['RememberSorting'] = true;
     $GLOBALS['cfg']['SQP'] = array();
     $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
     $GLOBALS['cfg']['ShowSQL'] = true;
     $GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
     $GLOBALS['cfg']['LimitChars'] = 100;
     $GLOBALS['cfg']['AllowThirdPartyFraming'] = false;
     $GLOBALS['cfg']['Server']['pmadb'] = 'pmadb';
     $GLOBALS['cfg']['Server']['usergroups'] = 'usergroups';
     $GLOBALS['cfg']['Server']['users'] = 'users';
     $GLOBALS['cfg']['ActionLinksMode'] = "both";
     $GLOBALS['cfg']['DefaultTabDatabase'] = 'db_structure.php';
     $GLOBALS['cfg']['QueryWindowHeight'] = 100;
     $GLOBALS['cfg']['QueryWindowWidth'] = 100;
     $GLOBALS['cfg']['PmaAbsoluteUri'] = "PmaAbsoluteUri";
     $GLOBALS['cfg']['DefaultTabTable'] = "db_structure.php";
     $GLOBALS['cfg']['NavigationTreeDefaultTabTable'] = "db_structure.php";
     $GLOBALS['cfg']['Confirm'] = "Confirm";
     $GLOBALS['cfg']['ShowHint'] = true;
     $GLOBALS['cfgRelation'] = array();
     $GLOBALS['cfgRelation']['menuswork'] = false;
     $GLOBALS['table'] = "table";
     $GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
     $GLOBALS['pmaThemeImage'] = 'image';
     $GLOBALS['server'] = 1;
     $GLOBALS['hostname'] = "hostname";
     $GLOBALS['username'] = "******";
     $GLOBALS['collation_connection'] = "collation_connection";
     $GLOBALS['text_dir'] = "text_dir";
     //$_POST
     $_POST['pred_password'] = '******';
     //$_SESSION
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
     $pmaconfig = $this->getMockBuilder('PMA_Config')->disableOriginalConstructor()->getMock();
     $GLOBALS['PMA_Config'] = $pmaconfig;
     //Mock DBI
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->any())->method('fetchResult')->will($this->returnValue(array('grant user1 select', 'grant user2 delete')));
     $fetchSingleRow = array('password' => 'pma_password', 'Table_priv' => 'pri1, pri2', 'Type' => 'Type');
     $dbi->expects($this->any())->method('fetchSingleRow')->will($this->returnValue($fetchSingleRow));
     $fetchValue = array('key1' => 'value1');
     $dbi->expects($this->any())->method('fetchValue')->will($this->returnValue($fetchValue));
     $dbi->expects($this->any())->method('tryQuery')->will($this->returnValue(true));
     $GLOBALS['dbi'] = $dbi;
 }
 function setup()
 {
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION[' PMA_token '] = 'token';
     $GLOBALS['lang'] = 'en';
     $GLOBALS['server'] = 99;
     $GLOBALS['cfg']['ServerDefault'] = 0;
 }
 /**
  * Set up global environment.
  *
  * @return void
  */
 public function setup()
 {
     $GLOBALS['table'] = 'table';
     $GLOBALS['db'] = 'db';
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $GLOBALS['cfg'] = array('ServerDefault' => 1, 'ActionLinksMode' => 'icons');
     $GLOBALS['server'] = 1;
 }
 /**
  * SetUp for test cases
  *
  * @return void
  */
 public function setup()
 {
     $GLOBALS['server'] = 0;
     $GLOBALS['cfg']['NavigationTreeEnableGrouping'] = true;
     $GLOBALS['cfg']['NavigationTreeDbSeparator'] = '_';
     $GLOBALS['cfg']['NavigationTreeTableSeparator'] = '__';
     $GLOBALS['cfg']['NavigationTreeTableLevel'] = 1;
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
 }
 /**
  * Prepares environment for the test.
  *
  * @return void
  */
 public function setUp()
 {
     $GLOBALS['cfg']['ServerDefault'] = 1;
     $GLOBALS['cfg']['ActionLinksMode'] = 'both';
     $GLOBALS['server'] = 1;
     $_SESSION['relation'][$GLOBALS['server']] = array('PMA_VERSION' => PMA_VERSION, 'db' => 'pmadb', 'users' => 'users', 'usergroups' => 'usergroups');
     $GLOBALS['pmaThemeImage'] = 'image';
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
 }
 /**
  * SetUp function for test cases
  *
  * @return void
  */
 public function setUp()
 {
     $GLOBALS['cfg']['ServerDefault'] = 1;
     $GLOBALS['cfg']['DBG'] = null;
     $GLOBALS['cfg']['TextareaCols'] = 10;
     $GLOBALS['cfg']['TextareaRows'] = 15;
     $GLOBALS['pmaThemeImage'] = 'image';
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
 }
Example #27
0
 /**
  * Sets up the fixture.
  *
  * @access protected
  * @return void
  */
 protected function setUp()
 {
     $this->object = new PMA_Navigation();
     $GLOBALS['cfgRelation']['db'] = 'pmadb';
     $GLOBALS['cfgRelation']['navigationhiding'] = 'navigationhiding';
     $GLOBALS['cfg']['Server']['user'] = '******';
     $GLOBALS['cfg']['ActionLinksMode'] = 'both';
     $GLOBALS['pmaThemeImage'] = 'image';
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
 }
 /**
  * Prepares environment for the test.
  *
  * @return void
  */
 public function setUp()
 {
     $GLOBALS['cfg']['ServerDefault'] = 1;
     $GLOBALS['cfg']['ActionLinksMode'] = 'both';
     $GLOBALS['cfg']['Server']['pmadb'] = 'pmadb';
     $GLOBALS['cfg']['Server']['users'] = 'users';
     $GLOBALS['cfg']['Server']['usergroups'] = 'usergroups';
     $GLOBALS['pmaThemeImage'] = 'image';
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
 }
 /**
  * SetUp for test cases
  *
  * @return void
  */
 public function setup()
 {
     $GLOBALS['server'] = 0;
     $GLOBALS['cfg']['DefaultTabDatabase'] = 'structure';
     $GLOBALS['cfg']['MaxNavigationItems'] = 250;
     $GLOBALS['cfg']['Server'] = array();
     $GLOBALS['cfg']['Server']['DisableIS'] = true;
     $GLOBALS['cfg']['DBG'] = array();
     $GLOBALS['cfg']['DBG']['sql'] = false;
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
 }
 /**
  * Configures global environment.
  *
  * @return void
  */
 function setup()
 {
     $GLOBALS['PMA_Config']->enableBc();
     $GLOBALS['server'] = 0;
     $GLOBALS['available_languages'] = array("en" => array("English", "US-ENGLISH"), "ch" => array("Chinese", "TW-Chinese"));
     $GLOBALS['text_dir'] = 'ltr';
     $GLOBALS['db'] = 'db';
     $GLOBALS['table'] = 'table';
     $this->object = new AuthenticationCookie();
     $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new PMA_Theme();
 }