home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / Statistics.phpt < prev    next >
Encoding:
Text File  |  2004-03-24  |  2.3 KB  |  67 lines

  1. <?php
  2. /* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP version 4╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩|
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2002 The PHP Group╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩|
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,╩╩╩╩╩╩╩|
  9. // | that is bundled with this package in the file LICENSE, and is╩╩╩╩╩╩╩╩|
  10. // | available at through the world-wide-web at╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩|
  11. // | http://www.php.net/license/2_02.txt.╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩|
  12. // | If you did not receive a copy of the PHP license and are unable to╩╩╩|
  13. // | obtain it through the world-wide-web, please send a note to╩╩╩╩╩╩╩╩╩╩|
  14. // | license@php.net so we can mail you a copy immediately.╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩|
  15. // +----------------------------------------------------------------------+
  16. // | Author: George Schlossnagle <george@omniti.com>                      | 
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id$
  20.  
  21. require_once "PHPUnit.php";
  22. require_once "Text/Statistics.php";
  23.  
  24. class TextTestCase extends PHPUnit_TestCase {
  25.   var $sample;
  26.   var $sampleAbbr;
  27.   var $object;
  28.   
  29.   function setUp() 
  30.   {
  31.     $this->sample = "
  32. Returns the number of words in the analysed text file or block. A word must     
  33. consist of letters a-z with at least one vowel sound, and optionally an         
  34. apostrophe or hyphen.";
  35.     $this->object = new Text_Statistics($this->sample);
  36.     $this->sampleAbbr = "
  37. Dear Mr. Schlossnagle,
  38.   
  39. Your request for a leave of absense has been approved.  Enjoy your vacation.
  40. ";
  41.   }  
  42.   function TextTestCase($name) 
  43.   {
  44.     $this->PHPUnit_TestCase($name);
  45.   }
  46.   function testNumSentences() 
  47.   {
  48.     $this->assertEquals(2, $this->object->numSentences);
  49.   }
  50.   function testNumWords() 
  51.   {
  52.     $this->assertEquals(31, $this->object->numWords);
  53.   }
  54.   function testNumSyllables() 
  55.   {
  56.     $this->assertEquals(45, $this->object->numSyllables);
  57.   }
  58.   function testNumSentencesAbbr() 
  59.   {
  60.     $this->assertEquals(2, $this->object->numSentences);
  61.   }
  62. }
  63. $suite = new PHPUnit_TestSuite('TextTestCase');
  64. $result = PHPUnit::run($suite);
  65. echo $result->toString();
  66. ?>
  67.