Skip to content

Commit

Permalink
Sync food-chain (exercism#821)
Browse files Browse the repository at this point in the history
[no important files changed]
  • Loading branch information
tomasnorre authored Oct 22, 2024
1 parent d037383 commit 32b62f8
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions exercises/practice/food-chain/FoodChainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,57 +13,60 @@ 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!",
"She swallowed the bird to catch the spider that 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(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!",
Expand All @@ -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!",
Expand All @@ -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!",
Expand All @@ -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!",
Expand All @@ -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.",
Expand All @@ -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.",
Expand Down Expand Up @@ -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());
}
}

0 comments on commit 32b62f8

Please sign in to comment.