public function testGetInt() { $this->mockEngineMethod('getInt')->with('name', 'default')->willReturn(true); $this->assertTrue(Config::getInt('name', 'default')); }
/** * @param int $type * @param string $message * @param string $file * @param int $line * @return bool */ private function handleError($type, $message, $file, $line) { if ($this->getError() !== null || (error_reporting() & $type) === 0) { return false; } $sourceTraceStartIndex = 2; if ($type === E_WARNING || $type === E_RECOVERABLE_ERROR) { $trace = debug_backtrace(); if (isset($trace[2]) && isset($trace[2]['file'])) { $suffix = ', called in ' . $trace[2]['file'] . ' on line ' . $trace[2]['line'] . ' and defined'; if (substr($message, -strlen($suffix)) === $suffix) { $message = substr($message, 0, strlen($message) - strlen($suffix)) . " (defined in {$file}:{$line})"; $file = $trace[2]['file']; $line = $trace[2]['line']; $sourceTraceStartIndex = 3; } } } $errorExceptionBitmask = Config::getInt('hyperframework.error_handler.error_exception_bitmask'); if ($errorExceptionBitmask === null) { $errorExceptionBitmask = E_ALL & ~(E_DEPRECATED | E_USER_DEPRECATED); } if (($type & $errorExceptionBitmask) === 0) { $this->error = new Error($type, $message, $file, $line); $this->handle(); $this->error = null; return false; } throw new ErrorException($type, $message, $file, $line, $sourceTraceStartIndex); }