PHPUnit - assertion failed but I want to continue testing

Viewed 11454
->assertTrue(false);
->assertTrue(true);

First assertion was failed and execution was stopped. But I want to continue the further snippet of code.

Is there possible in PHPUnit

4 Answers

I'm late to the party, but I recommend using a configuration file for the test suites to achieve this easily.

You can create phpunit.xml file from where you are running the phpunit test. Hence phpunit will run the needed tests listed there.

PHPUnit 3.7.38 by Sebastian Bergmann.

Configuration read from /path/phpunit.xml

In that file you can specify that you don't want to stop on failure.

<phpunit bootstrap="vendor/autoload.php" stopOnFailure="false">
  <testsuites>
    <testsuite name="Test">
      <file>tests/ClassTest.php</file>
    </testsuite>
  </testsuites>
</phpunit>

Hope this helps.

Related