public function execute(IReporter $reporter = null) { if ($this->status !== self::IGNORED) { call_user_func($this->scopedFn, $this, function () { $befores = call_user_func($this->befores); array_walk($befores, function ($fn) { call_user_func($fn); }); try { call_user_func($this->fn); } catch (\Exception $e) { $exceptionType = get_class($e); $message = "Exception '{$exceptionType}' with message '{$e->getMessage()}'"; $callsite = "{$e->getFile()}:{$e->getLine()}"; $this->addFailure($message, $callsite); } $afters = call_user_func($this->afters); array_walk($afters, function ($fn) { call_user_func($fn); }); }); } if ($reporter) { $reporter->specResult($this); } return $this->status !== self::FAILED; }
public function execute(IReporter $reporter = null) { $isRootContext = is_null($this->parentContext); if ($reporter && !$isRootContext) { $reporter->beforeContext($this->description); } $noFailures = true; foreach ($this->specs as $spec) { if ($this->ignored) { $spec->ignore(); } $passed = $spec->execute($reporter); $noFailures = $noFailures && $passed; } foreach ($this->contexts as $context) { if ($this->ignored) { $context->ignore(); } $passed = $context->execute($reporter); $noFailures = $noFailures && $passed; } if ($reporter) { $reporter->afterContext($this->description); } return $noFailures; }
public function execute(IReporter $reporter = null) { if ($reporter) { $reporter->beforeAll(); } $noFailures = $this->rootContext->execute($reporter); if ($reporter) { $reporter->afterAll(); } return $noFailures; }