Skip to content

Commit

Permalink
Avoid using internal method
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed May 14, 2024
1 parent 81bea03 commit 9d964ee
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/Core/Config/SniffsExcludeArgsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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()

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 9d964ee

Please sign in to comment.