From df3a30715349fcb2d204489ee9551e122972c468 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 13 Apr 2025 23:54:02 +0200 Subject: [PATCH] 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 --- .../Ruleset/Fixtures/ProcessRulesetCliArgsTest/.phpcs.xml | 1 + .../ProcessRulesetCliArgsTest/config/phpcs/.cache.phpcs | 0 .../Fixtures/ProcessRulesetCliArgsTest/phpcs.xml.dist | 3 +++ tests/Core/Ruleset/ProcessRulesetCliArgsTest.php | 8 ++++++++ 4 files changed, 12 insertions(+) create mode 100644 tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/config/phpcs/.cache.phpcs diff --git a/tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/.phpcs.xml b/tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/.phpcs.xml index 3e2f6e1066..bf62ca4983 100644 --- a/tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/.phpcs.xml +++ b/tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/.phpcs.xml @@ -8,6 +8,7 @@ + diff --git a/tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/config/phpcs/.cache.phpcs b/tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/config/phpcs/.cache.phpcs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/phpcs.xml.dist b/tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/phpcs.xml.dist index 0a6b7e76b2..4fd134c454 100644 --- a/tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/phpcs.xml.dist +++ b/tests/Core/Ruleset/Fixtures/ProcessRulesetCliArgsTest/phpcs.xml.dist @@ -22,6 +22,9 @@ + + + diff --git a/tests/Core/Ruleset/ProcessRulesetCliArgsTest.php b/tests/Core/Ruleset/ProcessRulesetCliArgsTest.php index 0231c5d84a..a2a14e5ef0 100644 --- a/tests/Core/Ruleset/ProcessRulesetCliArgsTest.php +++ b/tests/Core/Ruleset/ProcessRulesetCliArgsTest.php @@ -108,6 +108,10 @@ public static function dataCliArgs() 'name' => 'warningSeverity', 'expected' => 5, ], + 'Issue squiz#2395: "cache" set to file in parent before includes; "no-cache" set in child; parent should win [1]' => [ + 'name' => 'cache', + 'expected' => true, + ], 'Issue squiz#2395: "q" in child A before includes; "p" set in grandchild A, child A should win' => [ 'name' => 'showProgress', 'expected' => false, @@ -195,6 +199,10 @@ public static function dataCliArgsWithPaths() self::FIXTURE_DIR.'/vendor/OrgName/ExtStandard/bootstrap.php', ], ], + 'Paths should be resolved based on the ruleset location: cacheFile' => [ + 'name' => 'cacheFile', + 'expected' => self::FIXTURE_DIR.'/config/phpcs/.cache.phpcs', + ], ]; }//end dataCliArgsWithPaths()