Skip to content

Commit

Permalink
DX: cleanup PhpUnitStrictFixerTest (#7938)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed Apr 11, 2024
1 parent 75168ee commit f3aa277
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
2 changes: 1 addition & 1 deletion phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ parameters:
-
message: '#^Method PhpCsFixer\\Tests\\.+::provide.+Cases\(\) return type has no value type specified in iterable type iterable\.$#'
path: tests
count: 1020
count: 1019
tipsOfTheDay: false
tmpDir: dev-tools/phpstan/cache
17 changes: 2 additions & 15 deletions tests/Fixer/PhpUnit/PhpUnitStrictFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,8 @@ public static function provideFixCases(): iterable
self::generateTest("self::{$methodBefore}(1, \$a, '', );"),
];
}
}

/**
* Only method calls with 2 or 3 arguments should be fixed.
*
* @dataProvider provideNoFixWithWrongNumberOfArgumentsCases
*/
public function testNoFixWithWrongNumberOfArguments(string $expected): void
{
$this->fixer->configure(['assertions' => array_keys(self::getMethodsMap())]);
$this->doTest($expected);
}

public static function provideNoFixWithWrongNumberOfArgumentsCases(): iterable
{
// Only method calls with 2 or 3 arguments should be fixed.
foreach (self::getMethodsMap() as $candidate => $fix) {
yield sprintf('do not change call to "%s" without arguments.', $candidate) => [
self::generateTest(sprintf('$this->%s();', $candidate)),
Expand All @@ -138,7 +125,7 @@ public static function provideNoFixWithWrongNumberOfArgumentsCases(): iterable
}
}

public function testInvalidConfig(): void
public function testInvalidConfiguration(): void
{
$this->expectException(InvalidFixerConfigurationException::class);
$this->expectExceptionMessageMatches('/^\[php_unit_strict\] Invalid configuration: The option "assertions" .*\.$/');
Expand Down
2 changes: 0 additions & 2 deletions tests/Test/AbstractFixerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
use PhpCsFixer\Tests\Fixer\PhpUnit\PhpUnitConstructFixerTest;
use PhpCsFixer\Tests\Fixer\PhpUnit\PhpUnitDedicateAssertFixerTest;
use PhpCsFixer\Tests\Fixer\PhpUnit\PhpUnitMethodCasingFixerTest;
use PhpCsFixer\Tests\Fixer\PhpUnit\PhpUnitStrictFixerTest;
use PhpCsFixer\Tests\Fixer\PhpUnit\PhpUnitTestCaseStaticMethodCallsFixerTest;
use PhpCsFixer\Tests\Fixer\ReturnNotation\ReturnAssignmentFixerTest;
use PhpCsFixer\Tests\Fixer\Semicolon\MultilineWhitespaceBeforeSemicolonsFixerTest;
Expand Down Expand Up @@ -503,7 +502,6 @@ final public function testProperMethodNaming(): void
PhpUnitConstructFixerTest::class,
PhpUnitDedicateAssertFixerTest::class,
PhpUnitMethodCasingFixerTest::class,
PhpUnitStrictFixerTest::class,
PhpUnitTestCaseStaticMethodCallsFixerTest::class,
ReturnAssignmentFixerTest::class,
ReturnTypeDeclarationFixerTest::class,
Expand Down

0 comments on commit f3aa277

Please sign in to comment.