Commit 0e289be
committed
Files/FileList: fix tests to stop interfering with external standards tests
The AddFileTest.php tests introduced an issue that broke the ability to
run sniff tests for external standards using the PHPCS native test
framework.
This problem was happening because `self::initializeConfigAndRuleset()`
was called in a data provider method in `AddFileTest.php`. This means
that the `Config` instance created inside `initializeConfigAndRuleset()`
using `ConfigDouble` was created before `AllSniffs::suite()` had a
chance to get the installed standards from the `CodeSniffer.conf`
configuration file. When `AllSniffs::suite()` runs, `ConfigDouble`
already overrode the `configData` and `configDataFile` properties, and
`CodeSniffer.conf` is never read, and the tests for external standards
were not included.
To fix this problem, I opted to change the test to create an instance of
the `File` class (which requires an instance of the `Config` class) in
the test itself instead of doing that in the data provider.1 parent a12ddb0 commit 0e289be
1 file changed
+13
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
| 50 | + | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
| |||
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
68 | | - | |
| 74 | + | |
69 | 75 | | |
70 | 76 | | |
71 | 77 | | |
| |||
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
84 | | - | |
| 90 | + | |
85 | 91 | | |
86 | 92 | | |
87 | 93 | | |
88 | | - | |
89 | | - | |
90 | 94 | | |
91 | 95 | | |
92 | 96 | | |
| |||
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
98 | | - | |
99 | | - | |
| 102 | + | |
| 103 | + | |
100 | 104 | | |
101 | 105 | | |
102 | 106 | | |
| |||
0 commit comments