Last active
December 19, 2018 01:58
-
-
Save em7v/cd02c85b32f670631b65932739a49b2e to your computer and use it in GitHub Desktop.
HappyHappy Bender
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param string $happyWords Happy Words!!! | |
* @return string Unhappy Words 😢😢😢 | |
*/ | |
function stealingSmiles(string $happyWords): string | |
{ | |
return preg_replace('/(\){2,})/', ')', $happyWords); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace Tests\Unit; | |
use Tests\TestCase; | |
class HappyWordsTest extends TestCase | |
{ | |
public function testHappyWords() | |
{ | |
$helloBender = <<<EOT | |
Bender Bending Rodríguez (designated ))in-universe as Bending Unit 22, unit number 1,729, serial number 2716057) | |
is a fictional character who is one of the main characters in the animated television series Futurama. He was created by | |
series creators Matt Groening and David)) X. Cohen and is voiced by John DiMaggio. He fulfills a comic, antihero-type | |
role in Futurama and is descr))))ibed by fellow character Leela as an "alcoholic, whore-mongering, chain-smoking gambler". | |
According to the character's backstory, Bender was built in Tijuana, Mexico (the other characters refer to his "swarthy | |
Latin charm"). Viewers are informed, through his own testimony, of Bender's prejudice against non-robots. | |
For example, one of his signature)) expressions is "kill all humans". Exceptions who are not subject to | |
Bender's prejudicial attitude are t))hose individuals on his "Do Not Kill" list, which seems to comprise only his best | |
friend Philip J. Fry and his colleague Hermes Conrad (Hermes is added after the episode "Lethal Inspection"). | |
However, Bender is also occasionally portrayed as possessing a sympathetic side, suggesting that he is not as | |
belligerent as he claims, a view often echoed by his friends | |
EOT; | |
$unhappy = stealingSmiles($helloBender); | |
$this->assertEquals(-1, strpos($unhappy, '))')); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment