Skip to content

Commit 5c7c9f6

Browse files
authored
Add AbstractFixerTestCase::assertSuccessorName (#932)
1 parent b3a5201 commit 5c7c9f6

File tree

6 files changed

+11
-25
lines changed

6 files changed

+11
-25
lines changed

tests/Fixer/AbstractFixerTestCase.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,10 @@ final protected function assertRiskiness(bool $isRisky): void
235235
{
236236
self::assertSame($isRisky, $this->fixer->isRisky());
237237
}
238+
239+
final protected function assertSuccessorName(string $successorName): void
240+
{
241+
self::assertInstanceOf(DeprecatedFixerInterface::class, $this->fixer);
242+
self::assertSame([$successorName], $this->fixer->getSuccessorsNames());
243+
}
238244
}

tests/Fixer/DataProviderNameFixerTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@
1111

1212
namespace Tests\Fixer;
1313

14-
use PhpCsFixer\Fixer\DeprecatedFixerInterface;
15-
1614
/**
1715
* @internal
1816
*
19-
* @property DeprecatedFixerInterface $fixer
20-
*
2117
* @covers \PhpCsFixerCustomFixers\Fixer\DataProviderNameFixer
2218
*/
2319
final class DataProviderNameFixerTest extends AbstractFixerTestCase
@@ -40,7 +36,7 @@ public function testIsRisky(): void
4036

4137
public function testSuccessorName(): void
4238
{
43-
self::assertContains('php_unit_data_provider_name', $this->fixer->getSuccessorsNames());
39+
self::assertSuccessorName('php_unit_data_provider_name');
4440
}
4541

4642
/**

tests/Fixer/DataProviderReturnTypeFixerTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@
1111

1212
namespace Tests\Fixer;
1313

14-
use PhpCsFixer\Fixer\DeprecatedFixerInterface;
15-
1614
/**
1715
* @internal
1816
*
19-
* @property DeprecatedFixerInterface $fixer
20-
*
2117
* @covers \PhpCsFixerCustomFixers\Fixer\DataProviderReturnTypeFixer
2218
*/
2319
final class DataProviderReturnTypeFixerTest extends AbstractFixerTestCase
@@ -44,7 +40,7 @@ public function testIsRisky(): void
4440

4541
public function testSuccessorName(): void
4642
{
47-
self::assertContains('php_unit_data_provider_return_type', $this->fixer->getSuccessorsNames());
43+
self::assertSuccessorName('php_unit_data_provider_return_type');
4844
}
4945

5046
/**

tests/Fixer/DataProviderStaticFixerTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@
1111

1212
namespace Tests\Fixer;
1313

14-
use PhpCsFixer\Fixer\DeprecatedFixerInterface;
15-
1614
/**
1715
* @internal
1816
*
19-
* @property DeprecatedFixerInterface $fixer
20-
*
2117
* @covers \PhpCsFixerCustomFixers\Fixer\DataProviderStaticFixer
2218
*/
2319
final class DataProviderStaticFixerTest extends AbstractFixerTestCase
@@ -29,7 +25,7 @@ public function testIsRisky(): void
2925

3026
public function testSuccessorName(): void
3127
{
32-
self::assertContains('php_unit_data_provider_static', $this->fixer->getSuccessorsNames());
28+
self::assertSuccessorName('php_unit_data_provider_static');
3329
}
3430

3531
public function testConfiguration(): void

tests/Fixer/InternalClassCasingFixerTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@
1111

1212
namespace Tests\Fixer;
1313

14-
use PhpCsFixer\Fixer\DeprecatedFixerInterface;
15-
1614
/**
1715
* @internal
1816
*
19-
* @property DeprecatedFixerInterface $fixer
20-
*
2117
* @covers \PhpCsFixerCustomFixers\Fixer\InternalClassCasingFixer
2218
*/
2319
final class InternalClassCasingFixerTest extends AbstractFixerTestCase
@@ -29,7 +25,7 @@ public function testIsRisky(): void
2925

3026
public function testSuccessorName(): void
3127
{
32-
self::assertContains('class_reference_name_casing', $this->fixer->getSuccessorsNames());
28+
self::assertSuccessorName('class_reference_name_casing');
3329
}
3430

3531
/**

tests/Fixer/PhpdocParamOrderFixerTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@
1111

1212
namespace Tests\Fixer;
1313

14-
use PhpCsFixer\Fixer\DeprecatedFixerInterface;
15-
1614
/**
1715
* @internal
1816
*
19-
* @property DeprecatedFixerInterface $fixer
20-
*
2117
* @covers \PhpCsFixerCustomFixers\Fixer\PhpdocParamOrderFixer
2218
*/
2319
final class PhpdocParamOrderFixerTest extends AbstractFixerTestCase
@@ -29,7 +25,7 @@ public function testIsRisky(): void
2925

3026
public function testSuccessorName(): void
3127
{
32-
self::assertContains('phpdoc_param_order', $this->fixer->getSuccessorsNames());
28+
self::assertSuccessorName('phpdoc_param_order');
3329
}
3430

3531
/**

0 commit comments

Comments
 (0)