/** * The then keyword * Run the actual test * All given values needed will be parsed, and will execute every actions given by when * Will store the result of the test for further use * * @param callback $callback * @param string $label * * @return void * @throws Exception */ public function then($callback, $label) { $saved = clone $this->current_suite; $result = $this->current_suite->run($callback); $this->current_suite = $saved; $testNumber = count($this->results); $testDescription = $this->current_suite->description(); $this->results[] = $result; if ($result->is_error()) { $this->errors[] = $result; $this->labels[] = $label; $this->reporter->reportFailure($testNumber, $testDescription); } else { $this->reporter->reportSuccess($testNumber, $testDescription); } }