File tree Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 10
10
11
11
namespace PHPCSDebug \Tests \Debug ;
12
12
13
+ use PHP_CodeSniffer \Util \Common ;
13
14
use PHPCSUtils \TestUtils \UtilityMethodTestCase ;
14
15
15
16
/**
@@ -115,6 +116,17 @@ public function testOutput()
115
116
$ this ->expectOutputString ($ expected );
116
117
$ this ->setOutputCallback ([$ this , 'normalizeLineEndings ' ]);
117
118
119
+ if (empty ($ this ->ruleset ->tokenListeners )) {
120
+ // PHPCSUtils 1.0.9+.
121
+ $ sniffFile = \dirname (\dirname (__DIR__ )) . \DIRECTORY_SEPARATOR . 'Sniffs ' ;
122
+ $ sniffFile .= \DIRECTORY_SEPARATOR . 'Debug ' . \DIRECTORY_SEPARATOR . 'TokenListSniff.php ' ;
123
+ $ sniffClassName = Common::cleanSniffClass ('PHPCSDebug \\Sniffs \\Debug \\TokenListSniff ' );
124
+
125
+ $ restrictions = [\strtolower ($ sniffClassName ) => true ];
126
+ self ::$ phpcsFile ->ruleset ->registerSniffs ([$ sniffFile ], $ restrictions , []);
127
+ self ::$ phpcsFile ->ruleset ->populateTokenListeners ();
128
+ }
129
+
118
130
self ::$ phpcsFile ->process ();
119
131
}
120
132
Original file line number Diff line number Diff line change 10
10
11
11
namespace PHPCSDebug \Tests \Debug ;
12
12
13
+ use PHP_CodeSniffer \Util \Common ;
13
14
use PHPCSUtils \TestUtils \UtilityMethodTestCase ;
14
15
15
16
/**
@@ -135,6 +136,17 @@ public function testOutput()
135
136
$ this ->expectOutputString ($ expected );
136
137
$ this ->setOutputCallback ([$ this , 'normalizeLineEndings ' ]);
137
138
139
+ if (empty ($ this ->ruleset ->tokenListeners )) {
140
+ // PHPCSUtils 1.0.9+.
141
+ $ sniffFile = \dirname (\dirname (__DIR__ )) . \DIRECTORY_SEPARATOR . 'Sniffs ' ;
142
+ $ sniffFile .= \DIRECTORY_SEPARATOR . 'Debug ' . \DIRECTORY_SEPARATOR . 'TokenListSniff.php ' ;
143
+ $ sniffClassName = Common::cleanSniffClass ('PHPCSDebug \\Sniffs \\Debug \\TokenListSniff ' );
144
+
145
+ $ restrictions = [\strtolower ($ sniffClassName ) => true ];
146
+ self ::$ phpcsFile ->ruleset ->registerSniffs ([$ sniffFile ], $ restrictions , []);
147
+ self ::$ phpcsFile ->ruleset ->populateTokenListeners ();
148
+ }
149
+
138
150
self ::$ phpcsFile ->process ();
139
151
}
140
152
Original file line number Diff line number Diff line change 10
10
11
11
namespace PHPCSDebug \Tests \Debug ;
12
12
13
+ use PHP_CodeSniffer \Util \Common ;
13
14
use PHPCSUtils \TestUtils \UtilityMethodTestCase ;
14
15
15
16
/**
@@ -108,6 +109,17 @@ public function testOutput()
108
109
$ this ->expectOutputString ($ expected );
109
110
$ this ->setOutputCallback ([$ this , 'normalizeLineEndings ' ]);
110
111
112
+ if (empty ($ this ->ruleset ->tokenListeners )) {
113
+ // PHPCSUtils 1.0.9+.
114
+ $ sniffFile = \dirname (\dirname (__DIR__ )) . \DIRECTORY_SEPARATOR . 'Sniffs ' ;
115
+ $ sniffFile .= \DIRECTORY_SEPARATOR . 'Debug ' . \DIRECTORY_SEPARATOR . 'TokenListSniff.php ' ;
116
+ $ sniffClassName = Common::cleanSniffClass ('PHPCSDebug \\Sniffs \\Debug \\TokenListSniff ' );
117
+
118
+ $ restrictions = [\strtolower ($ sniffClassName ) => true ];
119
+ self ::$ phpcsFile ->ruleset ->registerSniffs ([$ sniffFile ], $ restrictions , []);
120
+ self ::$ phpcsFile ->ruleset ->populateTokenListeners ();
121
+ }
122
+
111
123
self ::$ phpcsFile ->process ();
112
124
}
113
125
Original file line number Diff line number Diff line change 73
73
die (1 );
74
74
}
75
75
76
+ $ installedStandards = \PHP_CodeSniffer \Util \Standards::getInstalledStandardDetails ();
77
+ foreach ($ installedStandards as $ details ) {
78
+ \PHP_CodeSniffer \Autoload::addSearchPath ($ details ['path ' ], $ details ['namespace ' ]);
79
+ }
80
+
76
81
// Try and load the PHPCSUtils autoloader.
77
82
if ($ phpcsUtilsDir !== false && \file_exists ($ phpcsUtilsDir . $ ds . 'phpcsutils-autoload.php ' )) {
78
83
require_once $ phpcsUtilsDir . $ ds . 'phpcsutils-autoload.php ' ;
You can’t perform that action at this time.
0 commit comments