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

Source for file Services_Trackback_SpamCheck_DNSBL_Test.php

Documentation is available at Services_Trackback_SpamCheck_DNSBL_Test.php

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

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