1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Unit test class for DocCommentSniff. |
4
|
|
|
* |
5
|
|
|
* PHP version 5 |
6
|
|
|
* |
7
|
|
|
* @category PHP |
8
|
|
|
* @package PHP_CodeSniffer |
9
|
|
|
* @author Greg Sherwood <[email protected]> |
10
|
|
|
* @author Alexander Obuhovich <[email protected]> |
11
|
|
|
* @license https://github.com/aik099/CodingStandard/blob/master/LICENSE BSD 3-Clause |
12
|
|
|
* @link https://github.com/aik099/CodingStandard |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace CodingStandard\Tests\Commenting; |
16
|
|
|
|
17
|
|
|
use TestSuite\AbstractSniffUnitTest; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Unit test class for DocCommentSniff. |
21
|
|
|
* |
22
|
|
|
* @category PHP |
23
|
|
|
* @package PHP_CodeSniffer |
24
|
|
|
* @author Greg Sherwood <[email protected]> |
25
|
|
|
* @author Alexander Obuhovich <[email protected]> |
26
|
|
|
* @license https://github.com/aik099/CodingStandard/blob/master/LICENSE BSD 3-Clause |
27
|
|
|
* @link https://github.com/aik099/CodingStandard |
28
|
|
|
*/ |
29
|
|
|
class DocCommentUnitTest extends AbstractSniffUnitTest |
30
|
|
|
{ |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Returns the lines where errors should occur. |
35
|
|
|
* |
36
|
|
|
* The key of the array should represent the line number and the value |
37
|
|
|
* should represent the number of errors that should occur on that line. |
38
|
|
|
* |
39
|
|
|
* @param string $testFile Name of the file with test data. |
40
|
|
|
* |
41
|
|
|
* @return array(int => int) |
42
|
|
|
*/ |
43
|
|
|
public function getErrorList($testFile) |
44
|
|
|
{ |
45
|
|
|
$ret = array( |
46
|
|
|
16 => 1, |
47
|
|
|
18 => 1, |
48
|
|
|
23 => 1, |
49
|
|
|
26 => 1, |
50
|
|
|
30 => 1, |
51
|
|
|
32 => 1, |
52
|
|
|
38 => 2, |
53
|
|
|
40 => 1, |
54
|
|
|
41 => 1, |
55
|
|
|
51 => 1, |
56
|
|
|
54 => 1, |
57
|
|
|
58 => 1, |
58
|
|
|
60 => 2, |
59
|
|
|
67 => 1, |
60
|
|
|
69 => 2, |
61
|
|
|
80 => 1, |
62
|
|
|
81 => 2, |
63
|
|
|
88 => 1, |
64
|
|
|
91 => 1, |
65
|
|
|
95 => 1, |
66
|
|
|
156 => 1, |
67
|
|
|
158 => 1, |
68
|
|
|
); |
69
|
|
|
|
70
|
|
|
if ($testFile === 'DocCommentUnitTest.inc') { |
71
|
|
|
$ret[176] = 3; |
72
|
|
|
|
73
|
|
|
// Compensate for https://github.com/squizlabs/PHP_CodeSniffer/issues/1169 fix. |
74
|
|
|
$ret[176] += 1; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
// Compensate for https://github.com/squizlabs/PHP_CodeSniffer/issues/1169 fix. |
78
|
|
|
$ret[14] = 1; |
79
|
|
|
|
80
|
|
|
return $ret; |
81
|
|
|
}//end getErrorList() |
82
|
|
|
|
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Returns the lines where warnings should occur. |
86
|
|
|
* |
87
|
|
|
* The key of the array should represent the line number and the value |
88
|
|
|
* should represent the number of warnings that should occur on that line. |
89
|
|
|
* |
90
|
|
|
* @param string $testFile Name of the file with test data. |
91
|
|
|
* |
92
|
|
|
* @return array(int => int) |
93
|
|
|
*/ |
94
|
|
|
public function getWarningList($testFile) |
95
|
|
|
{ |
96
|
|
|
return array(); |
97
|
|
|
}//end getWarningList() |
98
|
|
|
}//end class |
99
|
|
|
|