1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* CodingStandard_Tests_Files_OneTraitPerFileUnitTest. |
4
|
|
|
* |
5
|
|
|
* PHP version 5 |
6
|
|
|
* |
7
|
|
|
* @category PHP |
8
|
|
|
* @package PHP_CodeSniffer |
9
|
|
|
* @author Alexander Obuhovich <[email protected]> |
10
|
|
|
* @license https://github.com/aik099/CodingStandard/blob/master/LICENSE BSD 3-Clause |
11
|
|
|
* @link https://github.com/aik099/CodingStandard |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace CodingStandard\Tests\Files; |
15
|
|
|
|
16
|
|
|
use TestSuite\AbstractSniffUnitTest; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Unit test class for the OneTraitPerFile sniff. |
20
|
|
|
* |
21
|
|
|
* @category PHP |
22
|
|
|
* @package PHP_CodeSniffer |
23
|
|
|
* @author Alexander Obuhovich <[email protected]> |
24
|
|
|
* @license https://github.com/aik099/CodingStandard/blob/master/LICENSE BSD 3-Clause |
25
|
|
|
* @link https://github.com/aik099/CodingStandard |
26
|
|
|
*/ |
27
|
|
|
class OneTraitPerFileUnitTest extends AbstractSniffUnitTest |
28
|
|
|
{ |
29
|
|
|
|
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Should this test be skipped for some reason. |
33
|
|
|
* |
34
|
|
|
* @return bool |
35
|
|
|
*/ |
36
|
|
|
protected function shouldSkipTest() |
37
|
|
|
{ |
38
|
|
|
return PHP_VERSION_ID < 50400; |
39
|
|
|
}//end shouldSkipTest() |
40
|
|
|
|
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Returns the lines where errors should occur. |
44
|
|
|
* |
45
|
|
|
* The key of the array should represent the line number and the value |
46
|
|
|
* should represent the number of errors that should occur on that line. |
47
|
|
|
* |
48
|
|
|
* @param string $testFile Name of the file with test data. |
49
|
|
|
* |
50
|
|
|
* @return array(int => int) |
51
|
|
|
*/ |
52
|
|
|
public function getErrorList($testFile) |
53
|
|
|
{ |
54
|
|
|
return array( |
55
|
|
|
6 => 1, |
56
|
|
|
10 => 1, |
57
|
|
|
); |
58
|
|
|
}//end getErrorList() |
59
|
|
|
|
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Returns the lines where warnings should occur. |
63
|
|
|
* |
64
|
|
|
* The key of the array should represent the line number and the value |
65
|
|
|
* should represent the number of warnings that should occur on that line. |
66
|
|
|
* |
67
|
|
|
* @param string $testFile Name of the file with test data. |
68
|
|
|
* |
69
|
|
|
* @return array(int => int) |
70
|
|
|
*/ |
71
|
|
|
public function getWarningList($testFile) |
72
|
|
|
{ |
73
|
|
|
return array(); |
74
|
|
|
}//end getWarningList() |
75
|
|
|
}//end class |
76
|
|
|
|