From 88c3890fa496696fcad7220c08a1a2bd2fe9466b Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Fri, 27 Jul 2018 23:20:56 -0500 Subject: [PATCH 01/14] test for profanity --- app/Http/Requests/ShowUpdateRequest.php | 3 +- app/Rules/Profanity.php | 62 +++++++++++++++++++++++++ config/defaults.php | 17 +++++++ tests/Feature/CustomRuleTest.php | 41 ++++++++++++++++ 4 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 app/Rules/Profanity.php diff --git a/app/Http/Requests/ShowUpdateRequest.php b/app/Http/Requests/ShowUpdateRequest.php index 62ceea1b..4da40dc8 100644 --- a/app/Http/Requests/ShowUpdateRequest.php +++ b/app/Http/Requests/ShowUpdateRequest.php @@ -3,6 +3,7 @@ namespace KRLX\Http\Requests; use KRLX\Track; +use KRLX\Rules\Profanity; use Illuminate\Foundation\Http\FormRequest; class ShowUpdateRequest extends FormRequest @@ -49,7 +50,7 @@ protected function baseRules() { $baseRules = [ 'submitted' => ['boolean'], - 'title' => ['string', 'min:3', 'max:200'], + 'title' => ['string', 'min:3', 'max:200', new Profanity], 'content' => ['array'], 'scheduling' => ['array'], 'conflicts' => ['array', 'min:0'], diff --git a/app/Rules/Profanity.php b/app/Rules/Profanity.php new file mode 100644 index 00000000..f69250e0 --- /dev/null +++ b/app/Rules/Profanity.php @@ -0,0 +1,62 @@ +word = $bad_word; + return false; + } + } + + foreach(config('defaults.banned_words.partial') as $bad_word) { + if(strpos(strtolower($value), $bad_word) !== false or strpos(strtolower($value), str_plural($bad_word)) !== false) { + $this->word = $bad_word; + return false; + } + } + + return true; + } + + /** + * Get the validation error message. + * + * @return string + */ + public function message() + { + return "The word {$this->word} can't appear in the :attribute."; + } +} diff --git a/config/defaults.php b/config/defaults.php index 4f94daab..4a6fd34d 100644 --- a/config/defaults.php +++ b/config/defaults.php @@ -1,6 +1,23 @@ [ + /** + * The following words are not allowed in show titles, or any other + * custom validation field that has a "profanity" flag on it. This list + * is adapted from the UK Office of Communications' 2010 study on + * acceptable language to use in broadcasting. Presence of any of these + * strings, even in longer words, will throw a validation fault. + */ + 'partial' => ['shit', 'piss', 'fuck', 'cunt', 'cock', 'tit', 'bitch', 'bastard'], + + /** + * These words must be present in isolation to trigger a fault (usually + * because there are "safe" words that include these strings, such as + * "pass" being a safe word) + */ + 'full' => ['ass', 'asshole', 'pussy'], + ], 'directory' => 'https://apps.carleton.edu/stock/ldapimage.php?id=', 'title' => 'KRLX Community', 'salt' => env('OAUTH_SALT', 'krlx'), diff --git a/tests/Feature/CustomRuleTest.php b/tests/Feature/CustomRuleTest.php index 4964e6dd..7edfa199 100644 --- a/tests/Feature/CustomRuleTest.php +++ b/tests/Feature/CustomRuleTest.php @@ -2,6 +2,8 @@ namespace Tests\Feature; +use KRLX\Show; +use KRLX\User; use KRLX\Track; use Tests\TestCase; use Illuminate\Foundation\Testing\RefreshDatabase; @@ -39,4 +41,43 @@ public function testValidationRuleValidationRule() $this->assertEquals(422, $request->status(), "Did not receive HTTP 422 on rule $rule."); } } + + /** + * Test the "Profanity" validation rule: Does a string contain bad words? + * + * @return void + */ + public function testProfanityRule() + { + $show = factory(Show::class)->create(); + $user = factory(User::class)->create(); + $show->hosts()->attach($user, ['accepted' => true]); + + $partial = config('defaults.banned_words.partial')[0]; + $full = config('defaults.banned_words.full')[0]; + $bad_words = [ + $partial, + $partial.'hole', + str_plural($partial), + $full, + str_plural($full) + ]; + $good_words = [ + 'prefix'.$full, + 'hole' + ]; + foreach($good_words as $word) { + $request = $this->actingAs($user, 'api')->json('PATCH', "/api/v1/shows/{$show->id}", [ + 'title' => $word + ]); + $this->assertEquals(200, $request->status(), "Did not receive HTTP 200 with word $word."); + } + foreach($bad_words as $word) { + $request = $this->actingAs($user, 'api')->json('PATCH', "/api/v1/shows/{$show->id}", [ + 'title' => $word + ]); + $this->assertEquals(422, $request->status(), "Did not receive HTTP 422 with word $word."); + $this->assertNotEquals('The word can\'t appear in the title', array_get($request->json(), 'errors.title.0')); + } + } } From e9a2f5274eeebad56a3739585845ffc2e21aafc7 Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Sat, 28 Jul 2018 04:21:28 +0000 Subject: [PATCH 02/14] Apply fixes from StyleCI --- app/Rules/Profanity.php | 10 ++++++---- config/defaults.php | 4 ++-- tests/Feature/CustomRuleTest.php | 12 ++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/Rules/Profanity.php b/app/Rules/Profanity.php index f69250e0..c75c1c95 100644 --- a/app/Rules/Profanity.php +++ b/app/Rules/Profanity.php @@ -33,16 +33,18 @@ public function __construct() public function passes($attribute, $value) { $words = explode(' ', strtolower($value)); - foreach(array_merge(config('defaults.banned_words.full'), config('defaults.banned_words.partial')) as $bad_word) { - if(in_array($bad_word, $words) or in_array(str_plural($bad_word), $words)) { + foreach (array_merge(config('defaults.banned_words.full'), config('defaults.banned_words.partial')) as $bad_word) { + if (in_array($bad_word, $words) or in_array(str_plural($bad_word), $words)) { $this->word = $bad_word; + return false; } } - foreach(config('defaults.banned_words.partial') as $bad_word) { - if(strpos(strtolower($value), $bad_word) !== false or strpos(strtolower($value), str_plural($bad_word)) !== false) { + foreach (config('defaults.banned_words.partial') as $bad_word) { + if (strpos(strtolower($value), $bad_word) !== false or strpos(strtolower($value), str_plural($bad_word)) !== false) { $this->word = $bad_word; + return false; } } diff --git a/config/defaults.php b/config/defaults.php index 4a6fd34d..e4218cd2 100644 --- a/config/defaults.php +++ b/config/defaults.php @@ -2,7 +2,7 @@ return [ 'banned_words' => [ - /** + /* * The following words are not allowed in show titles, or any other * custom validation field that has a "profanity" flag on it. This list * is adapted from the UK Office of Communications' 2010 study on @@ -11,7 +11,7 @@ */ 'partial' => ['shit', 'piss', 'fuck', 'cunt', 'cock', 'tit', 'bitch', 'bastard'], - /** + /* * These words must be present in isolation to trigger a fault (usually * because there are "safe" words that include these strings, such as * "pass" being a safe word) diff --git a/tests/Feature/CustomRuleTest.php b/tests/Feature/CustomRuleTest.php index 7edfa199..7ed9f465 100644 --- a/tests/Feature/CustomRuleTest.php +++ b/tests/Feature/CustomRuleTest.php @@ -60,21 +60,21 @@ public function testProfanityRule() $partial.'hole', str_plural($partial), $full, - str_plural($full) + str_plural($full), ]; $good_words = [ 'prefix'.$full, - 'hole' + 'hole', ]; - foreach($good_words as $word) { + foreach ($good_words as $word) { $request = $this->actingAs($user, 'api')->json('PATCH', "/api/v1/shows/{$show->id}", [ - 'title' => $word + 'title' => $word, ]); $this->assertEquals(200, $request->status(), "Did not receive HTTP 200 with word $word."); } - foreach($bad_words as $word) { + foreach ($bad_words as $word) { $request = $this->actingAs($user, 'api')->json('PATCH', "/api/v1/shows/{$show->id}", [ - 'title' => $word + 'title' => $word, ]); $this->assertEquals(422, $request->status(), "Did not receive HTTP 422 with word $word."); $this->assertNotEquals('The word can\'t appear in the title', array_get($request->json(), 'errors.title.0')); From 0ee4e6d8d1063c627770617fa544c4a69a5b786e Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Fri, 27 Jul 2018 23:25:03 -0500 Subject: [PATCH 03/14] add test word --- tests/Feature/CustomRuleTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Feature/CustomRuleTest.php b/tests/Feature/CustomRuleTest.php index 7ed9f465..4ab40699 100644 --- a/tests/Feature/CustomRuleTest.php +++ b/tests/Feature/CustomRuleTest.php @@ -61,6 +61,7 @@ public function testProfanityRule() str_plural($partial), $full, str_plural($full), + 'F***', ]; $good_words = [ 'prefix'.$full, From 491b41db4c2211b9424a02c4b6eba6f89b960c0d Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Fri, 27 Jul 2018 23:30:43 -0500 Subject: [PATCH 04/14] refactor to catch words where most characters are replaced with asterisks --- app/Rules/Profanity.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/app/Rules/Profanity.php b/app/Rules/Profanity.php index c75c1c95..b5b00d62 100644 --- a/app/Rules/Profanity.php +++ b/app/Rules/Profanity.php @@ -33,19 +33,28 @@ public function __construct() public function passes($attribute, $value) { $words = explode(' ', strtolower($value)); - foreach (array_merge(config('defaults.banned_words.full'), config('defaults.banned_words.partial')) as $bad_word) { - if (in_array($bad_word, $words) or in_array(str_plural($bad_word), $words)) { + foreach(array_merge(config('defaults.banned_words.full'), config('defaults.banned_words.partial')) as $bad_word) { + if(in_array($bad_word, $words) or in_array(str_plural($bad_word), $words)) { $this->word = $bad_word; - return false; } } - foreach (config('defaults.banned_words.partial') as $bad_word) { - if (strpos(strtolower($value), $bad_word) !== false or strpos(strtolower($value), str_plural($bad_word)) !== false) { - $this->word = $bad_word; - - return false; + $bad_words = []; + foreach(config('defaults.banned_words.partial') as $bad_word) { + $bad_words[$bad_word] = [ + $bad_word, + str_plural($bad_word), + $bad_word[0].str_repeat('*', strlen($bad_word)-1), + $bad_word[0].str_repeat('*', strlen($bad_word)-1).$bad_word[-1] + ]; + } + foreach($bad_words as $word => $derivatives) { + foreach($derivatives as $derivative) { + if(strpos(strtolower($value), $derivative) !== false) { + $this->word = $word; + return false; + } } } From 9b08ccf8d731fbdb311f6b44feac76cf994f52ef Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Fri, 27 Jul 2018 23:37:41 -0500 Subject: [PATCH 05/14] add new character filters --- app/Rules/Profanity.php | 5 +++-- tests/Feature/CustomRuleTest.php | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Rules/Profanity.php b/app/Rules/Profanity.php index b5b00d62..00996493 100644 --- a/app/Rules/Profanity.php +++ b/app/Rules/Profanity.php @@ -46,12 +46,13 @@ public function passes($attribute, $value) $bad_word, str_plural($bad_word), $bad_word[0].str_repeat('*', strlen($bad_word)-1), - $bad_word[0].str_repeat('*', strlen($bad_word)-1).$bad_word[-1] + $bad_word[0].str_repeat('*', strlen($bad_word)-2).$bad_word[-1] ]; } + $target = preg_replace('/[!@#\$%\^]/', '*', strtolower($value)); foreach($bad_words as $word => $derivatives) { foreach($derivatives as $derivative) { - if(strpos(strtolower($value), $derivative) !== false) { + if(strpos($target, $derivative) !== false) { $this->word = $word; return false; } diff --git a/tests/Feature/CustomRuleTest.php b/tests/Feature/CustomRuleTest.php index 4ab40699..8444aa82 100644 --- a/tests/Feature/CustomRuleTest.php +++ b/tests/Feature/CustomRuleTest.php @@ -62,6 +62,8 @@ public function testProfanityRule() $full, str_plural($full), 'F***', + 'F**k', + 'F@$#', ]; $good_words = [ 'prefix'.$full, From 1cd7de5ee22990eea668aa33701776b5272b34ab Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Fri, 27 Jul 2018 23:39:47 -0500 Subject: [PATCH 06/14] allow exclamation points --- app/Rules/Profanity.php | 2 +- tests/Feature/CustomRuleTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Rules/Profanity.php b/app/Rules/Profanity.php index 00996493..3f701221 100644 --- a/app/Rules/Profanity.php +++ b/app/Rules/Profanity.php @@ -49,7 +49,7 @@ public function passes($attribute, $value) $bad_word[0].str_repeat('*', strlen($bad_word)-2).$bad_word[-1] ]; } - $target = preg_replace('/[!@#\$%\^]/', '*', strtolower($value)); + $target = preg_replace('/[@#\$%\^]/', '*', strtolower($value)); foreach($bad_words as $word => $derivatives) { foreach($derivatives as $derivative) { if(strpos($target, $derivative) !== false) { diff --git a/tests/Feature/CustomRuleTest.php b/tests/Feature/CustomRuleTest.php index 8444aa82..d047a6eb 100644 --- a/tests/Feature/CustomRuleTest.php +++ b/tests/Feature/CustomRuleTest.php @@ -68,6 +68,7 @@ public function testProfanityRule() $good_words = [ 'prefix'.$full, 'hole', + 'pals!!!', ]; foreach ($good_words as $word) { $request = $this->actingAs($user, 'api')->json('PATCH', "/api/v1/shows/{$show->id}", [ From 0f1810ff783fe5be11a5eac7450276288e932396 Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Sat, 28 Jul 2018 04:40:35 +0000 Subject: [PATCH 07/14] Apply fixes from StyleCI --- app/Rules/Profanity.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/Rules/Profanity.php b/app/Rules/Profanity.php index 3f701221..fc3281df 100644 --- a/app/Rules/Profanity.php +++ b/app/Rules/Profanity.php @@ -33,27 +33,29 @@ public function __construct() public function passes($attribute, $value) { $words = explode(' ', strtolower($value)); - foreach(array_merge(config('defaults.banned_words.full'), config('defaults.banned_words.partial')) as $bad_word) { - if(in_array($bad_word, $words) or in_array(str_plural($bad_word), $words)) { + foreach (array_merge(config('defaults.banned_words.full'), config('defaults.banned_words.partial')) as $bad_word) { + if (in_array($bad_word, $words) or in_array(str_plural($bad_word), $words)) { $this->word = $bad_word; + return false; } } $bad_words = []; - foreach(config('defaults.banned_words.partial') as $bad_word) { + foreach (config('defaults.banned_words.partial') as $bad_word) { $bad_words[$bad_word] = [ $bad_word, str_plural($bad_word), - $bad_word[0].str_repeat('*', strlen($bad_word)-1), - $bad_word[0].str_repeat('*', strlen($bad_word)-2).$bad_word[-1] + $bad_word[0].str_repeat('*', strlen($bad_word) - 1), + $bad_word[0].str_repeat('*', strlen($bad_word) - 2).$bad_word[-1], ]; } $target = preg_replace('/[@#\$%\^]/', '*', strtolower($value)); - foreach($bad_words as $word => $derivatives) { - foreach($derivatives as $derivative) { - if(strpos($target, $derivative) !== false) { + foreach ($bad_words as $word => $derivatives) { + foreach ($derivatives as $derivative) { + if (strpos($target, $derivative) !== false) { $this->word = $word; + return false; } } From e8d14a91d18b588044f82bc24bef956b9fc26309 Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Fri, 27 Jul 2018 23:44:45 -0500 Subject: [PATCH 08/14] split function in twain, thanks code climate --- app/Rules/Profanity.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/Rules/Profanity.php b/app/Rules/Profanity.php index fc3281df..dafbb19a 100644 --- a/app/Rules/Profanity.php +++ b/app/Rules/Profanity.php @@ -41,6 +41,18 @@ public function passes($attribute, $value) } } + return $this->partialWordsPass($value); + } + + /** + * Check the partial words - these are words which could appear as they + * normally are, or in any number of creative derivatives. + * + * @param mixed $value + * @return bool + */ + protected function partialWordsPass($value) + { $bad_words = []; foreach (config('defaults.banned_words.partial') as $bad_word) { $bad_words[$bad_word] = [ From f03f2e287679344b756c079b102f2a10c1336369 Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Fri, 27 Jul 2018 23:46:21 -0500 Subject: [PATCH 09/14] FINE --- app/Rules/Profanity.php | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/app/Rules/Profanity.php b/app/Rules/Profanity.php index dafbb19a..53dc613e 100644 --- a/app/Rules/Profanity.php +++ b/app/Rules/Profanity.php @@ -53,15 +53,7 @@ public function passes($attribute, $value) */ protected function partialWordsPass($value) { - $bad_words = []; - foreach (config('defaults.banned_words.partial') as $bad_word) { - $bad_words[$bad_word] = [ - $bad_word, - str_plural($bad_word), - $bad_word[0].str_repeat('*', strlen($bad_word) - 1), - $bad_word[0].str_repeat('*', strlen($bad_word) - 2).$bad_word[-1], - ]; - } + $bad_words = $this->assembleDerivatives(); $target = preg_replace('/[@#\$%\^]/', '*', strtolower($value)); foreach ($bad_words as $word => $derivatives) { foreach ($derivatives as $derivative) { @@ -76,6 +68,25 @@ protected function partialWordsPass($value) return true; } + /** + * Assemble the derivatives list used in partial word validation. + * + * @return array + */ + protected function assembleDerivatives() + { + $bad_words = []; + foreach (config('defaults.banned_words.partial') as $bad_word) { + $bad_words[$bad_word] = [ + $bad_word, + str_plural($bad_word), + $bad_word[0].str_repeat('*', strlen($bad_word) - 1), + $bad_word[0].str_repeat('*', strlen($bad_word) - 2).$bad_word[-1], + ]; + } + return $bad_words; + } + /** * Get the validation error message. * From 1f660d3308315035752b8d4ed314e50bea91eeb5 Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Sat, 28 Jul 2018 04:46:32 +0000 Subject: [PATCH 10/14] Apply fixes from StyleCI --- app/Rules/Profanity.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Rules/Profanity.php b/app/Rules/Profanity.php index 53dc613e..1361a03b 100644 --- a/app/Rules/Profanity.php +++ b/app/Rules/Profanity.php @@ -84,6 +84,7 @@ protected function assembleDerivatives() $bad_word[0].str_repeat('*', strlen($bad_word) - 2).$bad_word[-1], ]; } + return $bad_words; } From 747fcb05b33ed5a280e932a928bf44845a5d12ca Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Fri, 27 Jul 2018 23:52:30 -0500 Subject: [PATCH 11/14] how about now --- app/Rules/Profanity.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Rules/Profanity.php b/app/Rules/Profanity.php index 53dc613e..e829929c 100644 --- a/app/Rules/Profanity.php +++ b/app/Rules/Profanity.php @@ -32,7 +32,8 @@ public function __construct() */ public function passes($attribute, $value) { - $words = explode(' ', strtolower($value)); + $target = preg_replace('/[@#\$%\^]/', '*', strtolower($value)); + $words = explode(' ', $target); foreach (array_merge(config('defaults.banned_words.full'), config('defaults.banned_words.partial')) as $bad_word) { if (in_array($bad_word, $words) or in_array(str_plural($bad_word), $words)) { $this->word = $bad_word; @@ -41,7 +42,7 @@ public function passes($attribute, $value) } } - return $this->partialWordsPass($value); + return $this->partialWordsPass($target); } /** @@ -53,9 +54,7 @@ public function passes($attribute, $value) */ protected function partialWordsPass($value) { - $bad_words = $this->assembleDerivatives(); - $target = preg_replace('/[@#\$%\^]/', '*', strtolower($value)); - foreach ($bad_words as $word => $derivatives) { + foreach ($this->assembleDerivatives() as $word => $derivatives) { foreach ($derivatives as $derivative) { if (strpos($target, $derivative) !== false) { $this->word = $word; From 1ef27f73d113fb88a57dfe1675e52f746ab1dedd Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Fri, 27 Jul 2018 23:58:47 -0500 Subject: [PATCH 12/14] fix travis and code climate --- app/Rules/Profanity.php | 30 ++++++++++++++++++++++++------ tests/Feature/CustomRuleTest.php | 3 +++ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/app/Rules/Profanity.php b/app/Rules/Profanity.php index 00156afe..41de84b8 100644 --- a/app/Rules/Profanity.php +++ b/app/Rules/Profanity.php @@ -54,13 +54,31 @@ public function passes($attribute, $value) */ protected function partialWordsPass($value) { - foreach ($this->assembleDerivatives() as $word => $derivatives) { - foreach ($derivatives as $derivative) { - if (strpos($target, $derivative) !== false) { - $this->word = $word; + $bad_words = $this->assembleDerivatives(); + foreach ($bad_words as $word => $derivatives) { + if (! singleWordDerivativesPass($word, $derivatives, $value)) { + return false; + } + } - return false; - } + return true; + } + + /** + * Check if a single word's derivatives show up. + * + * @param string $word + * @param array $derivatives + * @param string $value + * @return bool + */ + private function singleWordDerivativesPass($word, $derivatives, $value) + { + foreach ($derivatives as $derivative) { + if (strpos($value, $derivative) !== false) { + $this->word = $word; + + return false; } } diff --git a/tests/Feature/CustomRuleTest.php b/tests/Feature/CustomRuleTest.php index d047a6eb..3f5d7de8 100644 --- a/tests/Feature/CustomRuleTest.php +++ b/tests/Feature/CustomRuleTest.php @@ -74,6 +74,9 @@ public function testProfanityRule() $request = $this->actingAs($user, 'api')->json('PATCH', "/api/v1/shows/{$show->id}", [ 'title' => $word, ]); + if($request->status() == 500) { + dump($request->json()); + } $this->assertEquals(200, $request->status(), "Did not receive HTTP 200 with word $word."); } foreach ($bad_words as $word) { From cc14cdfb8f8666877703ad53aa751c9cbd24af85 Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Sat, 28 Jul 2018 04:58:59 +0000 Subject: [PATCH 13/14] Apply fixes from StyleCI --- tests/Feature/CustomRuleTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Feature/CustomRuleTest.php b/tests/Feature/CustomRuleTest.php index 3f5d7de8..b5d0eaf0 100644 --- a/tests/Feature/CustomRuleTest.php +++ b/tests/Feature/CustomRuleTest.php @@ -74,7 +74,7 @@ public function testProfanityRule() $request = $this->actingAs($user, 'api')->json('PATCH', "/api/v1/shows/{$show->id}", [ 'title' => $word, ]); - if($request->status() == 500) { + if ($request->status() == 500) { dump($request->json()); } $this->assertEquals(200, $request->status(), "Did not receive HTTP 200 with word $word."); From 9475060325f827a5783141fc326411d015897928 Mon Sep 17 00:00:00 2001 From: Tate Bosler Date: Sat, 28 Jul 2018 00:02:11 -0500 Subject: [PATCH 14/14] put $this in front of an instance function, dumbass --- app/Rules/Profanity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Rules/Profanity.php b/app/Rules/Profanity.php index 41de84b8..27809ceb 100644 --- a/app/Rules/Profanity.php +++ b/app/Rules/Profanity.php @@ -56,7 +56,7 @@ protected function partialWordsPass($value) { $bad_words = $this->assembleDerivatives(); foreach ($bad_words as $word => $derivatives) { - if (! singleWordDerivativesPass($word, $derivatives, $value)) { + if (! $this->singleWordDerivativesPass($word, $derivatives, $value)) { return false; } }