Dropped AYAH
Going to merge into my AYAH library eventually. For now just need to remove it
This commit is contained in:
parent
5f2eaead10
commit
0090adef7c
3 changed files with 1 additions and 95 deletions
|
@ -21,8 +21,7 @@
|
|||
"satooshi/php-coveralls": "dev-master"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"joshtronic/php-ayah": "dev-master"
|
||||
"php": ">=5.4"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": ["src/"]
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Are You A Human Class File for PICKLES
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistribution of these files must retain the above copyright notice.
|
||||
*
|
||||
* @author Josh Sherman <josh@gravityblvd.com>
|
||||
* @copyright Copyright 2007-2014, Josh Sherman
|
||||
* @license http://www.opensource.org/licenses/mit-license.html
|
||||
* @package PICKLES
|
||||
* @link https://github.com/joshtronic/pickles
|
||||
*/
|
||||
|
||||
/**
|
||||
* Are You A Human API Interface
|
||||
*
|
||||
* @link http://areyouahuman.com
|
||||
*/
|
||||
class API_AYAH
|
||||
{
|
||||
public static function getHTML()
|
||||
{
|
||||
$config = Config::getInstance();
|
||||
|
||||
if (!$config->api['ayah'])
|
||||
{
|
||||
throw new Exception('Missing API configuration.');
|
||||
}
|
||||
|
||||
$ayah = new AYAH($config->api['ayah']);
|
||||
|
||||
return $ayah->getPublisherHTML();
|
||||
}
|
||||
|
||||
public static function isHuman()
|
||||
{
|
||||
$config = Config::getInstance();
|
||||
|
||||
if (!$config->api['ayah'])
|
||||
{
|
||||
throw new Exception('Missing API configuration.');
|
||||
}
|
||||
|
||||
$ayah = new AYAH($config->api['ayah']);
|
||||
|
||||
return $ayah->scoreResult();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
|
||||
class API_AYAHTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Missing API configuration
|
||||
*/
|
||||
public function testGetHTMLMissingConfig()
|
||||
{
|
||||
API_AYAH::getHTML();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Missing API configuration
|
||||
*/
|
||||
public function testIsHumanMissingConfig()
|
||||
{
|
||||
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}(\/[a-zA-Z0-9]{45})?\' 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