Returns whether a path is relative.
public static isRelative ( string $path ) : boolean | ||
$path | string | A path string. |
return | boolean | Returns true if the path is relative or empty, false if it is absolute. |
private function fixSuitePath($fix_path) { $xpath = new DOMXPath($this->doc); $node_list = $xpath->query('//testsuite/directory | //testsuite/file | //testsuite/exclude'); foreach ($node_list as $node) { if (Path::isRelative($path = $node->textContent)) { $new_text = new DOMText(Path::canonicalize($fix_path . '/' . $path)); if ($node->firstChild) { $node->replaceChild($new_text, $node->firstChild); } else { $node->appendChild($new_text); } } } }
/** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The path must be a string. Got: array */ public function testIsRelativeFailsIfInvalidPath() { Path::isRelative(array()); }
/** * Process given dir with replacements and makes it absolute. * * @param string $dir * * @return string * Absolute path with placeholders replaced. */ protected function processDir($dir) { $dir = $this->replacePattern($dir); // The absolute path has to be calculated relative to the configuration file if (Path::isRelative($dir)) { $dir = Path::makeAbsolute($dir, dirname($this->configFile)); } return rtrim($dir, '/'); }