📄 statistics.phpt
字号:
<?php/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */// +----------------------------------------------------------------------+// | PHP version 4适适适适适适适适适适适适适适适适适适适适适适适适适适适适|// +----------------------------------------------------------------------+// | Copyright (c) 1997-2002 The PHP Group适适适适适适适适适适适适适适适适|// +----------------------------------------------------------------------+// | This source file is subject to version 2.0 of the PHP license,适适适蕓// | that is bundled with this package in the file LICENSE, and is适适适适|// | available at through the world-wide-web at适适适适适适适适适适适适适蕓// | http://www.php.net/license/2_02.txt.适适适适适适适适适适适适适适适适蕓// | If you did not receive a copy of the PHP license and are unable to适蕓// | obtain it through the world-wide-web, please send a note to适适适适适|// | license@php.net so we can mail you a copy immediately.适适适适适适适蕓// +----------------------------------------------------------------------+// | Author: George Schlossnagle <george@omniti.com> | // +----------------------------------------------------------------------+//// $Id$require_once "PHPUnit.php";require_once "Text/Statistics.php";class TextTestCase extends PHPUnit_TestCase { var $sample; var $sampleAbbr; var $object; function setUp() { $this->sample = "Returns the number of words in the analysed text file or block. A word must consist of letters a-z with at least one vowel sound, and optionally an apostrophe or hyphen."; $this->object = new Text_Statistics($this->sample); $this->sampleAbbr = "Dear Mr. Schlossnagle, Your request for a leave of absense has been approved. Enjoy your vacation."; } function TextTestCase($name) { $this->PHPUnit_TestCase($name); } function testNumSentences() { $this->assertEquals(2, $this->object->numSentences); } function testNumWords() { $this->assertEquals(31, $this->object->numWords); } function testNumSyllables() { $this->assertEquals(45, $this->object->numSyllables); } function testNumSentencesAbbr() { $this->assertEquals(2, $this->object->numSentences); }}$suite = new PHPUnit_TestSuite('TextTestCase');$result = PHPUnit::run($suite);echo $result->toString();?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -