1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the mo4-coding-standard (phpcs standard) |
5
|
|
|
* |
6
|
|
|
* @author Xaver Loppenstedt <[email protected]> |
7
|
|
|
* |
8
|
|
|
* @license http://spdx.org/licenses/MIT MIT License |
9
|
|
|
* |
10
|
|
|
* @link https://github.com/mayflower/mo4-coding-standard |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
declare(strict_types=1); |
14
|
|
|
|
15
|
|
|
namespace MO4\Tests\Formatting; |
16
|
|
|
|
17
|
|
|
use MO4\Tests\AbstractMo4SniffUnitTest; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Unit test class for the UnnecessaryNamespaceUsageUnitTest sniff. |
21
|
|
|
* |
22
|
|
|
* A sniff unit test checks a .inc file for expected violations of a single |
23
|
|
|
* coding standard. Expected errors and warnings are stored in this class. |
24
|
|
|
* |
25
|
|
|
* @author Xaver Loppenstedt <[email protected]> |
26
|
|
|
* @author Marco Jantke <[email protected]> |
27
|
|
|
* @author Steffen Ritter <[email protected]> |
28
|
|
|
* |
29
|
|
|
* @copyright 2013-21 Xaver Loppenstedt, some rights reserved. |
30
|
|
|
* |
31
|
|
|
* @license http://spdx.org/licenses/MIT MIT License |
32
|
|
|
* |
33
|
|
|
* @link https://github.com/mayflower/mo4-coding-standard |
34
|
|
|
*/ |
35
|
|
|
class UnnecessaryNamespaceUsageUnitTest extends AbstractMo4SniffUnitTest |
36
|
|
|
{ |
37
|
|
|
protected $expectedWarningList = [ |
38
|
|
|
'UnnecessaryNamespaceUsageUnitTest.pass.1.inc' => [], |
39
|
|
|
'UnnecessaryNamespaceUsageUnitTest.pass.2.inc' => [], |
40
|
|
|
'UnnecessaryNamespaceUsageUnitTest.pass.3.inc' => [], |
41
|
|
|
'UnnecessaryNamespaceUsageUnitTest.pass.4.inc' => [], |
42
|
|
|
'UnnecessaryNamespaceUsageUnitTest.pass.5.inc' => [], |
43
|
|
|
'UnnecessaryNamespaceUsageUnitTest.fail.1.inc' => [ |
44
|
|
|
17 => 1, |
45
|
|
|
19 => 1, |
46
|
|
|
24 => 1, |
47
|
|
|
25 => 1, |
48
|
|
|
26 => 2, |
49
|
|
|
28 => 1, |
50
|
|
|
30 => 2, |
51
|
|
|
32 => 1, |
52
|
|
|
33 => 1, |
53
|
|
|
40 => 1, |
54
|
|
|
44 => 1, |
55
|
|
|
45 => 1, |
56
|
|
|
46 => 1, |
57
|
|
|
52 => 1, |
58
|
|
|
56 => 1, |
59
|
|
|
], |
60
|
|
|
'UnnecessaryNamespaceUsageUnitTest.fail.2.inc' => [ |
61
|
|
|
10 => 1, |
62
|
|
|
11 => 1, |
63
|
|
|
], |
64
|
|
|
'UnnecessaryNamespaceUsageUnitTest.fail.3.inc' => [ |
65
|
|
|
15 => 1, |
66
|
|
|
16 => 1, |
67
|
|
|
17 => 1, |
68
|
|
|
18 => 1, |
69
|
|
|
22 => 1, |
70
|
|
|
23 => 1, |
71
|
|
|
25 => 3, |
72
|
|
|
], |
73
|
|
|
'UnnecessaryNamespaceUsageUnitTest.fail.4.inc' => [], |
74
|
|
|
]; |
75
|
|
|
} |
76
|
|
|
|