Skip to content

Commit 061b38d

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 061b38d

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,10 @@ 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+
],
111115
'Issue squiz#2395: "q" in child A before includes; "p" set in grandchild A, child A should win' => [
112116
'name' => 'showProgress',
113117
'expected' => false,
@@ -195,6 +199,10 @@ public static function dataCliArgsWithPaths()
195199
self::FIXTURE_DIR.'/vendor/OrgName/ExtStandard/bootstrap.php',
196200
],
197201
],
202+
'Paths should be resolved based on the ruleset location: cacheFile' => [
203+
'name' => 'cacheFile',
204+
'expected' => self::FIXTURE_DIR.'/config/phpcs/.cache.phpcs',
205+
],
198206
];
199207

200208
}//end dataCliArgsWithPaths()

0 commit comments

Comments
 (0)