Skip to content

Instantly share code, notes, and snippets.

@StyxOfDynamite
Last active May 8, 2017 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StyxOfDynamite/7d0a84b8faf177c8282ae16e719217bb to your computer and use it in GitHub Desktop.
Save StyxOfDynamite/7d0a84b8faf177c8282ae16e719217bb to your computer and use it in GitHub Desktop.
Testing Profanity Filter.
<?php
class ProfanityTest extends TestCase {
protected $filter;
public function setUp()
{
$this->filter = new ProfanityFilter();
}
public function testTrue()
{
$this->assertTrue(true);
}
public function testIsNaughty()
{
$review = new Review();
$review->title = 'fuck this was rubbish.';
$this->assertTrue($this->filter->isNaughty($review));
}
public function testIsNice()
{
$rev = new Review();
$rev->title = 'Flip. this was nice.';
$this->assertFalse($this->filter->isNaughty($review));
}
}
?>
<?php
class ProfanityTest extends TestCase {
public function testTrue()
{
$this->assertTrue(true);
}
public function testIsNaughty()
{
$pf = new ProfanityFilter();
$review = new Review();
$review->title = 'fuck this was rubbish.';
$this->assertTrue($pf->isNaughty($review));
}
public function testIsNice()
{
$pf = new ProfanityFilter();
$rev = new Review();
$rev->title = 'Flip. this was nice.';
$this->assertFalse($pf->isNaughty($review));
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment