pickles/tests/classes/API/Google/ProfanityTest.php
Joshua Sherman 5d7f3a0e5a Added an injectable endpoint
Allows for injecting endpoints to simulate poor responses while still testing
the responses from the actual endpoint.
2014-01-11 19:07:29 -05:00

52 lines
922 B
PHP

<?php
class API_Google_ProfanityTest extends PHPUnit_Framework_TestCase
{
/**
* @dataProvider providerFormatPhoneNumber
*/
public function testCheck($a, $b)
{
$this->assertEquals($b, API_Google_Profanity::check($a));
}
public function providerFormatPhoneNumber()
{
return [
['alpha', false],
['beta', false],
['joshtronic', false],
['god', false],
['fck', false],
['fuck', true],
['shit', true],
['cocksucker', true],
['cuntface', false], // Unsure why not...
];
}
/**
* @expectedException Exception
* @expectedExceptionMessage Invalid response from API.
*/
public function testNullResponse()
{
$file = SITE_PATH . 'null-';
file_put_contents($file . 'test', null);
API_Google_Profanity::check('test', $file);
}
public function testMissingResponse()
{
}
public function testInvalidResponse()
{
}
}
?>