Advisor: mark that 'Rate of reading fixed position' may be wrong, requires further...
[phpmyadmin/thilanka.git] / test / libraries / rte / PMA_RTN_getDataFromRequest_test.php
blobdb6132563fe3efc62a1106e9087de3f13b50b30d
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test for fetching routine data from HTTP request
6 * @package phpMyAdmin-test
7 */
9 require_once 'libraries/common.lib.php';
13 * Include to test.
15 require_once 'libraries/rte/rte_routines.lib.php';
17 class PMA_RTN_getDataFromRequest_test extends PHPUnit_Framework_TestCase
19 public function setUp()
21 global $cfg;
23 $cfg['ShowFunctionFields'] = false;
24 require 'libraries/data_mysql.inc.php';
27 /**
28 * @dataProvider provider
30 public function testgetDataFromRequest($in, $out)
32 global $cfg, $_REQUEST;
34 unset($_REQUEST);
35 foreach ($in as $key => $value) {
36 if ($value !== '') {
37 $_REQUEST[$key] = $value;
40 PMA_RTN_setGlobals();
41 $this->assertEquals($out, PMA_RTN_getDataFromRequest());
44 public function provider()
46 return array(
47 array(
48 array(
49 'item_name' => '',
50 'item_original_name' => '',
51 'item_returnlength' => '',
52 'item_returnopts_num' => '',
53 'item_returnopts_text' => '',
54 'item_definition' => '',
55 'item_comment' => '',
56 'item_definer' => '',
57 'item_type' => '',
58 'item_type_toggle' => '',
59 'item_original_type' => '',
60 'item_param_dir' => '',
61 'item_param_name' => '',
62 'item_param_type' => '',
63 'item_param_length' => '',
64 'item_param_opts_num' => '',
65 'item_param_opts_text' => '',
66 'item_returntype' => '',
67 'item_isdeterministic' => '',
68 'item_securitytype' => '',
69 'item_sqldataaccess' => ''
71 array(
72 'item_name' => '',
73 'item_original_name' => '',
74 'item_returnlength' => '',
75 'item_returnopts_num' => '',
76 'item_returnopts_text' => '',
77 'item_definition' => '',
78 'item_comment' => '',
79 'item_definer' => '',
80 'item_type' => 'PROCEDURE',
81 'item_type_toggle' => 'FUNCTION',
82 'item_original_type' => 'PROCEDURE',
83 'item_num_params' => 0,
84 'item_param_dir' => array(),
85 'item_param_name' => array(),
86 'item_param_type' => array(),
87 'item_param_length' => array(),
88 'item_param_opts_num' => array(),
89 'item_param_opts_text' => array(),
90 'item_returntype' => '',
91 'item_isdeterministic' => '',
92 'item_securitytype_definer' => '',
93 'item_securitytype_invoker' => '',
94 'item_sqldataaccess' => ''
97 array(
98 array(
99 'item_name' => 'proc2',
100 'item_original_name' => 'proc',
101 'item_returnlength' => '',
102 'item_returnopts_num' => '',
103 'item_returnopts_text' => '',
104 'item_definition' => 'SELECT NULL',
105 'item_comment' => 'some text',
106 'item_definer' => 'root@localhost',
107 'item_type' => 'PROCEDURE',
108 'item_type_toggle' => 'FUNCTION',
109 'item_original_type' => 'PROCEDURE',
110 'item_param_dir' => array(0 => 'IN', 1 => 'FAIL'),
111 'item_param_name' => array(0 => 'bar', 1 => 'baz'),
112 'item_param_type' => array(0 => 'INT', 1 => 'FAIL'),
113 'item_param_length' => array(0 => '20', 1 => ''),
114 'item_param_opts_num' => array(0 => 'UNSIGNED', 1 => ''),
115 'item_param_opts_text' => array(0 => '', 1 => 'latin1'),
116 'item_returntype' => '',
117 'item_isdeterministic' => 'ON',
118 'item_securitytype' => 'INVOKER',
119 'item_sqldataaccess' => 'NO SQL'
121 array(
122 'item_name' => 'proc2',
123 'item_original_name' => 'proc',
124 'item_returnlength' => '',
125 'item_returnopts_num' => '',
126 'item_returnopts_text' => '',
127 'item_definition' => 'SELECT NULL',
128 'item_comment' => 'some text',
129 'item_definer' => 'root@localhost',
130 'item_type' => 'PROCEDURE',
131 'item_type_toggle' => 'FUNCTION',
132 'item_original_type' => 'PROCEDURE',
133 'item_num_params' => 2,
134 'item_param_dir' => array(0 => 'IN', 1 => ''),
135 'item_param_name' => array(0 => 'bar', 1 => 'baz'),
136 'item_param_type' => array(0 => 'INT', 1 => ''),
137 'item_param_length' => array(0 => '20', 1 => ''),
138 'item_param_opts_num' => array(0 => 'UNSIGNED', 1 => ''),
139 'item_param_opts_text' => array(0 => '', 1 => 'latin1'),
140 'item_returntype' => '',
141 'item_isdeterministic' => ' checked=\'checked\'',
142 'item_securitytype_definer' => '',
143 'item_securitytype_invoker' => ' selected=\'selected\'',
144 'item_sqldataaccess' => 'NO SQL'
147 array(
148 array(
149 'item_name' => 'func2',
150 'item_original_name' => 'func',
151 'item_returnlength' => '20',
152 'item_returnopts_num' => '',
153 'item_returnopts_text' => 'CHARSET utf8',
154 'item_definition' => 'SELECT NULL',
155 'item_comment' => 'some text',
156 'item_definer' => 'root@localhost',
157 'item_type' => 'FUNCTION',
158 'item_type_toggle' => 'PROCEDURE',
159 'item_original_type' => 'FUNCTION',
160 'item_param_dir' => array(0 => '', 1 => ''),
161 'item_param_name' => array(0 => 'bar', 1 => 'baz'),
162 'item_param_type' => array(0 => '<s>XSS</s>', 1 => 'TEXT'),
163 'item_param_length' => array(0 => '10,10', 1 => ''),
164 'item_param_opts_num' => array(0 => 'UNSIGNED', 1 => ''),
165 'item_param_opts_text' => array(0 => '', 1 => 'utf8'),
166 'item_returntype' => 'VARCHAR',
167 'item_isdeterministic' => '',
168 'item_securitytype' => 'DEFINER',
169 'item_sqldataaccess' => ''
171 array(
172 'item_name' => 'func2',
173 'item_original_name' => 'func',
174 'item_returnlength' => '20',
175 'item_returnopts_num' => '',
176 'item_returnopts_text' => 'CHARSET utf8',
177 'item_definition' => 'SELECT NULL',
178 'item_comment' => 'some text',
179 'item_definer' => 'root@localhost',
180 'item_type' => 'FUNCTION',
181 'item_type_toggle' => 'PROCEDURE',
182 'item_original_type' => 'FUNCTION',
183 'item_num_params' => '2',
184 'item_param_dir' => array(),
185 'item_param_name' => array(0 => 'bar', 1 => 'baz'),
186 'item_param_type' => array(0 => '', 1 => 'TEXT'),
187 'item_param_length' => array(0 => '10,10', 1 => ''),
188 'item_param_opts_num' => array(0 => 'UNSIGNED', 1 => ''),
189 'item_param_opts_text' => array(0 => '', 1 => 'utf8'),
190 'item_returntype' => 'VARCHAR',
191 'item_isdeterministic' => '',
192 'item_securitytype_definer' => ' selected=\'selected\'',
193 'item_securitytype_invoker' => '',
194 'item_sqldataaccess' => ''