Reputation: 11478
Is there a more official way to force a phpunit failure than $this->assertTrue(false)
?
Upvotes: 79
Views: 23803
Reputation: 30074
Another way to do it (especially helpful when writing a testing tool) would be:
use PHPUnit_Framework_ExpectationFailedException as PHPUnitException;
try {
// something here
} catch (SpecificException $e) {
// force a fail:
throw new PHPUnitException("This was not expected.");
}
Upvotes: 3
Reputation: 1400
Yes, theres a way,
$this->fail("your message");
if you want to see the page u have failed than
print_r(getResponse()->getContent());
Upvotes: 4
Reputation: 6644
I believe this should work within a test case:
$this->fail('Message');
Upvotes: 126