From ce60f4ca2fca18fa11bef244db508f4d8dc1ffd8 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 17 Feb 2024 04:05:16 +0100 Subject: [PATCH] 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. --- tests/Core/Config/ReportWidthTest.php | 6 +++--- tests/Core/ErrorSuppressionTest.php | 6 +++--- tests/Core/File/IsReferenceTest.php | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/Core/Config/ReportWidthTest.php b/tests/Core/Config/ReportWidthTest.php index 2e67fa2691..d10e7a07d9 100644 --- a/tests/Core/Config/ReportWidthTest.php +++ b/tests/Core/Config/ReportWidthTest.php @@ -244,7 +244,7 @@ public function testReportWidthInputHandlingForAuto() /** * Test that the report width will be set correctly for various types of input. * - * @param mixed $input Input value received. + * @param mixed $value Input value received. * @param int $expected Expected report width. * * @dataProvider dataReportWidthInputHandling @@ -252,10 +252,10 @@ public function testReportWidthInputHandlingForAuto() * * @return void */ - public function testReportWidthInputHandling($input, $expected) + public function testReportWidthInputHandling($value, $expected) { $config = new Config(); - $config->reportWidth = $input; + $config->reportWidth = $value; $this->assertSame($expected, $config->reportWidth); diff --git a/tests/Core/ErrorSuppressionTest.php b/tests/Core/ErrorSuppressionTest.php index 4ae1e33ba2..e8b7935cc1 100644 --- a/tests/Core/ErrorSuppressionTest.php +++ b/tests/Core/ErrorSuppressionTest.php @@ -730,9 +730,9 @@ public static function dataSuppressFile() { return [ 'no suppression' => [ - 'before' => '', - 'after' => '', - 'expectedErrors' => 1, + 'before' => '', + 'after' => '', + 'expectedWarnings' => 1, ], // Process with suppression. diff --git a/tests/Core/File/IsReferenceTest.php b/tests/Core/File/IsReferenceTest.php index bbe31baef2..62eb600333 100644 --- a/tests/Core/File/IsReferenceTest.php +++ b/tests/Core/File/IsReferenceTest.php @@ -36,16 +36,16 @@ public function testNotBitwiseAndToken() /** * Test correctly identifying whether a "bitwise and" token is a reference or not. * - * @param string $identifier Comment which precedes the test case. + * @param string $testMarker Comment which precedes the test case. * @param bool $expected Expected function output. * * @dataProvider dataIsReference * * @return void */ - public function testIsReference($identifier, $expected) + public function testIsReference($testMarker, $expected) { - $bitwiseAnd = $this->getTargetToken($identifier, T_BITWISE_AND); + $bitwiseAnd = $this->getTargetToken($testMarker, T_BITWISE_AND); $result = self::$phpcsFile->isReference($bitwiseAnd); $this->assertSame($expected, $result);