Skip to content

Commit

Permalink
Tests: make dataproviders static
Browse files Browse the repository at this point in the history
As of PHPUnit 10, data providers are (again) expected to be `static` methods.

This updates the test suite to respect that.

Includes removing the use of `$this` from select data providers.

Refs:
* sebastianbergmann/phpunit@9caafe2
* sebastianbergmann/phpunit 5100
  • Loading branch information
jrfnl authored and grogy committed Apr 10, 2024
1 parent fe1ecbe commit 1142c60
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/Unit/Errors/ParallelLintErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testGetMessage($message, $expected)
*
* @return array
*/
public function dataGetMessage()
public static function dataGetMessage()
{
return array(
'Message: empty string' => array(
Expand Down Expand Up @@ -88,7 +88,7 @@ public function testGetShortFilePath($filePath, $expectedShort)
*
* @return array
*/
public function dataGetFilePath()
public static function dataGetFilePath()
{
$cwd = getcwd();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Errors/SyntaxErrorGetLineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testGetLine($message, $expected)
*
* @return array
*/
public function dataGetLine()
public static function dataGetLine()
{
return array(
'Message: empty string' => array(
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Errors/SyntaxErrorGetNormalizeMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testMessageNormalizationWithoutTokenTranslation($message, $expec
*
* @return array
*/
public function dataMessageNormalization()
public static function dataMessageNormalization()
{
return array(
'Strip leading and trailing information - fatal error' => array(
Expand Down Expand Up @@ -85,7 +85,7 @@ public function testFilePathHandling($filePath, $fileName)
*
* @return array
*/
public function dataFilePathHandling()
public static function dataFilePathHandling()
{
return array(
'Plain file name' => array(
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Errors/SyntaxErrorTranslateTokensTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testTranslateTokens($message, $expected)
*
* @return array
*/
public function dataTranslateTokens()
public static function dataTranslateTokens()
{
return array(
'No token name in message' => array(
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Outputs/OutputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testCheckstyleOutput()
$this->assertInstanceOf('SimpleXMLElement', $parsed);
}

public function getGitLabOutputData()
public static function getGitLabOutputData()
{
return array(
array(
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/SettingsAddPathsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testAddPaths($original, $extra, $expected)
*
* @return array
*/
public function dataAddPaths()
public static function dataAddPaths()
{
return array(
'No paths passed on CLI, no extra paths' => array(
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/SettingsParseArgumentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testParseArgumentsInvalidArgument($command, $unsupported)
*
* @return array
*/
public function dataParseArgumentsInvalidArgument()
public static function dataParseArgumentsInvalidArgument()
{
return array(
'Unsupported short argument' => array(
Expand Down Expand Up @@ -79,7 +79,7 @@ public function testParseArguments($command, array $expectedChanged)
*
* @return array
*/
public function dataParseArguments()
public static function dataParseArguments()
{
return array(
'No arguments at all' => array(
Expand Down

0 comments on commit 1142c60

Please sign in to comment.