Fork me on GitHub
a Sensio Labs Product

I ate three cookies πŸͺ (v3.40.2) edition

Rule php_unit_method_casingΒΆ

Enforce camel (or snake) case for PHPUnit test methods, following configuration.

ConfigurationΒΆ

caseΒΆ

Apply camel or snake case to test methods.

Allowed values: 'camel_case' and 'snake_case'

Default value: 'camel_case'

ExamplesΒΆ

Example #1ΒΆ

Default configuration.

--- Original
+++ New
 <?php
 class MyTest extends \PhpUnit\FrameWork\TestCase
 {
-    public function test_my_code() {}
+    public function testMyCode() {}
 }

Example #2ΒΆ

With configuration: ['case' => 'snake_case'].

--- Original
+++ New
 <?php
 class MyTest extends \PhpUnit\FrameWork\TestCase
 {
-    public function testMyCode() {}
+    public function test_my_code() {}
 }

Rule setsΒΆ

The rule is part of the following rule sets:

Source classΒΆ

PhpCsFixer\Fixer\PhpUnit\PhpUnitMethodCasingFixer