Chris@0: 2 indicates segfault timeout, or other type of system Chris@0: * failure. Chris@0: */ Chris@0: class TestStatus { Chris@0: Chris@0: /** Chris@0: * Signify that the test result was a passed test. Chris@0: */ Chris@0: const PASS = 0; Chris@0: Chris@0: /** Chris@0: * Signify that the test result was a failed test. Chris@0: */ Chris@0: const FAIL = 1; Chris@0: Chris@0: /** Chris@0: * Signify that the test result was an exception or code error. Chris@0: * Chris@0: * This means that the test runner was able to exit and report an error. Chris@0: */ Chris@0: const EXCEPTION = 2; Chris@0: Chris@0: /** Chris@0: * Signify a system error where the test runner was unable to complete. Chris@0: * Chris@0: * Note that SYSTEM actually represents the lowest value of system errors, and Chris@0: * the returned value could be as high as 127. Since that's the case, this Chris@0: * constant should be used for range comparisons, and not just for equality. Chris@0: * Chris@14: * @see http://php.net/manual/pcntl.constants.php Chris@0: */ Chris@0: const SYSTEM = 3; Chris@0: Chris@0: /** Chris@0: * Turns a status code into a human-readable string. Chris@0: * Chris@0: * @param int $status Chris@0: * A test runner return code. Chris@0: * Chris@0: * @return string Chris@0: * The human-readable version of the status code. Chris@0: */ Chris@0: public static function label($status) { Chris@0: $statusMap = [ Chris@0: static::PASS => 'pass', Chris@0: static::FAIL => 'fail', Chris@0: static::EXCEPTION => 'exception', Chris@0: static::SYSTEM => 'error', Chris@0: ]; Chris@0: // For status 3 and higher, we want 'error.' Chris@0: $label = $statusMap[$status > static::SYSTEM ? static::SYSTEM : $status]; Chris@0: return $label; Chris@0: } Chris@0: Chris@0: }