Skip to content

Commit 5cb1f19

Browse files
committed
Adding unit test for VariableAnalysis sniff
In #78 there is a fatal error reported in case the sniff is processing a `compact` function's args.
1 parent 1d17e45 commit 5cb1f19

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
function foo() {
4+
$a = 'Hello';
5+
$c = compact( $a, $b );
6+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Unit test class for WordPressVIPMinimum Coding Standard.
4+
*
5+
* @package VIPCS\WordPressVIPMinimum
6+
*/
7+
8+
/**
9+
* Unit test class for the Variable Analysis sniff.
10+
*
11+
* @package VIPCS\WordPressVIPMinimum
12+
*/
13+
class WordPressVIPMinimum_Tests_Variables_VariableAnalysisUnitTest extends AbstractSniffUnitTest {
14+
15+
/**
16+
* Returns the lines where errors should occur.
17+
*
18+
* @return array <int line number> => <int number of errors>
19+
*/
20+
public function getErrorList() {
21+
return array();
22+
}
23+
24+
/**
25+
* Returns the lines where warnings should occur.
26+
*
27+
* @return array <int line number> => <int number of warnings>
28+
*/
29+
public function getWarningList() {
30+
return array(
31+
5 => 2,
32+
);
33+
34+
}
35+
36+
} // End class.

0 commit comments

Comments
 (0)