protected function _execute()
{
static::$_instances[] = $this;
$result = null;
$spec = function () {
$this->_expectations = [];
$closure = $this->_closure;
$result = $closure($this);
foreach ($this->_expectations as $expectation) {
$this->_passed = $expectation->passed() && $this->_passed;
}
array_pop(static::$_instances);
return $result;
};
if (Suite::$PHP >= 7) {
try {
$result = $spec();
} catch (Throwable $e) {
$this->_passed = false;
array_pop(static::$_instances);
throw $e;
}
} else {
try {
$result = $spec();
} catch (Exception $e) {
$this->_passed = false;
array_pop(static::$_instances);
throw $e;
}
}
return $result;
}