Permalink
Browse files

fix retrieval of child when child has same name as parent, fixes #32

…hopefully finally
  • Loading branch information...
1 parent 7ee3af5 commit 7f95328aec924665df2b9054d657307c0546065f @mikey179 committed Mar 29, 2012
View
@@ -6,7 +6,7 @@
- implemented issue #30: support "c" mode for fopen()
- fixed issue #31: prohibit aquiring locks when already locked / release lock on
fclose()
-- fixed issue #32: create subfolder of same name in existing folder fails
+- fixed issue #32: problems when subfolder has same name as folder
0.11.2, 2012-01-14
@@ -194,6 +194,10 @@ protected function getRealChildName($name)
*/
protected static function getChildName($name, $ownName)
{
+ if ($name === $ownName) {
+ return $name;
+ }
+
return substr($name, strlen($ownName) + 1);
}
@@ -595,11 +595,23 @@ public function unlinkCanNotRemoveEmptyDirectory()
* @test
* @group issue_32
*/
- public function duplicatedFolderName()
+ public function canCreateFolderOfSameNameAsParentFolder()
{
- vfsStream::setup('testFolder');
+ $root = vfsStream::setup('testFolder');
mkdir(vfsStream::url('testFolder') . '/testFolder/subTestFolder', 0777, true);
$this->assertTrue(file_exists(vfsStream::url('testFolder/testFolder/subTestFolder/.')));
}
+
+ /**
+ * @test
+ * @group issue_32
+ */
+ public function canRetrieveFolderOfSameNameAsParentFolder()
+ {
+ $root = vfsStream::setup('testFolder');
+ mkdir(vfsStream::url('testFolder') . '/testFolder/subTestFolder', 0777, true);
+ $this->assertTrue($root->hasChild('testFolder'));
+ $this->assertNotNull($root->getChild('testFolder'));
+ }
}
?>

0 comments on commit 7f95328

Please sign in to comment.