Skip to content

Commit b124a1c

Browse files
committed
Improve code samples
1 parent b25c7fc commit b124a1c

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ Configuration options:
8080
class FooTest extends TestCase {
8181
/**
8282
- * @dataProvider dataProvider
83-
+ * @dataProvider provideHappyPathCases
83+
+ * @dataProvider provideSomethingCases
8484
*/
85-
public function testHappyPath() {}
85+
public function testSomething($expected, $actual) {}
8686
- public function dataProvider() {}
87-
+ public function provideHappyPathCases() {}
87+
+ public function provideSomethingCases() {}
8888
}
8989
```
9090

@@ -95,11 +95,11 @@ The types returned by data providers must be `iterable`.
9595
<?php
9696
class FooTest extends TestCase {
9797
/**
98-
* @dataProvider provideHappyPathCases
98+
* @dataProvider provideSomethingCases
9999
*/
100-
public function testHappyPath() {}
101-
- public function provideHappyPathCases(): array {}
102-
+ public function provideHappyPathCases(): iterable {}
100+
public function testSomething($expected, $actual) {}
101+
- public function provideSomethingCases(): array {}
102+
+ public function provideSomethingCases(): iterable {}
103103
}
104104
```
105105

@@ -109,11 +109,11 @@ Data providers must be static.
109109
<?php
110110
class FooTest extends TestCase {
111111
/**
112-
* @dataProvider provideHappyPathCases
112+
* @dataProvider provideSomethingCases
113113
*/
114-
public function testHappyPath() {}
115-
- public function provideHappyPathCases() {}
116-
+ public static function provideHappyPathCases() {}
114+
public function testSomething($expected, $actual) {}
115+
- public function provideSomethingCases() {}
116+
+ public static function provideSomethingCases() {}
117117
}
118118
```
119119

src/Fixer/DataProviderNameFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class FooTest extends TestCase {
4545
/**
4646
* @dataProvider dataProvider
4747
*/
48-
public function testHappyPath() {}
48+
public function testSomething($expected, $actual) {}
4949
public function dataProvider() {}
5050
}
5151
'

src/Fixer/DataProviderReturnTypeFixer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ public function getDefinition(): FixerDefinitionInterface
3434
'<?php
3535
class FooTest extends TestCase {
3636
/**
37-
* @dataProvider provideHappyPathCases
37+
* @dataProvider provideSomethingCases
3838
*/
39-
public function testHappyPath() {}
40-
public function provideHappyPathCases(): array {}
39+
public function testSomething($expected, $actual) {}
40+
public function provideSomethingCases(): array {}
4141
}
4242
'
4343
),

src/Fixer/DataProviderStaticFixer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ public function getDefinition(): FixerDefinitionInterface
3333
'<?php
3434
class FooTest extends TestCase {
3535
/**
36-
* @dataProvider provideHappyPathCases
36+
* @dataProvider provideSomethingCases
3737
*/
38-
public function testHappyPath() {}
39-
public function provideHappyPathCases() {}
38+
public function testSomething($expected, $actual) {}
39+
public function provideSomethingCases() {}
4040
}
4141
'
4242
),

0 commit comments

Comments
 (0)