You are here

protected function PHPUnit_Util_Configuration::toAbsolutePath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Util/Configuration.php \PHPUnit_Util_Configuration::toAbsolutePath()

@since Method available since Release 3.5.0

Parameters

string $path:

bool $useIncludePath:

Return value

string

7 calls to PHPUnit_Util_Configuration::toAbsolutePath()
PHPUnit_Util_Configuration::getListenerConfiguration in vendor/phpunit/phpunit/src/Util/Configuration.php
Returns the configuration for listeners.
PHPUnit_Util_Configuration::getLoggingConfiguration in vendor/phpunit/phpunit/src/Util/Configuration.php
Returns the logging configuration.
PHPUnit_Util_Configuration::getPHPConfiguration in vendor/phpunit/phpunit/src/Util/Configuration.php
Returns the PHP configuration.
PHPUnit_Util_Configuration::getPHPUnitConfiguration in vendor/phpunit/phpunit/src/Util/Configuration.php
Returns the PHPUnit configuration.
PHPUnit_Util_Configuration::getTestSuite in vendor/phpunit/phpunit/src/Util/Configuration.php
@since Method available since Release 3.4.0

... See full list

File

vendor/phpunit/phpunit/src/Util/Configuration.php, line 1096

Class

PHPUnit_Util_Configuration
Wrapper for the PHPUnit XML configuration file.

Code

protected function toAbsolutePath($path, $useIncludePath = false) {
  if ($path[0] === '/') {
    return $path;
  }

  // Matches the following on Windows:
  //  - \\NetworkComputer\Path
  //  - \\.\D:
  //  - \\.\c:
  //  - C:\Windows
  //  - C:\windows
  //  - C:/windows
  //  - c:/windows
  if (defined('PHP_WINDOWS_VERSION_BUILD') && ($path[0] === '\\' || strlen($path) >= 3 && preg_match('#^[A-Z]\\:[/\\\\]#i', substr($path, 0, 3)))) {
    return $path;
  }

  // Stream
  if (strpos($path, '://') !== false) {
    return $path;
  }
  $file = dirname($this->filename) . DIRECTORY_SEPARATOR . $path;
  if ($useIncludePath && !file_exists($file)) {
    $includePathFile = stream_resolve_include_path($path);
    if ($includePathFile) {
      $file = $includePathFile;
    }
  }
  return $file;
}