testResult = $result; $status = self::STATUS_PENDING; $time = 0; $e = null; $result->startTest($this); foreach ($this->hooks as $hook) { if (method_exists($this, $hook.'Start')) { $this->{$hook.'Start'}(); } } $failedToStart = ReflectionHelper::readPrivateProperty($result, 'lastTestFailed'); if (!$this->ignored && !$failedToStart) { \PHP_Timer::start(); try { $this->test(); $status = self::STATUS_OK; } catch (\PHPUnit_Framework_AssertionFailedError $e) { $status = self::STATUS_FAIL; } catch (\PHPUnit_Framework_Exception $e) { $status = self::STATUS_ERROR; } catch (\Throwable $e) { $e = new \PHPUnit_Framework_ExceptionWrapper($e); $status = self::STATUS_ERROR; } catch (\Exception $e) { $e = new \PHPUnit_Framework_ExceptionWrapper($e); $status = self::STATUS_ERROR; } $time = \PHP_Timer::stop(); } foreach (array_reverse($this->hooks) as $hook) { if (method_exists($this, $hook.'End')) { $this->{$hook.'End'}($status, $time, $e); } } $result->endTest($this, $time); return $result; } public function getTestResultObject() { return $this->testResult; } /** * This class represents exactly one test * @return int */ public function count() { return 1; } /** * Should a test be skipped (can be set from hooks) * * @param boolean $ignored */ protected function ignore($ignored) { $this->ignored = $ignored; } }