48
48
49
49
require_once dirname (__FILE__ ) . '/ASTNodeTest.php ' ;
50
50
51
- require_once 'PHP/Depend/Code/ASTMethodPostfix.php ' ;
52
- require_once 'PHP/Depend/ConstantsI.php ' ;
53
-
54
51
/**
55
52
* Test case for the {@link PHP_Depend_Code_ASTMethodPostfix} class.
56
53
*
65
62
*/
66
63
class PHP_Depend_Code_ASTMethodPostfixTest extends PHP_Depend_Code_ASTNodeTest
67
64
{
65
+ /**
66
+ * testObjectMethodPostfixHasExpectedStartLine
67
+ *
68
+ * @return void
69
+ * @covers PHP_Depend_Parser
70
+ * @covers PHP_Depend_Builder_Default
71
+ * @covers PHP_Depend_Code_ASTMethodPostfix
72
+ * @group pdepend
73
+ * @group pdepend::ast
74
+ * @group unittest
75
+ */
76
+ public function testObjectMethodPostfixHasExpectedStartLine ()
77
+ {
78
+ $ postfix = $ this ->_getFirstMethodPostfixInFunction ();
79
+ self ::assertEquals (6 , $ postfix ->getStartLine ());
80
+ }
81
+
82
+ /**
83
+ * testObjectMethodPostfixHasExpectedStartColumn
84
+ *
85
+ * @return void
86
+ * @covers PHP_Depend_Parser
87
+ * @covers PHP_Depend_Builder_Default
88
+ * @covers PHP_Depend_Code_ASTMethodPostfix
89
+ * @group pdepend
90
+ * @group pdepend::ast
91
+ * @group unittest
92
+ */
93
+ public function testObjectMethodPostfixHasExpectedStartColumn ()
94
+ {
95
+ $ postfix = $ this ->_getFirstMethodPostfixInFunction ();
96
+ self ::assertEquals (13 , $ postfix ->getStartColumn ());
97
+ }
98
+
99
+ /**
100
+ * testObjectMethodPostfixHasExpectedEndLine
101
+ *
102
+ * @return void
103
+ * @covers PHP_Depend_Parser
104
+ * @covers PHP_Depend_Builder_Default
105
+ * @covers PHP_Depend_Code_ASTMethodPostfix
106
+ * @group pdepend
107
+ * @group pdepend::ast
108
+ * @group unittest
109
+ */
110
+ public function testObjectMethodPostfixHasExpectedEndLine ()
111
+ {
112
+ $ postfix = $ this ->_getFirstMethodPostfixInFunction ();
113
+ self ::assertEquals (7 , $ postfix ->getEndLine ());
114
+ }
115
+
116
+ /**
117
+ * testObjectMethodPostfixHasExpectedEndColumn
118
+ *
119
+ * @return void
120
+ * @covers PHP_Depend_Parser
121
+ * @covers PHP_Depend_Builder_Default
122
+ * @covers PHP_Depend_Code_ASTMethodPostfix
123
+ * @group pdepend
124
+ * @group pdepend::ast
125
+ * @group unittest
126
+ */
127
+ public function testObjectMethodPostfixHasExpectedEndColumn ()
128
+ {
129
+ $ postfix = $ this ->_getFirstMethodPostfixInFunction ();
130
+ self ::assertEquals (17 , $ postfix ->getEndColumn ());
131
+ }
132
+
133
+ /**
134
+ * testClassMethodPostfixHasExpectedStartLine
135
+ *
136
+ * @return void
137
+ * @covers PHP_Depend_Parser
138
+ * @covers PHP_Depend_Builder_Default
139
+ * @covers PHP_Depend_Code_ASTMethodPostfix
140
+ * @group pdepend
141
+ * @group pdepend::ast
142
+ * @group unittest
143
+ */
144
+ public function testClassMethodPostfixHasExpectedStartLine ()
145
+ {
146
+ $ postfix = $ this ->_getFirstMethodPostfixInFunction ();
147
+ self ::assertEquals (6 , $ postfix ->getStartLine ());
148
+ }
149
+
150
+ /**
151
+ * testClassMethodPostfixHasExpectedStartColumn
152
+ *
153
+ * @return void
154
+ * @covers PHP_Depend_Parser
155
+ * @covers PHP_Depend_Builder_Default
156
+ * @covers PHP_Depend_Code_ASTMethodPostfix
157
+ * @group pdepend
158
+ * @group pdepend::ast
159
+ * @group unittest
160
+ */
161
+ public function testClassMethodPostfixHasExpectedStartColumn ()
162
+ {
163
+ $ postfix = $ this ->_getFirstMethodPostfixInFunction ();
164
+ self ::assertEquals (13 , $ postfix ->getStartColumn ());
165
+ }
166
+
167
+ /**
168
+ * testClassMethodPostfixHasExpectedEndLine
169
+ *
170
+ * @return void
171
+ * @covers PHP_Depend_Parser
172
+ * @covers PHP_Depend_Builder_Default
173
+ * @covers PHP_Depend_Code_ASTMethodPostfix
174
+ * @group pdepend
175
+ * @group pdepend::ast
176
+ * @group unittest
177
+ */
178
+ public function testClassMethodPostfixHasExpectedEndLine ()
179
+ {
180
+ $ postfix = $ this ->_getFirstMethodPostfixInFunction ();
181
+ self ::assertEquals (7 , $ postfix ->getEndLine ());
182
+ }
183
+
184
+ /**
185
+ * testClassMethodPostfixHasExpectedEndColumn
186
+ *
187
+ * @return void
188
+ * @covers PHP_Depend_Parser
189
+ * @covers PHP_Depend_Builder_Default
190
+ * @covers PHP_Depend_Code_ASTMethodPostfix
191
+ * @group pdepend
192
+ * @group pdepend::ast
193
+ * @group unittest
194
+ */
195
+ public function testClassMethodPostfixHasExpectedEndColumn ()
196
+ {
197
+ $ postfix = $ this ->_getFirstMethodPostfixInFunction ();
198
+ self ::assertEquals (17 , $ postfix ->getEndColumn ());
199
+ }
200
+
68
201
/**
69
202
* testAcceptInvokesVisitOnGivenVisitor
70
203
*
@@ -129,7 +262,7 @@ public function testMethodPostfixStructureForSimpleInvocation()
129
262
PHP_Depend_Code_ASTArguments::CLAZZ
130
263
);
131
264
132
- $ this -> assertGraphEquals ($ prefix , $ expected );
265
+ self :: assertGraphEquals ($ prefix , $ expected );
133
266
}
134
267
135
268
/**
@@ -153,7 +286,7 @@ public function testMethodPostfixStructureForVariableInvocation()
153
286
PHP_Depend_Code_ASTArguments::CLAZZ
154
287
);
155
288
156
- $ this -> assertGraphEquals ($ prefix , $ expected );
289
+ self :: assertGraphEquals ($ prefix , $ expected );
157
290
}
158
291
159
292
/**
@@ -178,7 +311,7 @@ public function testMethodPostfixStructureForVariableVariableInvocation()
178
311
PHP_Depend_Code_ASTArguments::CLAZZ
179
312
);
180
313
181
- $ this -> assertGraphEquals ($ prefix , $ expected );
314
+ self :: assertGraphEquals ($ prefix , $ expected );
182
315
}
183
316
184
317
/**
@@ -203,7 +336,7 @@ public function testMethodPostfixStructureForCompoundVariableInvocation()
203
336
PHP_Depend_Code_ASTArguments::CLAZZ
204
337
);
205
338
206
- $ this -> assertGraphEquals ($ prefix , $ expected );
339
+ self :: assertGraphEquals ($ prefix , $ expected );
207
340
}
208
341
209
342
/**
@@ -227,7 +360,7 @@ public function testMethodPostfixStructureForSimpleStaticInvocation()
227
360
PHP_Depend_Code_ASTArguments::CLAZZ
228
361
);
229
362
230
- $ this -> assertGraphEquals ($ prefix , $ expected );
363
+ self :: assertGraphEquals ($ prefix , $ expected );
231
364
}
232
365
233
366
/**
@@ -251,7 +384,7 @@ public function testMethodPostfixStructureForVariableStaticInvocation()
251
384
PHP_Depend_Code_ASTArguments::CLAZZ
252
385
);
253
386
254
- $ this -> assertGraphEquals ($ prefix , $ expected );
387
+ self :: assertGraphEquals ($ prefix , $ expected );
255
388
}
256
389
257
390
/**
@@ -276,7 +409,7 @@ public function testMethodPostfixStructureForVariableVariableStaticInvocation()
276
409
PHP_Depend_Code_ASTArguments::CLAZZ
277
410
);
278
411
279
- $ this -> assertGraphEquals ($ prefix , $ expected );
412
+ self :: assertGraphEquals ($ prefix , $ expected );
280
413
}
281
414
282
415
/**
@@ -301,7 +434,7 @@ public function testMethodPostfixStructureForCompoundVariableStaticInvocation()
301
434
PHP_Depend_Code_ASTArguments::CLAZZ ,
302
435
);
303
436
304
- $ this -> assertGraphEquals ($ prefix , $ expected );
437
+ self :: assertGraphEquals ($ prefix , $ expected );
305
438
}
306
439
307
440
/**
@@ -328,7 +461,7 @@ public function testMethodPostfixStructureForVariableCompoundVariableStaticInvoc
328
461
PHP_Depend_Code_ASTArguments::CLAZZ ,
329
462
);
330
463
331
- $ this -> assertGraphEquals ($ prefix , $ expected );
464
+ self :: assertGraphEquals ($ prefix , $ expected );
332
465
}
333
466
334
467
/**
@@ -356,7 +489,7 @@ public function testMethodPostfixStructureForStaticInvocationWithConsecutiveInvo
356
489
PHP_Depend_Code_ASTArguments::CLAZZ
357
490
);
358
491
359
- $ this -> assertGraphEquals ($ prefix , $ expected );
492
+ self :: assertGraphEquals ($ prefix , $ expected );
360
493
}
361
494
362
495
/**
@@ -380,7 +513,7 @@ public function testMethodPostfixStructureForStaticInvocationOnVariable()
380
513
PHP_Depend_Code_ASTArguments::CLAZZ
381
514
);
382
515
383
- $ this -> assertGraphEquals ($ prefix , $ expected );
516
+ self :: assertGraphEquals ($ prefix , $ expected );
384
517
}
385
518
386
519
/**
@@ -404,7 +537,7 @@ public function testMethodPostfixStructureForSelfInvocation()
404
537
PHP_Depend_Code_ASTArguments::CLAZZ ,
405
538
);
406
539
407
- $ this -> assertGraphEquals ($ prefix , $ expected );
540
+ self :: assertGraphEquals ($ prefix , $ expected );
408
541
}
409
542
410
543
/**
@@ -428,7 +561,7 @@ public function testMethodPostfixStructureForParentInvocation()
428
561
PHP_Depend_Code_ASTArguments::CLAZZ ,
429
562
);
430
563
431
- $ this -> assertGraphEquals ($ prefix , $ expected );
564
+ self :: assertGraphEquals ($ prefix , $ expected );
432
565
}
433
566
434
567
/**
@@ -452,7 +585,7 @@ public function testMethodPostfixGraphForStaticReferenceInvocation()
452
585
PHP_Depend_Code_ASTArguments::CLAZZ ,
453
586
);
454
587
455
- $ this -> assertGraphEquals ($ prefix , $ expected );
588
+ self :: assertGraphEquals ($ prefix , $ expected );
456
589
}
457
590
458
591
/**
@@ -482,7 +615,7 @@ public function testMethodPostfixGraphForVariableArrayElementInvocation()
482
615
PHP_Depend_Code_ASTArguments::CLAZZ ,
483
616
);
484
617
485
- $ this -> assertGraphEquals ($ prefix , $ expected );
618
+ self :: assertGraphEquals ($ prefix , $ expected );
486
619
}
487
620
488
621
/**
@@ -512,7 +645,20 @@ public function testMethodPostfixGraphForPropertyArrayElementInvocation()
512
645
PHP_Depend_Code_ASTArguments::CLAZZ ,
513
646
);
514
647
515
- $ this ->assertGraphEquals ($ prefix , $ expected );
648
+ self ::assertGraphEquals ($ prefix , $ expected );
649
+ }
650
+
651
+ /**
652
+ * Returns a node instance for the currently executed test case.
653
+ *
654
+ * @return PHP_Depend_Code_ASTMethodPostfix
655
+ */
656
+ private function _getFirstMethodPostfixInFunction ()
657
+ {
658
+ return $ this ->getFirstNodeOfTypeInFunction (
659
+ self ::getCallingTestMethod (),
660
+ PHP_Depend_Code_ASTMethodPostfix::CLAZZ
661
+ );
516
662
}
517
663
518
664
/**
0 commit comments