1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the mo4-coding-standard (phpcs standard) |
5
|
|
|
* |
6
|
|
|
* PHP version 5 |
7
|
|
|
* |
8
|
|
|
* @category PHP |
9
|
|
|
* @package PHP_CodeSniffer-MO4 |
10
|
|
|
* @author Xaver Loppenstedt <[email protected]> |
11
|
|
|
* @license http://spdx.org/licenses/MIT MIT License |
12
|
|
|
* @version GIT: master |
13
|
|
|
* @link https://github.com/Mayflower/mo4-coding-standard |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace MO4\Tests\Arrays; |
17
|
|
|
|
18
|
|
|
use PHP_CodeSniffer\Exceptions\RuntimeException; |
19
|
|
|
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
|
|
|
|
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Unit test class for @see MultiLineArraySniff |
23
|
|
|
* |
24
|
|
|
* A sniff unit test checks a .inc file for expected violations of a single |
25
|
|
|
* coding standard. Expected errors and warnings are stored in this class. |
26
|
|
|
* |
27
|
|
|
* @category PHP |
28
|
|
|
* @package PHP_CodeSniffer-MO4 |
29
|
|
|
* @author Xaver Loppenstedt <[email protected]> |
30
|
|
|
* @copyright 2013-2017 Xaver Loppenstedt, some rights reserved. |
31
|
|
|
* @license http://spdx.org/licenses/MIT MIT License |
32
|
|
|
* @link https://github.com/Mayflower/mo4-coding-standard |
33
|
|
|
*/ |
34
|
|
View Code Duplication |
class MultiLineArrayUnitTest extends AbstractSniffUnitTest |
|
|
|
|
35
|
|
|
{ |
36
|
|
|
|
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Returns the lines where errors should occur. |
40
|
|
|
* |
41
|
|
|
* The key of the array should represent the line number and the value |
42
|
|
|
* should represent the number of errors that should occur on that line. |
43
|
|
|
* |
44
|
|
|
* @param string $testFile test file |
45
|
|
|
* |
46
|
|
|
* @return array<int, int> |
47
|
|
|
* @throws RuntimeException |
48
|
|
|
*/ |
49
|
|
|
protected function getErrorList($testFile='') |
50
|
|
|
{ |
51
|
|
|
switch ($testFile) { |
52
|
|
|
case 'MultiLineArrayUnitTest.pass.inc': |
53
|
|
|
return array(); |
54
|
|
|
case 'MultiLineArrayUnitTest.fail.inc': |
55
|
|
|
return array( |
56
|
|
|
4 => 1, |
57
|
|
|
12 => 1, |
58
|
|
|
18 => 2, |
59
|
|
|
22 => 1, |
60
|
|
|
24 => 1, |
61
|
|
|
28 => 1, |
62
|
|
|
32 => 1, |
63
|
|
|
); |
64
|
|
|
}//end switch |
65
|
|
|
|
66
|
|
|
throw new RuntimeException("Testfile {$testFile} in ".__DIR__." is not handled by ".__CLASS__); |
67
|
|
|
|
68
|
|
|
}//end getErrorList() |
69
|
|
|
|
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Returns the lines where warnings should occur. |
73
|
|
|
* |
74
|
|
|
* The key of the array should represent the line number and the value |
75
|
|
|
* should represent the number of warnings that should occur on that line. |
76
|
|
|
* |
77
|
|
|
* @return array<int, int> |
78
|
|
|
*/ |
79
|
|
|
protected function getWarningList() |
80
|
|
|
{ |
81
|
|
|
return array(); |
82
|
|
|
|
83
|
|
|
}//end getWarningList() |
84
|
|
|
|
85
|
|
|
|
86
|
|
|
}//end class |
87
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths