getRealParentDirectoryPath() public method

Example #1
0
 public function testGetRealParentDirectoryPath()
 {
     $this->given($adapter = new atoum\test\adapter())->and($adapter->file_exists = function ($path) {
         switch ($path) {
             case '/a/b/c/d/e':
             case '/a/b/c/d':
             case '/a/b/c':
                 return false;
             default:
                 return true;
         }
     })->then->if($path = new testedClass('/', '/', $adapter))->then->object($path->getRealParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo('/')->if($path = new testedClass('/a', '/', $adapter))->then->object($path->getRealParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo('/')->if($path = new testedClass('/a/', '/', $adapter))->then->object($path->getRealParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo('/')->if($path = new testedClass('/a/b', '/', $adapter))->then->object($path->getRealParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo('/a')->if($path = new testedClass('/a/b/', '/', $adapter))->then->object($path->getRealParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo('/a')->if($path = new testedClass('/a/b/c', '/', $adapter))->then->object($path->getRealParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo('/a/b')->if($path = new testedClass('/a/b/c/d', '/', $adapter))->then->object($path->getRealParentDirectoryPath())->isNotIdenticalTo($path)->toString->isEqualTo('/a/b');
 }