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

Source for file Services_Trackback_SpamCheck_Regex_Test.php

Documentation is available at Services_Trackback_SpamCheck_Regex_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/Regex.php';
  12.  
  13. // Testdata
  14. require_once dirname(__FILE__).'/trackback_data.php';
  15.  
  16.     // }}}
  17.  
  18. class Services_Trackback_SpamCheck_Regex_Test extends PHPUnit_Framework_TestCase
  19. {
  20.  
  21.     var $trackbacks = array();
  22.  
  23.     var $spamCheck;
  24.  
  25.     // {{{ setup()
  26.  
  27.     function setUp({
  28.         global $trackbackData;
  29.         foreach ($trackbackData as $id => $set{
  30.             $this->trackbacks[$idServices_Trackback::create($set);
  31.         }
  32.         $this->spamCheck Services_Trackback_SpamCheck::create('Regex');
  33.     }
  34.  
  35.     // }}}
  36.     // {{{ tearDown()
  37.  
  38.     function tearDown({
  39.     }
  40.  
  41.     // }}}
  42.     // {{{ Test create()
  43.  
  44.     function test_create({
  45.         $realCheck = new Services_Trackback_SpamCheck_Regex();
  46.         $this->assertTrue($this->spamCheck == $realCheck);
  47.     }
  48.  
  49.     // }}}
  50.     // {{{ Test check()
  51.     function test_check_failure_nospam({
  52.         $this->assertTrue(!$this->spamCheck->check($this->trackbacks['nospam']));
  53.     }
  54.     function test_check_failure_undetected({
  55.         $this->assertTrue(!$this->spamCheck->check($this->trackbacks['undetected']));
  56.     }
  57.     function test_check_success_all({
  58.         $this->assertTrue($this->spamCheck->check($this->trackbacks['all']));
  59.     }
  60.     function test_check_success_host({
  61.         $this->assertTrue($this->spamCheck->check($this->trackbacks['host']));
  62.     }
  63.     function test_check_success_title({
  64.         $this->assertTrue($this->spamCheck->check($this->trackbacks['title']));
  65.     }
  66.     function test_check_success_excerpt({
  67.         $this->assertTrue($this->spamCheck->check($this->trackbacks['excerpt']));
  68.     }
  69.     function test_check_success_url({
  70.         $this->assertTrue($this->spamCheck->check($this->trackbacks['url']));
  71.     }
  72.     function test_check_success_blog_name({
  73.         $this->assertTrue($this->spamCheck->check($this->trackbacks['blog_name']));
  74.     }
  75.     function test_check_success_decode({
  76.         $this->assertTrue($this->spamCheck->check($this->trackbacks['decode']));
  77.     }
  78.     // }}}
  79.     // {{{ Test getResults()
  80.  
  81.     function test_getResults({
  82.         $this->spamCheck->check($this->trackbacks['all']);
  83.         $results $this->spamCheck->getResults();
  84.         $this->assertTrue($results[0]);
  85.     }
  86.  
  87.     // }}}
  88.     // {{{ Test reset()
  89.  
  90.     function test_reset({
  91.         $this->spamCheck->check($this->trackbacks['all']);
  92.         $this->spamCheck->_results = array();
  93.         $fakeCheck Services_Trackback_SpamCheck::create('Regex');
  94.         $this->assertTrue($this->spamCheck == $fakeCheck);
  95.     }
  96.  
  97.     // }}}
  98.  
  99. }
  100. ?>

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