Should explicitly define the expected exception in code.
Example:
$this->setExpectedException(
EntityNotFoundException::class,
'User not found'
);
This makes refactoring easier and places the exception at the exact location it should be thrown. With annotations, a premature EntityNotFoundException could trigger the test to pass.
Should explicitly define the expected exception in code.
Example:
This makes refactoring easier and places the exception at the exact location it should be thrown. With annotations, a premature EntityNotFoundException could trigger the test to pass.