Skip to content

Commit 5b21e72

Browse files
committed
ProcessRulesetCliArgsTest: add tests for cache arg
Follow up on 1005 Was previously blocked by the `Config` class not allowing for the `cache` setting to be changed from within the tests, which was fixed via 1068. Also see 966
1 parent 3d54d4c commit 5b21e72

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/.phpcs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
<!-- Issue squizlabs/PHP_CodeSniffer#2395: allow overruling CLI args when they have different CLI flag names. -->
1010
<arg name="no-colors"/>
11+
<arg name="cache" value="./config/phpcs/.cache.phpcs"/>
1112

1213
<!-- Miscellaneous other settings. -->
1314
<arg name="report" value="full,summary,source"/>

tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/config/phpcs/.cache.phpcs

Whitespace-only changes.

tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/phpcs.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
<arg name="extensions" value="inc,php"/>
2323
<arg name="tab-width" value="4"/>
2424

25+
<!-- Issue squizlabs/PHP_CodeSniffer#2395: second test. -->
26+
<arg name="no-cache"/>
27+
2528
<!-- Miscellaneous other settings. -->
2629
<arg name="report-width" value="120"/>
2730

tests/Core/Ruleset/ProcessRulesetCliArgsTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ public static function dataCliArgs()
108108
'name' => 'warningSeverity',
109109
'expected' => 5,
110110
],
111+
'Issue squiz#2395: "cache" set to file in parent before includes; "no-cache" set in child; parent should win [1]' => [
112+
'name' => 'cache',
113+
'expected' => true,
114+
],
115+
'Issue squiz#2395: "cache" set to file in parent before includes; "no-cache" set in child; parent should win [2]' => [
116+
'name' => 'cacheFile',
117+
'expected' => self::FIXTURE_DIR.'/config/cache.phpcs',
118+
],
111119
'Issue squiz#2395: "q" in child A before includes; "p" set in grandchild A, child A should win' => [
112120
'name' => 'showProgress',
113121
'expected' => false,

0 commit comments

Comments
 (0)