From 776132b2a3fabd7f4d095907b5752998cea03c29 Mon Sep 17 00:00:00 2001 From: Tomas Norre Mikkelsen Date: Mon, 23 Sep 2024 13:28:11 +0200 Subject: [PATCH 1/7] Sync: Bob --- exercises/practice/bob/.docs/instructions.md | 27 ++-- exercises/practice/bob/.docs/introduction.md | 10 ++ exercises/practice/bob/.meta/example.php | 22 --- exercises/practice/bob/BobTest.php | 142 ++++++++++++++----- 4 files changed, 130 insertions(+), 71 deletions(-) create mode 100644 exercises/practice/bob/.docs/introduction.md diff --git a/exercises/practice/bob/.docs/instructions.md b/exercises/practice/bob/.docs/instructions.md index edddb1413..bb702f7bb 100644 --- a/exercises/practice/bob/.docs/instructions.md +++ b/exercises/practice/bob/.docs/instructions.md @@ -1,16 +1,19 @@ # Instructions -Bob is a lackadaisical teenager. In conversation, his responses are very limited. +Your task is to determine what Bob will reply to someone when they say something to him or ask him a question. -Bob answers 'Sure.' if you ask him a question, such as "How are you?". +Bob only ever answers one of five things: -He answers 'Whoa, chill out!' if you YELL AT HIM (in all capitals). - -He answers 'Calm down, I know what I'm doing!' if you yell a question at him. - -He says 'Fine. Be that way!' if you address him without actually saying -anything. - -He answers 'Whatever.' to anything else. - -Bob's conversational partner is a purist when it comes to written communication and always follows normal rules regarding sentence punctuation in English. +- **"Sure."** + This is his response if you ask him a question, such as "How are you?" + The convention used for questions is that it ends with a question mark. +- **"Whoa, chill out!"** + This is his answer if you YELL AT HIM. + The convention used for yelling is ALL CAPITAL LETTERS. +- **"Calm down, I know what I'm doing!"** + This is what he says if you yell a question at him. +- **"Fine. Be that way!"** + This is how he responds to silence. + The convention used for silence is nothing, or various combinations of whitespace characters. +- **"Whatever."** + This is what he answers to anything else. diff --git a/exercises/practice/bob/.docs/introduction.md b/exercises/practice/bob/.docs/introduction.md new file mode 100644 index 000000000..ea4a80776 --- /dev/null +++ b/exercises/practice/bob/.docs/introduction.md @@ -0,0 +1,10 @@ +# Introduction + +Bob is a [lackadaisical][] teenager. +He likes to think that he's very cool. +And he definitely doesn't get excited about things. +That wouldn't be cool. + +When people talk to him, his responses are pretty limited. + +[lackadaisical]: https://www.collinsdictionary.com/dictionary/english/lackadaisical diff --git a/exercises/practice/bob/.meta/example.php b/exercises/practice/bob/.meta/example.php index 88e925341..a24862cf6 100644 --- a/exercises/practice/bob/.meta/example.php +++ b/exercises/practice/bob/.meta/example.php @@ -1,27 +1,5 @@ . - * - * To disable strict typing, comment out the directive below. - */ - declare(strict_types=1); class Bob diff --git a/exercises/practice/bob/BobTest.php b/exercises/practice/bob/BobTest.php index 9828e46e4..12f92a9b4 100644 --- a/exercises/practice/bob/BobTest.php +++ b/exercises/practice/bob/BobTest.php @@ -1,27 +1,5 @@ . - * - * To disable strict typing, comment out the directive below. - */ - declare(strict_types=1); class BobTest extends PHPUnit\Framework\TestCase @@ -39,46 +17,82 @@ public function setUp(): void $this->bob = new Bob(); } + /** + * uuid: e162fead-606f-437a-a166-d051915cea8e + * @testdox stating something + */ public function testStatingSomething(): void { $this->assertEquals("Whatever.", $this->bob->respondTo("Tom-ay-to, tom-aaaah-to.")); } + /** + * uuid: 73a966dc-8017-47d6-bb32-cf07d1a5fcd9 + * @testdox shouting + */ public function testShouting(): void { $this->assertEquals("Whoa, chill out!", $this->bob->respondTo("WATCH OUT!")); } + /** + * uuid: d6c98afd-df35-4806-b55e-2c457c3ab748 + * @testdox shouting gibberish + */ public function testShoutingGibberish(): void { $this->assertEquals("Whoa, chill out!", $this->bob->respondTo("FCECDFCAAB")); } + /** + * uuid: 8a2e771d-d6f1-4e3f-b6c6-b41495556e37 + * @testdox asking a question + */ public function testAskingAQuestion(): void { $this->assertEquals("Sure.", $this->bob->respondTo("Does this cryogenic chamber make me look fat?")); } + /** + * uuid: 81080c62-4e4d-4066-b30a-48d8d76920d9 + * @testdox asking a numeric question + */ public function testAskingANumericQuestion(): void { $this->assertEquals("Sure.", $this->bob->respondTo("You are, what, like 15?")); } + /** + * uuid: 2a02716d-685b-4e2e-a804-2adaf281c01e + * @testdox asking gibberish + */ public function testAskingGibberish(): void { $this->assertEquals("Sure.", $this->bob->respondTo("fffbbcbeab?")); } + /** + * uuid: c02f9179-ab16-4aa7-a8dc-940145c385f7 + * @testdox talking forcefully + */ public function testTalkingForcefully(): void { $this->assertEquals("Whatever.", $this->bob->respondTo("Let's go make out behind the gym!")); } + /** + * uuid: 153c0e25-9bb5-4ec5-966e-598463658bcd + * @testdox using acronyms in regular speech + */ public function testUsingAcronymsInRegularSpeech(): void { $this->assertEquals("Whatever.", $this->bob->respondTo("It's OK if you don't want to go to the DMV.")); } + /** + * uuid: a5193c61-4a92-4f68-93e2-f554eb385ec6 + * @testdox forceful question + */ public function testForcefulQuestion(): void { $this->assertEquals( @@ -87,93 +101,147 @@ public function testForcefulQuestion(): void ); } + /** + * uuid: a20e0c54-2224-4dde-8b10-bd2cdd4f61bc + * @testdox shouting numbers + */ public function testShoutingNumbers(): void { $this->assertEquals("Whoa, chill out!", $this->bob->respondTo("1, 2, 3 GO!")); } + /** + * uuid: f7bc4b92-bdff-421e-a238-ae97f230ccac + * * @testdox no letters + */ public function testOnlyNumbers(): void { $this->assertEquals("Whatever.", $this->bob->respondTo("1, 2, 3")); } + /** + * uuid: bb0011c5-cd52-4a5b-8bfb-a87b6283b0e2 + * @testdox question with no letters + */ public function testQuestionWithOnlyNumbers(): void { $this->assertEquals("Sure.", $this->bob->respondTo("4?")); } + /** + * uuid: 496143c8-1c31-4c01-8a08-88427af85c66 + * @testdox shouting with special characters + */ public function testShoutingWithSpecialCharacters(): void { $this->assertEquals("Whoa, chill out!", $this->bob->respondTo("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!")); } + /** + * uuid: e6793c1c-43bd-4b8d-bc11-499aea73925f + * @testdox shouting with no exclamation mark + */ public function testShoutingWithNoExclamationMark(): void { $this->assertEquals("Whoa, chill out!", $this->bob->respondTo("I HATE YOU")); } + /** + * uuid: aa8097cc-c548-4951-8856-14a404dd236a + * @testdox statement containing question mark + */ public function testStatementContainingQuestionMark(): void { $this->assertEquals("Whatever.", $this->bob->respondTo("Ending with ? means a question.")); } + /** + * uuid: 9bfc677d-ea3a-45f2-be44-35bc8fa3753e + * @testdox non-letters with question + */ public function testNonLettersWithQuestion(): void { $this->assertEquals("Sure.", $this->bob->respondTo(":) ?")); } + /** + * uuid: 8608c508-f7de-4b17-985b-811878b3cf45 + * @testdox prattling on + */ public function testPrattlingOn(): void { $this->assertEquals("Sure.", $this->bob->respondTo("Wait! Hang on. Are you going to be OK?")); } + /** + * uuid: bc39f7c6-f543-41be-9a43-fd1c2f753fc0 + * @testdox silence + */ public function testSilence(): void { $this->assertEquals("Fine. Be that way!", $this->bob->respondTo("")); } + /** + * uuid: d6c47565-372b-4b09-b1dd-c40552b8378b + * @testdox prolonged silence + */ public function testProlongedSilence(): void { $this->assertEquals("Fine. Be that way!", $this->bob->respondTo(" ")); } + /** + * uuid: 4428f28d-4100-4d85-a902-e5a78cb0ecd3 + * @testdox alternate silence + */ public function testAlternateSilence(): void { $this->assertEquals("Fine. Be that way!", $this->bob->respondTo("\t\t\t\t\t\t\t\t\t\t")); } + /** + * uuid: 66953780-165b-4e7e-8ce3-4bcb80b6385a + * @testdox multiple line question + */ public function testMultipleLineQuestion(): void { $this->assertEquals("Whatever.", $this->bob->respondTo("\nDoes this cryogenic chamber make me look fat?\nno")); } + /** + * uuid: 5371ef75-d9ea-4103-bcfa-2da973ddec1b + * @testdox starting with whitespace + */ public function testStartingWithWhitespace(): void { $this->assertEquals("Whatever.", $this->bob->respondTo(" hmmmmmmm...")); } + /** + * uuid: 05b304d6-f83b-46e7-81e0-4cd3ca647900 + * @testdox ending with whitespace + */ public function testEndingWithWhitespace(): void { $this->assertEquals("Sure.", $this->bob->respondTo("Okay if like my spacebar quite a bit? ")); } + /** + * uuid: 72bd5ad3-9b2f-4931-a988-dce1f5771de2 + * @testdox other whitespace + */ + public function testOtherWhitespace() + { + $this->assertEquals("Fine. Be that way!", $this->bob->respondTo("\n\r \t")); + } + + /** + * uuid: 12983553-8601-46a8-92fa-fcaa3bc4a2a0 + * @testdox non-question ending with whitespace + */ public function testNonQuestionEndingWithWhitespace(): void { $this->assertEquals("Whatever.", $this->bob->respondTo("This is a statement ending with whitespace ")); } - -// public function testOtherWhitespace() - // { - // $this->assertEquals("Fine. Be that way!", $this->bob->respondTo("\n\r \t\u{000b}\u{00a0}\u{2002}")); - // } - // - // public function testShoutingWithUmlauts() - // { - // $this->assertEquals("Whoa, chill out!", $this->bob->respondTo("ÜMLÄÜTS!")); - // } - // - // public function testCalmlySpeakingWithUmlauts() - // { - // $this->assertEquals("Whatever.", $this->bob->respondTo("ÜMLäÜTS!")); - // } } From 3774d63defaf3ac24e92b05997f34934fa838da5 Mon Sep 17 00:00:00 2001 From: Tomas Norre Mikkelsen Date: Tue, 24 Sep 2024 14:21:40 +0200 Subject: [PATCH 2/7] Update exercises/practice/bob/BobTest.php Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com> --- exercises/practice/bob/BobTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/bob/BobTest.php b/exercises/practice/bob/BobTest.php index 12f92a9b4..af989c4cd 100644 --- a/exercises/practice/bob/BobTest.php +++ b/exercises/practice/bob/BobTest.php @@ -86,7 +86,7 @@ public function testTalkingForcefully(): void */ public function testUsingAcronymsInRegularSpeech(): void { - $this->assertEquals("Whatever.", $this->bob->respondTo("It's OK if you don't want to go to the DMV.")); + $this->assertEquals("Whatever.", $this->bob->respondTo("It's OK if you don't want to go work for NASA.")); } /** From 7ddf88d7ea689a9a3ce9abe4efbcd28a24e4c0c0 Mon Sep 17 00:00:00 2001 From: Tomas Norre Mikkelsen Date: Tue, 24 Sep 2024 14:21:47 +0200 Subject: [PATCH 3/7] Update exercises/practice/bob/BobTest.php Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com> --- exercises/practice/bob/BobTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exercises/practice/bob/BobTest.php b/exercises/practice/bob/BobTest.php index af989c4cd..566c12ec2 100644 --- a/exercises/practice/bob/BobTest.php +++ b/exercises/practice/bob/BobTest.php @@ -96,6 +96,9 @@ public function testUsingAcronymsInRegularSpeech(): void public function testForcefulQuestion(): void { $this->assertEquals( + "Calm down, I know what I'm doing!", + $this->bob->respondTo("WHAT'S GOING ON?") + ); "Calm down, I know what I'm doing!", $this->bob->respondTo("WHAT THE HELL WERE YOU THINKING?") ); From d750baa9eded6724be3fc74fa55e351ec6ff9598 Mon Sep 17 00:00:00 2001 From: Tomas Norre Mikkelsen Date: Tue, 24 Sep 2024 14:21:58 +0200 Subject: [PATCH 4/7] Update exercises/practice/bob/BobTest.php Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com> --- exercises/practice/bob/BobTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/bob/BobTest.php b/exercises/practice/bob/BobTest.php index 566c12ec2..909df37ca 100644 --- a/exercises/practice/bob/BobTest.php +++ b/exercises/practice/bob/BobTest.php @@ -77,7 +77,7 @@ public function testAskingGibberish(): void */ public function testTalkingForcefully(): void { - $this->assertEquals("Whatever.", $this->bob->respondTo("Let's go make out behind the gym!")); + $this->assertEquals("Whatever.", $this->bob->respondTo("Hi there!")); } /** From 403d53b759578c2e3f43769189c0a053943f51ee Mon Sep 17 00:00:00 2001 From: Tomas Norre Mikkelsen Date: Tue, 24 Sep 2024 14:22:04 +0200 Subject: [PATCH 5/7] Update exercises/practice/bob/BobTest.php Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com> --- exercises/practice/bob/BobTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/bob/BobTest.php b/exercises/practice/bob/BobTest.php index 909df37ca..866be93de 100644 --- a/exercises/practice/bob/BobTest.php +++ b/exercises/practice/bob/BobTest.php @@ -115,7 +115,7 @@ public function testShoutingNumbers(): void /** * uuid: f7bc4b92-bdff-421e-a238-ae97f230ccac - * * @testdox no letters + * @testdox no letters */ public function testOnlyNumbers(): void { From 3157be5ecfccdbec45feee6db78ce04232b2df98 Mon Sep 17 00:00:00 2001 From: Tomas Norre Mikkelsen Date: Tue, 24 Sep 2024 14:22:10 +0200 Subject: [PATCH 6/7] Update exercises/practice/bob/BobTest.php Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com> --- exercises/practice/bob/BobTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/bob/BobTest.php b/exercises/practice/bob/BobTest.php index 866be93de..ac9b89a94 100644 --- a/exercises/practice/bob/BobTest.php +++ b/exercises/practice/bob/BobTest.php @@ -146,7 +146,7 @@ public function testShoutingWithSpecialCharacters(): void */ public function testShoutingWithNoExclamationMark(): void { - $this->assertEquals("Whoa, chill out!", $this->bob->respondTo("I HATE YOU")); + $this->assertEquals("Whoa, chill out!", $this->bob->respondTo("I HATE THE DENTIST")); } /** From 9cb897021d34f6e7eb9674ac8682af051a776cc6 Mon Sep 17 00:00:00 2001 From: Tomas Norre Mikkelsen Date: Tue, 24 Sep 2024 14:40:00 +0200 Subject: [PATCH 7/7] Arrange Act Assert --- exercises/practice/bob/BobTest.php | 139 +++++++++++++++++++++-------- 1 file changed, 100 insertions(+), 39 deletions(-) diff --git a/exercises/practice/bob/BobTest.php b/exercises/practice/bob/BobTest.php index ac9b89a94..34deed1c3 100644 --- a/exercises/practice/bob/BobTest.php +++ b/exercises/practice/bob/BobTest.php @@ -9,21 +9,16 @@ public static function setUpBeforeClass(): void require_once 'Bob.php'; } - /** @var Bob */ - private $bob; - - public function setUp(): void - { - $this->bob = new Bob(); - } - /** * uuid: e162fead-606f-437a-a166-d051915cea8e * @testdox stating something */ public function testStatingSomething(): void { - $this->assertEquals("Whatever.", $this->bob->respondTo("Tom-ay-to, tom-aaaah-to.")); + $input = "Tom-ay-to, tom-aaaah-to."; + $expected = "Whatever."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -32,7 +27,10 @@ public function testStatingSomething(): void */ public function testShouting(): void { - $this->assertEquals("Whoa, chill out!", $this->bob->respondTo("WATCH OUT!")); + $input = "WATCH OUT!"; + $expected = "Whoa, chill out!"; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -41,7 +39,10 @@ public function testShouting(): void */ public function testShoutingGibberish(): void { - $this->assertEquals("Whoa, chill out!", $this->bob->respondTo("FCECDFCAAB")); + $input = "FCECDFCAAB"; + $expected = "Whoa, chill out!"; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -50,7 +51,10 @@ public function testShoutingGibberish(): void */ public function testAskingAQuestion(): void { - $this->assertEquals("Sure.", $this->bob->respondTo("Does this cryogenic chamber make me look fat?")); + $input = "Does this cryogenic chamber make me look fat?"; + $expected = "Sure."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -59,7 +63,10 @@ public function testAskingAQuestion(): void */ public function testAskingANumericQuestion(): void { - $this->assertEquals("Sure.", $this->bob->respondTo("You are, what, like 15?")); + $input = "You are, what, like 15?"; + $expected = "Sure."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -68,7 +75,10 @@ public function testAskingANumericQuestion(): void */ public function testAskingGibberish(): void { - $this->assertEquals("Sure.", $this->bob->respondTo("fffbbcbeab?")); + $input = "fffbbcbeab?"; + $expected = "Sure."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -77,7 +87,10 @@ public function testAskingGibberish(): void */ public function testTalkingForcefully(): void { - $this->assertEquals("Whatever.", $this->bob->respondTo("Hi there!")); + $input = "Hi there!"; + $expected = "Whatever."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -86,7 +99,10 @@ public function testTalkingForcefully(): void */ public function testUsingAcronymsInRegularSpeech(): void { - $this->assertEquals("Whatever.", $this->bob->respondTo("It's OK if you don't want to go work for NASA.")); + $input = "It's OK if you don't want to go work for NASA."; + $expected = "Whatever."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -95,13 +111,10 @@ public function testUsingAcronymsInRegularSpeech(): void */ public function testForcefulQuestion(): void { - $this->assertEquals( - "Calm down, I know what I'm doing!", - $this->bob->respondTo("WHAT'S GOING ON?") - ); - "Calm down, I know what I'm doing!", - $this->bob->respondTo("WHAT THE HELL WERE YOU THINKING?") - ); + $input = "WHAT'S GOING ON?"; + $expected = "Calm down, I know what I'm doing!"; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -110,7 +123,10 @@ public function testForcefulQuestion(): void */ public function testShoutingNumbers(): void { - $this->assertEquals("Whoa, chill out!", $this->bob->respondTo("1, 2, 3 GO!")); + $input = "1, 2, 3 GO!"; + $expected = "Whoa, chill out!"; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -119,7 +135,10 @@ public function testShoutingNumbers(): void */ public function testOnlyNumbers(): void { - $this->assertEquals("Whatever.", $this->bob->respondTo("1, 2, 3")); + $input = "1, 2, 3"; + $expected = "Whatever."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -128,7 +147,10 @@ public function testOnlyNumbers(): void */ public function testQuestionWithOnlyNumbers(): void { - $this->assertEquals("Sure.", $this->bob->respondTo("4?")); + $input = "4?"; + $expected = "Sure."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -137,7 +159,10 @@ public function testQuestionWithOnlyNumbers(): void */ public function testShoutingWithSpecialCharacters(): void { - $this->assertEquals("Whoa, chill out!", $this->bob->respondTo("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!")); + $input = "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"; + $expected = "Whoa, chill out!"; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -146,7 +171,10 @@ public function testShoutingWithSpecialCharacters(): void */ public function testShoutingWithNoExclamationMark(): void { - $this->assertEquals("Whoa, chill out!", $this->bob->respondTo("I HATE THE DENTIST")); + $input = "I HATE THE DENTIST"; + $expected = "Whoa, chill out!"; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -155,7 +183,10 @@ public function testShoutingWithNoExclamationMark(): void */ public function testStatementContainingQuestionMark(): void { - $this->assertEquals("Whatever.", $this->bob->respondTo("Ending with ? means a question.")); + $input = "Ending with ? means a question."; + $expected = "Whatever."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -164,7 +195,10 @@ public function testStatementContainingQuestionMark(): void */ public function testNonLettersWithQuestion(): void { - $this->assertEquals("Sure.", $this->bob->respondTo(":) ?")); + $input = ":) ?"; + $expected = "Sure."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -173,7 +207,10 @@ public function testNonLettersWithQuestion(): void */ public function testPrattlingOn(): void { - $this->assertEquals("Sure.", $this->bob->respondTo("Wait! Hang on. Are you going to be OK?")); + $input = "Wait! Hang on. Are you going to be OK?"; + $expected = "Sure."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -182,7 +219,10 @@ public function testPrattlingOn(): void */ public function testSilence(): void { - $this->assertEquals("Fine. Be that way!", $this->bob->respondTo("")); + $input = ""; + $expected = "Fine. Be that way!"; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -191,7 +231,10 @@ public function testSilence(): void */ public function testProlongedSilence(): void { - $this->assertEquals("Fine. Be that way!", $this->bob->respondTo(" ")); + $input = " "; + $expected = "Fine. Be that way!"; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -200,7 +243,10 @@ public function testProlongedSilence(): void */ public function testAlternateSilence(): void { - $this->assertEquals("Fine. Be that way!", $this->bob->respondTo("\t\t\t\t\t\t\t\t\t\t")); + $input = "\t\t\t\t\t\t\t\t\t\t"; + $expected = "Fine. Be that way!"; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -209,7 +255,10 @@ public function testAlternateSilence(): void */ public function testMultipleLineQuestion(): void { - $this->assertEquals("Whatever.", $this->bob->respondTo("\nDoes this cryogenic chamber make me look fat?\nno")); + $input = "\nDoes this cryogenic chamber make me look fat?\nNo."; + $expected = "Whatever."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -218,7 +267,10 @@ public function testMultipleLineQuestion(): void */ public function testStartingWithWhitespace(): void { - $this->assertEquals("Whatever.", $this->bob->respondTo(" hmmmmmmm...")); + $input = " hmmmmmmm..."; + $expected = "Whatever."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -227,7 +279,10 @@ public function testStartingWithWhitespace(): void */ public function testEndingWithWhitespace(): void { - $this->assertEquals("Sure.", $this->bob->respondTo("Okay if like my spacebar quite a bit? ")); + $input = "Okay if like my spacebar quite a bit? "; + $expected = "Sure."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -236,7 +291,10 @@ public function testEndingWithWhitespace(): void */ public function testOtherWhitespace() { - $this->assertEquals("Fine. Be that way!", $this->bob->respondTo("\n\r \t")); + $input = "\n\r \t"; + $expected = "Fine. Be that way!"; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } /** @@ -245,6 +303,9 @@ public function testOtherWhitespace() */ public function testNonQuestionEndingWithWhitespace(): void { - $this->assertEquals("Whatever.", $this->bob->respondTo("This is a statement ending with whitespace ")); + $input = "This is a statement ending with whitespace "; + $expected = "Whatever."; + $subject = new Bob(); + $this->assertEquals($expected, $subject->respondTo($input)); } }