Beispiel #1
0
 protected function runTest(Example $test)
 {
     $start_context = ['test' => $test, 'result_set' => $this->result_set];
     $this->emit('test.start', $start_context);
     $suite_runner = $this;
     $test_result_set = new ResultSet();
     $test->aroundEach(function ($block) use($suite_runner, $test_result_set, $test) {
         if ($test_result_set->isFailure()) {
             $block->skip();
         }
         $result = $suite_runner->captureAround([$block, 'invoke'], $test, $block);
         $test_result_set->addResult($result);
     });
     $this->result_set->addResult($test_result_set);
     $complete_context = ['test' => $test, 'result' => $test_result_set, 'result_set' => $this->result_set];
     $this->emit('test.complete', $complete_context);
     return $test_result_set;
 }
Beispiel #2
0
 /**
  * Begins a new test case within the active block.
  */
 public static function it($name, $fn)
 {
     $test_method = new Example($name, $fn);
     $test_method->addToParent();
     return $test_method;
 }