/** * Tests whether getRelativeAbleronPath() works correctly. * * @dataProvider dataProviderTestGetRelativeAbleronPath */ public function testGetRelativeAbleronPath($path, $expectedResult) { $this->assertSame(str_replace('{ROOT_DIR}', ABLERON_ROOT_DIR, $expectedResult), FileUtil::getRelativeAbleronPath(str_replace('{ROOT_DIR}', ABLERON_ROOT_DIR, $path))); }
/** * Returns a string representation of the given stack trace. * * @param array $trace The stack trace to format * @return string */ public static function getTraceAsString(array $trace) { $currentTracePosition = count($trace); $formattedTrace = array(); foreach ($trace as $tracePoint) { $formattedTrace[] = sprintf('#%d %s: %s%s(%s)', $currentTracePosition--, isset($tracePoint['file']) ? sprintf('%s(%d)', FileUtil::getRelativeAbleronPath($tracePoint['file']), $tracePoint['line']) : '[internal function]', isset($tracePoint['class']) ? $tracePoint['class'] . $tracePoint['type'] : '', $tracePoint['function'], !empty($tracePoint['args']) ? StringUtil::buildPhpArgumentString($tracePoint['args']) : ''); } return implode(StringUtil::CHAR_LINE_FEED, $formattedTrace); }