getResolvedPath() public method

public getResolvedPath ( )
Exemplo n.º 1
0
 public function isSubPathOf(path $path)
 {
     $this->resolve();
     $resolvedPath = $path->getResolvedPath();
     return $this->components !== $resolvedPath->components && ($resolvedPath->isRoot() === true || strpos($this->components, $resolvedPath->components . '/') === 0);
 }
Exemplo n.º 2
0
 public function testGetResolvedPath()
 {
     $this->if($path = new testedClass('/a/b'))->then->object($path->getResolvedPath())->isNotIdenticalTo($path)->toString->isEqualTo(DIRECTORY_SEPARATOR . 'a' . DIRECTORY_SEPARATOR . 'b')->if($path = new testedClass('/a/b/..'))->then->object($path->getResolvedPath())->isNotIdenticalTo($path)->toString->isEqualTo(DIRECTORY_SEPARATOR . 'a')->if($path = new testedClass('/a/b/../..'))->then->object($path->getResolvedPath())->isNotIdenticalTo($path)->toString->isEqualTo(DIRECTORY_SEPARATOR)->if($path = new testedClass('/a/b/.'))->then->object($path->getResolvedPath())->isNotIdenticalTo($path)->toString->isEqualTo(DIRECTORY_SEPARATOR . 'a' . DIRECTORY_SEPARATOR . 'b')->if($path = new testedClass('/a/./b'))->then->object($path->getResolvedPath())->isNotIdenticalTo($path)->toString->isEqualTo(DIRECTORY_SEPARATOR . 'a' . DIRECTORY_SEPARATOR . 'b')->if($path = new testedClass('//a////./////b'))->then->object($path->getResolvedPath())->isNotIdenticalTo($path)->toString->isEqualTo(DIRECTORY_SEPARATOR . 'a' . DIRECTORY_SEPARATOR . 'b')->given($adapter = new atoum\test\adapter())->and($adapter->getcwd = $currentDirectory = '/current/directory')->then->if($path = new testedClass('a/b', DIRECTORY_SEPARATOR, $adapter))->then->object($path->getResolvedPath())->isNotIdenticalTo($path)->toString->isEqualTo(DIRECTORY_SEPARATOR . 'current' . DIRECTORY_SEPARATOR . 'directory' . DIRECTORY_SEPARATOR . 'a' . DIRECTORY_SEPARATOR . 'b')->if($path = new testedClass('./a/b', DIRECTORY_SEPARATOR, $adapter))->then->object($path->getResolvedPath())->isNotIdenticalTo($path)->toString->isEqualTo(DIRECTORY_SEPARATOR . 'current' . DIRECTORY_SEPARATOR . 'directory' . DIRECTORY_SEPARATOR . 'a' . DIRECTORY_SEPARATOR . 'b')->if($path = new testedClass('../a/b', DIRECTORY_SEPARATOR, $adapter))->then->object($path->getResolvedPath())->isNotIdenticalTo($path)->toString->isEqualTo(DIRECTORY_SEPARATOR . 'current' . DIRECTORY_SEPARATOR . 'a' . DIRECTORY_SEPARATOR . 'b')->if($path = new testedClass('../../a/b', DIRECTORY_SEPARATOR, $adapter))->then->object($path->getResolvedPath())->isNotIdenticalTo($path)->toString->isEqualTo(DIRECTORY_SEPARATOR . 'a' . DIRECTORY_SEPARATOR . 'b');
 }