Fork me on GitHub
a Sensio Labs Product

7th Gear (v3.57.2) edition

Rule php_unit_test_annotation

Adds or removes @test annotations from tests, following configuration.


Using this rule is risky

This fixer may change the name of your tests, and could cause incompatibility with abstract classes or interfaces.



Whether to use the @test annotation or not.

Allowed values: 'annotation' and 'prefix'

Default value: 'prefix'


Example #1

Default configuration.

--- Original
+++ New
 class Test extends \PhpUnit\FrameWork\TestCase
-     * @test
+     *
-    public function itDoesSomething() {} }
+    public function testItDoesSomething() {} }

Example #2

With configuration: ['style' => 'annotation'].

--- Original
+++ New
 class Test extends \PhpUnit\FrameWork\TestCase
-public function testItDoesSomething() {}}
+ * @test
+ */
+public function itDoesSomething() {}}

Rule sets

The rule is part of the following rule sets:


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