Skip to content

Commit 99753e8

Browse files
committed
Add more tests
1 parent 3421e00 commit 99753e8

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/Core/Config/SniffsExcludeArgsTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,26 @@ public static function dataInvalidSniffs()
173173
],
174174
'suggestion' => 'StandardTwo.Category.Sniff',
175175
];
176+
177+
// Different cases are reported individually (in duplicate), but suggestions are reduced.
178+
$data[$argument.'; case mismatch - different errors'] = [
179+
'argument' => $argument,
180+
'value' => 'Standard.Category.Sniff.Code,sTANDARD.cATEGORY.sNIFF.cODE.eXTRA',
181+
'errors' => [
182+
'Message codes are not supported: Standard.Category.Sniff.Code',
183+
'Too many parts: sTANDARD.cATEGORY.sNIFF.cODE.eXTRA',
184+
],
185+
'suggestion' => 'Standard.Category.Sniff',
186+
];
187+
$data[$argument.'; case mismatch - same error'] = [
188+
'argument' => $argument,
189+
'value' => 'sTANDARD.cATEGORY.sNIFF.cODE,Standard.Category.Sniff.Code',
190+
'errors' => [
191+
'Message codes are not supported: sTANDARD.cATEGORY.sNIFF.cODE',
192+
'Message codes are not supported: Standard.Category.Sniff.Code',
193+
],
194+
'suggestion' => 'sTANDARD.cATEGORY.sNIFF',
195+
];
176196
}//end foreach
177197

178198
return $data;
@@ -242,6 +262,18 @@ public static function dataValidSniffs()
242262
'StandardTwo.Category.Sniff',
243263
],
244264
];
265+
266+
// Duplicates are reduced silently.
267+
$data[$argument.'; one valid sniff twice'] = [
268+
'argument' => $argument,
269+
'value' => 'Standard.Category.Sniff,Standard.Category.Sniff',
270+
'result' => ['Standard.Category.Sniff'],
271+
];
272+
$data[$argument.'; one valid sniff in different cases'] = [
273+
'argument' => $argument,
274+
'value' => 'Standard.Category.Sniff, standard.category.sniff, STANDARD.CATEGORY.SNIFF',
275+
'result' => ['Standard.Category.Sniff'],
276+
];
245277
}//end foreach
246278

247279
return $data;

0 commit comments

Comments
 (0)