问题
I am having problem with PHPUnit on Netbeans where few methods are showing as passed when the method throws some exception like Fatal error or something.
So it seems that PhpUnit cannot handle these exception and it just marks them as passed.
This would work fine
$this->assertEquals(true, 1 == 2);
Failed asserting that false matches expected true.
but if I add some code that throws some exception then it just marks it as passed as an example:
public function testEquals() {
thisMethodDoesNotExists(5);
}
It marks this as passed where it should not cz there is a fatal error.
回答1:
You can use @runInSeparateProcess
annotation.
Please see details.
https://phpunit.readthedocs.io/en/7.3/annotations.html#runinseparateprocess.
来源:https://stackoverflow.com/questions/52554619/phpunit-showing-passed-methods-that-throws-fatal-error-exception