Skip to content

Commit 6615915

Browse files
committed
Updated ContrivedControllerTest with complex data provider
1 parent 75c8541 commit 6615915

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

testing_example/tests/src/Unit/Controller/ContrivedControllerTest.php

+18-6
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,24 @@ public function testHandCount($expected, $first, $second) {
6868
* Data provider for testHandCountIsolated().
6969
*/
7070
public function providerTestHandCountIsolated() {
71-
return [
72-
['I can count these on one hand.', 0],
73-
['I can count these on one hand.', 5],
74-
['I need two hands to count these.', 10],
75-
['That\'s just too many numbers to count.', 11],
76-
];
71+
$data = [];
72+
73+
// Add one-hand data.
74+
foreach (range(0, 5) as $sum) {
75+
$data[] = ['I can count these on one hand.', $sum];
76+
}
77+
78+
// Add two-hand data.
79+
foreach (range(6, 10) as $sum) {
80+
$data[] = ['I need two hands to count these.', $sum];
81+
}
82+
83+
// Add too-many data.
84+
foreach (range(11, 15) as $sum) {
85+
$data[] = ['That\'s just too many numbers to count.', $sum];
86+
}
87+
88+
return $data;
7789
}
7890

7991
/**

0 commit comments

Comments
 (0)