Skip to content

Commit 32b62f8

Browse files
authored
Sync food-chain (#821)
[no important files changed]
1 parent d037383 commit 32b62f8

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

exercises/practice/food-chain/FoodChainTest.php

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,57 +13,60 @@ public static function setUpBeforeClass(): void
1313
require_once 'FoodChain.php';
1414
}
1515

16-
protected function setUp(): void
17-
{
18-
$this->foodChain = new FoodChain();
19-
}
20-
2116
/**
2217
* uuid: 751dce68-9412-496e-b6e8-855998c56166
18+
* @testdox fly
2319
*/
2420
public function testFly(): void
2521
{
22+
$foodChain = new FoodChain();
2623
$expected = [
2724
"I know an old lady who swallowed a fly.",
2825
"I don't know why she swallowed the fly. Perhaps she'll die."
2926
];
30-
$this->assertEquals($expected, $this->foodChain->verse(1));
27+
$this->assertEquals($expected, $foodChain->verse(1));
3128
}
3229

3330
/**
3431
* uuid: 6c56f861-0c5e-4907-9a9d-b2efae389379
32+
* @testdox spider
3533
*/
3634
public function testSpider(): void
3735
{
36+
$foodChain = new FoodChain();
3837
$expected = [
3938
"I know an old lady who swallowed a spider.",
4039
"It wriggled and jiggled and tickled inside her.",
4140
"She swallowed the spider to catch the fly.",
4241
"I don't know why she swallowed the fly. Perhaps she'll die."
4342
];
44-
$this->assertEquals($expected, $this->foodChain->verse(2));
43+
$this->assertEquals($expected, $foodChain->verse(2));
4544
}
4645

4746
/**
4847
* uuid: 3edf5f33-bef1-4e39-ae67-ca5eb79203fa
48+
* @testdox bird
4949
*/
5050
public function testBird(): void
5151
{
52+
$foodChain = new FoodChain();
5253
$expected = [
5354
"I know an old lady who swallowed a bird.",
5455
"How absurd to swallow a bird!",
5556
"She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.",
5657
"She swallowed the spider to catch the fly.",
5758
"I don't know why she swallowed the fly. Perhaps she'll die."
5859
];
59-
$this->assertEquals($expected, $this->foodChain->verse(3));
60+
$this->assertEquals($expected, $foodChain->verse(3));
6061
}
6162

6263
/**
6364
* uuid: e866a758-e1ff-400e-9f35-f27f28cc288f
65+
* @testdox cat
6466
*/
6567
public function testCat(): void
6668
{
69+
$foodChain = new FoodChain();
6770
$expected = [
6871
"I know an old lady who swallowed a cat.",
6972
"Imagine that, to swallow a cat!",
@@ -72,14 +75,16 @@ public function testCat(): void
7275
"She swallowed the spider to catch the fly.",
7376
"I don't know why she swallowed the fly. Perhaps she'll die."
7477
];
75-
$this->assertEquals($expected, $this->foodChain->verse(4));
78+
$this->assertEquals($expected, $foodChain->verse(4));
7679
}
7780

7881
/**
7982
* uuid: 3f02c30e-496b-4b2a-8491-bc7e2953cafb
83+
* @testdox dog
8084
*/
8185
public function testDog(): void
8286
{
87+
$foodChain = new FoodChain();
8388
$expected = [
8489
"I know an old lady who swallowed a dog.",
8590
"What a hog, to swallow a dog!",
@@ -89,14 +94,16 @@ public function testDog(): void
8994
"She swallowed the spider to catch the fly.",
9095
"I don't know why she swallowed the fly. Perhaps she'll die."
9196
];
92-
$this->assertEquals($expected, $this->foodChain->verse(5));
97+
$this->assertEquals($expected, $foodChain->verse(5));
9398
}
9499

95100
/**
96101
* uuid: 4b3fd221-01ea-46e0-825b-5734634fbc59
102+
* @testdox goat
97103
*/
98104
public function testGoat(): void
99105
{
106+
$foodChain = new FoodChain();
100107
$expected = [
101108
"I know an old lady who swallowed a goat.",
102109
"Just opened her throat and swallowed a goat!",
@@ -107,14 +114,16 @@ public function testGoat(): void
107114
"She swallowed the spider to catch the fly.",
108115
"I don't know why she swallowed the fly. Perhaps she'll die."
109116
];
110-
$this->assertEquals($expected, $this->foodChain->verse(6));
117+
$this->assertEquals($expected, $foodChain->verse(6));
111118
}
112119

113120
/**
114121
* uuid: 1b707da9-7001-4fac-941f-22ad9c7a65d4
122+
* @testdox cow
115123
*/
116124
public function testCow(): void
117125
{
126+
$foodChain = new FoodChain();
118127
$expected = [
119128
"I know an old lady who swallowed a cow.",
120129
"I don't know how she swallowed a cow!",
@@ -126,26 +135,30 @@ public function testCow(): void
126135
"She swallowed the spider to catch the fly.",
127136
"I don't know why she swallowed the fly. Perhaps she'll die."
128137
];
129-
$this->assertEquals($expected, $this->foodChain->verse(7));
138+
$this->assertEquals($expected, $foodChain->verse(7));
130139
}
131140

132141
/**
133142
* uuid: 3cb10d46-ae4e-4d2c-9296-83c9ffc04cdc
143+
* @testdox horse
134144
*/
135145
public function testHorse(): void
136146
{
147+
$foodChain = new FoodChain();
137148
$expected = [
138149
"I know an old lady who swallowed a horse.",
139150
"She's dead, of course!"
140151
];
141-
$this->assertEquals($expected, $this->foodChain->verse(8));
152+
$this->assertEquals($expected, $foodChain->verse(8));
142153
}
143154

144155
/**
145156
* uuid: 22b863d5-17e4-4d1e-93e4-617329a5c050
157+
* @testdox multiple verses
146158
*/
147159
public function testMultipleVerses(): void
148160
{
161+
$foodChain = new FoodChain();
149162
$expected = [
150163
"I know an old lady who swallowed a fly.",
151164
"I don't know why she swallowed the fly. Perhaps she'll die.",
@@ -161,13 +174,15 @@ public function testMultipleVerses(): void
161174
"She swallowed the spider to catch the fly.",
162175
"I don't know why she swallowed the fly. Perhaps she'll die."
163176
];
164-
$this->assertEquals($expected, $this->foodChain->verses(1, 3));
177+
$this->assertEquals($expected, $foodChain->verses(1, 3));
165178
}
166179
/**
167180
* uuid: e626b32b-745c-4101-bcbd-3b13456893db
181+
* @testdox full song
168182
*/
169183
public function testFullSong(): void
170184
{
185+
$foodChain = new FoodChain();
171186
$expected = [
172187
"I know an old lady who swallowed a fly.",
173188
"I don't know why she swallowed the fly. Perhaps she'll die.",
@@ -220,6 +235,6 @@ public function testFullSong(): void
220235
"I know an old lady who swallowed a horse.",
221236
"She's dead, of course!"
222237
];
223-
$this->assertEquals($expected, $this->foodChain->song());
238+
$this->assertEquals($expected, $foodChain->song());
224239
}
225240
}

0 commit comments

Comments
 (0)