[ACCEPTED]-How to force a failure with phpunit-phpunit

Accepted answer
Score: 116

I believe this should work within a test 1 case:

Score: 3

Another way to do it (especially helpful 1 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.");
Score: 2

Yes, theres a way,

$this->fail("your message");

if you want to see the 1 page u have failed than


More Related questions