Data provider names must match the name of the test.
Fixer could be risky if one is calling data provider by name as function.
Prefix that replaces "test".
Allowed types: string
Default value: 'provide'
Suffix to be present at the end.
Allowed types: string
Default value: 'Cases'
Default configuration.
--- Original
+++ New
<?php
class FooTest extends TestCase {
/**
- * @dataProvider dataProvider
+ * @dataProvider provideSomethingCases
*/
public function testSomething($expected, $actual) {}
- public function dataProvider() {}
+ public function provideSomethingCases() {}
}
With configuration: ['prefix' => 'data_', 'suffix' => '']
.
--- Original
+++ New
<?php
class FooTest extends TestCase {
/**
- * @dataProvider dt_prvdr_ftr
+ * @dataProvider data_feature
*/
public function test_feature($expected, $actual) {}
- public function dt_prvdr_ftr() {}
+ public function data_feature() {}
}
With configuration: ['prefix' => 'provides', 'suffix' => 'Data']
.
--- Original
+++ New
<?php
class FooTest extends TestCase {
/**
* @dataProvider dataProviderUsedInMultipleTests
*/
public function testA($expected, $actual) {}
/**
* @dataProvider dataProviderUsedInMultipleTests
*/
public function testB($expected, $actual) {}
/**
- * @dataProvider dataProviderUsedInSingleTest
+ * @dataProvider providesCData
*/
public function testC($expected, $actual) {}
/**
* @dataProvider dataProviderUsedAsFirstInTest
* @dataProvider dataProviderUsedAsSecondInTest
*/
public function testD($expected, $actual) {}
public function dataProviderUsedInMultipleTests() {}
- public function dataProviderUsedInSingleTest() {}
+ public function providesCData() {}
public function dataProviderUsedAsFirstInTest() {}
public function dataProviderUsedAsSecondInTest() {}
}
The rule is part of the following rule set: