1 | <?php |
||
16 | class GetFunctionParametersTest extends BaseAbstractClassMethodTest |
||
|
|||
17 | { |
||
18 | |||
19 | public $filename = 'sniff-examples/utility-functions/get_function_parameters.php'; |
||
20 | |||
21 | /** |
||
22 | * testGetFunctionCallParameters |
||
23 | * |
||
24 | * @group utilityFunctions |
||
25 | * |
||
26 | * @dataProvider dataGetFunctionCallParameters |
||
27 | * |
||
28 | * @param int $stackPtr Stack pointer for a T_CLASS token in the test file. |
||
29 | * @param string $expected The expected fully qualified class name. |
||
30 | */ |
||
31 | public function testGetFunctionCallParameters($stackPtr, $expected) |
||
36 | |||
37 | /** |
||
38 | * dataGetFunctionCallParameters |
||
39 | * |
||
40 | * @see testGetFunctionCallParameters() |
||
41 | * |
||
42 | * @return array |
||
43 | */ |
||
44 | public function dataGetFunctionCallParameters() |
||
45 | { |
||
46 | return array( |
||
47 | array(88, array( |
||
48 | 1 => array( |
||
49 | 'start' => 90, |
||
50 | 'end' => 91, |
||
51 | 'raw' => '1', |
||
52 | ), |
||
53 | 2 => array( |
||
54 | 'start' => 93, |
||
55 | 'end' => 94, |
||
56 | 'raw' => '2', |
||
57 | ), |
||
58 | 3 => array( |
||
59 | 'start' => 96, |
||
60 | 'end' => 97, |
||
61 | 'raw' => '3', |
||
62 | ), |
||
63 | 4 => array( |
||
64 | 'start' => 99, |
||
65 | 'end' => 100, |
||
66 | 'raw' => '4', |
||
67 | ), |
||
68 | 5 => array( |
||
69 | 'start' => 102, |
||
70 | 'end' => 103, |
||
71 | 'raw' => '5', |
||
72 | ), |
||
73 | 6 => array( |
||
74 | 'start' => 105, |
||
75 | 'end' => 106, |
||
76 | 'raw' => '6', |
||
77 | ), |
||
78 | 7 => array( |
||
79 | 'start' => 108, |
||
80 | 'end' => 110, |
||
81 | 'raw' => 'true', |
||
82 | ), |
||
83 | ), |
||
84 | |||
85 | ), |
||
86 | array(120, array( |
||
87 | 1 => array( |
||
88 | 'start' => 122, |
||
89 | 'end' => 129, |
||
90 | 'raw' => 'dirname( __FILE__ )', |
||
91 | ), |
||
92 | ), |
||
93 | ), |
||
94 | array(250, array( |
||
95 | 1 => array( |
||
96 | 'start' => 252, |
||
97 | 'end' => 252, |
||
98 | 'raw' => '$stHour', |
||
99 | ), |
||
100 | 2 => array( |
||
101 | 'start' => 254, |
||
102 | 'end' => 255, |
||
103 | 'raw' => '0', |
||
104 | ), |
||
105 | 3 => array( |
||
106 | 'start' => 257, |
||
107 | 'end' => 258, |
||
108 | 'raw' => '0', |
||
109 | ), |
||
110 | 4 => array( |
||
111 | 'start' => 260, |
||
112 | 'end' => 264, |
||
113 | 'raw' => '$arrStDt[0]', |
||
114 | ), |
||
115 | 5 => array( |
||
116 | 'start' => 266, |
||
117 | 'end' => 270, |
||
118 | 'raw' => '$arrStDt[1]', |
||
119 | ), |
||
120 | 6 => array( |
||
121 | 'start' => 272, |
||
122 | 'end' => 276, |
||
123 | 'raw' => '$arrStDt[2]', |
||
124 | ), |
||
125 | ), |
||
126 | |||
127 | ), |
||
128 | ); |
||
129 | } |
||
130 | |||
131 | |||
132 | /** |
||
133 | * testGetFunctionCallParameter |
||
134 | * |
||
135 | * @group utilityFunctions |
||
136 | * |
||
137 | * @dataProvider dataGetFunctionCallParameter |
||
138 | * |
||
139 | * @param int $stackPtr Stack pointer for a T_CLASS token in the test file. |
||
140 | * @param string $expected The expected fully qualified class name. |
||
141 | */ |
||
142 | public function testGetFunctionCallParameter($stackPtr, $paramPosition, $expected) |
||
147 | |||
148 | /** |
||
149 | * dataGetFunctionCallParameter |
||
150 | * |
||
151 | * @see testGetFunctionCallParameter() |
||
152 | * |
||
153 | * @return array |
||
154 | */ |
||
155 | public function dataGetFunctionCallParameter() |
||
156 | { |
||
157 | return array( |
||
158 | array(88, 4, array( |
||
159 | 'start' => 99, |
||
160 | 'end' => 100, |
||
161 | 'raw' => '4', |
||
162 | ), |
||
163 | ), |
||
164 | array(120, 1, array( |
||
165 | 'start' => 122, |
||
166 | 'end' => 129, |
||
167 | 'raw' => 'dirname( __FILE__ )', |
||
168 | ), |
||
169 | ), |
||
170 | array(250, 1, array( |
||
171 | 'start' => 252, |
||
172 | 'end' => 252, |
||
173 | 'raw' => '$stHour', |
||
174 | ), |
||
175 | ), |
||
176 | array(250, 6, array( |
||
177 | 'start' => 272, |
||
178 | 'end' => 276, |
||
179 | 'raw' => '$arrStDt[2]', |
||
180 | ), |
||
181 | ), |
||
182 | ); |
||
183 | } |
||
184 | |||
185 | |||
186 | /** |
||
187 | * testGetFunctionCallParameterCount |
||
188 | * |
||
189 | * @group utilityFunctions |
||
190 | * |
||
191 | * @dataProvider dataGetFunctionCallParameterCount |
||
192 | * |
||
193 | * @param int $stackPtr Stack pointer for a T_CLASS token in the test file. |
||
194 | * @param string $expected The expected fully qualified class name. |
||
195 | */ |
||
196 | public function testGetFunctionCallParameterCount($stackPtr, $expected) |
||
201 | |||
202 | /** |
||
203 | * dataGetFunctionCallParameterCount |
||
204 | * |
||
205 | * @see testGetFunctionCallParameterCount() |
||
206 | * |
||
207 | * @return array |
||
208 | */ |
||
209 | public function dataGetFunctionCallParameterCount() |
||
238 | |||
239 | } |
||
240 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.