From 9d964ee104f9034cf221bd75915177b9ee009f9b Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Tue, 14 May 2024 08:50:51 +0100 Subject: [PATCH] Avoid using internal method --- tests/Core/Config/SniffsExcludeArgsTest.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/Core/Config/SniffsExcludeArgsTest.php b/tests/Core/Config/SniffsExcludeArgsTest.php index e4620ba0b0..4eedb624ea 100644 --- a/tests/Core/Config/SniffsExcludeArgsTest.php +++ b/tests/Core/Config/SniffsExcludeArgsTest.php @@ -32,7 +32,6 @@ final class SniffsExcludeArgsTest extends TestCase */ public function testInvalid($argument, $value, $message) { - $config = new ConfigDouble(); $exception = 'PHP_CodeSniffer\Exceptions\DeepExitException'; if (method_exists($this, 'expectException') === true) { @@ -44,7 +43,7 @@ public function testInvalid($argument, $value, $message) $this->setExpectedException($exception, $message); } - $config->processLongArgument($argument.'='.$value, 0); + new ConfigDouble(["--$argument=$value"]); }//end testInvalid() @@ -123,8 +122,7 @@ public static function dataInvalidSniffs() */ public function testValid($argument, $value) { - $config = new ConfigDouble(); - $config->processLongArgument($argument.'='.$value, 0); + $config = new ConfigDouble(["--$argument=$value"]); $this->assertSame(explode(',', $value), $config->$argument); @@ -171,11 +169,13 @@ public static function dataValidSniffs() */ public function testOnlySetOnce($argument) { - $position = 0; - $config = new ConfigDouble(); - $config->processLongArgument($argument.'=StandardOne.Category.Sniff', $position++); - $config->processLongArgument($argument.'=StandardTwo.Category.Sniff', $position++); - $config->processLongArgument($argument.'=Standard.AnotherCategory.Sniff', $position++); + $config = new ConfigDouble( + [ + "--$argument=StandardOne.Category.Sniff", + "--$argument=StandardTwo.Category.Sniff", + "--$argument=Standard.AnotherCategory.Sniff", + ] + ); $this->assertSame(['StandardOne.Category.Sniff'], $config->$argument);