Skip to content

Commit 815901d

Browse files
committed
Feat: Add PhpUnitMethodCasingFixer
1 parent 3f2a451 commit 815901d

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

ecs.php

+3
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
use PhpCsFixer\Fixer\PhpUnit\PhpUnitDedicateAssertInternalTypeFixer;
134134
use PhpCsFixer\Fixer\PhpUnit\PhpUnitExpectationFixer;
135135
use PhpCsFixer\Fixer\PhpUnit\PhpUnitFqcnAnnotationFixer;
136+
use PhpCsFixer\Fixer\PhpUnit\PhpUnitMethodCasingFixer;
136137
use PhpCsFixer\Fixer\PhpUnit\PhpUnitMockFixer;
137138
use PhpCsFixer\Fixer\PhpUnit\PhpUnitMockShortWillReturnFixer;
138139
use PhpCsFixer\Fixer\PhpUnit\PhpUnitNoExpectationAnnotationFixer;
@@ -535,6 +536,8 @@
535536
->withConfiguredRule(PhpdocOrderFixer::class, ['order' => ['param', 'return', 'throws']])
536537
// Order phpdoc tags by value.
537538
->withConfiguredRule(PhpdocOrderByValueFixer::class, ['annotations' => ['covers', 'group', 'throws']])
539+
// Enforce camel case for PHPUnit test methods.
540+
->withConfiguredRule(PhpUnitMethodCasingFixer::class, ['case' => 'camel_case'])
538541
// Calls to `PHPUnit\Framework\TestCase` static methods must all be of the same type (`$this->...`)
539542
->withConfiguredRule(PhpUnitTestCaseStaticMethodCallsFixer::class, ['call_type' => 'this'])
540543
// An empty line feed must precede any configured statement

tests/Integration/Fixtures/PhpUnit.correct.php.inc

+5
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,9 @@ class PhpUnit extends TestCase
3131
// PhpUnitTestCaseStaticMethodCallsFixer
3232
$this->assertSame(1, 2);
3333
}
34+
35+
public function testMethodName(): void // PhpUnitMethodCasingFixer
36+
{
37+
$this->assertTrue(true);
38+
}
3439
}

tests/Integration/Fixtures/PhpUnit.wrong.php.inc

+5
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,9 @@ class PhpUnit extends TestCase
3131
// PhpUnitTestCaseStaticMethodCallsFixer
3232
static::assertSame(1, 2);
3333
}
34+
35+
public function test_method_name(): void // PhpUnitMethodCasingFixer
36+
{
37+
$this->assertTrue(true);
38+
}
3439
}

0 commit comments

Comments
 (0)