diff --git a/filesystem/File.php b/filesystem/File.php index 5e9598a74..e03da57fa 100755 --- a/filesystem/File.php +++ b/filesystem/File.php @@ -1,10 +1,10 @@ ParentID) { $p = DataObject::get_by_id('Folder', $this->ParentID); diff --git a/filesystem/Folder.php b/filesystem/Folder.php index 6f496b165..62f5ed67a 100755 --- a/filesystem/Folder.php +++ b/filesystem/Folder.php @@ -1,6 +1,7 @@ assertEquals(ASSETS_DIR . $path,$folder->getRelativePath(), + 'Nested path information is correctly saved to database (with trailing slash)' + ); + + $this->assertTrue(file_exists(ASSETS_PATH . $path), 'File'); + $parentFolder = DataObject::get_one('Folder', '"Name" = \'FolderTest\''); + $this->assertNotNull($parentFolder); + $this->assertEquals($parentFolder->ID, $folder->ParentID); + + $path = '/FolderTest/testFindOrMake'; + $folder = Folder::findOrMake($path); + $this->assertEquals(ASSETS_DIR . $path . '/',$folder->getRelativePath(), + 'Path information is correctly saved to database (without trailing slash)' + ); + } +} \ No newline at end of file