mageekguy\atoum\fs\path::getParentDirectoryPath PHP Method

getParentDirectoryPath() public method

    public function getParentDirectoryPath()
    {
        $parentDirectory = clone $this;
        $parentDirectory->components = self::getComponents(dirname($parentDirectory->components));
        return $parentDirectory;
    }

Usage Example

Example #1
0
 public function testGetParentDirectoryPath()
 {
     $this->if($path = new testedClass('/', '/'))->then->object($path->getParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo('/')->if($path = new testedClass('/' . uniqid(), '/'))->then->object($path->getParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo('/')->if($path = new testedClass(($parentDirectory = '/' . uniqid()) . '/' . uniqid(), '/'))->then->object($path->getParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo($parentDirectory)->object($path->getParentDirectoryPath()->getParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo('/')->if($path = new testedClass('\\', '\\'))->then->object($path->getParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo('\\')->if($path = new testedClass('\\' . uniqid(), '\\'))->then->object($path->getParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo('\\')->if($path = new testedClass('C:\\' . uniqid(), '\\'))->then->object($path->getParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo('C:\\');
 }