Skip to content

Commit d0d1d68

Browse files
authored
PhpUnitDedicatedAssertFixer must run before NoUnusedImportsFixer (#639)
1 parent 00a1b48 commit d0d1d68

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Latest stable version](https://img.shields.io/packagist/v/kubawerlos/php-cs-fixer-custom-fixers.svg?label=current%20version)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)
44
[![PHP version](https://img.shields.io/packagist/php-v/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://php.net)
55
[![License](https://img.shields.io/github/license/kubawerlos/php-cs-fixer-custom-fixers.svg)](LICENSE)
6-
![Tests](https://img.shields.io/badge/tests-2978-brightgreen.svg)
6+
![Tests](https://img.shields.io/badge/tests-2981-brightgreen.svg)
77
[![Downloads](https://img.shields.io/packagist/dt/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)
88

99
[![CI Status](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/workflows/CI/badge.svg?branch=main&event=push)](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions)

src/Fixer/PhpUnitDedicatedAssertFixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public function testFoo() {
6464
}
6565

6666
/**
67+
* Must run before NoUnusedImportsFixer.
6768
* Must run after PhpUnitAssertArgumentsOrderFixer.
6869
*/
6970
public function getPriority(): int

tests/PriorityTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,26 @@ public function testFoo() {
436436
',
437437
];
438438

439+
yield [
440+
new CustomFixer\PhpUnitDedicatedAssertFixer(),
441+
new Fixer\Import\NoUnusedImportsFixer(),
442+
'<?php
443+
class FooTest extends TestCase {
444+
public function testFoo() {
445+
$this->assertCount(3, $elements);
446+
}
447+
}
448+
',
449+
'<?php
450+
use function count;
451+
class FooTest extends TestCase {
452+
public function testFoo() {
453+
$this->assertSame(3, count($elements));
454+
}
455+
}
456+
',
457+
];
458+
439459
$noExtraBlankLinesFixer = new Fixer\Whitespace\NoExtraBlankLinesFixer();
440460
$noExtraBlankLinesFixer->configure(['tokens' => ['curly_brace_block']]);
441461
yield [

0 commit comments

Comments
 (0)