Skip to content

Commit 994bb1c

Browse files
committed
Update test: treat empty values as errors
1 parent d5f5fe0 commit 994bb1c

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

tests/Core/Config/SniffsExcludeArgsTest.php

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,32 @@ public static function dataInvalidSniffs()
8181
$messageTemplate = 'ERROR: The specified sniff code "%s" is invalid'.PHP_EOL;
8282

8383
foreach ($arguments as $argument) {
84+
// Empty values are errors.
85+
$data[$argument.'; empty string'] = [
86+
'argument' => $argument,
87+
'value' => '',
88+
'errors' => [
89+
'No codes specified / empty argument',
90+
],
91+
'suggestion' => null,
92+
];
93+
$data[$argument.'; one comma alone'] = [
94+
'argument' => $argument,
95+
'value' => ',',
96+
'errors' => [
97+
'No codes specified / empty argument',
98+
],
99+
'suggestion' => null,
100+
];
101+
$data[$argument.'; two commas alone'] = [
102+
'argument' => $argument,
103+
'value' => ',,',
104+
'errors' => [
105+
'No codes specified / empty argument',
106+
],
107+
'suggestion' => null,
108+
];
109+
84110
// A standard is not a valid sniff.
85111
$data[$argument.'; standard'] = [
86112
'argument' => $argument,
@@ -190,11 +216,6 @@ public static function dataValidSniffs()
190216
$data = [];
191217

192218
foreach ($arguments as $argument) {
193-
$data[$argument.'; empty string'] = [
194-
'argument' => $argument,
195-
'value' => '',
196-
'result' => [],
197-
];
198219
$data[$argument.'; one valid sniff'] = [
199220
'argument' => $argument,
200221
'value' => 'Standard.Category.Sniff',
@@ -210,16 +231,6 @@ public static function dataValidSniffs()
210231
];
211232

212233
// Rogue commas are quietly ignored.
213-
$data[$argument.'; one comma alone'] = [
214-
'argument' => $argument,
215-
'value' => ',',
216-
'result' => [],
217-
];
218-
$data[$argument.'; two commas alone'] = [
219-
'argument' => $argument,
220-
'value' => ',,',
221-
'result' => [],
222-
];
223234
$data[$argument.'; trailing comma'] = [
224235
'argument' => $argument,
225236
'value' => 'Standard.Category.Sniff,',

0 commit comments

Comments
 (0)