📜  phpunit assert continue - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:34.980000             🧑  作者: Mango

代码示例1
public function testDemo()
{
    $failures = [];
    try {
        $this->assertTrue(false);
    } catch(PHPUnit_Framework_ExpectationFailedException $e) {
        $failures[] = $e->getMessage();
    }
    try {
        $this->assertTrue(false);
    } catch(PHPUnit_Framework_ExpectationFailedException $e) {
        $failures[] = $e->getMessage();
    }
    if(!empty($failures))
    {
        throw new PHPUnit_Framework_ExpectationFailedException (
            count($failures)." assertions failed:\n\t".implode("\n\t", $failures)
        );
    }
}