Beispiel #1
0
 private static function get_download_link(ArtefactTypeFile $artefact, BlockInstance $instance, $wmp = false)
 {
     return get_config('wwwroot') . 'artefact/file/download.php?file=' . $artefact->get('id') . '&view=' . $instance->get('view') . ($wmp ? '&download=1' : '');
 }
 /**
  * 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'));
 }