SimpleTest 是一个为PHP程序提供的单元测试的框架,包含一个内嵌的web浏览器用来测试PHP的Web网站。

示例代码

 require_once('simpletest/uNit_tester.php');
require_once('simpletest/reporter.php');
require_once('../classes/log.php');

class TestOfLogging extends UnitTestCase {
    
    Function testCreatingNewFile() {
        @unlink('/temp/test.log');
        $log = new Log('/temp/test.log');
        $this->assertFalse(file_exists('/temp/test.log'));
        $log->message('Should write this to a file');
        $this->assertTrue(file_exists('/temp/test.log'));
    }
}

$test = &new TestOfLogging();
$test->run(new HtmlReporter());
?>

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务