Skip to content

Commit

Permalink
Feat: Add PhpUnitMethodCasingFixer
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraM committed May 14, 2024
1 parent 3f2a451 commit 815901d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
use PhpCsFixer\Fixer\PhpUnit\PhpUnitDedicateAssertInternalTypeFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitExpectationFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitFqcnAnnotationFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitMethodCasingFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitMockFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitMockShortWillReturnFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitNoExpectationAnnotationFixer;
Expand Down Expand Up @@ -535,6 +536,8 @@
->withConfiguredRule(PhpdocOrderFixer::class, ['order' => ['param', 'return', 'throws']])
// Order phpdoc tags by value.
->withConfiguredRule(PhpdocOrderByValueFixer::class, ['annotations' => ['covers', 'group', 'throws']])
// Enforce camel case for PHPUnit test methods.
->withConfiguredRule(PhpUnitMethodCasingFixer::class, ['case' => 'camel_case'])
// Calls to `PHPUnit\Framework\TestCase` static methods must all be of the same type (`$this->...`)
->withConfiguredRule(PhpUnitTestCaseStaticMethodCallsFixer::class, ['call_type' => 'this'])
// An empty line feed must precede any configured statement
Expand Down
5 changes: 5 additions & 0 deletions tests/Integration/Fixtures/PhpUnit.correct.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@ class PhpUnit extends TestCase
// PhpUnitTestCaseStaticMethodCallsFixer
$this->assertSame(1, 2);
}

public function testMethodName(): void // PhpUnitMethodCasingFixer
{
$this->assertTrue(true);
}
}
5 changes: 5 additions & 0 deletions tests/Integration/Fixtures/PhpUnit.wrong.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@ class PhpUnit extends TestCase
// PhpUnitTestCaseStaticMethodCallsFixer
static::assertSame(1, 2);
}

public function test_method_name(): void // PhpUnitMethodCasingFixer
{
$this->assertTrue(true);
}
}

0 comments on commit 815901d

Please sign in to comment.