From 32b62f8f7bbcf182915dcdc77dec64957405a8dc Mon Sep 17 00:00:00 2001 From: Tomas Norre Mikkelsen Date: Tue, 22 Oct 2024 13:32:01 +0200 Subject: [PATCH] Sync food-chain (#821) [no important files changed] --- .../practice/food-chain/FoodChainTest.php | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/exercises/practice/food-chain/FoodChainTest.php b/exercises/practice/food-chain/FoodChainTest.php index 38de7dba..5bc850a6 100644 --- a/exercises/practice/food-chain/FoodChainTest.php +++ b/exercises/practice/food-chain/FoodChainTest.php @@ -13,42 +13,43 @@ public static function setUpBeforeClass(): void require_once 'FoodChain.php'; } - protected function setUp(): void - { - $this->foodChain = new FoodChain(); - } - /** * uuid: 751dce68-9412-496e-b6e8-855998c56166 + * @testdox fly */ public function testFly(): void { + $foodChain = new FoodChain(); $expected = [ "I know an old lady who swallowed a fly.", "I don't know why she swallowed the fly. Perhaps she'll die." ]; - $this->assertEquals($expected, $this->foodChain->verse(1)); + $this->assertEquals($expected, $foodChain->verse(1)); } /** * uuid: 6c56f861-0c5e-4907-9a9d-b2efae389379 + * @testdox spider */ public function testSpider(): void { + $foodChain = new FoodChain(); $expected = [ "I know an old lady who swallowed a spider.", "It wriggled and jiggled and tickled inside her.", "She swallowed the spider to catch the fly.", "I don't know why she swallowed the fly. Perhaps she'll die." ]; - $this->assertEquals($expected, $this->foodChain->verse(2)); + $this->assertEquals($expected, $foodChain->verse(2)); } /** * uuid: 3edf5f33-bef1-4e39-ae67-ca5eb79203fa + * @testdox bird */ public function testBird(): void { + $foodChain = new FoodChain(); $expected = [ "I know an old lady who swallowed a bird.", "How absurd to swallow a bird!", @@ -56,14 +57,16 @@ public function testBird(): void "She swallowed the spider to catch the fly.", "I don't know why she swallowed the fly. Perhaps she'll die." ]; - $this->assertEquals($expected, $this->foodChain->verse(3)); + $this->assertEquals($expected, $foodChain->verse(3)); } /** * uuid: e866a758-e1ff-400e-9f35-f27f28cc288f + * @testdox cat */ public function testCat(): void { + $foodChain = new FoodChain(); $expected = [ "I know an old lady who swallowed a cat.", "Imagine that, to swallow a cat!", @@ -72,14 +75,16 @@ public function testCat(): void "She swallowed the spider to catch the fly.", "I don't know why she swallowed the fly. Perhaps she'll die." ]; - $this->assertEquals($expected, $this->foodChain->verse(4)); + $this->assertEquals($expected, $foodChain->verse(4)); } /** * uuid: 3f02c30e-496b-4b2a-8491-bc7e2953cafb + * @testdox dog */ public function testDog(): void { + $foodChain = new FoodChain(); $expected = [ "I know an old lady who swallowed a dog.", "What a hog, to swallow a dog!", @@ -89,14 +94,16 @@ public function testDog(): void "She swallowed the spider to catch the fly.", "I don't know why she swallowed the fly. Perhaps she'll die." ]; - $this->assertEquals($expected, $this->foodChain->verse(5)); + $this->assertEquals($expected, $foodChain->verse(5)); } /** * uuid: 4b3fd221-01ea-46e0-825b-5734634fbc59 + * @testdox goat */ public function testGoat(): void { + $foodChain = new FoodChain(); $expected = [ "I know an old lady who swallowed a goat.", "Just opened her throat and swallowed a goat!", @@ -107,14 +114,16 @@ public function testGoat(): void "She swallowed the spider to catch the fly.", "I don't know why she swallowed the fly. Perhaps she'll die." ]; - $this->assertEquals($expected, $this->foodChain->verse(6)); + $this->assertEquals($expected, $foodChain->verse(6)); } /** * uuid: 1b707da9-7001-4fac-941f-22ad9c7a65d4 + * @testdox cow */ public function testCow(): void { + $foodChain = new FoodChain(); $expected = [ "I know an old lady who swallowed a cow.", "I don't know how she swallowed a cow!", @@ -126,26 +135,30 @@ public function testCow(): void "She swallowed the spider to catch the fly.", "I don't know why she swallowed the fly. Perhaps she'll die." ]; - $this->assertEquals($expected, $this->foodChain->verse(7)); + $this->assertEquals($expected, $foodChain->verse(7)); } /** * uuid: 3cb10d46-ae4e-4d2c-9296-83c9ffc04cdc + * @testdox horse */ public function testHorse(): void { + $foodChain = new FoodChain(); $expected = [ "I know an old lady who swallowed a horse.", "She's dead, of course!" ]; - $this->assertEquals($expected, $this->foodChain->verse(8)); + $this->assertEquals($expected, $foodChain->verse(8)); } /** * uuid: 22b863d5-17e4-4d1e-93e4-617329a5c050 + * @testdox multiple verses */ public function testMultipleVerses(): void { + $foodChain = new FoodChain(); $expected = [ "I know an old lady who swallowed a fly.", "I don't know why she swallowed the fly. Perhaps she'll die.", @@ -161,13 +174,15 @@ public function testMultipleVerses(): void "She swallowed the spider to catch the fly.", "I don't know why she swallowed the fly. Perhaps she'll die." ]; - $this->assertEquals($expected, $this->foodChain->verses(1, 3)); + $this->assertEquals($expected, $foodChain->verses(1, 3)); } /** * uuid: e626b32b-745c-4101-bcbd-3b13456893db + * @testdox full song */ public function testFullSong(): void { + $foodChain = new FoodChain(); $expected = [ "I know an old lady who swallowed a fly.", "I don't know why she swallowed the fly. Perhaps she'll die.", @@ -220,6 +235,6 @@ public function testFullSong(): void "I know an old lady who swallowed a horse.", "She's dead, of course!" ]; - $this->assertEquals($expected, $this->foodChain->song()); + $this->assertEquals($expected, $foodChain->song()); } }