Added better test coverage to the AYAH class
This commit is contained in:
parent
549abca8df
commit
abe73f66a4
1 changed files with 17 additions and 0 deletions
|
@ -19,6 +19,23 @@ class API_AYAHTest extends PHPUnit_Framework_TestCase
|
|||
{
|
||||
API_AYAH::isHuman();
|
||||
}
|
||||
|
||||
public function testGetHTML()
|
||||
{
|
||||
$config = Config::getInstance();
|
||||
$config->data['api']['ayah'] = [
|
||||
'publisher_key' => '01f70454bada303692be5f36a8fd104eba8b00dd',
|
||||
'scoring_key' => '80cc3f9c6e1da29369c238d55bd8528a968473ad',
|
||||
];
|
||||
|
||||
$this->assertRegExp('/<div id=\'AYAH\'><\/div><script src=\'https:\/\/ws.areyouahuman.com\/ws\/script\/[a-z0-9]{40}\/ip[a-zA-Z0-9]{43}\' type=\'text\/javascript\' language=\'JavaScript\'><\/script>/', API_AYAH::getHTML());
|
||||
}
|
||||
|
||||
public function testIsNotHuman()
|
||||
{
|
||||
// Unfortunately there's no way to test a true response (mock maybe?)
|
||||
$this->assertFalse(API_AYAH::isHuman());
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue