SimpleTest是一个为PHP程序提供的单元测试的框架,包含一个内嵌的web浏览器用来测试PHP的Web网站。
示例代码
<?phprequire_once('simpletest/unit_tester.php');require_once('simpletest/reporter.php');require_once('../classes/log.php');classTestOfLoggingextendsUnitTestCase{functiontestCreatingNewFile(){@unlink('/temp/test.log');$log=newLog('/temp/test.log');$this->assertFalse(file_exists('/temp/test.log'));$log->message('Shouldwritethistoafile');$this->assertTrue(file_exists('/temp/test.log'));}}$test=&newTestOfLogging();$test->run(newHtmlReporter());?>
评论