Allen Chou says to YSITD
急 在線等 我在寫 PHPUnit,我預期某個 function 要跳 Exceptions,所以我這樣寫 public function testNegativeWeigth(): void { $this->expectExceptionMessage("Negative weight detected"); $sales = new Sales; $sales->getCost("ABC", "123", -1234); } 如果我想在一個 test 裡面給予很多測資,然後每一個都必須跳 exception 才是正常的,我應該怎麼寫 先說,連續好幾個 $sales->getCost("ABC", "123", -1234); 的話,只要有一個跳 exception,assertion 就成立了,但我要每一個都跳 exception 才可以