多次运行 PHPUnit 测试用例
我正在寻找一种方法,如何使用不同的设置多次运行测试用例。
我正在测试一个数据库访问类(数十种测试方法),并希望在“正常模式”下测试它,然后在“调试模式”下进行测试。两种模式必须产生相同的测试结果。
在测试用例设置中是否有可能这样做?还是重写 run() 方法?我不想写两次测试,当然:)
谢谢
编辑:知道了!
public function run(PHPUnit_Framework_TestResult $result = NULL)
{
    if ($result === NULL) {
        $result = $this->createResult();
    }
    /**
     * Run the testsuite multiple times with different debug level
     */
    $this->debugLevel = 0;
    print "Setting debug level to: " . $this->debugLevel . PHP_EOL;
    $result->run($this);
    $this->debugLevel = 8;
    print "Setting debug level to: " . $this->debugLevel . PHP_EOL;
    $result->run($this);
    $this->debugLevel = 16;
    print "Setting debug level to: " . $this->debugLevel . PHP_EOL;
    $result->run($this);
    return $result;
}
public function setUp()
{
    parent::setUp();
    $this->myclass->setOptions('debug', $this->debugLevel);
}
 
					 
				 
				    		 
				    		 
				    		 
				    		