Skip to content

Commit ce60f4c

Browse files
committed
Tests: data set keys should match parameter names
Initially to prevent issues with a few PHPUnit versions which were around in the early days of PHP 8.0, where these would accidentally be seen as parameter names. So, as a best practice, when using keys in data sets, the keys should match the parameter names of the receiving test method. An ulterior reason to make this change is that PHPUnit 11 will always treat the keys as parameter names, so this can be seen as a preparation step for allowing for PHPUnit 11 support in PHPCS 4.0.
1 parent 6f7c596 commit ce60f4c

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

tests/Core/Config/ReportWidthTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,18 @@ public function testReportWidthInputHandlingForAuto()
244244
/**
245245
* Test that the report width will be set correctly for various types of input.
246246
*
247-
* @param mixed $input Input value received.
247+
* @param mixed $value Input value received.
248248
* @param int $expected Expected report width.
249249
*
250250
* @dataProvider dataReportWidthInputHandling
251251
* @covers \PHP_CodeSniffer\Config::__set
252252
*
253253
* @return void
254254
*/
255-
public function testReportWidthInputHandling($input, $expected)
255+
public function testReportWidthInputHandling($value, $expected)
256256
{
257257
$config = new Config();
258-
$config->reportWidth = $input;
258+
$config->reportWidth = $value;
259259

260260
$this->assertSame($expected, $config->reportWidth);
261261

tests/Core/ErrorSuppressionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -730,9 +730,9 @@ public static function dataSuppressFile()
730730
{
731731
return [
732732
'no suppression' => [
733-
'before' => '',
734-
'after' => '',
735-
'expectedErrors' => 1,
733+
'before' => '',
734+
'after' => '',
735+
'expectedWarnings' => 1,
736736
],
737737

738738
// Process with suppression.

tests/Core/File/IsReferenceTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ public function testNotBitwiseAndToken()
3636
/**
3737
* Test correctly identifying whether a "bitwise and" token is a reference or not.
3838
*
39-
* @param string $identifier Comment which precedes the test case.
39+
* @param string $testMarker Comment which precedes the test case.
4040
* @param bool $expected Expected function output.
4141
*
4242
* @dataProvider dataIsReference
4343
*
4444
* @return void
4545
*/
46-
public function testIsReference($identifier, $expected)
46+
public function testIsReference($testMarker, $expected)
4747
{
48-
$bitwiseAnd = $this->getTargetToken($identifier, T_BITWISE_AND);
48+
$bitwiseAnd = $this->getTargetToken($testMarker, T_BITWISE_AND);
4949
$result = self::$phpcsFile->isReference($bitwiseAnd);
5050
$this->assertSame($expected, $result);
5151

0 commit comments

Comments
 (0)