我知道“--repeat”选项,但我宁愿在测试和每个测试中定义重复。在我的单元测试中,有些测试我不想重复,有些测试我比其他测试更想重复。
我刚在想:
protected function tearDown() {
if (test has not been ran 3 times) {
$this->runTest(); // Re-run the test
}
}
Run Code Online (Sandbox Code Playgroud)
这似乎不起作用,$this->run() 也不起作用。我看过 PHPUnit 源代码,但我不确定。我猜它正在检查测试状态,如果它已经运行,它会拒绝再次运行它。