stopOnFailure() public method

Stop the suite runner when a failure occurs
public stopOnFailure ( )
Example #1
0
         $passingChild = new Test("passing child", function () {
         });
         $failingChild = new Test("failing child", function () {
             throw new Exception("booo");
         });
         $passing2Child = new Test("passing2 child", function () {
         });
         $childSuite->addTest($passingChild);
         $childSuite->addTest($failingChild);
         $childSuite->addTest($passing2Child);
         $suite->addTest($childSuite);
         $passing2 = new Test("passing2 spec", function () {
         });
         $suite->addTest($passing2);
         $configuration = new Configuration();
         $configuration->stopOnFailure();
         $suite->setEventEmitter($this->eventEmitter);
         $runner = new Runner($suite, $configuration, $this->eventEmitter);
         $result = new TestResult($this->eventEmitter);
         $runner->run($result);
         assert($result->getTestCount() === 3, "spec count should be 3");
     });
 });
 $behavesLikeErrorEmitter = function () {
     $this->suite->addTest(new Test("my spec", function () {
         trigger_error("This is a user notice", E_USER_NOTICE);
     }));
     $error = [];
     $this->eventEmitter->on('error', function ($errno, $errstr, $errfile, $errline) use(&$error) {
         $error = array('errno' => $errno, 'errstr' => $errstr, 'errfile' => $errfile, 'errline' => $errline);
     });