Source for file Services_Trackback_SpamCheck_Akismet_Test.php
Documentation is available at Services_Trackback_SpamCheck_Akismet_Test.php
// Services_Trackback classes
require_once 'Services/Trackback.php';
require_once 'Services/Trackback/SpamCheck.php';
require_once 'Services/Trackback/SpamCheck/Akismet.php';
require_once 'PHPUnit.php';
require_once dirname (__FILE__ ). '/trackback_data.php';
require_once 'test/akismet_key.php';
class Webservices_Trackback_SpamCheck_Akismet_TestCase extends PHPUnit_TestCase
var $trackbacks = array ();
// {{{ Webservices_Trackback_SpamCheck_Akismet_TestCase()
// constructor of the test suite
function Webservices_Trackback_SpamCheck_Akismet_TestCase ($name) {
$this->PHPUnit_TestCase ($name);
if (!isset ($akismetApiKey) || $akismetApiKey === false ) {
foreach ($trackbackData as $id => $set) {
$this->trackbacks[$id]->set (
'REFERER' => 'http://www.example.com',
'url' => 'http://www.schlitt.info/applications/blog/',
$this->assertTrue ($this->spamCheck == $realCheck);
function test_check_failure_nospam () {
$this->assertFalse ($this->spamCheck->check ($this->trackbacks['nospam']));
function test_check_failure_undetected () {
$this->assertFalse ($this->spamCheck->check ($this->trackbacks['undetected']));
function test_check_success_all () {
$this->assertTrue ($this->spamCheck->check ($this->trackbacks['all']));
function test_getResults () {
$this->spamCheck->check ($this->trackbacks['all']);
$results = $this->spamCheck->getResults ();
$this->assertTrue ($results[0 ]);
$this->spamCheck->check ($this->trackbacks['all']);
$this->spamCheck->reset ();
$this->assertTrue ($this->spamCheck == $fakeCheck);
function test_verifyKey_success () {
$this->assertTrue ($this->spamCheck->verifyKey ());
function test_verifyKey_failure () {
$this->spamCheck->_options ['key'] = 'foobar';
$this->assertFalse ($this->spamCheck->verifyKey ());
function test_reportSpam_success () {
$this->assertTrue ($this->spamCheck->submitSpam ($this->trackbacks['all']));
if (isset ($akismetApiKey) && $akismetApiKey !== false ) {
$suite = new PHPUnit_TestSuite ("Webservices_Trackback_SpamCheck_Akismet_TestCase");
$result = PHPUnit ::run ($suite);
echo $result->toString ();
echo 'Skipped test case "Webservices_Trackback_SpamCheck_Akismet_TestCase" because Akismet API key is missing. Please configure it in test/akismet_key.php!';
Documentation generated on Mon, 11 Mar 2019 14:36:53 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|