Enforce camel (or snake) case for PHPUnit test methods, following configuration.
Apply camel or snake case to test methods.
Allowed values: 'camel_case'
and 'snake_case'
Default value: 'camel_case'
Default configuration.
--- Original
+++ New
<?php
class MyTest extends \PhpUnit\FrameWork\TestCase
{
- public function test_my_code() {}
+ public function testMyCode() {}
}
With configuration: ['case' => 'snake_case']
.
--- Original
+++ New
<?php
class MyTest extends \PhpUnit\FrameWork\TestCase
{
- public function testMyCode() {}
+ public function test_my_code() {}
}
The rule is part of the following rule sets:
- Fixer class: PhpCsFixer\Fixer\PhpUnit\PhpUnitMethodCasingFixer
- Test class: PhpCsFixer\Tests\Fixer\PhpUnit\PhpUnitMethodCasingFixerTest
The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.