diff --git a/main/newscorm/resourcelinker.inc.php b/main/newscorm/resourcelinker.inc.php index 6562d3e346..774ad5ab8d 100755 --- a/main/newscorm/resourcelinker.inc.php +++ b/main/newscorm/resourcelinker.inc.php @@ -1468,16 +1468,17 @@ function show_addresource_button($additionalparameters = '') /** * this function is to delete ONE specific resource that were added to a specific item -*/ +* Deprecated +*//* function delete_one_added_resource($source_type, $source_id, $resource_type, $resource_id) { - echo "delete_one_added_resource"; + //echo "delete_one_added_resource"; global $_course; $TABLERESOURCE = $_course['dbNameGlu']."resource"; $sql="DELETE FROM `$TABLERESOURCE` WHERE source_type='$source_type' and source_id='$source_id' and resource_type='$resource_type' and resource_id='$resource_id'"; Database::query($sql,__FILE__,__LINE__); -} +}*/ /** * this function is to delete the resources that were added to a specific item diff --git a/main/resourcelinker/resourcelinker.inc.php b/main/resourcelinker/resourcelinker.inc.php index 470a7df131..0b60aa6dfc 100755 --- a/main/resourcelinker/resourcelinker.inc.php +++ b/main/resourcelinker/resourcelinker.inc.php @@ -45,7 +45,7 @@ //include(api_get_path(SYS_CODE_PATH).'lang/english/resourcelinker.inc.php'); // TODO: Repeated deleting and moving the rest of this lang file to trad4all //include(api_get_path(SYS_CODE_PATH).'lang/'.$_course['language'].'/resourcelinker.inc.php'); // TODO: Repeated deleting and moving the rest of this lang file to trad4all include_once(api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'); -include('../exercice/hotpotatoes.lib.php'); +include(api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php'); /* ============================================================================== @@ -1441,17 +1441,18 @@ function show_addresource_button($additionalparameters = '') /** * this function is to delete ONE specific resource that were added to a specific item -*/ +* Deprecated +*//* function delete_one_added_resource($source_type, $source_id, $resource_type, $resource_id) { - echo "delete_one_added_resource"; + //echo "delete_one_added_resource"; global $_course; $TABLERESOURCE = $_course['dbNameGlu']."resource"; $sql="DELETE FROM `$TABLERESOURCE` WHERE source_type='$source_type' and source_id='$source_id' and resource_type='$resource_type' and resource_id='$resource_id'"; Database::query($sql,__FILE__,__LINE__); } - +*/ /** * this function is to delete the resources that were added to a specific item */ diff --git a/tests/main/resourcelinker/resourcelinker.inc.test.php b/tests/main/resourcelinker/resourcelinker.inc.test.php new file mode 100644 index 0000000000..3a0b5ec379 --- /dev/null +++ b/tests/main/resourcelinker/resourcelinker.inc.test.php @@ -0,0 +1,197 @@ +assertTrue(is_bool($res)); + //ob_end_clean(); + //var_dump($res); + } + + function testDisplayAddedResources() { + //ob_start(); + $type=1; + $id=1; + $style=''; + $res = display_added_resources($type, $id, $style); + if(!is_null($res)) + $this->assertTrue(is_resource($res)); + //ob_end_clean(); + //var_dump($res); + } + + function testDisplayAddedresourceLink() { + //ob_start(); + $type=''; + $id=1; + $style=''; + $res = display_addedresource_link($type, $id, $style); + $this->assertTrue(is_null($res)); + //ob_end_clean(); + //var_dump($res); + } + + function testDisplayAddedresourceLinkInLearnpath() { + //ob_start(); + $type=''; + $id=1; + $completed=''; + $id_in_path=''; + $builder=''; + $icon=''; + $level = 0; + $res = display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_path, $builder, $icon, $level); + $this->assertTrue(is_null($res)); + //ob_end_clean(); + //var_dump($res); + } + + function testDisplayResources() { + //ob_start(); + $showdeleteimg=''; + $res = display_resources($showdeleteimg); + $this->assertTrue(is_null($res)); + //ob_end_clean(); + //var_dump($res); + } + + function testEdit_addedResources() { + //ob_start(); + $type=''; + $id=1; + $res = edit_added_resources($type, $id); + $this->assertTrue(is_null($res)); + //ob_end_clean(); + //var_dump($res); + } + + function testFileOrFolder() { + //ob_start(); + $filefolder=''; + $res = file_or_folder($filefolder); + $this->assertTrue(is_numeric($res)); + //ob_end_clean(); + //var_dump($res); + } + + function testGetAddedresourceLinkInLearnpath() { + //ob_start(); + $type=''; + $id=1; + $id_in_path=''; + $res = get_addedresource_link_in_learnpath($type, $id, $id_in_path); + $this->assertTrue(is_string($res)); + //ob_end_clean(); + //var_dump($res); + } + + function testShowAddresourceButton() { + ob_start(); + $additionalparameters = ''; + $res = show_addresource_button($additionalparameters); + $this->assertTrue(is_null($res)); + ob_end_clean(); + //var_dump($res); + } + + function testShowDocuments() { + ob_start(); + $folder=''; + $res = show_documents($folder); + $this->assertTrue(is_null($res)); + ob_end_clean(); + //var_dump($res); + } + + function testShowFolderUp() { + //ob_start(); + $res = show_folder_up(); + $this->assertTrue(is_null($res)); + //ob_end_clean(); + //var_dump($res); + } + + function testShoworhideAddresourcelink() { + ob_start(); + $type=''; + $id=1; + $res = showorhide_addresourcelink($type, $id); + $this->assertTrue(is_null($res)); + ob_end_clean(); + //var_dump($res); + } + + function testStoreResources() { + //ob_start(); + $source_type=''; + $source_id=''; + $res = store_resources($source_type, $source_id); + $this->assertTrue(is_null($res)); + //ob_end_clean(); + //var_dump($res); + } + + function testUnsetSessionResources() { + //ob_start(); + $res = unset_session_resources(); + $this->assertTrue(is_null($res)); + //ob_end_clean(); + //var_dump($res); + } + + function testUpdateAddedResources() { + //ob_start(); + $type=''; + $id=1; + $res = update_added_resources($type, $id); + $this->assertTrue(is_null($res)); + //ob_end_clean(); + //var_dump($res); + } + + /*function testDeleteOneAddedResource() { + //ob_start(); + $source_type=''; + $source_id=1; + $resource_type=''; + $resource_id=1; + $res =delete_one_added_resource($source_type, $source_id, $resource_type, $resource_id); + $this->assertTrue(is_null($res)); + //ob_end_clean(); + //var_dump($res); + }*/ + + function testRemoveResource() { + //ob_start(); + $resource_key=''; + $res = remove_resource($resource_key); + $this->assertTrue(is_null($res)); + //ob_end_clean(); + //var_dump($res); + } + + function testDeleteAddedResource() { + //ob_start(); + $type=''; + $id=1; + $res = delete_added_resource($type, $id); + $this->assertTrue(is_null($res)); + //ob_end_clean(); + //var_dump($res); + } + + function testDeleteAllResources_type() { + //ob_start(); + $type=''; + $res = delete_all_resources_type($type); + $this->assertTrue(is_null($res)); + //ob_end_clean(); + //var_dump($res); + } +} +?> \ No newline at end of file