Skip to content

Commit

Permalink
DX: remove PhpUnitNamespacedFixerTest::testClassIsFixed (PHP-CS-Fix…
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos authored and danog committed Feb 2, 2024
1 parent f49915f commit 469adbc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
2 changes: 1 addition & 1 deletion phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ parameters:
-
message: '#^Method PhpCsFixer\\Tests\\.+::provide.+Cases\(\) return type has no value type specified in iterable type iterable\.$#'
path: tests
count: 1096
count: 1095

-
message: '#Call to static method .+ with .+ will always evaluate to true.$#'
Expand Down
28 changes: 0 additions & 28 deletions tests/Fixer/PhpUnit/PhpUnitNamespacedFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use PhpCsFixer\Fixer\PhpUnit\PhpUnitTargetVersion;
use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
use PhpCsFixer\Tokenizer\Tokens;

/**
* @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
Expand Down Expand Up @@ -281,33 +280,6 @@ final class MyTest extends TestCase
];
}

/**
* @dataProvider provideClassIsFixedCases
*/
public function testClassIsFixed(string $class): void
{
$this->fixer->configure(['target' => PhpUnitTargetVersion::VERSION_NEWEST]);

Tokens::clearCache();
$tokens = Tokens::fromCode(sprintf('<?php new %s();', $class));

$this->fixer->fix(new \SplFileInfo(__FILE__), $tokens);

self::assertTrue($tokens->isChanged());
self::assertStringNotContainsString('_', $tokens->generateCode());
}

public static function provideClassIsFixedCases(): iterable
{
$classmap = require __DIR__.'/../../../vendor/composer/autoload_classmap.php';

foreach ($classmap as $class => $file) {
if (str_starts_with($class, 'PHPUnit_')) {
yield $file => [$class];
}
}
}

/**
* @dataProvider provideFix81Cases
*
Expand Down

0 comments on commit 469adbc

Please sign in to comment.