PHPUnit 在预期异常后不会继续测试
为什么 PHPUnit 不在此代码中执行最后一个异常断言?
public function testConfigOverriding()
{
$this->dependencyContainer = new DependencyContainer(__DIR__ . "/../../Resources/valid_json.json");
$this->assertEquals('overriden', $this->dependencyContainer->getConfig('shell_commander')['pygmentize_command']);
$unexisting = "unexisting_file";
$this->setExpectedException('Exception', "Configuration file at path \"$unexisting\" doesn't exist.");
$this->dependencyContainer = new DependencyContainer($unexisting);
$invalid = __DIR . "/../../Resources/invalid_json.json";
$this->setExpectedException('Exception', "Configuration JSON file provided is not valid.");
$this->dependencyContainer = new DependencyContainer($invalid);
}
所以基本上:它测试是否抛出了“unexsisting_file”异常,但完全忽略了“无效的json”测试。我是否需要对引发的每个异常进行单独的测试?