Services_Trackback
[ class tree: Services_Trackback ] [ index: Services_Trackback ] [ all elements ]

Source for file Services_Trackback_SpamCheck_SURBL_Test.php

Documentation is available at Services_Trackback_SpamCheck_SURBL_Test.php

  1. <?php
  2.  
  3. // Includepath for local CVS development
  4. // set_include_path('/cvs/pear/Services_Trackback'.PATH_SEPARATOR.get_include_path());
  5.  
  6.     // {{{ require_once
  7.  
  8. // Services_Trackback classes
  9. require_once 'Services/Trackback.php';
  10. require_once 'Services/Trackback/SpamCheck.php';
  11. require_once 'Services/Trackback/SpamCheck/SURBL.php';
  12.  
  13. // Unittest suite
  14. require_once 'PHPUnit/Framework/TestCase.php';
  15.  
  16. // Testdata
  17. require_once dirname(__FILE__).'/trackback_data.php';
  18.  
  19.     // }}}
  20.  
  21. class Services_Trackback_SpamCheck_SURBL_Test extends PHPUnit_Framework_TestCase
  22. {
  23.  
  24.     var $trackbacks = array();
  25.  
  26.     var $spamCheck;
  27.  
  28.     // {{{ Webservices_Trackback_SpamCheck_TestCase()
  29.  
  30.     // }}}
  31.     // {{{ setup()
  32.  
  33.     function setUp({
  34.         global $trackbackData;
  35.         foreach ($trackbackData as $id => $set{
  36.             $this->trackbacks[$idServices_Trackback::create($set);
  37.         }
  38.         $this->spamCheck Services_Trackback_SpamCheck::create('SURBL');
  39.     }
  40.  
  41.     // }}}
  42.     // {{{ tearDown()
  43.  
  44.     function tearDown({
  45.     }
  46.  
  47.     // }}}
  48.     // {{{ Test create()
  49.  
  50.     function test_create({
  51.         $realCheck = new Services_Trackback_SpamCheck_SURBL();
  52.         $this->assertTrue($this->spamCheck == $realCheck);
  53.     }
  54.  
  55.     // }}}
  56.     // {{{ Test check()
  57.     function test_check_failure_nospam({
  58.         $this->assertTrue(!$this->spamCheck->check($this->trackbacks['nospam']));
  59.     }
  60.     function test_check_failure_undetected({
  61.         $this->assertTrue(!$this->spamCheck->check($this->trackbacks['undetected']));
  62.     }
  63.     function test_check_success_all({
  64.         $this->assertTrue($this->spamCheck->check($this->trackbacks['all']));
  65.     }
  66.     function test_check_success_host({
  67.         $this->assertTrue($this->spamCheck->check($this->trackbacks['host']));
  68.     }
  69.     function test_check_failure_title({
  70.         $this->assertTrue($this->spamCheck->check($this->trackbacks['title']));
  71.     }
  72.     function test_check_success_excerpt({
  73.         $this->assertTrue($this->spamCheck->check($this->trackbacks['excerpt']));
  74.     }
  75.     function test_check_success_url({
  76.         $this->assertTrue($this->spamCheck->check($this->trackbacks['url']));
  77.     }
  78.     function test_check_success({
  79.         $this->assertTrue($this->spamCheck->check($this->trackbacks['blog_name']));
  80.     }
  81.     // }}}
  82.     // {{{ Test getResults()
  83.  
  84.     function test_getResults({
  85.         $this->spamCheck->check($this->trackbacks['all']);
  86.         $results $this->spamCheck->getResults();
  87.         $this->assertTrue($results[0]);
  88.     }
  89.  
  90.     // }}}
  91.     // {{{ Test reset()
  92.  
  93.     function test_reset({
  94.         $this->spamCheck->check($this->trackbacks['all']);
  95.         $this->spamCheck->reset();
  96.  
  97.         $fakeCheck Services_Trackback_SpamCheck::create('SURBL');
  98.         $this->assertTrue($this->spamCheck == $fakeCheck);
  99.     }
  100.  
  101.     // }}}
  102.  
  103. }

Documentation generated on Mon, 11 Mar 2019 15:25:47 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.