How to indicate that a PHPUnit test is expected to fail?

Viewed 11870

Is it possible to mark a test as "expected to fail" with PHPUnit? This would be useful when performing TDD, and you want to distinguish between genuinely failed tests, and tests that happen to fail because the associated code hasn't been written yet.

6 Answers

In PHPUnit 8.2.5 you can simply expect the thrown assertion exception:

$this->expectException('PHPUnit\Framework\ExpectationFailedException');
$this->assertTrue(false);
Related