run() public method

Run all the specs belonging to the suite
public run ( Peridot\Core\TestResult $result )
$result Peridot\Core\TestResult
Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  *
  * @param TestResult $result
  */
 public function run(TestResult $result)
 {
     $this->eventEmitter->on('test.failed', function () {
         if ($this->configuration->shouldStopOnFailure()) {
             $this->eventEmitter->emit('suite.halt');
         }
     });
     $this->eventEmitter->emit('runner.start');
     $this->suite->setEventEmitter($this->eventEmitter);
     $start = microtime(true);
     $this->suite->run($result);
     $this->eventEmitter->emit('runner.end', [microtime(true) - $start]);
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  *
  * @param TestResult $result
  */
 public function run(TestResult $result)
 {
     $this->handleErrors();
     $this->eventEmitter->on('test.failed', function () {
         if ($this->configuration->shouldStopOnFailure()) {
             $this->eventEmitter->emit('suite.halt');
         }
     });
     $this->eventEmitter->emit('runner.start');
     $this->suite->setEventEmitter($this->eventEmitter);
     $this->suite->run($result);
     $this->eventEmitter->emit('runner.end');
     restore_error_handler();
 }
Exemplo n.º 3
0
     $suite->run($result);
     assert($result->getTestCount() === 2, "two specs should have run");
 });
 it("should return the number of tests failed", function () {
     $result = new TestResult($this->eventEmitter);
     $suite = new Suite("Suite", function () {
     });
     $suite->setEventEmitter($this->eventEmitter);
     $suite->addTest(new Test("this was run", function () {
     }));
     $suite->addTest(new Test("this was also run", function () {
     }));
     $suite->addTest(new Test("this failed", function () {
         throw new Exception('spec failed');
     }));
     $suite->run($result);
     assert($result->getFailureCount() === 1, "one specs should have failed");
 });
 describe('->startTest()', function () {
     beforeEach(function () {
         $this->eventEmitter = new EventEmitter();
         $this->result = new TestResult($this->eventEmitter);
     });
     it('should increment the test count', function () {
         $this->result->startTest(new Test('some test'));
         assert(1 === $this->result->getTestCount(), "test count should be 1");
     });
     it('should fire a test.start event', function () {
         $emitted = null;
         $this->eventEmitter->on('test.start', function ($test) use(&$emitted) {
             $emitted = $test;