123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505 |
- <?php
- require_once(api_get_path(LIBRARY_PATH).'document.lib.php');
- class TestDropboxFunctions extends UnitTestCase {
-
- function testhandle_multiple_actions() {
- global $_user, $is_courseAdmin, $is_courseTutor;
- $res= handle_multiple_actions();
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testdisplay_move_form() {
- ob_start();
- $id= 1;
- $part = 'test';
- $res= display_move_form($part, $id, $target=array());
- ob_end_clean();
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testdisplay_action_options() {
- ob_start();
- $categories= 1;
- $part = 'test';
- $res= display_action_options($part, $categories, $current_category=0);
- ob_end_clean();
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testdisplay_file_checkbox() {
- $id= 1;
- $part = 'test';
- $res= display_file_checkbox($id, $part);
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testdisplay_addcategory_form() {
- global $dropbox_cnf;
- ob_start();
- $action= 'test';
- $res= display_addcategory_form($category_name='', $id='',$action);
- ob_end_clean();
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testDisplay_add_form() {
- global $_user, $is_courseAdmin, $is_courseTutor, $course_info, $origin, $dropbox_unid;
- ob_start();
- $res= display_add_form();
- ob_end_clean();
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testdisplayuserlink() {
- global $_otherusers;
- $user_id = 1;
- $res= display_user_link($user_id, $name='');
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testGetUserNameFromId() {
- global $dropbox_cnf;
- $id = 1;
- $res= getUserNameFromId($id);
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testGetLoginFromId() {
- $id = 1;
- $res= getLoginFromId($id);
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testget_total_number_feedback() {
- global $dropbox_cnf;
- $res= get_total_number_feedback($file_id='');
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testGetdropbox_categories() {
- $res= get_dropbox_categories($filter='');
- if(!is_null($res)){
- $this->assertTrue(is_array($res));
- }
-
- }
-
- function testgetUserOwningThisMailing() {
- global $dropbox_cnf;
- $mailingPseudoId = '1';
- $res= getUserOwningThisMailing($mailingPseudoId, $owner = 0, $or_die = '');
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testget_last_tool_access() {
- global $_course, $_user;
- $tool = '1';
- $res= get_last_tool_access($tool, $course_code='', $user_id='');
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function teststoreaddcategory() {
- global $_user,$dropbox_cnf;
- $res= store_addcategory();
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testStoremove() {
- $id= 1;
- $part = 'test';
- $target = array();
- $res= store_move($id, $target, $part);
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function teststoreadddropbox() {
- global $dropbox_cnf;
- global $_user;
- global $_course;
- $res= store_add_dropbox();
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testIsCourseMember() {
- $user_id = 1;
- $res= isCourseMember($user_id);
- if(!is_null($res)){
- $this->assertTrue(is_bool($res));
- }
-
- }
-
- function testfeedback() {
- $array = array();
- $res= feedback($array);
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testformat_feedback() {
- $feedback = array();
- $res= format_feedback($feedback);
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testfeedback_form() {
- global $dropbox_cnf;
- $res= feedback_form();
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function teststore_feedback() {
- global $dropbox_cnf;
- global $_user;
- $res= store_feedback();
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testcheck_file_name() {
- global $_course;
- $file_name_2_check = 'test';
- $res= check_file_name($file_name_2_check, $counter=0);
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testcheck_number_feedback() {
- $key = 'test';
- $array = array();
- $res= check_number_feedback($key, $array);
- if(!is_null($res)){
- $this->assertTrue(is_numeric($res));
- }
-
- }
-
- function testgenerate_html_overview() {
- $files = array();
- $res= generate_html_overview($files, $dont_show_columns=array(), $make_link=array());
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
-
-
- function testdropbox_cnf() {
- $variable = 'test';
- $res= dropbox_cnf($variable);
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testmy_pre_add_callback() {
- global $files;
- $p_event = 'test';
- $res= my_pre_add_callback($p_event, &$p_header);
- if(!is_null($res)){
- $this->assertTrue(is_numeric($res));
- }
-
- }
-
- function testcleanup_temp_dropbox() {
- global $_course;
- $res= cleanup_temp_dropbox();
- if(!is_null($res)){
- $this->assertTrue(is_bool($res));
- }
-
- }
-
- function testdelete_category() {
- global $_user, $is_courseAdmin, $is_courseTutor,$dropbox_cnf;
- $id= 1;
- $action = 'test';
- $res= delete_category($action, $id);
- if(!is_null($res)){
- $this->assertTrue(is_string($res));
- }
-
- }
-
- function testremoveUnusedFiles() {
- $res= removeUnusedFiles();
- if(!is_null($res)){
- $this->assertTrue(is_array($res));
- }
-
- }
-
- function testremoveMoreIfMailing() {
- $file_id = 1;
- $res= removeMoreIfMailing($file_id);
- if(!is_null($res)){
- $this->assertTrue(is_array($res));
- }
-
- }
- }
- ?>
|