Skip to content

Commit

Permalink
Add test case for setting multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed May 6, 2024
1 parent b6df259 commit b18272d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/Core/Config/SniffListValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,39 @@ public static function dataValidSniffs()
}//end dataValidSniffs()


/**
* Ensure that only the first argument is processed and others are ignored.
*
* @param string $argument 'sniffs' or 'exclude'.
*
* @return void
* @dataProvider dataOnlySetOnce
*/
public function testOnlySetOnce($argument)
{
$config = new ConfigDouble();
$config->processLongArgument($argument.'=StandardOne.Category.Sniff', 0);
$config->processLongArgument($argument.'=StandardTwo.Category.Sniff', 0);
$config->processLongArgument($argument.'=Standard.AnotherCategory.Sniff', 0);

$this->assertSame(['StandardOne.Category.Sniff'], $config->$argument);

}//end testOnlySetOnce()


/**
* Data provider for testOnlySetOnce().
*
* @return string[]
*/
public static function dataOnlySetOnce()
{
return [
'sniffs' => ['sniffs'],
'exclude' => ['exclude'],
];

}//end dataOnlySetOnce()


}//end class

0 comments on commit b18272d

Please sign in to comment.