Answer the question
In order to leave comments, you need to log in
Why doesn't expectException work in functional tests?
Why doesn't expectException work in functional tests? That is, elementarily, this statement never works under any circumstances in functional tests. The unit seems to be fine. And you have to use an alternative:
$response = $this->post(route('items.use', ['id' => -1, 'count' => 0]));
$this->assertTrue($response->exception->getCode() == 0);
$item = Item::findOrFail($id);
$this->expectException(InvalidArgumentException::class);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question