Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 1.46 KB

php_unit_method_casing.rst

File metadata and controls

68 lines (47 loc) · 1.46 KB

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:

References

The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.