/** * Test that an artefact gets a new path when moved. */ public function testArtefactHierarchyMove() { // Create folder. $folderdata = array('owner' => $this->testuserid, 'title' => 'Test folder', 'description' => 'Test folder description'); $folder = new ArtefactTypeFolder(0, $folderdata); $folder->commit(); // Create a file. $filedata = array('owner' => $this->testuserid, 'title' => 'Test file', 'description' => 'Test file description'); $file = new ArtefactTypeFile(0, $filedata); $file->commit(); // Check that path is root. $fileid = $file->get('id'); $this->assertEquals('/' . $fileid, $file->get('path')); // "Move" file to a folder. $folderid = $folder->get('id'); $file = new ArtefactTypeFile($fileid); $file->move($folderid); $newpath = "/{$folderid}/{$fileid}"; $this->assertEquals($newpath, $file->get('path')); }