Explorar el Código

permission commit + removes tests directory

root hace 13 años
padre
commit
5b2ec4f888
Se han modificado 100 ficheros con 0 adiciones y 16510 borrados
  1. 0 6
      .hgignore
  2. 0 6
      tests/chamilotest.php
  3. 0 8
      tests/course_tests/index.html
  4. 0 22
      tests/datafiller/data_courses.php
  5. 0 166
      tests/datafiller/data_users.php
  6. 0 48
      tests/datafiller/fill_all.php
  7. 0 32
      tests/datafiller/fill_courses.php
  8. 0 31
      tests/datafiller/fill_users.php
  9. 0 32
      tests/datafiller/fill_whoisonline.php
  10. 0 8
      tests/datafiller/index.html
  11. BIN
      tests/img/bg-footer.gif
  12. BIN
      tests/img/bg-header4.png
  13. BIN
      tests/img/header-logo.png
  14. 0 8
      tests/index.html
  15. 0 50
      tests/internationalization.lib.test_standalone.php
  16. 0 398
      tests/main/admin/calendar.lib.test.php
  17. 0 155
      tests/main/admin/statistics/statistics.lib.test.php
  18. 0 208
      tests/main/admin/sub_language.class.test.php
  19. 0 137
      tests/main/announcements/announcements.inc.test.php
  20. 0 84
      tests/main/auth/lost_password.lib.test.php
  21. 0 71
      tests/main/auth/openid/xrds.lib.test.php
  22. 0 79
      tests/main/chat/chat_functions.lib.test.php
  23. 0 16
      tests/main/conference/get_translation.lib.test.php
  24. 0 23
      tests/main/course_info/download.lib.test.php
  25. 0 319
      tests/main/dropbox/dropbox_class.inc.test.php
  26. 0 529
      tests/main/dropbox/dropbox_functions.inc.test.php
  27. 0 389
      tests/main/exercice/answer.class.test.php
  28. 0 539
      tests/main/exercice/exercise.class.test.php
  29. 0 42
      tests/main/exercice/exercise.lib.test.php
  30. 0 85
      tests/main/exercice/exercise_result.class.test.php
  31. 0 100
      tests/main/exercice/export/exercise_import.inc.test.php
  32. 0 198
      tests/main/exercice/export/qti2/qti2_classes.test.php
  33. 0 86
      tests/main/exercice/export/qti2/qti2_export.test.php
  34. 0 234
      tests/main/exercice/export/scorm/scorm_classes.test.php
  35. 0 45
      tests/main/exercice/fill_blanks.class.test.php
  36. 0 29
      tests/main/exercice/freeanswer.class.test.php
  37. 0 178
      tests/main/exercice/hotpotatoes.lib.test.php
  38. 0 1363
      tests/main/forum/forumfunction.inc.test.php
  39. 0 135
      tests/main/gradebook/lib/be/attendancelink.class.test.php
  40. 0 423
      tests/main/gradebook/lib/be/category.class.test.php
  41. 0 42
      tests/main/gradebook/lib/be/dropboxlink.class.test.php
  42. 0 347
      tests/main/gradebook/lib/be/evaluation.class.test.php
  43. 0 153
      tests/main/gradebook/lib/be/exerciselink.class.test.php
  44. 0 42
      tests/main/gradebook/lib/be/forumthreadlink.class.test.php
  45. 0 20
      tests/main/inc/banner.inc.test.php
  46. 0 17
      tests/main/inc/banner.lib.test.php
  47. 0 40
      tests/main/inc/course_document.lib.test.php
  48. 0 35
      tests/main/inc/lib/access_url_edit_courses_to_url_functions.lib.test.php
  49. 0 32
      tests/main/inc/lib/access_url_edit_sessions_to_url_functions.lib.test.php
  50. 0 33
      tests/main/inc/lib/access_url_edit_users_to_url_functions.lib.test.php
  51. 0 170
      tests/main/inc/lib/add_course.lib.inc.test.php
  52. 0 34
      tests/main/inc/lib/add_courses_to_sessions_functions.lib.test.php
  53. 0 29
      tests/main/inc/lib/add_many_session_to_category_functions.lib.test.php
  54. 0 600
      tests/main/inc/lib/blog.lib.test.php
  55. 0 94
      tests/main/inc/lib/classmanager.lib.test.php
  56. 0 557
      tests/main/inc/lib/course.lib.test.php
  57. 0 314
      tests/main/inc/lib/database.lib.test.php
  58. 0 65
      tests/main/inc/lib/debug.lib.inc.test.php
  59. 0 321
      tests/main/inc/lib/display.lib.test.php
  60. 0 300
      tests/main/inc/lib/document.lib.test.php
  61. 0 150
      tests/main/inc/lib/events.lib.inc.test.php
  62. 0 121
      tests/main/inc/lib/exercise_show_functions.lib.test.php
  63. 0 109
      tests/main/inc/lib/export.lib.inc.test.php
  64. 0 76
      tests/main/inc/lib/fileDisplay.lib.test.php
  65. 0 191
      tests/main/inc/lib/fileManage.lib.test.php
  66. 0 196
      tests/main/inc/lib/fileManager.lib.test.php
  67. 0 382
      tests/main/inc/lib/fileUpload.lib.test.php
  68. 0 9
      tests/main/inc/lib/geometry.lib.test.php
  69. 0 157
      tests/main/inc/lib/glossary.lib.test.php
  70. 0 464
      tests/main/inc/lib/groupmanager.lib.test.php
  71. 0 113
      tests/main/inc/lib/image.lib.test.php
  72. 0 16
      tests/main/inc/lib/import.lib.test.php
  73. 0 83
      tests/main/inc/lib/internationalization.lib.test.php
  74. 0 81
      tests/main/inc/lib/legal.lib.test.php
  75. 0 33
      tests/main/inc/lib/mail.lib.inc.test.php
  76. 0 867
      tests/main/inc/lib/main_api.lib.test.php
  77. 0 539
      tests/main/inc/lib/main_api.lib.test_standalone.php
  78. 0 61
      tests/main/inc/lib/message.lib.test.php
  79. 0 87
      tests/main/inc/lib/notebook.lib.test.php
  80. 0 64
      tests/main/inc/lib/online.inc.test.php
  81. 0 72
      tests/main/inc/lib/rmdirr.lib.test.php
  82. 0 105
      tests/main/inc/lib/security.lib.test.php
  83. 0 107
      tests/main/inc/lib/session_handler.class.test.php
  84. 0 127
      tests/main/inc/lib/sessionmanager.lib.test.php
  85. 0 152
      tests/main/inc/lib/social.lib.test.php
  86. 0 165
      tests/main/inc/lib/sortabletable.class.test.php
  87. 0 99
      tests/main/inc/lib/specific_fields_manager.lib.test.php
  88. 0 157
      tests/main/inc/lib/stats.lib.inc.test.php
  89. 0 126
      tests/main/inc/lib/statsUtils.lib.inc.test.php
  90. 0 313
      tests/main/inc/lib/surveymanager.lib.test.php
  91. 0 108
      tests/main/inc/lib/system_announcements.lib.test.php
  92. 0 79
      tests/main/inc/lib/tablesort.lib.test.php
  93. 0 150
      tests/main/inc/lib/text.lib.test.php
  94. 0 485
      tests/main/inc/lib/tracking.lib.test.php
  95. 0 25
      tests/main/inc/lib/upload.xajax.test.php
  96. 0 225
      tests/main/inc/lib/urlmanager.lib.test.php
  97. 0 360
      tests/main/inc/lib/usermanager.lib.test.php
  98. 0 85
      tests/main/inc/lib/xht.lib.test.php
  99. 0 211
      tests/main/inc/lib/xmd.lib.test.php
  100. 0 33
      tests/main/inc/tool_navigation_menu.inc.test.php

+ 0 - 6
.hgignore

@@ -1,6 +0,0 @@
-/* For licensing terms, see /license.txt */
-
-/* README */ 
-
-This directory is used for automated testing through the use of the SimpleTest framework..
-Run test_suite.php 

+ 0 - 6
tests/chamilotest.php

@@ -1,6 +0,0 @@
-<?php require_once('../main/inc/global.inc.php');
-
-var_dump(api_is_windows_os());
-
-//echo (api_is_windows_os()?'true':'false');
-?>

+ 0 - 8
tests/course_tests/index.html

@@ -1,8 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-</head>
-<body>
-<br />
-</body>
-</html>

+ 0 - 22
tests/datafiller/data_courses.php

@@ -1,22 +0,0 @@
-<?php //$id$
-/**
- * This script contains the data to fill (or empty) the database with using
- * the fillers in this directory.
- * @author Yannick Warnier <yannick.warnier@dokeos.com>
- *
- */
-/**
- * Initialisation section
- */
-global $_configuration;
-$courses = array();
-$courses[] = array(
-    'code' => 'ENGLISH101',
-    'title' => 'English for beginners',
-    'tutor' => '',
-    'category' => 'PROJ',
-    'language' => 'english',
-    'admin_id' => 1,
-    'expires' => '2020-09-01 00:00:00',
-    'fill' => true,
-);

+ 0 - 166
tests/datafiller/data_users.php

@@ -1,166 +0,0 @@
-<?php //$id$
-/**
- * This script contains the data to fill (or empty) the database with using
- * the fillers in this directory.
- * @author Yannick Warnier <yannick.warnier@dokeos.com>
- *
- */
-/**
- * Initialisation section
- */
-$users = array();
-$users[] = array(
-    'username' => 'ywarnier',
-    'pass' => 'ywarnier',
-    'firstname' => 'Yannick',
-    'lastname' => 'Warnier',
-    'status' => 1,
-    'auth_source' => 'platform',
-    'email' => 'yannick.warnier@example.com',
-    'creator_id' => 1,
-    'active' => 1,
-);
-$users[] = array(
-    'username' => 'mmosquera',
-    'pass' => 'mmosquera',
-    'firstname' => 'Michela',
-    'lastname' => 'Mosquera Guardamino',
-    'status' => 1,
-    'auth_source' => 'platform',
-    'email' => 'michela.mosquera@example.com',
-    'creator_id' => 1,
-    'active' => 1,
-);
-$users[] = array(
-    'username' => 'mlanoix',
-    'pass' => 'mlanoix',
-    'firstname' => 'Michel',
-    'lastname' => 'Lanoix',
-    'status' => 5,
-    'auth_source' => 'platform',
-    'email' => 'michel.lanoix@example.com',
-    'creator_id' => 1,
-    'active' => 1
-);
-
-$users[] = array(
-    'username' => 'jmontoya',
-    'pass' => 'jmontoya',
-    'firstname' => 'Julio',
-    'lastname' => 'Montoya',
-    'status' => 1,
-    'auth_source' => 'platform',
-    'email' => 'julio.montoya@example.com',
-    'creator_id' => 1,
-    'active' => 1
-);
-
-$users[] = array(
-    'username' => 'agarcia',
-    'pass' => 'agarcia',
-    'firstname' => 'Alan',
-    'lastname' => 'Garcia',
-    'status' => 1,
-    'auth_source' => 'platform',
-    'email' => 'agarcia@example.com',
-    'creator_id' => 1,
-    'active' => 1
-);
-
-$users[] = array(
-    'username' => 'pperez',
-    'pass' => 'pperez',
-    'firstname' => 'Pedro',
-    'lastname' => 'Perez',
-    'status' => 5,
-    'auth_source' => 'platform',
-    'email' => 'pperez@example.com',
-    'creator_id' => 1,
-    'active' => 1
-);
-
-$users[] = array(
-    'username' => 'ggomez',
-    'pass' => 'ggomez',
-    'firstname' => 'Gabriela',
-    'lastname' => 'Gomez',
-    'status' => 5,
-    'auth_source' => 'platform',
-    'email' => 'ggomez@example.com',
-    'creator_id' => 1,
-    'active' => 1
-);
-
-$users[] = array(
-    'username' => 'norizales',
-    'pass' => 'norizales',
-    'firstname' => 'Noa',
-    'lastname' => 'Orizales',
-    'status' => 5,
-    'auth_source' => 'platform',
-    'email' => 'norizales@example.com',
-    'creator_id' => 1,
-    'active' => 1
-);
-
-$users[] = array(
-    'username' => 'jbrion',
-    'pass' => 'jbrion',
-    'firstname' => 'Jon',
-    'lastname' => 'Brion',
-    'status' => 5,
-    'auth_source' => 'platform',
-    'email' => 'jbrion@example.com',
-    'creator_id' => 1,
-    'active' => 1
-);
-
-
-$users[] = array(
-    'username' => 'fapple',
-    'pass' => 'fapple',
-    'firstname' => 'Fiona',
-    'lastname' => 'Apple Maggart',
-    'status' => 5,
-    'auth_source' => 'platform',
-    'email' => 'fapple@example.com',
-    'creator_id' => 1,
-    'active' => 1
-);
-
-$users[] = array(
-    'username' => 'acalabaza',
-    'pass' => 'acalabaza',
-    'firstname' => 'Aldo',
-    'lastname' => 'Calabaza',
-    'status' => 5,
-    'auth_source' => 'platform',
-    'email' => 'acalabaza@example.com',
-    'creator_id' => 1,
-    'active' => 1
-);
-
-
-$users[] = array('username' => 'mhalles','pass' => 'mhalles','firstname' => 'Maria','lastname' => 'Halles','status' => 5,'auth_source' => 'platform','email' => 'mhalles@example.com','creator_id' => 1,'active' => 1);
-$users[] = array('username' => 'adaniel','pass' => 'adaniel','firstname' => 'Annaa','lastname' => 'Daniel','status' => 5,'auth_source' => 'platform','email' => 'adaniel@example.com','creator_id' => 1,'active' => 1);
-$users[] = array('username' => 'ppiedra','pass' => 'ppiedra','firstname' => 'Pirot','lastname' => 'Piedra','status' => 5,'auth_source' => 'platform','email' => 'ppiedra@example.com','creator_id' => 1,'active' => 1);
-$users[] = array('username' => 'amartin','pass' => 'amartin','firstname' => 'Angel','lastname' => 'Martin','status' => 5,'auth_source' => 'platform','email' => 'amartin@example.com','creator_id' => 1,'active' => 1);
-$users[] = array('username' => 'mhingis','pass' => 'mhingis','firstname' => 'Marsi','lastname' => 'Hingis','status' => 5,'auth_source' => 'platform','email' => 'mhingis@example.com','creator_id' => 1,'active' => 1);
-$users[] = array('username' => 'jlennon','pass' => 'jlennon','firstname' => 'Johny','lastname' => 'Lennon','status' => 5,'auth_source' => 'platform','email' => 'jlennon@example.com','creator_id' => 1,'active' => 1);
-$users[] = array('username' => 'pchavez','pass' => 'pchavez','firstname' => 'Parol','lastname' => 'Chavez','status' => 5,'auth_source' => 'platform','email' => 'pchavez@example.com','creator_id' => 1,'active' => 1);
-
-
-/*
-$users[] = array(
-    'username' => '',
-    'pass' => '',
-    'firstname' => '',
-    'lastname' => '',
-    'status' => 1,
-    'auth_source' => 'platform',
-    'email' => '',
-    'status' => 1,
-    'creator_id' => 1,
-    'active' => 1,
-);
-*/

+ 0 - 48
tests/datafiller/fill_all.php

@@ -1,48 +0,0 @@
-<?php //$id$
-/**
- * This script contains calls to the various filling scripts that allow a
- * demo presenter to fill his Dokeos with demo data.
- * This script is locked against execution from the browser, to avoid malicious
- * insertion on production portals.
- * To execute, you need the PHP5 Command Line Interface (CLI) to be installed
- * on your system and t launch this script manually using: php5 fill_all.php
- * @author Yannick Warnier <yannick.warnier@dokeos.com>
- */
- 
-/**
- * Initialisation section
- */
-$incdir = dirname(__FILE__).'/../../main/inc/'; 
-require $incdir.'global.inc.php';
-
-/**
- * Code logic
- */
-//Avoid execution if not from the command line
-if (PHP_SAPI != 'cli') { die('This demo-data filling script can only be run from the command line. Please launch it from the command line using: php5 fill_all.php. To enable it from your browser (very highly dangerous), remove the first line of code from the "logic" section of this file.'); }
-$eol = PHP_EOL;
-$output = '';
-$files = scandir(dirname(__FILE__));
-foreach ($files as $file) {
-	if (substr($file,0,1) == '.' or substr($file,0,5) != 'fill_') { ; } //skip
-    else {    	
-    	if ($file == basename(__FILE__)) {
-    		//skip, this is the current file
-    	} else {
-            $output .= $eol.'Reading file: '.$file.$eol;
-    		require_once $file;
-            $function = basename($file,'.php');
-            if (function_exists($function)) {
-            	$output .= $eol.'Executing function '.$function.$eol;
-                $function();
-            } else {
-                //function not found
-            }
-    	}
-    }
-}
-/**
- * Display
- */
-echo $output.$eol;
-echo "Done all$eol";

+ 0 - 32
tests/datafiller/fill_courses.php

@@ -1,32 +0,0 @@
-<?php //$id$
-/**
- * This script contains a data filling procedure for users
- * @author Yannick Warnier <yannick.warnier@beeznest.com>
- *
- */
-/**
- * Initialisation section
- */
-//require_once '../../main/inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
-require_once api_get_path(LIBRARY_PATH).'database.lib.php';
-/**
- * Loads the data and injects it into the Chamilo database, using the Chamilo
- * internal functions.
- * @return  array  List of user IDs for the users that have just been inserted
- */
-function fill_courses() {
-    $eol = PHP_EOL;
-    $courses = array(); //declare only to avoid parsing notice
-    require_once 'data_courses.php'; //fill the $users array
-    $output = array();
-    $output[] = array('title'=>'Courses Filling Report:');
-    $i = 1;
-    foreach ($courses as $i => $course) {
-        //first check that the first item doesn't exist already
-    	$output[$i]['line-init'] = $course['title'];
-    	$output[$i]['line-info'] = ($res = create_course($course['code'],$course['title'],$course['tutor'],$course['category'],$course['language'],$course['admin_id'],Database::get_database_name_prefix(),$course['expires'],$course['fill'])?$res:get_lang('NotInserted'));
-    	$i++;
-    }
-    return $output;
-}

+ 0 - 31
tests/datafiller/fill_users.php

@@ -1,31 +0,0 @@
-<?php //$id$
-/**
- * This script contains a data filling procedure for users
- * @author Yannick Warnier <yannick.warnier@beeznest.com>
- *
- */
-/**
- * Initialisation section
- */
-//require_once '../../main/inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
-/**
- * Loads the data and injects it into the Chamilo database, using the Chamilo
- * internal functions.
- * @return  array  List of user IDs for the users that have just been inserted
- */
-function fill_users() {
-	$eol = PHP_EOL;
-    $users = array(); //declare only to avoid parsing notice
-    require_once 'data_users.php'; //fill the $users array
-    $output = array();
-    $output[] = array('title'=>'Users Filling Report:');
-    $i = 1;
-    foreach ($users as $i => $user) {
-        //first check that the first item doesn't exist already
-    	$output[$i]['line-init'] = $user['firstname'];
-    	$output[$i]['line-info'] = ($res = UserManager::create_user($user['firstname'],$user['lastname'],$user['status'],$user['email'],$user['username'],$user['pass'],null,null,null,null,$user['auth_source'],null,$user['active'])?$res:get_lang('NotInserted'));
-    	$i++;
-    }
-    return $output;
-}

+ 0 - 32
tests/datafiller/fill_whoisonline.php

@@ -1,32 +0,0 @@
-<?php //$id$
-/**
- * This script contains a data filling procedure for users
- * @author Julio Montoya <gugli100@gmail.com>
- *
- */
- 
-/**
- * Initialisation section
- */
-
-require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
-/**
- * Loads the data and injects it into the Dokeos database, using the Dokeos
- * internal functions.
- * @return  array  List of user IDs for the users that have just been inserted
- */
-function fill_whoisonline() {
-	$table_e_online = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE);
-	$max = 100;
-		
-	//Cleaning the table
-	$sql = "TRUNCATE $table_e_online"; 
-	$rs = Database::query($sql);
-	//filling the table
-	for ($i=1;$i <=$max;$i++) {
-		$date = api_get_local_time();
-		$sql = "INSERT INTO	$table_e_online (login_id, login_user_id, login_date, login_ip, course, session_id, access_url_id)
-				VALUES ('$i', '$i', '$date', '127.0.0.1', '', '0','1')";
-		$rs = Database::query($sql);
-	}	
-}

+ 0 - 8
tests/datafiller/index.html

@@ -1,8 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-</head>
-<body>
-<br />
-</body>
-</html>

BIN
tests/img/bg-footer.gif


BIN
tests/img/bg-header4.png


BIN
tests/img/header-logo.png


+ 0 - 8
tests/index.html

@@ -1,8 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-</head>
-<body>
-<br />
-</body>
-</html>

+ 0 - 50
tests/internationalization.lib.test_standalone.php

@@ -1,50 +0,0 @@
-<?php
-
-/**
- * A standalone test for the internationalization library.
- * @author Ricardo Rodriguez Salazar, 2009.
- * @author Ivan Tcholakov, September 2009.
- * For licensing terms, see /dokeos_license.txt
- */
-
-//ini_set('memory_limit','128M');
-
-$_current_dir = dirname(__FILE__).'/';
-
-$_sys_code_path = $_current_dir.'../main/';
-$_sys_include_path = $_sys_code_path.'inc/';
-$_sys_library_path = $_sys_code_path.'inc/lib/';
-
-$_test_sys_code_path = $_current_dir.'main/';
-$_test_sys_include_path = $_test_sys_code_path.'inc/';
-$_test_sys_library_path = $_test_sys_code_path.'inc/lib/';
-
-
-require_once($_current_dir.'simpletest/unit_tester.php');
-
-require_once($_sys_include_path.'global.inc.php');
-
-//header('Content-Type: text/html; charset=' . $charset);
-header('Content-Type: text/html; charset=' . 'UTF-8');
-
-require_once($_current_dir.'simpletest/web_tester.php');
-require_once($_current_dir.'simpletest/mock_objects.php');
-require_once($_current_dir.'simpletest/autorun.php');
-
-$_SESSION['_user']['user_id'] = 1;
-
-class InternationalizationTests extends TestSuite {
-
-    function  InternationalizationTests() {
-        $this->TestSuite('Internationalization Tests');
-
-        global $_test_sys_library_path;
-		$this->addTestFile($_test_sys_library_path.'internationalization.lib.test.php');
-    }
-
-}
-
-$test = & new InternationalizationTests();
-//$test-> run( new HtmlReporter());
-
-?>

+ 0 - 398
tests/main/admin/calendar.lib.test.php

@@ -1,398 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php");
-//require_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'icalcreator/iCalcreator.class.php');
-//require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
-
-
-class TestCalendar extends UnitTestCase {
-
-
-	public function TestCalendar(){
-		$this->UnitTestCase('Admin calendar library - main/admin/calendar.inc.test.php');
-	}
-	public function testToJavascript(){
-		$res = to_javascript();
-		$this->assertTrue($res);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Adds an agenda item in the database. Similar to store_new_agenda_item() except it takes parameters
-	 * @param   array   Course info
-	 * @param   string  Event title
-	 * @param   string  Event content/description
-	 * @param   string  Start date
-	 * @param   string  End date
-	 * @param   array   List of groups to which this event is added
-	 * @param   int     Parent id (optional)
-	 * @return  int     The new item's DB ID
-	 */
-	public function testAgendaAddItem(){
-		global $_course;
-		$course_code=$_course;
-		$course_info = '';
-		$title='test';
-		$content='test function';
-		$db_start_date='07/11/2009';
-		$db_end_date='07/20/2009';
-		$res = agenda_add_item($course_info, $title, $content, $db_start_date, $db_end_date, $to=array(), $parent_id=null);
-		$this->assertTrue($res>0,'Global agenda item could not be inserted');
-        delete_agenda_item($res);
-		//var_dump($res);
-	}
-
-	public function testStoreNewAgendaItem(){
-		global $_user;
-		$res_store = store_new_agenda_item();
-		$this->assertTrue(is_numeric($res_store));
-
-		//delete the new agenda item in the database
-		if (is_numeric($res_store)) {
-			$res_delete = delete_agenda_item($res_store);
-			$this->assertTrue(is_numeric($res_store));
-		}
-	}
-
- 	 public function testShowAddForm(){
- 		ob_start();
- 		global $MonthsLong;
- 		$id='';
- 		$res= show_add_form($id);
- 		ob_end_clean();
- 		$this->assertTrue(is_null($res));
- 		//var_dump($res);
- 	}
-
- 	public function testAddWeek(){
- 		$timestamp=12;
- 		$num=1;
- 		$res = add_week($timestamp,$num);
- 		$this->assertTrue(is_numeric($res));
- 		//var_dump($res);
- 	}
-
- 	public function testAddMonth(){
- 		$timestamp=5;
- 		$num=1;
- 		$res = add_month($timestamp,$num);
- 		$this->assertTrue(is_numeric($res));
- 		//var_dump($res);
- 	}
-
- 	public function testAddYear(){
- 		$timestamp=9999;
- 		$num=1;
- 		$res = add_year($timestamp,$num);
- 		$this->assertTrue(is_numeric($res));
- 		//var_dump($res);
- 	}
-
-
-/**
- * Adds a repetitive item to the database
- * @param   array   Course info
- * @param   int     The original event's id
- * @param   string  Type of repetition
- * @param   int     Timestamp of end of repetition (repeating until that date)
- * @param   array   Original event's destination
- * @return  boolean False if error, True otherwise
- */
-
- 	public function testAgendaAddRepeatItem(){
- 		//this function is not used or deprecated
- 	}
-
- 	public function testGetCalendarItems(){
- 		global $_course;
- 		$month=01;
- 		$year=2010;
-		$res = get_calendar_items($month, $year);
- 		$this->assertTrue(is_array($res));
- 		//var_dump($res);
- 	}
-
- 	//This funtion need a path where will copy to the other folder.
-/*
- 	public function testAgendaImportIcal() {
- 		global $_course;
- 		$course_info = $_course;
- 		$file = api_get_path(SYS_PATH).'tests/main/admin/icals/test.ics';
- 		$res = agenda_import_ical($course_info, $file);
- 		if(is_bool($res)){
- 		$this->assertTrue(is_bool($res));
- 		$this->assertTrue($res===false || $res === true);
- 		}else{
- 			$this->assertTrue($res);
- 		}
- 	}
-*/
-
-	public function testStoreEditedAgendaItem(){
- 		ob_start();
- 		$id=1;
-		$title='';
-		$content='';
-		$start_date= 21;
-		$end_date=25;
-		$res = store_edited_agenda_item();
- 		$edit_result=save_edit_agenda_item($id,$title,$content,$start_date,$end_date);
- 		ob_end_clean();
- 		$this->assertTrue($edit_result);
- 		//var_dump($edit_result);
- 	}
-
- 	public function testSaveEditAgendaItem(){
-	 	$id=Database::escape_string($id);
-		$title=Database::escape_string($title);
-		$content=Database::escape_string($content);
-		$start_date=Database::escape_string($start_date);
-		$end_date=Database::escape_string($end_date);
-	 	$res = save_edit_agenda_item($id,$title,$content,$start_date,$end_date);
- 		$this->assertTrue($res);
- 		$this->assertTrue(is_bool($res));
- 		//var_dump($res);
- 	}
-
- 	public function testCalculateStartEndOfWeek(){
- 		$week_number=4;
- 		$year=2011;
- 		$res = calculate_start_end_of_week($week_number, $year);
- 		$this->assertTrue(is_array($res));
- 		$this->assertTrue($res);
- 		//var_dump($res);
- 	}
-
- 	/**
-	* Displays all the agenda items
-	*/
- 	public function testDisplayAgendaItems() {
- 		global $is_courseAdmin;
- 		ob_start();
- 		$TABLEAGENDA = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
- 		$res = display_agenda_items();
- 		ob_end_clean();
- 		$this->assertTrue(is_null($res));
- 	}
-
- 	 	public function testDisplayDaycalendar(){
- 		ob_start();
- 		$agendaitems='';
- 		$day='';
- 		$month='';
- 		$year='';
- 		$weekdaynames='';
- 		$monthName='';
- 		$res = display_daycalendar($agendaitems, $day, $month, $year, $weekdaynames, $monthName);
- 		ob_end_clean();
- 		$this->assertTrue(is_null($res));
- 		//var_dump($res);
- 	}
-
- 	public function testDisplayWeekcalendar() {
- 		ob_start();
- 		$agendaitems='';
- 		$month=10;
- 		$year=2011;
- 		$weekdaynames='';
- 		$monthName='';
- 		$res = display_weekcalendar($agendaitems, $month, $year, $weekdaynames, $monthName);
- 		ob_end_clean();
- 		$this->assertTrue(is_null($res));
- 		//var_dump($res);
- 	}
-
- 	public function testGetDayAgendaitems() {
- 		$courses_dbs=array();
- 		$month=01;
- 		$year=2010;
- 		$day='1';
- 		$res = get_day_agendaitems($courses_dbs, $month, $year, $day);
- 		$this->assertTrue(is_array($res));
- 		//var_dump($res);
- 	}
-
- 	public function testGetWeekAgendaitems() {
- 		$courses_dbs=array();
- 		$month=01;
- 		$year=2010;
-		$res = get_week_agendaitems($courses_dbs, $month, $year);
- 		$this->assertTrue(is_array($res));
- 	}
-
- 	public function testGetRepeatedEventsDayView(){
- 			global $_course;
- 			$start = 0;
- 			$end = 0;
- 			$params = array();
-			$course_code = 'COURSETEST';
-			$course_info = api_get_course_info($course_code);
-			$resul = get_repeated_events_day_view($course_info,$start,$end,$params);
-	 		$this->assertTrue(is_array($resul));
- 	}
-
- 	public function testGetRepeatedEventsWeekView(){
- 		$course_info = 'COURSETEST';
- 		$resul = get_repeated_events_week_view($course_info, 0, 0, '');
- 		$this->assertTrue(is_array($resul));
- 	}
-
- 	public function testGetRepeatedEventsMonthView(){
- 		$course_code='COURSETEST';
- 		$course_info = api_get_course_info($course_code);
- 		$resul= get_repeated_events_month_view($course_info,0,0,'');
-		$this->assertTrue(is_array($resul));
-		//var_dump($resul);
-	}
-
-	public function testGetRepeatedEventsListView(){
-		$course_code='COURSETEST';
- 		$course_info = api_get_course_info($course_code);
-		$resul = get_repeated_events_list_view($course_info,0,0,'');
-		$this->assertTrue(is_array($resul));
-		//var_dump($resul);
-	}
-
-	public function testDeleteAgendaItem(){
-		$id=1;
-		$res = delete_agenda_item($id);
-		$this->assertTrue(is_bool($res));
- 	}
- 	 	public function testDisplayMinimonthcalendar(){
- 		ob_start();
- 		global $DaysShort;
- 		$agendaitems=array('test','test2');
- 		$month=01;
- 		$year=2010;
- 		$monthName='';
- 		$res = display_minimonthcalendar($agendaitems, $month, $year, $monthName);
- 		ob_end_clean();
- 		$this->assertTrue(is_null($res));
- 		//var_dump($res);
- 	}
-
- 	public function testUserGroupFilterJavascript(){
- 		$res = user_group_filter_javascript();
- 		$this->assertTrue($res);
- 		$this->assertTrue(is_string($res));
- 		//var_dump($res);
- 	}
-
- 	public function testDisplayMonthcalendar(){
- 		ob_start();
- 		global $MonthsLong;
-		global $DaysShort;
-		global $origin;
-		$month=05;
-		$year=2010;
-		$res = display_monthcalendar($month, $year);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		$this->assertNull($res);
-		//var_dump($res);
- 	}
-
- 	public function testDisplayCourseadminLinks(){
- 		ob_start();
- 		$res = display_courseadmin_links();
- 		ob_end_clean();
- 		$this->assertTrue(is_null($res));
- 		//var_dump($res);
- 	}
-
- 	public function testDisplayStudentLinks(){
- 		ob_start();
- 		global $show;
- 		$res = display_student_links();
- 		ob_end_clean();
- 		$this->assertTrue(is_null($res));
- 		//var_dump($res);
- 	}
-
- 	public function testGetAgendaItem(){
- 		$id=4;
- 		$res = get_agenda_item($id);
- 		if(is_array($res)) {
- 			$this->assertTrue(is_array($res));
- 		}
- 	}
-
-
-	/**
-	* Makes an agenda item visible or invisible for a student
-	* @param integer id the id of the agenda item we are changing the visibility of
-	*/
- 	public function testShowhideAgendaItem(){
-		ob_start();
-		$id=1;
-		global $nameTools;
- 		$res = showhide_agenda_item($id);
- 		//Show the message when the visibility was changed
- 		$real_show = Display::display_normal_message(get_lang("VisibilityChanged"));
- 		ob_end_clean();
- 		if(!empty($res)){
- 			$this->assertTrue($res);
- 			$this->assertTrue($real_show);
- 		} else {
- 			$this->assertNull($res);
- 		}
- 		//var_dump($res);
- 	}
-
- 	/**
-	* Displays only 1 agenda item. This is used when an agenda item is added to the learning path.
-	*/
- 	public function testDisplayOneAgendaItem(){
- 		ob_start();
-		$agenda_id=1;
-		$res = display_one_agenda_item($agenda_id);
-		ob_end_clean();
- 		$this->assertTrue(is_null($res));
-
-  	}
-
-	/**
-	* Show the form for adding a new agenda item. This is the same function that is used whenever we are editing an
-	* agenda item. When the id parameter is empty (default behaviour), then we show an empty form, else we are editing and
-	* we have to retrieve the information that is in the database and use this information in the forms.
-	*/
- 	public function testShowGroupFilterForm(){
- 		ob_start();
- 		$res = show_group_filter_form();
- 		ob_end_clean();
- 		$this->assertTrue(is_null($res));
- 	}
-
- 	public function testShowUserFilterForm(){
-		ob_start();
- 		$res = show_user_filter_form();
- 		ob_end_clean();
- 		$this->assertTrue(is_null($res));
- 	}
-
- 	public function testGetAgendaitems(){
- 		global $_user;
-		global $_configuration;
- 		$month=01;
- 		$year=2010;
- 		$res = get_agendaitems($month, $year);
- 		if(is_array($res)) {
- 			$this->assertTrue(is_array($res));
- 		}
-
- 	}
-
- 	public function testDisplayUpcomingEvents(){
- 		 ob_start();
-		 $res = display_upcoming_events();
-		 ob_end_clean();
-		 $this->assertNull($res);
- 	}
-
- 	public function testIsRepeatedEvent() {
-	//This is deprecated or not used
- 	}
-
-}
-?>

+ 0 - 155
tests/main/admin/statistics/statistics.lib.test.php

@@ -1,155 +0,0 @@
-<?php
-class TestStatistics extends UnitTestCase{
-
-	public function TestStatistics(){
-		$this->UnitTestCase('this File test the provides some function for statistics ');
-	}
-
-	public function setUp(){
-		$this-> statisc = new Statistics();
-	}
-
-	public function tearDown(){
-		$this->statisc = null;
-	}
-
-	public function testMakeSizeString(){
-		$size=20960000;
-		$res = Statistics::make_size_string($size);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Count courses
-	 * @param string $category_code  Code of a course category. Default: count
-	 * all courses.
-	 * @return int Number of courses counted
-	 */
-	public function testCountCourses(){
-		$res = Statistics::count_courses();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testCountUsers(){
-		$user_id ='1';
-		$category_code = NULL;
-		$course_code='ABC';
-		$firstName='Jhon'; $lastName='Doe'; $status='1'; $email='localhost@localhost.com'; $loginName='admin'; $password='admin';
-		$count_invisible_courses = true;
-		$res = Statistics::count_users($status, $category_code, $count_invisible_courses);
-		$this->assertTrue(is_numeric($res));
-		$this->assertTrue(count($res)===0 || count($res)!==0);
-	}
-
-	public function testGetNumberOfActivities() {
-		$resu = Statistics::get_number_of_activities();
-		if(!is_null($resu)){
-		$this->assertTrue(is_numeric($resu));
-		$this->assertTrue(count($resu)==0 || count($resu)!==0);
-		}
-	}
-
-	/**
-	 * Get activities data to display
-	 */
-	public function testGetActivitiesData(){
-		global $dateTimeFormatLong;
-		$from = 0;
-		$number_of_items = 30;
-		$column = '';
-		$direction = 'ASC';
-		$resu = Statistics::get_activities_data($from, $number_of_items, $column, $direction);
-    	$this->assertTrue(is_array($resu));
-    }
-
-	/**
-	 * Get all course categories
-	 * @return array All course categories (code => name)
-	 */
-    public function testGetCourseCategories(){
-    	$res = Statistics::get_course_categories();
-    	$this->assertTrue($res);
-    	//var_dump($res);
-    }
-
-    public function testRescale(){
-    	$data=array('test','test2','test3');
-    	$max = 500;
-    	$res = Statistics::rescale($data, $max);
-    	$this->assertTrue($res);
-    	$this->assertTrue(is_array($res));
-    	//var_dump($res);
-    }
-
-    public function testPrintStats(){
-    	ob_start();
-    	$title='testing';
-    	$stats=array('test','test2','test3');
-    	$show_total = true;
-    	$is_file_size = false;
-    	$res = Statistics::print_stats($title, $stats, $show_total = true, $is_file_size = false);
-    	ob_end_clean();
-    	$this->assertTrue(is_null($res));
-    	//var_dump($res);
-    }
-
-    public function testPrintLoginStats(){
-    	ob_start();
-    	$type='month';
-    	$resu = Statistics::print_login_stats($type);
-    	ob_end_clean();
-        $this->assertTrue(is_null($resu));
-    	//var_dump($resu);
-	}
-
-    public function testPrintRecenLoginStats(){
-		ob_start();
-    	$res = Statistics::print_recent_login_stats();
-    	ob_end_clean();
-    	$this->assertTrue(is_null($res));
-    	//var_dump($res);
-    }
-
-    public function testPrintToolStats(){
-    	ob_start();
-    	$resu = Statistics::print_tool_stats();
-    	ob_end_clean();
-    	$this->assertTrue(is_null($resu));
-    }
-
-    public function testPrintCourseByLanguageStats(){
-    	ob_start();
-    	$resu = Statistics::print_course_by_language_stats();
-    	ob_end_clean();
-    	$this->assertTrue(is_null($resu));
-    	//var_dump($resu);
-    }
-
-    public function testPrintUserPicturesStats(){
-    	ob_start();
-       	$resu = Statistics::print_user_pictures_stats();
-    	ob_end_clean();
-    	$this->assertTrue(is_null($resu));
-    }
-
-    public function testPrintActivitiesStats(){
-    	ob_start();
-    	$res = Statistics::print_activities_stats();
-   		ob_end_clean();
-   		$this->assertTrue(is_null($res));
-   		//var_dump($res);
-    }
-
-    public function testPrintCourseLastVisit(){
-    	ob_start();
-    	$column='';
-    	$direction='';
-	    $parameters['action'] = 'courselastvisit';
-	   	$res = Statistics::print_course_last_visit();
-    	ob_end_clean();
-    	$this->assertTrue(is_null($res));
-    }
-}
-?>

+ 0 - 208
tests/main/admin/sub_language.class.test.php

@@ -1,208 +0,0 @@
-<?php
-require_once (api_get_path(SYS_CODE_PATH).'admin/sub_language.class.php');
-require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
-
-class TestSubLanguageManager extends UnitTestCase {
-
-	public $clean = array();
-
-        public function __construct() {
-            $this->UnitTestCase('Sublanguage Manager library - main/admin/sub_language.class.test.php');
-        }
-	/**
-	 *	Testing who get all data of lang folder
-	 *  @param String to url path folder
-	 *  @param bool true if we only want the subname
-	 *  @return Array All file of lang folder
-	 */
-	public function testget_lang_folder_files_list(){
-		$path = api_get_path(SYS_LANG_PATH).'english';
-		$res = SubLanguageManager::get_lang_folder_files_list($path, $only_main_name = false);
-		$this->assertTrue(is_array($res));
-		$this->assertTrue(count($res)>0);
-	}
-
-	/**
-	 *
-	 *
-	 */
-	public function testget_all_information_of_sub_language(){
-		$parent_id = 13;
-		$language_id = 10;
-		$res = SubLanguageManager::get_all_information_of_sub_language($parent_id, $language_id);
-        // under normal circumstances, there is no language 10 child of language 13
-		$this->assertFalse($res);
-	}
-
-    /**
-	 *
-	 */
-	public function testget_all_information_of_language(){
-		$parent_id = 11;
-		$res = SubLanguageManager::get_all_information_of_language($parent_id);
-		$this->assertTrue(is_array($res));
-	}
-
-	/**
-	 * Get variables within a language file
-	 */
-	public function testget_all_language_variable_in_file(){
-	    $system_path_folder = api_get_path(SYS_LANG_PATH);
-	    $system_path_file = $system_path_folder.'spanish/link.inc.php';
-	    $res = SubLanguageManager::get_all_language_variable_in_file($system_path_file);
-	    $this->assertTrue(is_array($res));
-	}
-    
-    /**
-     * Add directory for sub-language
-     * @param String The sub-language path directory ( /var/www/my_lms/main/lang/spanish_corporate )
-     * @return boolean
-     */
-    public function testadd_language_directory() {
-        $res = SubLanguageManager :: add_language_directory('test');
-        $this->assertTrue($res);
-        $res = SubLanguageManager :: remove_language_directory('test');
-    }
-
-	/**
-	 * 
-	 */
-	public function testadd_file_in_language_directory(){
-        $res = SubLanguageManager :: add_language_directory('test');
-        $this->assertTrue($res);
-		$system_path_file = api_get_path(SYS_LANG_PATH).'test/spanish.inc.php';
-		$res = SubLanguageManager::add_file_in_language_directory($system_path_file);
-		$this->assertTrue($res);
-        $res = SubLanguageManager :: remove_language_directory('test');
-	}
-
-	public function testwrite_data_in_file(){
-		$dirname = api_get_path(SYS_LANG_PATH);
-    	$file = $dirname.'spanish.inc.php';
-		$path_file = $file;
-		$new_sub_language='spanishtest';
-		$variable_sub_language='test';
-		$res = SubLanguageManager::write_data_in_file($path_file,$new_sub_language,$variable_sub_language);
-		$this->assertTrue($res);
-	}
-
-	/**
-	 * Delete sub language of database
-	 * @param Integer id's.
-	 * @return null
- 	 */
-	public function Testremove_sub_language() {
-		$parent_id = '';
-		$sub_language_id = 1;
-		$res = SubLanguageManager :: remove_sub_language($parent_id, $sub_language_id);
-		$this->assertFalse($res);
-		//	var_dump($res);
-	}
-
-	/**
-	 * Test of Check if language exist by id
-	 * @param Integer
-	 * @return Boolean
-	 */
-	public function Testcheck_if_exist_language_by_id() {
-		$language_id = 14;
-		$res = SubLanguageManager :: check_if_exist_language_by_id($language_id);
-		$this->assertTrue($res);
-		//	var_dump($res);
-	}
-
-	/**
-	 * Show the name of language by id
-	 * @param Integer id
-	 * @return String the name of language
-	 */
-	public function Testget_name_of_language_by_id() {
-		$language_id = 13;
-        $tbl_admin_languages    = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
-        $sql='SELECT original_name FROM '.$tbl_admin_languages.' WHERE id=13';
-        $rs=Database::query($sql);
-        $name ='';
-        if (Database::num_rows($rs)>0) {
-            $name = Database::result($rs,0,'original_name');
-        }        
-		$res = SubLanguageManager :: get_name_of_language_by_id($language_id);
-		$this->assertEqual($res,$name,'The language name from function does not match the database value');
-	}
-
-	/**
-	 * Verified if language is an sub-language
-	 * @param Integer
-	 * @return Boolean
-	 */
-	public function Testcheck_if_language_is_sub_language_for_non_existing_sublanguage() {
-		$language_id = 112;
-		$res = SubLanguageManager :: check_if_language_is_sub_language($language_id);
-		$this->assertFalse($res);
-		//	var_dump($res);
-	}
-
-	/**
-	 *
-	 */
-	public function Testcheck_if_language_is_father() {
-		$language_id = 12;
-		$res = SubLanguageManager :: check_if_language_is_father($language_id);
-		$this->assertFalse($res);
-		//	var_dump($res);
-	}
-
-	/**
-	 *
-	 */
-	public function Testmake_language_unavailable_and_back() {
-		$language_id = 11;
-		$res = SubLanguageManager :: make_unavailable_language($language_id);
-		$this->assertTrue($res,'Language could not be made unavailable');
-        $res = SubLanguageManager :: make_available_language($language_id);
-		// var_dump($res);
-	}
-
-	/**
-	 *
-	 */
-	public function Testmake_available_language() {
-		$language_id= 11;
-        $res = SubLanguageManager :: make_unavailable_language($language_id);
-		$res = SubLanguageManager :: make_available_language ($language_id);
-        $this->assertTrue($res,'Language could not be made available');
-		// var_dump($res);
-	}
-	/**
-	 *
-	 *
-	 */
-	public function Testset_platform_language_empty(){
-        $backup = SubLanguageManager :: get_platform_language_id();
-		$language_id = '';
-		$res = SubLanguageManager :: set_platform_language($language_id);
-		$this->assertFalse($res);
-        $res = SubLanguageManager :: set_platform_language($backup);
-		// var_dump($res);
-	}
-    public function Testset_platform_language_2(){
-        $backup = SubLanguageManager :: get_platform_language_id();
-        $language_id = 2;
-        $res = SubLanguageManager :: set_platform_language($language_id);
-        $this->assertTrue($res);
-        $res = SubLanguageManager :: set_platform_language($backup);
-        // var_dump($res);
-    }
-	/**
-	 *
-	 *
-	 */
-	public function Testremove_directory_of_sub_language(){
-        $res = SubLanguageManager :: remove_language_directory('test');
-        // create a directory of sub language
-		$res = SubLanguageManager :: add_language_directory('test');
-		$this->assertTrue($res);
-		$res = SubLanguageManager :: remove_language_directory('test');
-        // var_dump($res);
-	}
-}
-?>

+ 0 - 137
tests/main/announcements/announcements.inc.test.php

@@ -1,137 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-require_once api_get_path(SYS_CODE_PATH).'announcements/announcements.inc.php';
-require_once api_get_path(LIBRARY_PATH).'course.lib.php';
-require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
-require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
-
-class TestAnnouncements extends UnitTestCase {
-
-        function TestAnnouncements(){
-            $this->UnitTestCase('Displays one specific announcement test');
-        }
-        /*public function Testdisplay_announcement(){
-            global $_user, $dateFormatLong, $_course;
-            global $defaultVisibilityForANewCourse, $error_msg;
-            ob_start();
-            //create course
-            $courseSysCode= '142';
-            $courseScreenCode='142';
-            $courseRepository='142';
-            $courseDbName='dokeos_142';
-            $titular='R. F. Wolfgan';
-            $category='1';
-            $title='prueba111';
-            $course_language='english';
-            $uidCreator='1';
-            global $course_code;
-            $course_code = $courseSysCode;
-            prepare_course_repository($courseRepository,$courseSysCode);
-            update_Db_course($courseDbName);
-            $pictures_array=fill_course_repository($courseRepository);
-            fill_Db_course($courseDbName, $courseRepository, $course_language,$pictures_array);
-            $res1 = register_course($courseSysCode, $courseScreenCode, $courseRepository, $courseDbName, $titular, $category, $title, $course_language, $uidCreator, $expiration_date = "", $teachers=array());
-            $_course = api_get_course_info($courseSysCode);
-
-            // display announcement in the course added
-            $announcements_id= 1;
-            $res2 = display_announcement($announcements_id);
-            ob_end_clean();
-            $this->assertTrue(is_numeric($res1));
-            $res3 = CourseManager::delete_course($courseSysCode);
-
-            //var_dump($res1);
-            //var_dump($res2);
-
-        }
-
-        public function Testshow_to_form(){
-            $to_already_selected = "";
-
-            $_SESSION['_cid'] = 'CURSO1';
-
-            $res = show_to_form($to_already_selected);
-            $this->assertTrue(is_null($res));
-            //var_dump($res);
-        }*/
-
-        public function Testconstruct_not_selected_select_form(){
-            $courseSysCode= '123';
-            $course_code = $courseSysCode;
-            ob_start();
-            $to_already_selected="";
-            $_SESSION['_cid'] = 'CURSO1';
-            $user_list = array( 0=>array(
-                              0 => '1','user_id' => '1',
-                              1 =>'Doe','lastname' =>'Doe',
-                              2 =>'John','firstname' =>'John',
-                              3 => 'admin','username' =>'admin'
-                          ));
-
-            $res = construct_not_selected_select_form($group_list=null, $user_list,$to_already_selected);
-            ob_end_clean();
-            $this->assertTrue(is_null($res));
-            //var_dump($res);
-        }
-
-        public function Testconstruct_selected_select_form(){
-            $to_already_selected="";
-            ob_start();
-            $res = construct_selected_select_form($group_list=null, $user_list=null,$to_already_selected);
-            ob_end_clean();
-            $this->assertTrue(is_null($res));
-            //var_dump($res);
-        }
-
-        public function Testshow_to_form_group(){
-            ob_start();
-            $group_id=1;
-            $group_users=GroupManager::get_subscribed_users($group_id);
-            $res = show_to_form_group($group_id);
-            ob_end_clean();
-            $this->assertTrue(is_null($res));
-            //var_dump($res);
-        }
-
-        public function Testget_course_users(){
-            $_SESSION['id_session'] = 'CURSO1';
-            $user_list = CourseManager::get_real_and_linked_user_list(api_get_course_id(), true, $_SESSION['id_session']);
-            $res = get_course_users();
-            if($res = array($res)){
-            $this->assertTrue(is_array($res));
-            } else {
-            $this->assertTrue(is_null($res));
-            }
-            //var_dump($res);
-        }
-
-        public function Testget_course_groups(){
-            $_SESSION['id_session']='CURSO1';
-            $new_group_list = CourseManager::get_group_list_of_course(api_get_course_id(), intval($_SESSION['id_session']));
-            $res = get_course_groups();
-            $this->assertFalse($res);
-            $this->assertTrue(is_array($res));
-            var_dump($res);
-        }
-
-        public function Testload_edit_users(){
-            $_SESSION['id_session']='CURSO1';
-            global $_course;
-            global $tbl_item_property;
-            $tbl_item_property 	= Database::get_course_table(TABLE_ITEM_PROPERTY);
-            $tool = '';
-            $id = '';
-            $res = load_edit_users($tool, $id);
-            $this->assertTrue(is_null($res));
-            var_dump($res);
-        }
-        /*
-        public function Testsent_to_form(){
-            $group_names=get_course_groups();
-            $sent_to_array='';
-            $res = sent_to_form($sent_to_array);
-            $this->assertTrue(is_null($res));
-            var_dump($res);
-        }*/
-}

+ 0 - 84
tests/main/auth/lost_password.lib.test.php

@@ -1,84 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'login.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
-
-class TestLostPassword extends UnitTestCase {
-
-    public function __construct(){
-        $this->UnitTestCase('Lost password library - main/auth/lost_password.lib.test.php');
-    }
-	/* function commented in platform code
-	function testget_email_headers(){
-		global $charset;
-		$res = get_email_headers();
- 		$this->assertTrue($res);
- 		$this->assertTrue(is_string($res));
- 		//var_dump($res);
-	}
-	*/
-
-	function testget_secret_word(){
-		global $_configuration;
-		$add='';
-		$res = Login::get_secret_word($add);
- 		// Expects an string of 32 chars
- 		$this->assertEqual(strlen($res),32);
-
- 		$this->assertTrue(is_string($res));
- 		//var_dump($res);
-	}
-
-	function testget_user_account_list(){
-		global $_configuration;
-		$user='';
-		$thisUser=array();
-		$secretword = Login::get_secret_word($thisUser["email"]);
-		$reset_link = get_lang('Pass')." : $thisUser[password]";
-		$userAccountList[] = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$thisUser["loginName"]."\n".get_lang('ResetLink').' : '.$reset_link.'';
-		$res = Login::get_user_account_list($user, $reset = false);
- 		$this->assertTrue(is_array($userAccountList));
- 		//var_dump($userAccountList);
-	}
-
-	function testhandle_encrypted_password() {
-		require_once api_get_path (LIBRARY_PATH).'mail.lib.inc.php';
-		global $charset;
-		global $_configuration;
-		ob_start();
-		$user=array('abc');
-		$emailSubject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT
-		$userAccountList = Login::get_user_account_list($user, true); // BODY
-		$emailTo = $user[0]["email"];
-		$secretword = Login::get_secret_word($emailTo);
-		$emailBody = get_lang('DearUser')." :\n".get_lang("password_request")."\n\n";
-		$emailBody .= "-----------------------------------------------\n".$userAccountList."\n-----------------------------------------------\n\n";
-		$emailBody .=get_lang('PasswordEncryptedForSecurity');
-		$emailBody .="\n\n".get_lang('Formula').",\n".get_lang('PlataformAdmin');
-		$sender_name = api_get_setting('administratorName').' '.api_get_setting('administratorSurname');
-    	$email_admin = api_get_setting('emailAdministrator');
-		$res=Login::handle_encrypted_password($user);
-
-		if(!is_array($res))$this->assertTrue(is_null($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-
-	function testreset_password(){
-		$secret='1234567891011';
-		$id=5;
-		$res=Login::reset_password($secret, $id);
-		$this->assertTrue($res);
- 		$this->assertTrue(is_string($res));
- 		//var_dump($res);
-	}
-
-	function testsend_password_to_user() {
-		$user=array();
-		ob_start();
-		$res=Login::send_password_to_user($user);
-		if(!is_null($res))$this->assertTrue(is_array($res));
-		ob_end_clean();
- 		//var_dump($res);
-	}
-}
-?>

+ 0 - 71
tests/main/auth/openid/xrds.lib.test.php

@@ -1,71 +0,0 @@
-<?php
-require_once(api_get_path(SYS_CODE_PATH).'auth/openid/xrds.lib.php');
-
-class TestXrds extends UnitTestCase {
-
-    public function __construct(){
-        $this->UnitTestCase('XRDS library for OpenID - main/auth/openid/xrds.lib.test.php');
-    }
-	/*
-	function testxrds_cdata() {
-		global $xrds_open_elements, $xrds_services, $xrds_current_service;
-		$parser='';
-		$data='';
-		$res=_xrds_cdata(&$parser, $data);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	*/
-
-	function testxrdsparse() {
-
-		$xml = <<<XML
-		<xml version="1.0">
-		<users>
-		<fname>Christian</fname>
-		<lname>Fasa Fasa</lname>
-		</users>
-XML;
-
-		$parser = xrds_parse($xml);
-		if (is_resource($parser)) {
-			$this->assertTrue(is_resource($parser));
-		} else {
-			$this->assertTrue(is_null($parser));
-		}
-	}
-/*
-	function test_xrds_element_end() {
-		 global $xrds_open_elements, $xrds_services, $xrds_current_service;
-		 $parser='';
-		 $name='';
-		 $xrds_current_service['version'] = 2;
-		 $xrds_current_service['version'] = 1;
-		 $xrds_services[] = $xrds_current_service;
-		 $xrds_current_service= array();
-		 $res=_xrds_element_end(&$parser, $name);
-		 $this->assertTrue(is_null($res));
-		 //var_dump($xrds_current_service);
-	}
-
-	function test_xrds_element_start() {
-
-		global $xrds_open_elements;
-
-		$name='';
-		$attribs='';
-
-		$res=_xrds_element_start(&$parser, $name, $attribs);
-
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function test_xrds_strip_namespace() {
-		$name='';
-		$res=_xrds_strip_namespace($name);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}*/
-}
-?>

+ 0 - 79
tests/main/chat/chat_functions.lib.test.php

@@ -1,79 +0,0 @@
-<?php
-require_once(api_get_path(SYS_CODE_PATH).'chat/chat_functions.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
-
-class TestChatFunctions extends UnitTestCase {
-
-    public function __construct(){
-        $this->UnitTestCase('Chat library - main/chat/chat_functions.lib.test.php');
-    }
-
-	public function setUp() {
-		$this->tcourse = new CourseManager();
-	}
-
-	public function tearDown() {
-		$this->tcourse = null;
-	}
-
-
-
-	function testuser_connected_in_chat () {
-		$course_code = 'COURSETEST';
-		$user_id=1;
-		$course_info = api_get_course_info($course_code);
-		$database_name = $course_info['dbName'];
-		$res = user_connected_in_chat($user_id,$database_name);
- 		$this->assertTrue(is_bool($res));
-	}
-
-
-	function testUsersListInChat () {
-		$course_code = 'COURSETEST';
-		$course_info = api_get_course_info($course_code);
-		$database_name = $course_info['dbName'];
-		$res = users_list_in_chat($database_name);
- 		$this->assertTrue(is_array($res));
- 		//var_dump($res);
-	}
-
-	function CreateChatConnection($database_name) {
-		$session_id = 1;
-		$tbl_chat_connected = Database::get_course_chat_connected_table($database_name);
-		$sql = "SELECT user_id FROM $tbl_chat_connected WHERE user_id = 1";
-		$result = Database::query($sql);
-		//The user_id exists so we must do an UPDATE and not a INSERT
-		$current_time = date('Y-m-d H:i:s');
-		if (Database::num_rows($result)==0) {
-			$query="INSERT INTO $tbl_chat_connected(user_id,last_connection,session_id) VALUES(1,'$current_time','$session_id')";
-		} else {
-			$query="UPDATE $tbl_chat_connected set last_connection='".$current_time."' WHERE user_id=1 AND session_id='$session_id'";
-		}
-		Database::query($query);
-	}
-
-
-	function testExitOfChat () {
-		$course_code = 'COURSETEST';
-		$course_info = api_get_course_info($course_code);
-		$database_name = $course_info['dbName'];
-		$this->CreateChatConnection($database_name);
-		$user_id = 1;
-		$res = exit_of_chat($user_id);
-		//$resu = $this->tcourse->delete_course($course_code);
- 		$this->assertTrue(is_null($res));
- 		//var_dump($res);
-	}
-
-
-		function testDisconnectUserOfChat() {
-		$_SESSION['is_courseAdmin'] = 1;
-		$course_code = 'COURSETEST';
-		$course_info = api_get_course_info($course_code);
-		$database_name = $course_info['dbName'];
-		$this->CreateChatConnection($database_name);
-		$res = disconnect_user_of_chat($database_name);
-		$this->assertTrue(is_null($res));
-	}
-}
-?>

+ 0 - 16
tests/main/conference/get_translation.lib.test.php

@@ -1,16 +0,0 @@
-<?php
-require_once(api_get_path(SYS_CODE_PATH).'conference/get_translation.lib.php');
-
-class TestGetTranslation extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Conference translation getter library - main/conference/get_translation.lib.test.php');
-    }
-
-	function testget_language_file_as_xml(){
-		ob_start();
-		$res=get_language_file_as_xml($language='english');
-		ob_end_clean();
-		$this->assertTrue(is_string($res));
-	}
-}

+ 0 - 23
tests/main/course_info/download.lib.test.php

@@ -1,23 +0,0 @@
-<?php
-
-require_once api_get_path(SYS_CODE_PATH).'course_info/download.lib.php';
-
-
-class TestCreateBackupIsAdmin extends UnitTestCase {
-    public function __construct() {
-        $this->UnitTestCase('Course download library - main/course_info/download.lib.test.php');
-    }
-    public function Testcreate_backup_is_admin()
-    {
-        $_GET = array('archive' => 'index.html');
-
-        $resTrue =  create_backup_is_admin(true);
-        $this->assertTrue(is_bool($resTrue));
-        $resFalse = create_backup_is_admin(false);
-        $this->assertFalse($resFalse);
-        $this->assertEqual($resTrue , $resFalse);
-        //var_dump($resTrue, $resFalse);
-    }
-}
-
-?>

+ 0 - 319
tests/main/dropbox/dropbox_class.inc.test.php

@@ -1,319 +0,0 @@
-<?php
-
-class TestDropbox extends UnitTestCase {
-	
-	public $ddropboxwork;
-	public $ddropboxsentwork;
-	public $dperson;
-	
-	public function TestDropbox() {
-	$this->UnitTestCase('');
-	}
-	
-	public function setUp() {				
-		global $dropbox_cnf; 
-		$dropbox_cnf['tbl_post'] 		= Database::get_course_table(TABLE_DROPBOX_POST);
-		$dropbox_cnf['tbl_file'] 		= Database::get_course_table(TABLE_DROPBOX_FILE);
-		$dropbox_cnf['tbl_person'] 		= Database::get_course_table(TABLE_DROPBOX_PERSON);
-		$dropbox_cnf['tbl_intro'] 		= Database::get_course_table(TABLE_TOOL_INTRO);
-		$dropbox_cnf['tbl_user'] 		= Database::get_main_table(TABLE_MAIN_USER);
-		$dropbox_cnf['tbl_course_user']	= Database::get_main_table(TABLE_MAIN_COURSE_USER);
-		$dropbox_cnf['tbl_category'] 	= Database::get_course_table(TABLE_DROPBOX_CATEGORY);
-		$dropbox_cnf['tbl_feedback'] 	= Database::get_course_table(TABLE_DROPBOX_FEEDBACK);
-		$this->ddropboxwork = new Dropbox_Work(1);			
-		$this->ddropboxsentwork = new Dropbox_SentWork(1);
-		$this->dperson = new Dropbox_Person(1, 1, 1);
-	}
-	
-	public function tearDown() {		
-		$this-> ddropboxwork = null;
-		$this-> ddropboxsentwork = null;
-		$this-> dperson = null;
-	}
-	
-//Class Dropbox_Work
-
-	/**
-	 * Constructor calls private functions to create a new work or retreive an existing work from DB
-	 * depending on the number of parameters
-	 *
-	 * @param unknown_type $arg1
-	 * @param unknown_type $arg2
-	 * @param unknown_type $arg3
-	 * @param unknown_type $arg4
-	 * @param unknown_type $arg5
-	 * @param unknown_type $arg6
-	 * @return Dropbox_Work
-	 */
-	 
-	function testDropbox_Work() {			
-		$arg1=1;
-		$resu= $this->ddropboxwork->Dropbox_Work($arg1, $arg2=null, $arg3=null, $arg4=null, $arg5=null, $arg6=null);
-		$this->assertTrue(is_null($resu));
-        //var_dump($resu);
-	}
-	
-	/**
-	 * private function creating a new work object
-	 *
-	 * @param unknown_type $uploader_id
-	 * @param unknown_type $title
-	 * @param unknown_type $description
-	 * @param unknown_type $author
-	 * @param unknown_type $filename
-	 * @param unknown_type $filesize
-	 *
-	 * @todo 	$author was originally a field but this has now been replaced by the first and lastname of the uploader (to prevent anonymous uploads)
-	 * 			As a consequence this parameter can be removed
-	 */
-	 
-	function testCreateNewWork() {
-		global $dropbox_cnf;				
-		$uploader_id=1;
-		$title='test';
-		$description = 'testing';
-		$author= 'test';
-		$filename='test.txt';
-		$filesize=125;
-		$resu= $this->ddropboxwork->_createNewWork($uploader_id, $title, $description, $author, $filename, $filesize);
-		$this->assertTrue(is_null($resu));
-        //var_dump($resu);
-	}
-	
-	/**
-	 * private function creating existing object by retreiving info from db
-	 *
-	 * @param unknown_type $id
-	 */
-	
-	function testCreateExistingWork() {
-		global $dropbox_cnf;
-		$dropbox_cnf['tbl_file'] 		= Database::get_course_table(TABLE_DROPBOX_FILE);
-		$dropbox_cnf['tbl_feedback'] 	= Database::get_course_table(TABLE_DROPBOX_FEEDBACK);
-		$id = 1;
-		$resu= $this->ddropboxwork->_createExistingWork($id);
-		$this->assertTrue(is_null($resu));
-        //var_dump($resu);
-	}
-	
-//Class Dropbox_SentWork
-		
-	/**
-	 * Constructor calls private functions to create a new work or retreive an existing work from DB
-	 * depending on the number of parameters
-	 *
-	 * @param unknown_type $arg1
-	 * @param unknown_type $arg2
-	 * @param unknown_type $arg3
-	 * @param unknown_type $arg4
-	 * @param unknown_type $arg5
-	 * @param unknown_type $arg6
-	 * @param unknown_type $arg7
-	 * @return Dropbox_SentWork
-	 */
-	 	
-	function testDropbox_SentWork() {
-		$arg1 = 1;
-		$resu= $this->ddropboxsentwork->Dropbox_SentWork($arg1, $arg2=null, $arg3=null, $arg4=null, $arg5=null, $arg6=null, $arg7=null);
-		$this->assertTrue(is_null($resu));
-	}	
-		
-	/**
-	 * private function creating a new SentWork object
-	 *
-	 * @param unknown_type $uploader_id
-	 * @param unknown_type $title
-	 * @param unknown_type $description
-	 * @param unknown_type $author
-	 * @param unknown_type $filename
-	 * @param unknown_type $filesize
-	 * @param unknown_type $recipient_ids
-	 */
-	 
-	function testCreateNewSentWork() {
-		$recipient_ids = array(1,2);
-		$uploader_id=1;
-		$title='test';
-		$description = 'testing';
-		$author= 'test';
-		$filename='test.txt';
-		$filesize=125;
-		$resu= $this->ddropboxsentwork->_createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids);
-		$this->assertTrue(is_null($resu));
-	}
-	
-	/**
-	 * private function creating existing object by retreiving info from db
-	 *
-	 * @param unknown_type $id
-	 */
-	 
-	function testCreateExistingSentWork() {
-		$id = 1;
-		$resu= $this->ddropboxsentwork->_createExistingSentWork($id);
-		$this->assertTrue(is_null($resu));
-	}
-	
-//Class Dropbox_SentWork
-	
-	/**
-	 * Constructor for recreating the Dropbox_Person object
-	 *
-	 * @param unknown_type $userId
-	 * @param unknown_type $isCourseAdmin
-	 * @param unknown_type $isCourseTutor
-	 * @return Dropbox_Person
-	 */
-	
-	function testDropbox_Person() {
-		$userId = 1;
-		$isCourseAdmin = 1;
-		$isCourseTutor = 1;
-		$resu= $this->dperson->Dropbox_Person($userId, $isCourseAdmin, $isCourseTutor);
-		$this->assertTrue(is_null($resu));
-	}
-	
-	/**
-	 * This private method is used by the usort function in  the
-	 * orderSentWork and orderReceivedWork methods.
-	 * It compares 2 work-objects by 1 of the properties of that object, dictated by the
-	 * private property _orderBy
-	 *
-	 * @param unknown_type $a
-	 * @param unknown_type $b
-	 * @return -1, 0 or 1 dependent of the result of the comparison.
-	 */
-	 
-	function testCmpWork() {
-		$a = 1;
-		$b = 1;
-		$resu= $this->dperson->_cmpWork($a, $b);
-		if(!is_numeric($resu)) {
-		$this->assertTrue(is_null($resu));
-		}
-	}
-	
-	/**
-	 * method that sorts the objects in the sentWork array, dependent on the $sort parameter.
-	 * $sort can be lastDate, firstDate, title, size, ...
-	 *
-	 * @param unknown_type $sort
-	 */
-	 
-	 function testorderSentWork() {
-		$sort = 1;
-		$resu= $this->dperson->orderSentWork($sort);
-		if(!is_numeric($resu)) {
-		$this->assertTrue(is_null($resu));
-		}
-	}
-	
-	/**
-	 * method that sorts the objects in the receivedWork array, dependent on the $sort parameter.
-	 * $sort can be lastDate, firstDate, title, size, ...
-	 * @param unknown_type $sort
-	 */
-	 
-	function testorderReceivedWork() {
-		$sort = 1;
-		$resu= $this->dperson->orderReceivedWork($sort);
-		if(!is_numeric($resu)) {
-		$this->assertTrue(is_null($resu));
-		}
-	}
-	
-	/**
-	 * Updates feedback for received work of this person with id=$id
-	 *
-	 * @param unknown_type $id
-	 * @param unknown_type $text
-	 */
-	 
-	 function testupdateFeedback() {
-		$id = 1;
-		$text = 'test';
-		$resu= $this->dperson->updateFeedback($id, $text);
-		if(!is_bool($resu)) {
-		$this->assertTrue(is_null($resu));
-		}
-	}
-	
-	/**
-	 * Filter the received work
-	 * @param string $type
-	 * @param string $value
-	 */
-	 
-	 function testfilter_received_work() {
-		$type = 1;
-		$value = 1;
-		$resu= $this->dperson->filter_received_work($type,$value);
-		if(!is_bool($resu)) {
-		$this->assertTrue(is_null($resu));
-		}
-	}
-	
-	/**
-	 * Deletes all the received work of this person
-	 *
-	 */
-	 
-	 function testdeleteAllReceivedWork() {
-		$resu= $this->dperson->deleteAllReceivedWork();
-		if(!is_numeric($resu)) {
-		$this->assertTrue(is_null($resu));
-		}
-	}
-	
-	/**
-	 * Deletes all the received categories and work of this person
-	 */
-	 
-	function testdeleteReceivedWorkFolder() {
-		$id = 1;
-		$resu= $this->dperson->deleteReceivedWorkFolder($id);
-		if(!is_bool($resu)) {
-		$this->assertTrue(is_null($resu));
-		}
-	}
-		
-	/**
-	 * Deletes a received dropbox file of this person with id=$id
-	 *
-	 * @param integer $id
-	 */
-	 
-	 function testdeleteReceivedWork() {
-		$id = 1;
-		$resu= $this->dperson->deleteReceivedWork($id);
-		if(!is_bool($resu)) {
-		$this->assertTrue(is_null($resu));
-		}
-	}
-	
-	 /**
-	 * Deletes all the sent dropbox files of this person
-	 */
-	
-	 function testdeleteAllSentWork() {
-		$resu= $this->dperson->deleteAllSentWork();
-		if(!is_bool($resu)) {
-		$this->assertTrue(is_null($resu));
-		}
-	}
-	
-	/**
-	 * Deletes a sent dropbox file of this person with id=$id
-	 *
-	 * @param unknown_type $id
-	 */
-	
-	function testdeleteSentWork() {
-		$id = 1;
-		$resu= $this->dperson->deleteSentWork($id);
-		if(!is_bool($resu)) {
-		$this->assertTrue(is_null($resu));
-		}
-	}
-}
-?>

+ 0 - 529
tests/main/dropbox/dropbox_functions.inc.test.php

@@ -1,529 +0,0 @@
-<?php
-//include_once(api_get_path(LIBRARY_PATH)."/pclzip/pclzip.lib.php");
-require_once(api_get_path(LIBRARY_PATH).'document.lib.php');
-class TestDropboxFunctions extends UnitTestCase {
-
-	/**
-	* This function is a wrapper function for the multiple actions feature.
-	* @return	Mixed	If there is a problem, return a string message, otherwise nothing
-	*/
-
-	function testhandle_multiple_actions() {
-		global $_user, $is_courseAdmin, $is_courseTutor;
-		$res= handle_multiple_actions();
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-
-	/**
-	* Displays the form to move one individual file to a category
-	* @return html code of the form that appears in a dokeos message box.
-	*/
-
-	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));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* This functions displays all teh possible actions that can be performed on multiple files. This is the dropdown list that
-	* appears below the sortable table of the sent / or received files.
-	* @return html value for the dropdown list
-	*/
-
-	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));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* this function returns the html code that displays the checkboxes next to the files so that
-	* multiple actions on one file are possible.
-	* @param $id the unique id of the file
-	* @param $part are we dealing with a sent or with a received file?
-	* @return html code
-	*/
-
-	function testdisplay_file_checkbox() {
-		$id= 1;
-		$part = 'test';
-		$res= display_file_checkbox($id, $part);
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* This function displays the form to add a new category.
-	*
-	* @param $category_name this parameter is the name of the category (used when no section is selected)
-	* @param $id this is the id of the category we are editing.
-	*
-	* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
-	* @version march 2006
-	*/
-
-	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));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* this function displays the form to upload a new item to the dropbox.
-	*
-	* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
-	* @version march 2006
-	*/
-
-	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));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* This function displays the firstname and lastname of the user as a link to the user tool.
-	* @see this is the same function as in the new forum, so this probably has to move to a user library.
-	* @todo move this function to the user library
-	*/
-
-	function testdisplayuserlink() {
-		global $_otherusers;
-		$user_id = 1;
-		$res= display_user_link($user_id, $name='');
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* returns username or false if user isn't registered anymore
-	* @todo check if this function is still necessary. There might be a library function for this.
-	*/
-
-	function testGetUserNameFromId() {
-		global $dropbox_cnf;
-		$id = 1;
-		$res= getUserNameFromId($id);
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* returns loginname or false if user isn't registered anymore
-	* @todo check if this function is still necessary. There might be a library function for this.
-	*/
-
-	function testGetLoginFromId() {
-		$id = 1;
-		$res= getLoginFromId($id);
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-
-	/**
-	* @desc This function retrieves the number of feedback messages on every document. This function might become obsolete when
-	* 		the feedback becomes user individual.
-	*/
-
-	function testget_total_number_feedback() {
-		global $dropbox_cnf;
-		$res= get_total_number_feedback($file_id='');
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* This function retrieves all the dropbox categories and returns them as an array
-	* @param $filter default '', when we need only the categories of the sent or the received part.
-	* @return array
-	*/
-
-	function testGetdropbox_categories() {
-		$res= get_dropbox_categories($filter='');
-		if(!is_null($res)){
-		$this->assertTrue(is_array($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* Mailing zip-file is posted to (dest_user_id = ) mailing pseudo_id
-	* and is only visible to its uploader (user_id).
-	* Mailing content files have uploader_id == mailing pseudo_id, a normal recipient,
-	* and are visible initially to recipient and pseudo_id.
-	* @todo check if this function is still necessary.
-	*/
-
-	function testgetUserOwningThisMailing() {
-		global $dropbox_cnf;
-		$mailingPseudoId = '1';
-		$res= getUserOwningThisMailing($mailingPseudoId, $owner = 0, $or_die = '');
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	 * Get the last access to a given tool of a given user
-	 * @param $tool string the tool constant
-	 * @param $course_code the course_id
-	 * @param $user_id the id of the user
-	 * @return string last tool access date
-	 * @todo consider moving this function to a more appropriate place.
-	 */
-
-	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));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* This functions stores a new dropboxcategory
-	* @var 	it might not seem very elegant if you create a category in sent and in received with the same name that you get two entries in the
-	*		dropbox_category table but it is the easiest solution. You get
-	*		cat_name | received | sent | user_id
-	*		test	 |	  1		|	0  |	237
-	*		test	 |	  0		|	1  |	237
-	*		more elegant would be
-	*		test	 |	  1		|	1  |	237
-	*/
-
-	function teststoreaddcategory() {
-		global $_user,$dropbox_cnf;
-		$res= store_addcategory();
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* This function moves a file to a different category
-	* @param $id the id of the file we are moving
-	* @param $target the id of the folder we are moving to
-	* @param $part are we moving a received file or a sent file?
-	* @return language string
-	*/
-
-	function testStoremove() {
-		$id= 1;
-		$part = 'test';
-		$target = array();
-		$res= store_move($id, $target, $part);
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	*@return selected string
-	*/
-
-	function teststoreadddropbox() {
-		global $dropbox_cnf;
-		global $_user;
-		global $_course;
-		$res= store_add_dropbox();
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* @return boolean indicating if user with user_id=$user_id is a course member
-	* @todo eliminate global
-	* @todo check if this function is still necessary. There might be a library function for this.
-	*/
-
-	function testIsCourseMember() {
-		$user_id = 1;
-		$res= isCourseMember($user_id);
-		if(!is_null($res)){
-		$this->assertTrue(is_bool($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* this function transforms the array containing all the feedback into something visually attractive.
-	* @param an array containing all the feedback about the given message.
-	*/
-
-	function testfeedback() {
-		$array = array();
-		$res= feedback($array);
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* This function returns the html code to display the feedback messages on a given dropbox file
-	* @param $feedback_array an array that contains all the feedback messages about the given document.
-	* @return html code
-	* @todo add the form for adding new comment (if the other party has not deleted it yet).
-	* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
-	* @version march 2006
-	*/
-
-	function testformat_feedback() {
-		$feedback = array();
-		$res= format_feedback($feedback);
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* this function returns the code for the form for adding a new feedback message to a dropbox file.
-	* @return html code
-	*/
-
-	function testfeedback_form() {
-		global $dropbox_cnf;
-		$res= feedback_form();
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* @return a language string (depending on the success or failure.
-	*/
-
-	function teststore_feedback() {
-		global $dropbox_cnf;
-		global $_user;
-		$res= store_feedback();
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* @desc This function checks if the real filename of the dropbox files doesn't already exist in the temp folder. If this is the case then
-	*		it will generate a different filename;
-	*/
-
-	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));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* @desc this function checks if the key exists. If this is the case it returns the value, if not it returns 0
-	*/
-
-	function testcheck_number_feedback() {
-		$key = 'test';
-		$array = array();
-		$res= check_number_feedback($key, $array);
-		if(!is_null($res)){
-		$this->assertTrue(is_numeric($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* @desc generates the contents of a html file that gives an overview of all the files in the zip file.
-	*		This is to know the information of the files that are inside the zip file (who send it, the comment, ...)
-	*/
-
-	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));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* This function downloads all the files of the inputarray into one zip
-	* @param $array an array containing all the ids of the files that have to be downloaded.
-	* @todo consider removing the check if the user has received or sent this file (zip download of a folder already sufficiently checks for this).
-	* @todo integrate some cleanup function that removes zip files that are older than 2 days
-	*/
-	/*
-	function testzip_download() {
-		global $_course;
-		global $dropbox_cnf;
-		global $_user;
-		global $files;
-		$array = array();
-		$res= zip_download($array);
-		if(!is_string($res)){
-		$this->assertTrue(is_null($res));
-		}
-        //var_dump($res);
-	}
-	*/
-
-	/**
-	* This function is an alternative zip download. It was added because PCLZip causes problems on PHP5 when using PCLZIP_CB_PRE_ADD and a callback function to rename
-	* the files inside the zip file (dropbox scrambles the files to prevent
-	* @todo consider using a htaccess that denies direct access to the file but only allows the php file to access it. This would remove the scrambling requirement
-	*		but it would require additional checks to see if the filename of the uploaded file is not used yet.
-	* @param $files is an associative array that contains the files that the user wants to download (check to see if the user is allowed to download these files already
-	*		 happened so the array is clean!!. The key is the filename on the filesystem. The value is an array that contains both the filename on the filesystem and
-	*		 the original filename (that will be used in the zip file)
-	* @todo when we copy the files there might be two files with the same name. We need a function that (recursively) checks this and changes the name
-	*/
-/*
-	function testzip_download_alternative() {
-		global $_course;
-		global $_user;
-		$files = 'test';
-		$res= zip_download_alternative($files);
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-*/
-
-
-	/**
-	* Function that finds a given config setting
-	*/
-
-	function testdropbox_cnf() {
-		$variable = 'test';
-		$res= dropbox_cnf($variable);
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* This is a callback function to decrypt the files in the zip file to their normal filename (as stored in the database)
-	* @param $p_event a variable of PCLZip
-	* @param $p_header a variable of PCLZip
-	*/
-
-	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));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* @desc Cleans the temp zip files that were created when users download several files or a whole folder at once.
-	*		T
-	* @return true
-	*/
-
-	function testcleanup_temp_dropbox() {
-		global $_course;
-		$res= cleanup_temp_dropbox();
-		if(!is_null($res)){
-		$this->assertTrue(is_bool($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* This function deletes a dropbox category
-	* @todo give the user the possibility what needs to be done with the files in this category: move them to the root, download them as a zip, delete them
-	*/
-
-	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));
-		}
-        //var_dump($res);
-	}
-
-
-		/**
-	* Checks if there are files in the dropbox_file table that aren't used anymore in dropbox_person table.
-	* If there are, all entries concerning the file are deleted from the db + the file is deleted from the server
-	*/
-
-	function testremoveUnusedFiles() {
-		$res= removeUnusedFiles();
-		if(!is_null($res)){
-		$this->assertTrue(is_array($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-	* @todo check if this function is still necessary.
-	*/
-
-	function testremoveMoreIfMailing() {
-		$file_id = 1;
-		$res= removeMoreIfMailing($file_id);
-		if(!is_null($res)){
-		$this->assertTrue(is_array($res));
-		}
-        //var_dump($res);
-	}
-}
-?>

+ 0 - 389
tests/main/exercice/answer.class.test.php

@@ -1,389 +0,0 @@
-<?php
-
-class TestAnswer extends UnitTestCase {
-
-	public $aAnswer;
-	
-	public function TestAnswer() {
-		$this->UnitTestCase('');
-	}
-	
-	public function setUp() {
-		/*
-		//Create a new exercise
-		require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php';
-		require_once api_get_path(SYS_CODE_PATH).'inc/lib/pear/HTML/QuickForm.php';
-		$this->aAnswer = new Answer(2);
-		$this->aAnswer->read();
-		$this->aAnswer = new Exercise();
-		
-		$form = array(
-		'exerciseTitle'=>'testtitle',
-		'exerciseDescription'=>'testdescription',
-		'exerciseAttempts'=>'0',
-		'exerciseFeedbackType'=>'0',
-		'exerciseType'=>'1',
-		'randomQuestions'=>'0',
-		'randomAnswers'=>'0',
-		'results_disabled'=>'0',
-    	'enabletimercontroltotalminutes'=>'0');
-    	$res = Exercise::processCreation($form,$type='1');
-    	*/
-		$this->aAnswer = new Answer(2);
-					
-		
-	}
-	
-	public function tearDown() {		
-		$this->aAnswer = null;
-	}
-	
-	/**
-	 * constructor of the class
-	 *
-	 * @author 	Olivier Brouckaert
-	 * @param 	integer	Question ID that answers belong to
-	 */
-	 
-	 /*
-	function testAnswerConstructor() {
-		$questionId = 1;
-		$res = $this->aAnswer->Answer($questionId);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}  
-	*/
-	
-	 
-	
-	/**
-	 * creates a new answer
-	 *
-	 * @author Olivier Brouckaert
-	 * @param string 	answer title
-	 * @param integer 	0 if bad answer, not 0 if good answer
-	 * @param string 	answer comment
-	 * @param integer 	answer weighting
-	 * @param integer 	answer position
-	 * @param coordinates 	Coordinates for hotspot exercises (optional)
-	 * @param integer		Type for hotspot exercises (optional)
-	 */
-	 
-	 function testcreateAnswer() {
-	 	$answer = 'test';
-	 	$correct = 1;
-	 	$comment ='test';
-	 	$weighting = 2;
-	 	$position = 1;
-		$res = $this->aAnswer->createAnswer($answer,$correct,$comment,$weighting,$position,$new_hotspot_coordinates = 1, $new_hotspot_type = 1,$destination='');
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	} 
-	
-	/**
-	 * duplicates answers by copying them into another question
-	 * @param - integer $newQuestionId - ID of the new question
-	 */
-	 
-	 function testduplicate() {
-	 	$newQuestionId = 1;
-		$res = $this->aAnswer->duplicate($newQuestionId);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	} 
-	
-	/**
-	 * Returns a list of answers
-	 * @return array	List of answers where each answer is an array of (id, answer, comment, grade) and grade=weighting
-	 */
-	 
-	 function testgetAnswersList() {
-		$res = $this->aAnswer->getAnswersList();
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	} 
-	 
-	/**
-	 * Returns a list of grades
-	 * @return array	List of grades where grade=weighting (?)
-	 */
-	 
-	 function testgetGradesList() {
-		$res = $this->aAnswer->getGradesList();
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	} 
-	
-	/**
-	  * Returns the question type
-	  * @return	integer	The type of the question this answer is bound to
-	  */
-	  
-	  function testgetQuestionType() {
-		$res = $this->aAnswer->getQuestionType();
-		if(!is_null($res)){
-			$this->assertTrue(is_numeric($res));
-		}
-		//var_dump($res);
-	}
-	
-	/**
-	 * tells if answer is correct or not
-	 * @param - integer $id - answer ID
-	 * @return - integer - 0 if bad answer, not 0 if good answer
-	 */
-	 
-	 function testisCorrect() {
-	 	$id = 1;
-		$res = $this->aAnswer->isCorrect($id);
-		if(!is_null($res)){
-			$this->assertTrue(is_numeric($res));
-		}
-		//var_dump($res);
-	}
-	
-	/**
-	 * reads answer informations from the data base
-	 */
-	 
-	 function testread() {
-		$res = $this->aAnswer->read();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * reads answer informations from the data base ordered by parameter
-	 * @param	string	Field we want to order by
-	 * @param	string	DESC or ASC
-	 */
-	 
-	 function testreadOrderedBy() {
-	 	global $_course;
-	 	$field = 'position';
-		$res = $this->aAnswer->readOrderedBy($field,$order=ASC);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * records answers into the data base
-	 */
-	 
-	 function testsave() {
-		$res = $this->aAnswer->save();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns the answer title
-	 * @param - integer $id - answer ID
-	 * @return - string - answer title
-	 */
-	 
-	 function testselectAnswer() {
-	 	$id = 1;
-		$res = $this->aAnswer->selectAnswer($id);
-		if(!is_null($res)){
-			$this->assertTrue(is_string($res));
-		}
-		//var_dump($res);
-	}
-	
-	/**
-	 * @param - integer $id - answer ID
-	 * @return - bool - answer by id
-	 */
-	function testselectAnswerByAutoId() {
-	 	$auto_id = 1;
-		$res = $this->aAnswer->selectAnswerByAutoId($auto_id);
-		if(!is_null($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns the answer title from an answer's position
-	 * @param - integer $id - answer ID
-	 * @return - bool - answer title
-	 */
-	 
-	 function testselectAnswerIdByPosition() {
-	 	$pos = 1;
-		$res = $this->aAnswer->selectAnswerIdByPosition($pos);
-		if(!is_null($res)){
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns the autoincrement id identificator
-	 * @return - integer - answer num
-	 */
-	 
-	 function testselectAutoId() {
-	 	$id = 1;
-		$res = $this->aAnswer->selectAutoId($id);
-		if(!is_null($res)){
-			$this->assertTrue(is_numeric($res));
-		}
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns answer comment
-	 * @param - integer $id - answer ID
-	 * @return - string - answer comment
-	 */
-	 
-	 function testselectComment() {
-	 	$id = 1;
-		$res = $this->aAnswer->selectComment($id);
-		if(!is_null($res)){
-			$this->assertTrue(is_string($res));
-		}
-		//var_dump($res);
-	}	
-	
-	/**
-	 * returns the question ID of the destination question
-	 * @return - integer - the question ID
-	 */
-	 
-	 function testselectDestination() {
-	 	$id = 1;
-		$res = $this->aAnswer->selectDestination($id);
-		if(!is_null($res)){
-			$this->assertTrue(is_string($res));
-		}
-		//var_dump($res);
-	}	
-	
-	/**
-	 * returns answer hotspot coordinates
-	 * @param	integer	Answer ID
-	 * @return	integer	Answer position
-	 */
-	 
-	 function testselectHotspotCoordinates() {
-	 	$id = 1;
-		$res = $this->aAnswer->selectHotspotCoordinates($id);
-		if(!is_null($res)){
-			$this->assertTrue(is_string($res));
-		}
-	}
-	
-	/**
-	 * returns answer hotspot type
-	 *
-	 * @author	Toon Keppens
-	 * @param	integer		Answer ID
-	 * @return	integer		Answer position
-	 */
-	
-	function testselectHotspotType() {
-	 	$id = 1;
-		$res = $this->aAnswer->selectHotspotType($id);
-		if(!is_null($res)){
-			$this->assertTrue(is_string($res));
-		}
-	}
-	
-	/**
-	 * returns the number of answers in this question
-	 *
-	 * @author - Olivier Brouckaert
-	 * @return - integer - number of answers
-	 */
-	 
-	 function testselectNbrAnswers() {
-		$res = $this->aAnswer->selectNbrAnswers();
-		if(!is_null($res)){
-			$this->assertTrue(is_numeric($res));
-		}
-	}
-	 
-	/**
-	 * returns answer position
-	 *
-	 * @author - Olivier Brouckaert
-	 * @param - integer $id - answer ID
-	 * @return - integer - answer position
-	 */
-	 
-	 function testselectPosition() {
-	 	$id = 1;
-		$res = $this->aAnswer->selectPosition($id);
-		if(!is_null($res)){
-			$this->assertTrue(is_numeric($res));
-		}
-	}
-	
-	/**
-	 * returns the question ID which the answers belong to
-	 *
-	 * @author - Olivier Brouckaert
-	 * @return - integer - the question ID
-	 */
-	 
-	 function testselectQuestionId() {
-		$res = $this->aAnswer->selectQuestionId();
-		if(!is_null($res)){
-			$this->assertTrue(is_numeric($res));
-		}
-	}
-	
-	/**
-	 * returns answer weighting
-	 *
-	 * @author - Olivier Brouckaert
-	 * @param - integer $id - answer ID
-	 * @return - integer - answer weighting
-	 */
-	
-	function testselectWeighting() {
-		$id = 1;
-		$res = $this->aAnswer->selectWeighting($id);
-		if(!is_null($res)){
-			$this->assertTrue(is_numeric($res));
-		}
-	}
-	
-	 /**
-	 * updates an answer
-	 *
-	 * @author Toon Keppens
-	 * @param	string	Answer title
-	 * @param	string	Answer comment
-	 * @param	integer	Answer weighting
-	 * @param	integer	Answer position
-	 */
-	 
-	 function testupdateAnswers() {
-		$answer = '';
-		$comment = '';
-		$weighting=2;
-		$position=1;
-		$destination='0@@0@@0@@0';
-		$res = $this->aAnswer->updateAnswers($answer,$comment,$weighting,$position,$destination);
-		if(!is_null($res)){
-			$this->assertTrue(is_numeric($res));
-		}
-	}
-	
-	/**
-	 *  clears $new_* arrays
-	 */
-	 
-	 function testcancel() {
-		$res = $this->aAnswer->cancel();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	} 
-}
-?>

+ 0 - 539
tests/main/exercice/exercise.class.test.php

@@ -1,539 +0,0 @@
-<?php
-
-class TestExercise extends UnitTestCase {
-	
-	public $eExercise;
-	
-	public function TestExercise() {
-		$this->UnitTestCase('');
-	}
-	
-	public function setUp() {
-
-		$this->eExercise = new Exercise();			
-	}
-	
-	public function tearDown() {		
-		$this->eExercise = null;
-	}
-	
-	/**
-	 * adds a question into the question list
-	 * @param - integer $questionId - question ID
-	 * @return - boolean - true if the question has been added, otherwise false
-	 */
-		
-	function testaddToList() {
-		$questionId = 1;
-		$res = $this->eExercise->addToList($questionId);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * Creates the form to create / edit an exercise
-	 * @param FormValidator $form the formvalidator instance (by reference)
-	 */
-	 
-	function testcreateForm() {
-		global $id;
-		$form = new FormValidator('introduction_text');
-		$res = $this->eExercise->createForm($form, $type='full');
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}	
-	
-	
-	/**
-	 * disables the exercise
-	 */
-	 
-	 function testdisable() {
-		$res = $this->eExercise->disable();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}	
-	
-	 function testdisable_results() {
-		$res = $this->eExercise->disable_results();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * enables the exercise
-	 */	
-	 
-	 function testenable() {
-		$res = $this->eExercise->enable();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	function testenable_results() {
-		$res = $this->eExercise->enable_results();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * Same as isRandom() but has a name applied to values different than 0 or 1
-	 */
-	 
-	 function testgetShuffle() {
-		$res = $this->eExercise->getShuffle();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-	 
-	 /**
-	 * returns 'true' if the question ID is in the question list
-	 *
-	 * @author - Olivier Brouckaert
-	 * @param - integer $questionId - question ID
-	 * @return - boolean - true if in the list, otherwise false
-	 */
-	
-	function testisInList() {
-		$questionId = 1;
-		$res = $this->eExercise->isInList($questionId);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * tells if questions are selected randomly, and if so returns the draws
-	 *
-	 * @author - Olivier Brouckaert
-	 * @return - integer - 0 if not random, otherwise the draws
-	 */
-	
-	function testisRandom() {
-		$res = $this->eExercise->isRandom();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * moves a question down in the list
-	 * @param - integer $id - question ID to move down
-	 */
-	
-	function testmoveDown() {
-		$id=1;
-		$res = $this->eExercise->moveDown($id);
-		if(!is_null($res)){
-		$this->assertTrue(is_numeric($res));
-		}
-		//var_dump($res);
-	}
-	
-	/**
-	 * moves a question up in the list
-	 * @param - integer $id - question ID to move up
-	 */
-	
-	function testmoveUp() {
-		$id=1;
-		$res = $this->eExercise->moveUp($id);
-		if(!is_null($res)){
-		$this->assertTrue(is_numeric($res));
-		}
-		//var_dump($res);
-	}
-	
-	/**
-	 * function which process the creation of exercises
-	 * @param FormValidator $form the formvalidator instance
-	 */
-	 /*
-	 function testprocessCreation() {
-		$form = new FormValidator('exerciseTitle');
-		$res = $this->eExercise->processCreation($form,$type='');
-		if(!is_null($res)){
-		$this->assertTrue(is_numeric($res));
-		}
-		//var_dump($res);
-	}*/
-	
-	/**
-	 * reads exercise informations from the data base
-	 * @param - integer $id - exercise ID
-	 * @return - boolean - true if exercise exists, otherwise false
-	 */
-	
-	function testread() {
-		global $_course;
-       	global $_configuration;
-        global $questionList;
-        $id=1;
-		$res = $this->eExercise->read($id);
-		if(!is_null($res)){
-		$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res);
-	}
-	
-	/**
-	 * removes a question from the question list
-	 * @param - integer $questionId - question ID
-	 * @return - boolean - true if the question has been removed, otherwise false
-	 */
-	 
-	 function testremoveFromList() {
-		global $_course;
-       	global $_configuration;
-        global $questionList;
-        $questionId=1;
-		$res = $this->eExercise-> removeFromList($questionId);
-		if(!is_null($res)){
-		$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res);
-	}
-	 
-	 /**
-	 * updates the exercise in the data base
-	 */
-	 
-	 function testsave() {
-		global $_course,$_user;
-		$res = $this->eExercise-> save($type_e='');
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	 function testsearch_engine_delete() {
-		$res = $this->eExercise-> search_engine_delete();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	function testsearch_engine_save() {
-		$res = $this->eExercise-> search_engine_save();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns the number of attempts setted
-	 * @return - numeric - exercise attempts
-	 */
-	 
-	 function testselectAttempts() {
-		$res = $this->eExercise-> selectAttempts();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns the exercise description
-	 * @return - string - exercise description
-	 */
-	 
-	 function testselectDescription() {
-		$res = $this->eExercise-> selectDescription();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns the expired time
-	 * @return - string - expired time
-	 */
-	 
-	function testselectExpiredTime() {
-		$res = $this->eExercise-> selectExpiredTime();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-	 
-	/** returns the number of FeedbackType  *
-	 *  0=>Feedback , 1=>DirectFeedback, 2=>NoFeedback
-	 * @return - numeric - exercise attempts
-	 */ 
-	
-	function testselectFeedbackType() {
-		$res = $this->eExercise-> selectFeedbackType();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns the exercise ID
-	 * @return - integer - exercise ID
-	 */
-	 
-	 function testselectId() {
-		$res = $this->eExercise-> selectId();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns the number of questions in this exercise
-	 * @return - integer - number of questions
-	 */
-	 
-	 function testselectNbrQuestions() {
-		$res = $this->eExercise-> selectNbrQuestions();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-	 
-	/**
-	 * returns the array with the question ID list
-	 * @return - array - question ID list
-	 */
-	 
-	 function testselectQuestionList() {
-		$res = $this->eExercise-> selectQuestionList();
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-	  
-	/**
-	 * returns random answers status.
-	 */ 
-	 
-	function testselectRandomAnswers() {
-		$res = $this->eExercise-> selectRandomAnswers();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-	
-	/**
-     * selects questions randomly in the question list
-	 *
-	 * @author - Olivier Brouckaert
-	 * @return - array - if the exercise is not set to take questions randomly, returns the question list
-	 *					 without randomizing, otherwise, returns the list with questions selected randomly
-     */
-     
-     function testselectRandomList() {
-		$res = $this->eExercise-> selectRandomList();
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * tells if questions are selected randomly, and if so returns the draws
-	 * @return - integer - results disabled exercise
-	 */
-	 
-	 function testselectResultsDisabled() {
-		$res = $this->eExercise-> selectResultsDisabled();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns the exercise sound file
-	 * @return - string - exercise description
-	 */
-	 
-	 function testselectSound() {
-		$res = $this->eExercise-> selectSound();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns the exercise status (1 = enabled ; 0 = disabled)
-	 * @return - int - true if enabled, otherwise false
-	 */
-	 
-	 function testselectStatus() {
-		$res = $this->eExercise-> selectStatus();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns the time limit
-	 * @return int
-	 */
-	 
-	 function testselectTimeLimit() {
-		$res = $this->eExercise-> selectTimeLimit();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns the exercise title
-	 * @return - string - exercise title
-	 */
-	 
-	 function testselectTitle() {
-		$res = $this->eExercise-> selectTitle();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * returns the exercise type
-	 * @return - integer - exercise type
-	 */
-	 
-	 function testselectType() {
-		$res = $this->eExercise-> selectType();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * sets to 0 if questions are not selected randomly
-	 * if questions are selected randomly, sets the draws
-	 * @param - integer $random - 0 if not random, otherwise the draws
-	 * @return void
-	 */
-	 
-	 function testsetRandom() {
-	 	$random = 1;
-		$res = $this->eExercise-> setRandom($random);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	 
-	/**
-	 * update the table question
-	 * @return void
-	 */
-	function testupdate_question_positions() {
-		$res = $this->eExercise-> update_question_positions();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * changes the exercise max attempts
-	 * @param - numeric $attempts - exercise max attempts
-	 * @return void
-	 */
-	 
-	function testupdateAttempts() {
-		$attempts = 1;
-		$res = $this->eExercise-> updateAttempts($attempts);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * changes the exercise description
-	 * @param - string $description - exercise description
-	 * @return void
-	 */
-	 
-	 function testupdateDescription() {
-		$description = 'testdescription';
-		$res = $this->eExercise-> updateDescription($description);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	* changes the exercise expired_time
-	* @param - int The expired time of the quiz
-	* @return void
-	*/
-	
-	function testupdateExpiredTime() {
-		$expired_time = 1;
-		$res = $this->eExercise-> updateExpiredTime($expired_time);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * changes the exercise feedback type
-	 * @param - numeric $attempts - exercise max attempts
-	 * @return void
-	 */
-	 
-	function testupdateFeedbackType() {
-		$feedback_type = 1;
-		$res = $this->eExercise-> updateFeedbackType($feedback_type);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * sets to 0 if answers are not selected randomly
-	 * if answers are selected randomly
-	 * @param - integer $random_answers - random answers
-	 * @return void
-	 */
-	
-	function testupdateRandomAnswers() {
-		$random_answers = 0;
-		$res = $this->eExercise-> updateRandomAnswers($random_answers);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * update the results
-	 * @return void
-	 */
-	function testupdateResultsDisabled() {
-		$results_disabled = 1;
-		$res = $this->eExercise->updateResultsDisabled($results_disabled);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * changes the exercise sound file
-	 * @param - string $sound - exercise sound file
-	 * @param - string $delete - ask to delete the file
-	 * @return void
-	 */
-	
-	function testupdateSound() {
-		global $audioPath, $documentPath,$_course, $_user;
-		$sound = 'test';
-		$delete = 'test';
-		$res = $this->eExercise->updateSound($sound,$delete);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * changes the exercise title
-	 * @param - string $title - exercise title
-	 * @return void
-	 */
-	 
-	function testupdateTitle() {
-		$title = 'test';
-		$res = $this->eExercise->updateTitle($title);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * changes the exercise type
-	 * @param - integer $type - exercise type
-	 */
-	 
-	 function testupdateType() {
-		$type = 1;
-		$res = $this->eExercise->updateType($type);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * deletes the exercise from the database
-	 * Notice : leaves the question in the data base
-	 */
-	 
-	 function testdelete() {
-	 	global $_course,$_user;
-		$res = $this->eExercise->delete();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}	
-}
-?>

+ 0 - 42
tests/main/exercice/exercise.lib.test.php

@@ -1,42 +0,0 @@
-<?php
-require_once api_get_path(SYS_CODE_PATH).'exercice/question.class.php';
-
-class TestExerciseLib extends UnitTestCase {
-	/*public $eQuestion;
-	
-	public function TestExerciseLib() {
-		$this->UnitTestCase('');
-	}
-	
-	public function setUp() {
-
-		$this->eQuestion = new Question();			
-	}
-	
-	public function tearDown() {		
-		$this->eQuestion = null;
-	}*/
-	/**
-	 * @param int question id
-	 * @param boolean only answers
-	 * @param boolean origin i.e = learnpath
-	 * @param int current item from the list of questions
-	 * @param int number of total questions
-	 */
- 	 
- 	 function testshowQuestion() {
- 	 	global $_course;
- 	 	$questionId = 1;
- 	 	$current_item = 1 ;
- 	 	$total_item = 1;
- 	 	//$objQuestionTmp = $question->read($questionId);
- 	 	$res = showQuestion($questionId, $onlyAnswers=false, $origin=false,$current_item, $total_item);
- 	 	$this->assertTrue(is_null($res));
- 	 	var_dump($res);
- 	 }
-	
-	
-	
-	
-}	
-?>

+ 0 - 85
tests/main/exercice/exercise_result.class.test.php

@@ -1,85 +0,0 @@
-<?php
-
-require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
-
-class TestExerciseResult extends UnitTestCase {
-	
-		public $eExerciseResult;
-	
-	public function TestExerciseResult() {
-		$this->UnitTestCase('');
-	}
-	
-	public function setUp() {
-		$this->eExerciseResult = new ExerciseResult();			
-	}
-	
-	public function tearDown() {		
-		$this->eExerciseResult = null;
-	}
-	
-	/**
-	 * Gets the results of all students (or just one student if access is limited)
-	 * @param	string		The document path (for HotPotatoes retrieval)
-	 * @param	integer		User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
-	 */
-	 
-	function test_getExercisesReporting() {
-		global $user_id;
-	 	$document_path = api_get_path(SYS_COURSE_PATH).'document/';
-		$res = $this->eExerciseResult->_getExercisesReporting($document_path,$user_id,$filter=0);
-		if(!is_null($res)) {
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res);
-	}
-	
-	/**
-	 * Exports the complete report as a CSV file
-	 * @param	string		Document path inside the document tool
-	 * @param	integer		Optional user ID
-	 * @param	boolean		Whether to include user fields or not
-	 * @return	boolean		False on error
-	 */
-	 
-	 function testexportCompleteReportCSV() {
-		global $user_id;
-		$document_path = api_get_path(SYS_COURSE_PATH).'document/';
-		if(!headers_sent()){
-		$res = $this->eExerciseResult->exportCompleteReportCSV($document_path,$user_id, $export_user_fields = array(), $export_filter = 0);
-		}
-		if(!is_null($res)) {
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res);
-	}
-	
-	/**
-	 * Exports the complete report as an XLS file
-	 * @return	boolean		False on error
-	 */
-	 
-	 function testexportCompleteReportXLS() {
-		global $user_id;
-		$document_path = api_get_path(SYS_COURSE_PATH).'document/';
-		if(!headers_sent()){
-		$res = $this->eExerciseResult->exportCompleteReportXLS($document_path='',$user_id, $export_user_fields=array(), $export_filter = 0);
-		}
-		if(!is_null($res)) {
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res);
-	}
-	 
-	 
-	
-	
-	
-	
-	
-	
-	
-	
-	
-}
-?>

+ 0 - 100
tests/main/exercice/export/exercise_import.inc.test.php

@@ -1,100 +0,0 @@
-<?php
-
-
-//Is possible than this functions still are not implemented int he Chamilo systems or some are deprecated
-
-
-class TestExerciseImport extends UnitTestCase {
-	
-	function testelementData() {
-		global $element_pile;
-		$element_pile = array();
-		$parser= array();
-		$data = array();
-		$res = elementData($parser,$data);
-		$this->assertFalse(is_array($res));
-		if(!is_null){
-			$this->assertTrue($res);
-		}
-		//var_dump($res);
-	} 
-	
-	function testendElement() {
-		global $element_pile;
-		$element_pile = array();
-		$parser= array();
-		$data = array();
-		$res = endElement($parser,$data);
-		$this->assertFalse(is_array($res));
-		if(!is_null){
-			$this->assertTrue($res);
-		}
-		//var_dump($res);
-	} 
-	
-	/**
-	 * possible deprecated
-	 * @return the path of the temporary directory where the exercise was uploaded and unzipped
-	 */
- 
-	/*function testgetandunzipuploadedexercise() {
-		include_once (realpath(dirname(__FILE__) . '/../../inc/lib/pclzip/') . '/pclzip.lib.php');
-		$res = get_and_unzip_uploaded_exercise();
-		$this->assertFalse(is_array($res));
-		if(!is_null){
-			$this->assertTrue($res);
-		}
-		//var_dump($res);
-	} */
-	
-	/**
-	 * main function to import an exercise,
-	 * Possible deprecated
-	 * @return an array as a backlog of what was really imported, and error or debug messages to display
-	 */
- 
-	/*function testimport_exercise() {
-		$file = '';
-		$res = import_exercise($file);
-		$this->assertFalse(is_array($res));
-		if(!is_null){
-			$this->assertTrue($res);
-		}
-		var_dump($res);
-	}*/
-	
-	function testparse_file() {
-		$file = '';
-		$exercisePath = '';
-		$questionFile = '';
-		$res = parse_file($exercisePath, $file, $questionFile);
-		$this->assertTrue(is_array($res));
-		if(!is_null){
-			$this->assertTrue($res);
-		}
-		//var_dump($res);
-	}
-	
-	function teststartElement() {
-		$parser = 'test';
-		$name = 'test';
-		$attributes = array();
-		$res = startElement($parser, $name, $attributes);
-		$this->assertFalse(is_array($res));
-		if(!is_null){
-			$this->assertTrue($res);
-		}
-		//var_dump($res);
-	}
-	
-	function testtempdir() {
-		$dir = '/tmp';
-		$res = tempdir($dir, $prefix='tmp', $mode=0777);
-		$this->assertFalse(is_array($res));
-		if(!is_null){
-			$this->assertTrue(is_string($res));
-		}
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 198
tests/main/exercice/export/qti2/qti2_classes.test.php

@@ -1,198 +0,0 @@
-<?php
-
-require_once(api_get_path(SYS_CODE_PATH).'/exercice/answer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercice/exercise.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercice/hotspot.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercice/unique_answer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercice/multiple_answer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercice/matching.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercice/freeanswer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercice/fill_blanks.class.php');
-define('UNIQUE_ANSWER',		1);
-define('MCUA',				1);
-define('TF',				1);
-define('MULTIPLE_ANSWER',	2);
-define('MCMA',				2);
-define('FILL_IN_BLANKS',	3);
-define('FIB',				3);
-define('MATCHING',			4);
-define('FREE_ANSWER', 		5);
-define('HOTSPOT',			6);
-
-class TestQti2 extends UnitTestCase {
-
-	public $qIms2Question;
-	public $qImsAnswerFillInBlanks;
-	public $qImsAnswerFree;
-	public $qImsAnswerHotspot;
-	public $qImsAnswerMatching;
-	public $qImsAnswerMultipleChoice;
-
-	public function __construct() {
-        $this->UnitTestCase('QTI2 library - main/exercice/export/qti2/qti2_classes.test.php');
-	}
-
-	public function setUp() {
-		$this->qIms2Question = new Ims2Question();
-		$this->qImsAnswerFillInBlanks = new ImsAnswerFillInBlanks(1);
-		$this->qImsAnswerFree = new ImsAnswerFree(1);
-		$this->qImsAnswerHotspot = new ImsAnswerHotspot(1);
-		$this->qImsAnswerMatching = new ImsAnswerMatching(1);
-		$this->qImsAnswerMultipleChoice = new ImsAnswerMultipleChoice(1);
-	}
-
-	public function tearDown() {
-		$this-> qIms2Question = null;
-		$this-> qImsAnswerFillInBlanks = null;
-		$this-> qImsAnswerFree = null;
-		$this-> qImsAnswerHotspot = null;
-		$this-> qImsAnswerMatching = null;
-		$this-> qImsAnswerMultipleChoice = null;
-	}
-
-//Class qIms2Question
-	 /**
-     * Include the correct answer class and create answer
-     */
-
-	function testsetAnswer() {
-		$res=Ims2Question::setAnswer();
-		if(!is_null){
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res);
-	}
-
-	function testcreateAnswersForm() {
-		$form = array(1);
-		$res=Ims2Question::createAnswersForm($form);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testprocessAnswersCreation() {
-		$form = array(1);
-		$res=Ims2Question::processAnswersCreation($form);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-
-//Class qImsAnswerFillInBlanks
-
- 	 /**
-     * Export the text with missing words.
-     *
-     *
-     */
-	function testimsExportResponses() {
-		$questionIdent = array(1);
-		$questionStatment = array(1);
-		$res=$this->qImsAnswerFillInBlanks->imsExportResponses($questionIdent, $questionStatment);
-			if(!is_null){
-				$this->assertTrue(is_bool($res));
-			}
-		//var_dump($res);
-	}
-
-	function testimsExportResponsesDeclaration() {
-		$questionIdent = array(1);
-		$res=$this->qImsAnswerFillInBlanks->imsExportResponsesDeclaration($questionIdent);
-			if(!is_null){
-				$this->assertTrue(is_bool($res));
-			}
-		//var_dump($res);
-	}
-
-//Class qImsAnswerFree
-
-	/**
-     * TODO implement
-     * Export the question part as a matrix-choice, with only one possible answer per line.
-     */
-
-	function testImsExportResponsesqImsAnswerFree() {
-		$questionIdent = array('');
-		$questionStatment = array('');
-		$res=$this->qImsAnswerFree->imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='');
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testImsExportResponsesDeclarationqImsAnswerFree() {
-		$questionIdent = array(1);
-		$res=$this->qImsAnswerFree->imsExportResponsesDeclaration($questionIdent);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-
-//Class qImsAnswerHotspot
-
-	/**
-     * TODO update this to match hotspots instead of copying matching
-     * Export the question part as a matrix-choice, with only one possible answer per line.
-     */
-
-	function testimsExportResponsesqImsAnswerHotspot() {
-		$questionIdent = array(1);
-		$questionStatment = array(1);
-		$res=$this->qImsAnswerHotspot->imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='');
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-
-	function testimsExportResponsesDeclarationqImsAnswerHotspot() {
-		$questionIdent = array(1);
-		$res=$this->qImsAnswerHotspot->imsExportResponsesDeclaration($questionIdent);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-//Class qImsAnswerMatching
-
-    /**
-     * Export the question part as a matrix-choice, with only one possible answer per line.
-     */
-
-	function testimsExportResponsesqImsAnswerMatching() {
-		$questionIdent = array(1);
-		$questionStatment = array(1);
-		$res=$this->qImsAnswerMatching->imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='');
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-
-	function testimsExportResponsesDeclarationqImsAnswerMatching() {
-		$questionIdent = array(1);
-		$res=$this->qImsAnswerMatching->imsExportResponsesDeclaration($questionIdent);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-//Class qImsAnswerMultipleChoice
-
-     /**
-     * Return the XML flow for the possible answers.
-     *
-     */
-
-	function testimsExportResponsesqImsAnswerMultipleChoice() {
-		$questionIdent = array(1);
-		$questionStatment = array(1);
-		$res=$this->qImsAnswerMultipleChoice->imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='');
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-
-	function testimsExportResponsesDeclarationqImsAnswerMultipleChoice() {
-		$questionIdent = array(1);
-		$res=$this->qImsAnswerMultipleChoice->imsExportResponsesDeclaration($questionIdent);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 86
tests/main/exercice/export/qti2/qti2_export.test.php

@@ -1,86 +0,0 @@
-<?php
-
-//Is possible than this functions are not implemented or some are deprecated, this file will not
-//available for the test suite.
-
-class TestQti2Export extends UnitTestCase {
-	
-	public $qImsAssessmentItem;
-	public $qImsItem;
-	public $qImsSection;
-	
-	
-	public function TestQti2Export() {
-		$this->UnitTestCase('');
-	}
-	
-	public function setUp() {	
-
-		//$objQuestion = Question::read(1);		
-		$objQuestion = Question::read(1);
-		
-		$question = new Ims2Question();
-	    /*
-	    $qst = $question->read(1);
-	    if( !$qst or $qst->type == FREE_ANSWER)
-	    {
-	        return '';
-	    }
-	    $question->id = $qst->id;
-	    $question->type = $qst->type;
-	    $question->question = $qst->question;
-	    $question->description = $qst->description;
-		$question->weighting=$qst->weighting;
-		$question->position=$qst->position;
-		$question->picture=$qst->picture;
-		*/
-						
-		$this->qImsAssessmentItem = new ImsAssessmentItem($question);		
-		//$this->qImsItem = new ImsItem(1);
-		//$this->qImsSection = new ImsSection(1);
-	}
-	
-	public function tearDown() {		
-		$this-> qImsAssessmentItem = null;
-		$this-> qImsItem = null;
-		$this-> qImsSection = null;
-	}
-	
-//Class ImsAssessmentItem
-	
-	 /**
-     * Constructor.
-     * @param $question The Question object we want to export.
-     */
-     /*
-	function testImsAssessmentItem() {
-		$question = array();
-		$res = $this->qImsAssessmentItem->ImsAssessmentItem($question);
-			if(!is_null){
-			$this->assertTrue(is_bool($res));
-			}
-			var_dump($res);
-	}  
-	*/
-	
-	function teststart_item() {
-		/*
-		$res = $this->qImsAssessmentItem->start_item();
-		if(!is_null){
-			$this->assertTrue(is_bool($res));
-		}
-		var_dump($res);
-		*/
-	} 
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-}
-?>

+ 0 - 234
tests/main/exercice/export/scorm/scorm_classes.test.php

@@ -1,234 +0,0 @@
-<?php
-
-require_once(api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercice/question.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercice/unique_answer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercice/multiple_answer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercice/multiple_answer_combination.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercice/fill_blanks.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercice/freeanswer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercice/hotspot.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercice/matching.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercice/hotspot.class.php');
-
-// answer types
-define('UNIQUE_ANSWER',		1);
-define('MCUA',				1);
-define('TF',				1);
-define('MULTIPLE_ANSWER',	2);
-define('MCMA',				2);
-define('FILL_IN_BLANKS',	3);
-define('FIB',				3);
-define('MATCHING',			4);
-define('FREE_ANSWER', 		5);
-define('HOTSPOT',			6);
-define('HOT_SPOT_ORDER', 	7);
-define('HOT_SPOT_DELINEATION', 		8);
-define('MULTIPLE_ANSWER_COMBINATION', 	9);
-
-class TestScormClasses extends UnitTestCase {
-
-	public $sScormAnswerFillInBlanks;
-	public $sScormAnswerFree;
-	public $sScormAnswerHotspot;
-	public $sScormAnswerMatching;
-	public $sScormAnswerMultipleChoice;
-	public $sScormAnswerTrueFalse;
-	public $sScormQuestion;
-
-	public function __construct() {
-	   $this->UnitTestCase('SCORM exercises export library - main/exercice/export/scorm/scorm_classes.test.php');
-	}
-
-	public function setUp() {
-		$this->sScormAnswerFillInBlanks = new ScormAnswerFillInBlanks(1);
-		$this->sScormAnswerFree = new ScormAnswerFree(1);
-		$this->sScormAnswerHotspot = new ScormAnswerHotspot(1);
-		$this->sScormAnswerMatching = new ScormAnswerMatching(1);
-		$this->sScormAnswerMultipleChoice = new ScormAnswerMultipleChoice(1);
-		$this->sScormAnswerTrueFalse = new ScormAnswerTrueFalse(1);
-		$this->sScormQuestion = new ScormQuestion(1);
-	}
-
-	public function tearDown() {
-		$this-> sScormAnswerFillInBlanks = null;
-		$this-> sScormAnswerFree = null;
-		$this-> sScormAnswerHotspot = null;
-		$this-> sScormAnswerMatching = null;
-		$this-> sScormAnswerMultipleChoice = null;
-		$this-> sScormAnswerTrueFalse = null;
-		$this-> sScormQuestion = null;
-	}
-
-
-//Class sScormAnswerFillInBlanks
-
-	/**
-     * Export the text with missing words.
-     *
-     * As a side effect, it stores two lists in the class :
-     * the missing words and their respective weightings.
-     */
-
-	function testexport() {
-		$res= $this->sScormAnswerFillInBlanks->export();
-		if(!is_null($res)){
-		$this->assertTrue(is_array($res));
-		}
-        //var_dump($res);
-	}
-
-//Class sScormAnswerFree
-
-	/**
-     * Export the text with missing words.
-     *
-     * As a side effect, it stores two lists in the class :
-     * the missing words and their respective weightings.
-     *
-     */
-	function testexportsScormAnswerFree() {
-		$res= $this->sScormAnswerFree->export();
-		if(!is_null($res)){
-		$this->assertTrue(is_array($res));
-		}
-        //var_dump($res);
-	}
-
-//Class sScormAnswerHotspot
-
-	/**
-	 * Returns the javascript code that goes with HotSpot exercises
-	 * @return string	The JavaScript code
-	 */
-
-	function testexportsScormAnswerHotspot() {
-		$res= $this->sScormAnswerHotspot->export();
-		if(!is_null($res)){
-		$this->assertTrue(is_array($res));
-		}
-        //var_dump($res);
-	}
-
-		function testgetjsheadersScormAnswerHotspot() {
-		$res= $this->sScormAnswerHotspot->get_js_header();
-		if(!is_null($res)){
-		$this->assertTrue(is_string($res));
-		}
-        //var_dump($res);
-	}
-
-	//Class sScormAnswerMatching
-
-	/**
-     * Export the question part as a matrix-choice, with only one possible answer per line.
-     * @author Amand Tihon <amand@alrj.org>
-     */
-
-	function testexportsScormAnswerMatching() {
-		$res= $this->sScormAnswerMatching->export();
-		if(!is_null($res)){
-		$this->assertTrue(is_array($res));
-		}
-        //var_dump($res);
-	}
-
-//Class sScormAnswerMultipleChoice
-
-	/**
-	 * Return HTML code for possible answers
-     */
-
-	function testexportsScormAnswerMultipleChoice() {
-		$res= $this->sScormAnswerMultipleChoice->export();
-		if(!is_null($res)){
-		$this->assertTrue(is_array($res));
-		}
-        //var_dump($res);
-	}
-
-//Class sScormAnswerTrueFalse
-
-	/**
-     * Return the XML flow for the possible answers.
-     * That's one <response_lid>, containing several <flow_label>
-     */
-
-	function testexportsScormAnswerTrueFalse() {
-		$res= $this->sScormAnswerTrueFalse->export();
-		if(!is_null($res)){
-		$this->assertTrue(is_array($res));
-		}
-        //var_dump($res);
-	}
-
-//Class sScormQuestion
-
-	function testcreateAnswersFormsScormQuestion() {
-		$form = '';
-		$res= $this->sScormQuestion->createAnswersForm($form);
-		if(!is_null($res)){
-		$this->assertTrue(is_bool($res));
-		}
-        //var_dump($res);
-	}
-
-	/**
-     * Return the XML flow for the possible answers.
-     * That's one <response_lid>, containing several <flow_label>
-     */
-
-	/*function testexportsScormQuestion() {
-		$res= $this->sScormQuestion->export();
-		if(!is_null($res)){
-		$this->assertTrue(is_array($res));
-		}
-        //var_dump($res);
-	}*/
-
- 	/**
-     * Returns an HTML-formatted question
-     */
-     /*
-	function testgetQuestionHTMLsScormQuestion() {
-		$res= $this->sScormQuestion->getQuestionHTML();
-		if(!is_null($res)){
-		$this->assertTrue(is_array($res));
-		}
-        //var_dump($res);
-	}*/
-
-	/**
-     * Return the JavaScript code bound to the question
-     */
-     /*
-     function testgetQuestionJSsScormQuestion() {
-		$res= ScormQuestion::getQuestionJS();
-		if(!is_null($res)){
-		$this->assertTrue(is_array($res));
-		}
-        //var_dump($res);
-	}*/
-
-	function testprocessAnswersCreationJSsScormQuestion() {
-		$form = '';
-		$res= $this->sScormQuestion->processAnswersCreation($form);
-		if(!is_null($res)){
-		$this->assertTrue(is_bool($res));
-		}
-        //var_dump($res);
-	}
-
-	 /**
-	 * Include the correct answer class and create answer
-	 */
-
-	 function testsetAnswersCreationJSsScormQuestion() {
-		$res= $this->sScormQuestion->setAnswer();
-		if(!is_null($res)){
-		$this->assertTrue(is_bool($res));
-		}
-        //var_dump($res);
-	}
-}
-?>

+ 0 - 45
tests/main/exercice/fill_blanks.class.test.php

@@ -1,45 +0,0 @@
-<?php
-
-class TestFillBlanksClass extends UnitTestCase {
-	
-	public $fFillBlanks;
-	
-	public function TestFillBlanksClass() {
-		$this->UnitTestCase('');
-	}
-	
-	public function setUp() {
-		$this->fFillBlanks = new FillBlanks();			
-	}
-	
-	public function tearDown() {		
-		$this->fFillBlanks = null;
-	}
-		
-	/**
-	 * function which redifines Question::createAnswersForm
-	 * @param the formvalidator instance
-	 */
-	 /*
-	function testcreateAnswersForm() {
-		$form = new FormValidator('introduction_text');
-		$res = $this->fFillBlanks->createAnswersForm($form);
-		$this->assertTrue(is_null($res));
-		var_dump($res);
-	}*/
-	
-	/**
-	 * abstract function which creates the form to create / edit the answers of the question
-	 * @param the formvalidator instance
-	 */
-	/* 
-	function testprocessAnswersCreation() {
-		global $charset;
-		$form = new FormValidator('introduction_text');
-		$res = $this->fFillBlanks->processAnswersCreation($form);
-		$this->assertTrue(is_null($res));
-		var_dump($res);
-	}*/
-
-}
-?>

+ 0 - 29
tests/main/exercice/freeanswer.class.test.php

@@ -1,29 +0,0 @@
-<?php
-class TestFreeanswer extends UnitTestCase {
-	
-	/**
-	 * function which redifines Question::createAnswersForm
-	 * @param the formvalidator instance
-	 */
-	 
-	function testcreateAnswersForm () {
-		$form = new FormValidator('exercise_admin', 'post', api_get_self().'?exerciseId='.$_GET['exerciseId']);
-		$res =FreeAnswer::createAnswersForm($form);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}	
-	
-	/**
-	 * abstract function which creates the form to create / edit the answers of the question
-	 * @param the formvalidator instance
-	 */
-	
-	function testprocessAnswersCreation () {
-		$form = new FormValidator('exercise_admin', 'post', api_get_self().'?exerciseId='.$_GET['exerciseId']);
-		$res =FreeAnswer::processAnswersCreation($form);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-}
-?>

+ 0 - 178
tests/main/exercice/hotpotatoes.lib.test.php

@@ -1,178 +0,0 @@
-<?php
-require_once(api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php');
-
-class TestHotpotatoes extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Hotpotatoes exercises library - main/exercice/hotpotatoes.lib.test.php');
-    }
-
-	function testCheckImageName() {
-		$imgparams=array();
-		$string='';
-		$checked = myarraysearch($imgparams,$string);
-		$res=CheckImageName(&$imgparams,$string);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue(is_bool($checked));
-		//var_dump($res);
-	}
-
-	function testCheckSubFolder() {
-		$path='Location: /main/exercice/';
-		$res=CheckSubFolder($path);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testFillFolderName() {
-		$name='testnameofthefolder';
-		$nsize=12;
-		$res=FillFolderName($name,$nsize);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testGenerateHiddenList() {
-		$imgparams=array('test');
-		$res=GenerateHiddenList($imgparams);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-
-
-	}
-
-	function testGenerateHpFolder() {
-		$folder='main/exercice/hotpotatoes.lib.php';
-		$res=GenerateHpFolder($folder);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testGetComment() {
-
-			$course_code = 'COURSETEST';
-			$path = 'exercice_submit.php';
-			$query ="select comment from $dbTable where path='$path'";
-			$res=GetComment($path,$course_code);
-			$this->assertTrue(is_string($res));
-			//var_dump($res);
-
-		}
-
-	/*  Deprecated
-	function testGetFileName() {
-		$fname='main/exercice/hotpotatoes.lib.php';
-		$res=GetFileName($fname);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}*/
-
-	function testGetFolderName() {
-		$fname='main/exercice/hotpotatoes.lib.php';
-		$res=GetFolderName($fname);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testGetFolderPath() {
-		$fname='main/exercice/hotpotatoes.lib.php';
-		$res=GetFolderPath($fname);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testGetImgName() {
-		$imgtag='<img src="example.jpg">';
-		$res=GetImgName($imgtag);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testGetImgParams() {
-		$fname='/main/css/academica/images/bg.jpg';
-		$fpath='main/css/academica/images/';
-		$imgparams= array();
-		$imgcount='';
-		$res=GetImgParams($fname,$fpath,&$imgparams,&$imgcount);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testGetQuizName() {
-		$course_code = 'COURSETEST';
-		$fname='exercice_submit.php';
-		$fpath='main/exercice/exercice_submit.php';
-		$res=GetQuizName($fname,$fpath);
-
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testGetSrcName() {
-		$imgtag='src="test.jpg""';
-		$res=GetSrcName($imgtag);
-		if(!is_string($res))$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testhotpotatoes_init() {
-		$base = api_get_path(SYS_CODE_PATH);
-		$baseWorkDir=$base.'exercice/';
-		$res=hotpotatoes_init($baseWorkDir);
-		$this->assertFalse($res);
-		//var_dump($res);
-	}
-
-	function testHotPotGCt() {
-		$folder='/main/exercice';
-		$flag=4;
-		$userID=1;
-		$res=HotPotGCt($folder,$flag,$userID);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testmyarraysearch() {
-		$array=array();
-		$node='';
-		$res=myarraysearch($array,$node);
-		if(!is_bool($res))$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testReadFileCont() {
-		$full_file_path='';
-		$res=ReadFileCont($full_file_path);
-		if(!is_bool($res))$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testReplaceImgTag() {
-		$content='src="test2.jpg"';
-		$res=ReplaceImgTag($content);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testSetComment() {
-		global $dbTable;
-		$path='/main/exercice';
-		$comment='testing this function';
-		$comment = Database::escape_string($comment);
-		$query = "UPDATE $dbTable set comment='$comment' where path='$path'";
-		$result = Database::query($query);
-		$res=SetComment($path,$comment);
-		$this->assertTrue(is_string($res));
-		//var_dump($resu);
-	}
-
-	function testWriteFileCont() {
-		$course_code = 'COURSETEST';
-		$full_file_path='/main/exercice/';
-		$content='test test test';
-		$res=WriteFileCont($full_file_path,$content);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 1363
tests/main/forum/forumfunction.inc.test.php

@@ -1,1363 +0,0 @@
-<?php
-require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/gradebookitem.class.php';
-require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/abstractlink.class.php';
-require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/evallink.class.php';
-
-class TestForumFunction extends UnitTestCase {
-	
-	public function TestForumFunction() {
-		$this->UnitTestCase('Test forum function');
-	}
-	
-	public function __construct() {
-		// The constructor acts like a global setUp for the class			
-		require_once api_get_path(SYS_TEST_PATH).'setup.inc.php';
-	}
-	
-	/**
-	 * This function add a attachment file into forum
-	 * @param string  a comment about file
-	 * @param int last id from forum_post table
-	 * @return void
-	 */
-	public function testadd_forum_attachment_file() {
-		 global $_course;
-		 $file_comment='testcoment';
-		 $last_id = 1;
-		 $res = add_forum_attachment_file($file_comment,$last_id);
-		 $this->assertTrue(is_null($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function approves a post = change
-	*
-	* @param $post_id the id of the post that will be deleted
-	* @param $action make the post visible or invisible
-	* @return string language variable
-	*/
-	
-	public function testapprove_post() {
-		 $action= 'invisible';
-		 $post_id = 1;
-		 $res = approve_post($post_id, $action);
-		 $this->assertTrue(is_string($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function changes the lock status in the database
-	*
-	* @param $content what is it that we want to (un)lock: forum category, forum, thread, post
-	* @param $id the id of the content we want to (un)lock
-	* @param $action do we lock (=>locked value in db = 1) or unlock (=> locked value in db = 0)
-	* @return string, language variable
-	* @todo move to itemmanager
-	*/
-	
-	public function testchange_lock_status() {
-		 $content = 'testcontent';
-		 $action= 'invisible';
-		 $id = 1;
-		 $res = change_lock_status($content, $id, $action);
-		 $this->assertTrue(is_string($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function changes the visibility in the database (item_property)
-	*
-	* @param $content what is it that we want to make (in)visible: forum category, forum, thread, post
-	* @param $id the id of the content we want to make invisible
-	* @param $target_visibility what is the current status of the visibility (0 = invisible, 1 = visible)
-	* @todo change the get parameter so that it matches the tool constants.
-	* @todo check if api_item_property_update returns true or false => returnmessage depends on it.
-	* @todo move to itemmanager
-	* @return string language variable
-	*/
-	
-	public function testchange_visibility() {
-		 $content= 'testcontent';
-		 $target_visibility = 1;
-		 $id = 1;
-		 $res = change_visibility($content, $id, $target_visibility);
-		 $this->assertTrue(is_string($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function gets the all information of the last (=most recent) post of the thread
-	* This can be done by sorting the posts that have the field thread_id=$thread_id and sort them by post_date
-	* @param $thread_id the id of the thread we want to know the last post of.
-	* @return an bool or array if there is a last post found, false if there is no post entry linked to that thread => thread will be deleted
-	*/
-	
-	public function testcheck_if_last_post_of_thread() {
-		 $thread_id = 1;
-		 $res = check_if_last_post_of_thread($thread_id);
-		 if(!is_bool($res)) {
-		  $this->assertTrue(is_array($res));
-		 }
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function returns a piece of html code that make the links grey (=invisible for the student)
-	* @param boolean 0/1: 0 = invisible, 1 = visible
-	* @return string language variable
-	*/
-	
-	public function testclass_visible_invisible() {
-		 $current_visibility_status = 0;
-		 $res = class_visible_invisible($current_visibility_status);
-		 $this->assertTrue(is_string($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function counts the number of forums inside a given category
-	* @param $cat_id the id of the forum category
-	* @todo an additional parameter that takes the visibility into account. For instance $countinvisible=0 would return the number
-	* 		of visible forums, $countinvisible=1 would return the number of visible and invisible forums
-	* @return int the number of forums inside the given category
-	*/
-	
-	public function testcount_number_of_forums_in_category() {
-		 $cat_id = 1;
-		 $res = count_number_of_forums_in_category($cat_id);
-		 $this->assertTrue(is_numeric($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function counts the number of post inside a thread user
-	* @param 	int Thread ID
-	* @param 	int User ID
-	* @return	int the number of post inside a thread user
-	*/
-	
-	public function testcount_number_of_post_for_user_thread() {
-		 $thread_id = 1;
-		 $user_id = 1;
-		 $res = count_number_of_post_for_user_thread($thread_id, $user_id);
-		 $this->assertTrue(is_numeric($res));
-		 //var_dump($res); 	
-	 }
-	
-	/**
-	* This function counts the number of post inside a thread
-	* @param 	int Thread ID
-	* @return	int the number of post inside a thread
-	*/
-	
-	public function testcount_number_of_post_in_thread() {
-		 $thread_id = 1;
-		 $res = count_number_of_post_in_thread($thread_id);
-		 $this->assertTrue(is_numeric($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function counts the number of user register in course
-	* @param 	int Course ID
-	* @return	int the number of user register in course
-	*/
-	
-	public function testcount_number_of_user_in_course() {
-		 global $cidReq;
-		 $course_id = $cidReq;
-		 $res = count_number_of_user_in_course($course_id);
-		 $this->assertTrue(is_numeric($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	*
-	*  This function show current thread qualify .
-	* @param integer contains the information the current thread id
-	* @param integer contains the information the current session id
-	* @return array or null if is empty
-	*/
-	
-	public function testcurrent_qualify_of_thread() {
-		 $thread_id = 1;
-		 $session_id = 1;
-		 $res = current_qualify_of_thread($thread_id,$session_id);
-		 $this->assertTrue(is_null($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	 * Display the search results
-	 * @return void HTML - display the results
-	 */
-	 
-	 public function testdisplay_forum_search_results() {
-		 global $origin;
-		 $search_term = 'testterm';
-		 ob_start();
-		 $res = display_forum_search_results($search_term);
-		 ob_end_clean();
-		 $this->assertTrue(is_null($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function takes care of the display of the lock icon
-	* @param $content what is it that we want to (un)lock: forum category, forum, thread, post
-	* @param $id the id of the content we want to (un)lock
-	* @param $current_visibility_status what is the current status of the visibility (0 = invisible, 1 = visible)
-	* @return void display the lock HTML.
-	*/
-	 
-	 function testdisplay_lock_unlock_icon() {
-		 $content = 'testterm';
-		 $id = 1;
-		 $current_lock_status = 0;
-		 ob_start();
-		 $res = display_lock_unlock_icon($content, $id, $current_lock_status, $additional_url_parameters='');
-		 ob_end_clean();
-		 $this->assertTrue(is_null($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function takes care of the display of the up and down icon
-	* @param $content what is it that we want to make (in)visible: forum category, forum, thread, post
-	* @param $id is the id of the item we want to display the icons for
-	* @param $list is an array of all the items. All items in this list should have an up and down icon except for the first (no up icon) and the last (no down icon)
-	* 		 The key of this $list array is the id of the item.
-	* @return void HTML
-	*/
-	
-	public function testdisplay_up_down_icon() {
-		 $content = 'testcontent';
-		 $id = 1;
-		 $list = array('test');
-		 ob_start();
-		 $res = display_up_down_icon($content, $id, $list);
-		 ob_end_clean();
-		 $this->assertTrue(is_null($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function displays the user image from the profile, with a link to the user's details.
-	* @param 	int 	User's database ID
-	* @param 	str 	User's name
-	* @return 	string 	An HTML with the anchor and the image of the user
-	*/
-	
-	public function testdisplay_user_image() {
-		 $name = 'testcontent';
-		 $user_id = 1;
-		 $res = display_user_image($user_id,$name, $origin='');
-		 $this->assertTrue(is_string($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function displays the firstname and lastname of the user as a link to the user tool.
-	* @param string 
-	* @return string HTML
-	*/
-	
-	public function testdisplay_user_link() {
-		 $name = 'testcontent';
-		 $user_id = 1;
-		 $res = display_user_link($user_id, $name, $origin='');
-		 $this->assertTrue(is_string($res));
-		 //var_dump($res); 	
-	 }
-	 
-	/**
-	* This function takes care of the display of the visibility icon
-	* @param $content what is it that we want to make (in)visible: forum category, forum, thread, post
-	* @param $id the id of the content we want to make invisible
-	* @param $current_visibility_status what is the current status of the visibility (0 = invisible, 1 = visible)
-	* @return void string HTML 
-	*/
-	
-	public function testdisplay_visible_invisible_icon() {
-		 $content = 'testcontent';
-		 $current_visibility_status = 0;
-		 $id = 1;
-		 ob_start();
-		 $res = display_visible_invisible_icon($content, $id, $current_visibility_status, $additional_url_parameters='');
-		 ob_end_clean();
-		 $this->assertTrue(is_null($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	 * This function edit a attachment file into forum
-	 * @param string  a comment about file
-	 * @param int Post Id
-	 * @param int attachment file Id
-	 * @return void
-	 */
-	 
-	 public function testedit_forum_attachment_file() {
-		 $file_comment = 'testcontent';
-		 $id_attach = 1;
-		 $post_id = 1;
-		 $res = edit_forum_attachment_file($file_comment,$post_id,$id_attach);
-		 $this->assertTrue(is_null($res));
-		 //var_dump($res); 	
-	}
-	 
-	 /**
-	 * Display the search form for the forum and display the search results
-	 * @return void display an HTML search results
-	 */
-	 
-	 public function testforum_search() {
-		ob_start();
-		$res = forum_search();
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /** This function gets all the post written by an user
-	 * @param int user id
-	 * @param string db course name
-	 * @return string
-	 */
-	 
-	 public function testget_all_post_from_user() {
-		global $_course;
-		$course_db = $_course['dbName'];
-		$user_id = 1;
-		$res = get_all_post_from_user($user_id, $course_db);
-		$this->assertTrue(is_string($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	 * Show a list with all the attachments according to the post's id
-	 * @param the post's id
-	 * @return array with the post info
-	 */
-	 
-	 public function testget_attachment() {
-		$post_id = 1;
-		$res = get_attachment($post_id);
-		$this->assertTrue(is_array($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* Retrieve all the information off the forum categories (or one specific) for the current course.
-	* The categories are sorted according to their sorting order (cat_order
-	* @param $id default ''. When an id is passed we only find the information about that specific forum category. If no id is passed we get all the forum categories.
-	* @return an array containing all the information about all the forum categories
-	*/
-	
-	public function testget_forum_categories() {
-		$res = get_forum_categories($id='');
-		$this->assertTrue(is_array($res));
-		//var_dump($res); 	
-	 }
-	
-	/**
-	* This function retrieves all the information of a given forum_id
-	* @param $forum_id integer that indicates the forum
-	* @return array returns
-	* @deprecated this functionality is now moved to get_forums($forum_id)
-	*/
-	/*
-	function testget_forum_information() {
-		$forum_id = 1;
-		$res = get_forum_information($forum_id);
-		$this->assertTrue(is_array($res));
-		//var_dump($res); 	
-	 }*/
-	 
-	 /**
-	* This function retrieves all the information of a given forumcategory id
-	* @param $forum_id integer that indicates the forum
-	* @return array returns if there are category
-	* @return bool returns if there aren't category
-	*/
-	
-	public function testget_forumcategory_information() {
-		$cat_id = 1;
-		$res = get_forumcategory_information($cat_id);
-		if(!is_bool($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res); 	
-	 }
-	
-	/**
-	* Retrieve all the forums (regardless of their category) or of only one. The forums are sorted according to the forum_order.
-	* Since it does not take the forum category into account there probably will be two or more forums that have forum_order=1, ...
-	* @return an array containing all the information about the forums (regardless of their category)
-	* @todo check $sql4 because this one really looks fishy.
-	*/
-	
-	public function testget_forums() {
-		$res = get_forums($id='');
-		if(!is_bool($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function retrieves all the fora in a given forum category
-	* @param integer $cat_id the id of the forum category
-	* @return an array containing all the information about the forums (regardless of their category)
-	*/
-	
-	public function testget_forums_in_category() {
-		$cat_id = 1;
-		$res = get_forums_in_category($cat_id);
-		if(!is_bool($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	 * This function gets all the forum information of the all the forum of the group
-	 * @param integer $group_id the id of the group we need the fora of (see forum.forum_of_group)
-	 * @return array
-	 * @todo this is basically the same code as the get_forums function. Consider merging the two.
-	 */
-	 
-	 public function testget_forums_of_group() {
-		$group_id = 1;
-		$res = get_forums_of_group($group_id);
-		if(!is_null($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	  /**
-	*
-	*  This function get qualify historical.
-	* @param integer contains the information the current user id
-	* @param integer contains the information the current thread id
-	* @param boolean contains the information of option to run
-	* @return array()
-	*/
-	
-	public function testget_historical_qualify() {
-		$user_id = 1;
-		$thread_id = 1;
-		$opt = true;
-		$res = get_historical_qualify($user_id,$thread_id,$opt);
-		if(!is_null($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This functions gets all the last post information of a certain forum
-	* @param $forum_id the id of the forum we want to know the last post information of.
-	* @param $show_invisibles
-	* @return array containing all the information about the last post (last_post_id, last_poster_id, last_post_date, last_poster_name, last_poster_lastname, last_poster_firstname)
-	*/
-	
-	public function testget_last_post_information() {
-		$forum_id = 1;
-		$res = get_last_post_information($forum_id, $show_invisibles=false);
-		if(!is_null($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	  /** This function get the name of an thread by id
-	 * @param int thread_id
-	 * @return String
-	 **/
-	 
-	 public function testget_name_thread_by_id() {
-		$thread_id = 1;
-		$res = get_name_thread_by_id($thread_id);
-		if(!is_null($res)){
-			$this->assertTrue(is_string($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	 /** This function get the name of an user by id
-	 * @param user_id int
-	 * return String
-	 */
-	 
-	 public function testget_name_user_by_id() {
-		$user_id = 1;
-		$res = get_name_user_by_id($user_id);
-		if(!is_null($res)){
-			$this->assertTrue(is_string($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	 * This function retrieves all the email adresses of the users who wanted to be notified
-	 * about a new post in a certain forum or thread
-	 * @param string $content does the user want to be notified about a forum or about a thread
-	 * @param integer $id the id of the forum or thread
-	 * @return array
-	 */
-	 
-	  public function testget_notifications() {
-		$id = 1;
-		$content = 'test message notified';
-		$res = get_notifications($content,$id);
-		if(!is_null($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	 * Get all the notification subscriptions of the user
-	 * = which forums and which threads does the user wants to be informed of when a new
-	 * post is added to this thread
-	 * @param integer $user_id the user_id of a user (default = 0 => the current user)
-	 * @param boolean $force force get the notification subscriptions (even if the information is already in the session
-	 * @return array
-	 */
-	 
-	 public function testget_notifications_of_user() {
-		$res = get_notifications_of_user($user_id = 0, $force = false);
-		if(!is_null($res)){
-			$this->assertTrue(is_string($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function retrieves all the information of a post
-	* @param $forum_id integer that indicates the forum
-	* @return array returns
-	*/
-	
-	public function testget_post_information() {
-		$post_id = 1;
-		$res = get_post_information($post_id);
-		if(!is_null($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* With this function we find the number of posts and topics in a given forum.
-	* @param int
-	* @return array
-	* @todo consider to call this function only once and let it return an array where the key is the forum id and the value is an array with number_of_topics and number of post
-	* as key of this array and the value as a value. This could reduce the number of queries needed (especially when there are more forums)
-	* @todo consider merging both in one query.
-	* @deprecated the counting mechanism is now inside the function get_forums
-	*/
-	/*
-	function testget_post_topics_of_forum() {
-		$forum_id = 1;
-		$res = get_post_topics_of_forum($forum_id);
-		if(!is_null($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }*/
-	 
-	 /**
-	* Retrieve all posts of a given thread
-	* @param int $thread_id integer that indicates the forum
-	* @return an array containing all the information about the posts of a given thread
-	*/
-	
-	public function testget_posts() {
-		$thread_id = 1;
-		$res = get_posts($thread_id);
-		if(!is_null($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function retrieves information of statistical
-	* @param 	int Thread ID
-	* @param 	int User ID
-	* @param 	int Course ID
-	* @return	array the information of statistical
-	*/
-	
-	public function testget_statistical_information() {
-		$thread_id = 1;
-		$user_id = 1;
-		$course_id = 'COURSETEST' ;
-		$res = get_statistical_information($thread_id, $user_id, $course_id);
-		if(!is_null($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	
-	/**
-	* This function retrieves all the information of a thread
-	* @param $forum_id integer that indicates the forum
-	* @return array returns
-	*/
-	
-	function testget_thread_information() {
-		$thread_id = 1;
-		$res = get_thread_information($thread_id);
-		if(!is_bool($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res); 	
-	 }
-
-	 /**
-	* This function return the posts inside a thread from a given user
-	* @param 	course code
-	* @param 	int Thread ID
-	* @param 	int User ID
-	* @return	int the number of post inside a thread
-	*/
-
-	public function testget_thread_user_post() {
-		global $_course;
-		$thread_id = 1;
-		$course_db = $_course['dbName'];
-		$user_id = 1;
-		$res = get_thread_user_post($course_db, $thread_id, $user_id );
-		if(!is_null($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	 /**
-	  * @param string
-	  * @param int
-	  * @param int 
-	  * @param int
-	  * @return void
-	  */
-	 public function testget_thread_user_post_limit() {
-	 	global $_course;
-		$thread_id = 1;
-		$course_db = $_course['dbName'];
-		$user_id = 1;
-		$res = get_thread_user_post_limit($course_db, $thread_id, $user_id, $limit=10);
-		if(!is_null($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function retrieves forum thread users details
-	* @param 	int Thread ID
-	* @param	string	Course DB name (optional)
-	* @return	resource Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[])
-	*/
-	
-	 public function testget_thread_users_details() {
-		$thread_id = 1;
-		$res = get_thread_users_details($thread_id, $db_name = null);
-		if(!is_null($res)){
-			$this->assertTrue(is_resource($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function retrieves forum thread users not qualify
-	* @param 	int Thread ID
-	* @param	string	Course DB name (optional)
-	* @return	array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[])
-	*/
-	 
-	 public function testget_thread_users_not_qualify() {
-		$thread_id = 1;
-		$res = get_thread_users_not_qualify($thread_id, $db_name = null);
-		if(!is_null($res)){
-			$this->assertTrue(is_resource($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function retrieves forum thread users qualify
-	* @param 	int Thread ID
-	* @param	string	Course DB name (optional)
-	* @return	array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[])
-	*/
-	 
-	 public function testget_thread_users_qualify() {
-		$thread_id = 1;
-		$res = get_thread_users_qualify($thread_id, $db_name = null);
-		if(!is_bool($res)){
-			$this->assertTrue(is_resource($res));
-		} else {
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* Retrieve all the threads of a given forum
-	* @param int forum id
-	* @return an array containing all the information about the threads
-	*/
-	
-	 public function testget_threads() {
-		$forum_id = 1;
-		$res = get_threads($forum_id);
-		if(!is_bool($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	/**
-	* This function retrieves all the unapproved messages for a given forum
-	* This is needed to display the icon that there are unapproved messages in that thread (only the courseadmin can see this)
-	* @param $forum_id the forum where we want to know the unapproved messages of
-	* @return array returns
-	*/
-	
-	 public function testget_unaproved_messages() {
-		$forum_id = 1;
-		$res = get_unaproved_messages($forum_id);
-		if(!is_bool($res)){
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	/**
-	* This function is used to find all the information about what's new in the forum tool
-	* @return void
-	*/
-	
-	 public function testget_whats_new() {
-		$res = get_whats_new();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function handles all the forum and forumcategories actions. This is a wrapper for the
-	* forum and forum categories. All this code code could go into the section where this function is
-	* called but this make the code there cleaner.
-	* @return void
-	*/
-	
-	public function testhandle_forum_and_forumcategories() {
-		$res = handle_forum_and_forumcategories();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function is called whenever something is made visible because there might be new posts and the user might have indicated that (s)he wanted
-	* to be informed about the new posts by mail.
-	* @param string
-	* @param int
-	* @return string language variable
-	*/
-	
-	public function testhandle_mail_cue() {
-		$content = 'test content';
-		$id = 1;
-		$res = handle_mail_cue($content, $id);
-		$this->assertTrue(is_string($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function return the html syntax for the image
-	* @param $image_url The url of the image (absolute or relative)
-	* @param $alt The alt text (when the images cannot be displayed). http://www.w3.org/TR/html4/struct/objects.html#adef-alt
-	* @param $title The title of the image. Most browsers display this as 'tool tip'. http://www.w3.org/TR/html4/struct/global.html#adef-title
-	* @todo this is the same as the Display::xxx function, so it can be removed => all calls have to be changed also
-	* @return string url image
-	*/
-	
-	public function testicon() {
-		$image_url = api_get_path(WEB_IMG_PATH).'test.png';
-		$res = icon($image_url,$alt='',$title='');
-		$this->assertTrue(is_string($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* The thread view counter gets increased every time someone looks at the thread
-	* @param int 
-	* @return void
-	*/
-	
-	public function testincrease_thread_view() {
-		$thread_id = 1;
-		$res = increase_thread_view($thread_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function displays the form for moving a post message to a different (already existing) or a new thread.
-	* @return void HTML
-	*/
-	
-	public function testmove_post_form() {
-		ob_start();
-		$res = move_post_form();
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function displays the form for moving a thread to a different (already existing) forum
-	* @return void HTML
-	*/
-	
-	public function testmove_thread_form() {
-		ob_start();
-		$res = move_thread_form();
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function moves a forum or a forum category up or down
-	* @param $content what is it that we want to make (in)visible: forum category, forum, thread, post
-	* @param $direction do we want to move it up or down.
-	* @param $id the id of the content we want to make invisible
-	* @todo consider removing the table_item_property calls here but this can prevent unwanted side effects when a forum does not have an entry in
-	* 		the item_property table but does have one in the forum table.
-	* @return string language variable
-	*/
-	
-	public function testmove_up_down() {
-		$content = 'test content';
-		$direction = 'test direction';
-		$id = 1;
-		$res = move_up_down($content, $direction, $id);
-		$this->assertTrue(is_string($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* Prepares a string or an array of strings for display by stripping slashes
-	* @param mixed	String or array of strings
-	* @return mixed String or array of strings
-	*/
-	
-	public function testprepare4display() {
-		$res = prepare4display($input='');
-		$this->assertTrue(is_string($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	 * Return the link to the forum search page
-	 */
-	 
-	 public function testsearch_link() {
-		$res = search_link();
-		$this->assertTrue(is_string($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function sends the mails for the mail notification
-	* @param array
-	* @param array
-	* @return void
-	*/
-	
-	public function testsend_mail() {
-		$res = send_mail($user_info=array(), $thread_information=array());
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This function sends the notification mails to everybody who stated that they wanted to be informed when a new post
-	* was added to a given thread.
-	* @param int  id thread
-	* @param array reply information
-	* @return void
-	*/
-	
-	public function testsend_notification_mails() {
-		$thread_id = 1; 
-		$reply_info = array('test');
-		$res = send_notification_mails($thread_id, $reply_info);
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	 * Get all the users who need to receive a notification of a new post (those subscribed to
-	 * the forum or the thread)
-	 * @param integer $forum_id the id of the forum
-	 * @param integer $thread_id the id of the thread
-	 * @param integer $post_id the id of the post
-	 * @return bool
-	 */
-	 
-	 public function testsend_notifications() {
-		$res = send_notifications($forum_id=0, $thread_id=0, $post_id=0);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	 * This function stores which users have to be notified of which forums or threads
-	 * @param string $content does the user want to be notified about a forum or about a thread
-	 * @param integer $id the id of the forum or thread
-	 * @return string language variable
-	 */
-	 
-	 public function testset_notification() {
-	 	$content = 'test content';
-	 	$id = 1;
-		$res = set_notification($content,$id, $add_only = false);
-		$this->assertTrue(is_string($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This public function displays the form that is used to add a forum category.
-	* @param array
-	* @return void HTML
-	*/
-	
-	 public function testshow_add_forum_form() {
-	 	ob_start();
-		$res = show_add_forum_form($inputvalues=array());
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This public function displays the form that is used to add a forum category.
-	* @param array input values
-	* @return void HTML
-	*/
-	
-	public function testshow_add_forumcategory_form() {
-	 	ob_start();
-		$res = show_add_forumcategory_form($inputvalues=array());
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This public function displays the form that is used to add a post. This can be a new thread or a reply.
-	* @param $action is the parameter that determines if we are
-	*					1. newthread: adding a new thread (both empty) => No I-frame
-	*					2. replythread: Replying to a thread ($action = replythread) => I-frame with the complete thread (if enabled)
-	*					3. replymessage: Replying to a message ($action =replymessage) => I-frame with the complete thread (if enabled) (I first thought to put and I-frame with the message only)
-	* 					4. quote: Quoting a message ($action= quotemessage) => I-frame with the complete thread (if enabled). The message will be in the reply. (I first thought not to put an I-frame here)
-	* @return void HTML
-	*/
-	 
-	public function testshow_add_post_form() {
-	 	ob_start();
-		$res = show_add_post_form($action='', $id='', $form_values='');
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This public function displays the form that is used to edit a forum category.
-	* This is more or less a copy from the show_add_forumcategory_form public function with the only difference that is uses
-	* some default values. I tried to have both in one public function but this gave problems with the handle_forum_and_forumcategories public function
-	* (storing was done twice)
-	* @param array
-	* @return void HTML
-	*/
-	
-	public function testshow_edit_forumcategory_form() {
-	 	ob_start();
-		$res = show_edit_forumcategory_form($inputvalues=array());
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This public function displays the form that is used to edit a post. This can be a new thread or a reply.
-	* @param array contains all the information about the current post
-	* @param array contains all the information about the current thread
-	* @param array contains all info about the current forum (to check if attachments are allowed)
-	* @param array contains the default values to fill the form
-	* @return void
-	*/
-	
-	public function testshow_edit_post_form() {
-	 	ob_start();
-	 	$current_post = array('test');
-	 	$current_thread = array('test2');
-	 	$current_forum = array('test3');
-		$res = show_edit_post_form($current_post, $current_thread, $current_forum, $form_values='',$id_attach=0);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-
-	/**
-	* This public function show qualify.
-	* @param string contains the information of option to run
-	* @param string contains the information the current course id
-	* @param integer contains the information the current forum id
-	* @param integer contains the information the current user id
-	* @param integer contains the information the current thread id
-	* @return integer qualify
-	* @example $option=1 obtained the qualification of the current thread
-	*/
-	
-	public function testshow_qualify() {
-	 	$option =  1;
-	 	$couser_id = 1;
-	 	$forum_id = 1;
-	 	$user_id = 1;
-	 	$thread_id = 1;
-		$res = show_qualify($option,$couser_id,$forum_id,$user_id,$thread_id);
-		if(!is_numeric($res)){
-			$this->assertTrue(is_null($res));
-		} else {
-			$this->assertTrue(is_numeric($res));
-		}
-		//var_dump($res); 	
-	 }
-	 
-	/**
-	* This function builds an array of all the posts in a given thread where the key of the array is the post_id
-	* It also adds an element children to the array which itself is an array that contains all the id's of the first-level children
-	* @return an array containing all the information on the posts of a thread
-	*/
-
-	 public function testcalculate_children() {
-		$rows = array();
-		$res = calculate_children($rows);
-		$this->assertTrue(is_array($res));
-		//var_dump($res); 	
-	 }
-	 
-	 public function test_phorum_recursive_sort() {
-		$rows = array();
-		$res = _phorum_recursive_sort($rows, &$threads, $seed=0, $indent=0);
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-
-	/**
-	* This public function stores the edit of a post in the forum_post table.
-	* @param array 
-	* @return void HTML
-	*/
-	
-	public function teststore_edit_post() {
-		$values = array('test');
-		ob_start();
-		$res = store_edit_post($values);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This public function stores the forum in the database. The new forum is added to the end.
-	* @param array
-	* @return string language variable
-	*/
-	
-	public function teststore_forum() {
-		$values = array('test');
-		ob_start();
-		$res = store_forum($values);
-		ob_end_clean();
-		$this->assertTrue(is_string($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This public function stores the forum category in the database. The new category is added to the end.
-	* @param array
-	* @return void HMTL language variable
-	*/
-	
-	public function teststore_forumcategory() {
-		$values = array('test');
-		ob_start();
-		$res = store_forumcategory($values);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	*
-	* @param array
-	* @return string HTML language variable 
-	*/
-	
-	public function teststore_move_post() {
-		$values = array('test');
-		ob_start();
-		$res = store_move_post($values);
-		ob_end_clean();
-		$this->assertTrue(is_string($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* @param array
-	* @return string HTML language variable 
-	*/
-	
-	public function teststore_move_thread() {
-		$values = array('test');
-		ob_start();
-		$res = store_move_thread($values);
-		ob_end_clean();
-		$this->assertTrue(is_string($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	*
-	*  This public function store qualify historical.
-	* @param boolean contains the information of option to run
-	* @param string contains the information the current course id
-	* @param integer contains the information the current forum id
-	* @param integer contains the information the current user id
-	* @param integer contains the information the current thread id
-	* @param integer contains the information the current qualify
-	* @return void
-	* @example $option=1 obtained the qualification of the current thread
-	*/
-	
-	public function teststore_qualify_historical() {
-		$option = 1;
-		$couser_id = 1;
-		$forum_id = 1;
-		$user_id = 1;
-		$thread_id = 1;
-		$current_qualify = 1;
-		$qualify_user_id = 1;
-		$res = store_qualify_historical($option,$couser_id,$forum_id,$user_id,$thread_id,$current_qualify,$qualify_user_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	* This public function stores a reply in the forum_post table.
-	* It also updates the forum_threads table (thread_replies +1 , thread_last_post, thread_date)
-	*/
-	
-	public function teststore_reply() {
-		$values = array('test');
-		ob_start();
-		$res = store_reply($values);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-	 
-	 /**
-	 * @param integer contains the information of user id
-	 * @param integer contains the information of thread id
-	 * @param integer contains the information of thread qualify
-	 * @param integer contains the information of user id of qualifier
-	 * @param integer contains the information of time
-	 * @param integer contains the information of session id
-	 * @return Array() optional
-	 **/
-	 
- 	 public function teststore_theme_qualify() {
-		$user_id = 1;
-		$thread_id = 1;
-		$qualify_time = 1;
-		$res = store_theme_qualify($user_id,$thread_id,$thread_qualify=0,$qualify_user_id=0,$qualify_time,$session_id=null);
-		if(!is_bool($res)) {
-			$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res); 	
-	 }
- 
-	 /**
-	* This public function stores a new thread. This is done through an entry in the forum_thread table AND
-	* in the forum_post table because. The threads are also stored in the item_property table. (forum posts are not (yet))
-	* @param array
-	* @return void HTML
-	*/
-	
-	public function teststore_thread() {
-		$values = array();
-		ob_start();
-		$res = store_thread($values);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	 }
-
-
-	/**
-	* The relies counter gets increased every time somebody replies to the thread
-	* @param
-	* @return void
-	*/
-	
-	public function testupdate_thread() {
-		$thread_id = 1;
-		$last_post_id = 1;
-		$post_date = 1;
-		$res = update_thread($thread_id, $last_post_id,$post_date);
-		$this->assertTrue(is_null($res));
-		//var_dump($res); 	
-	}
-	
- 
- 	 /**
-	* This public function is called when the user is not allowed in this forum/thread/...
-	* @return bool display message of "not allowed"
-	*/
-	
-	public function testforum_not_allowed_here() {
-		 ob_start();
-		 $res = forum_not_allowed_here();
-		 ob_end_clean();
-		 $this->assertTrue(is_bool($res));
-		 //var_dump($res); 	
-	 }
-	 
-	  /**
-	 * Delete the all the attachments from the DB and the file according to the post's id or attach id(optional)
-	 * @param post id
-	 * @param attach id (optional)
-	 * @return void
-	 */
-	 
-	 public function testdelete_attachment() {
-		 global $_course;
-		 $post_id = 1;
-		 $res = delete_attachment($post_id,$id_attach=0);
-		 $this->assertTrue(is_null($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This public function deletes a forum or a forum category
-	* This public function currently does not delete the forums inside the category, nor the threads and replies inside these forums.
-	* For the moment this is the easiest method and it has the advantage that it allows to recover fora that were acidently deleted
-	* when the forum category got deleted.
-	*
-	* @param $content = what we are deleting (a forum or a forum category)
-	* @param $id The id of the forum category that has to be deleted.
-	* @return void
-	* @todo write the code for the cascading deletion of the forums inside a forum category and also the threads and replies inside these forums
-	* @todo config setting for recovery or not (see also the documents tool: real delete or not).
-	*/
-	
-	public function testdelete_forum_forumcategory_thread() {
-		 $content= 'testcontent';
-		 $id = 1;
-		 $res = delete_forum_forumcategory_thread($content, $id);
-		 $this->assertTrue(is_null($res));
-		 //var_dump($res); 	
-	 }
-	 
-	 /**
-	* This public function deletes the forum image if exists
-	* @param int forum id
-	* @return boolean true if success
-	*/
-	 
-	 public function testdelete_forum_image() {
-		 $forum_id = 1;
-		 $res = delete_forum_image($forum_id);
-		 $this->assertTrue(is_bool($res));
-		 //var_dump($res); 	
-	 }
-	
-	/**
-	* This public function deletes a forum post. This separate public function is needed because forum posts do not appear in the item_property table (yet)
-	* and because deleting a post also has consequence on the posts that have this post as parent_id (they are also deleted).
-	* an alternative would be to store the posts also in item_property and mark this post as deleted (visibility = 2).
-	* We also have to decrease the number of replies in the thread table
-	* @return string language variable
-	* @param $post_id the id of the post that will be deleted
-	* @todo write recursive public function that deletes all the posts that have this message as parent
-	*/
-		
-	 public function testdelete_post() {
-		$table_posts 			= Database :: get_course_table(TABLE_FORUM_POST);
-		$table_threads 		= Database :: get_course_table(TABLE_FORUM_THREAD);
-		$post_id = 1;
-		$res = delete_post($post_id);
-		$this->assertTrue(is_string($res));
-		//var_dump($res); 	
-	 }
-	 
-	 public function __destruct() {
-		// The destructor acts like a global tearDown for the class			
-		require_once api_get_path(SYS_TEST_PATH).'teardown.inc.php';			
-	}
-}
-?>

+ 0 - 135
tests/main/gradebook/lib/be/attendancelink.class.test.php

@@ -1,135 +0,0 @@
-<?php
-
-class TestAttendanceLink extends UnitTestCase {
-
-	public function TestAttendanceLink() {
-		$this->UnitTestCase('Test Attendance Link');
-	}
-
-	public function __construct() {
-        $this->UnitTestCase('Gradebook attendances library - main/gradebook/lib/be/attendancelink.class.test.php');
-	    // The constructor acts like a global setUp for the class
-		global $date;
-		TestManager::create_test_course('COURSEATTENDANCELINK');
-		$this->attendance = new AttendanceLink();
-		$this->attendance->set_course_code('COURSEATTENDANCELINK');
-		$this->attendance->set_id (1);
-		$this->attendance->set_type (LINK_ATTENDANCE);
-		$this->attendance->set_ref_id (1) ;
-		$this->attendance->set_user_id (1);
-		$this->attendance->set_category_id(1);
-		$this->attendance->set_date ($date);
-		$this->attendance->set_weight (1);
-		$this->attendance->set_visible (1);
-		$this->attendance->set_session_id(1);
-	}
-
-	public function testcalc_score() {
-		$res = $this->attendance->calc_score($stud_id = null);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Generate an array of all attendances available.
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
-	 */
-
-	public function testget_all_links() {
-		$_SESSION['id_session'] = 1;
-		$res = $this->attendance->get_all_links();
-		if(!is_array($res)){
-			$this->assertTrue(is_null($res));
-		} else {
-			$this->assertTrue(is_array($res));
-		}
-		$_SESSION['id_session'] = null;
-		//var_dump($res);
-	}
-
-	/**
-	 * @return string description
-	 */
-
-	public function testget_description() {
-		$res = $this->attendance->get_description();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testget_link() {
-		$res = $this->attendance->get_link();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testget_name() {
-		$res = $this->attendance->get_name();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testget_not_created_links() {
-		$res = $this->attendance->get_not_created_links();
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testget_test_id() {
-		$res = $this->attendance->get_test_id();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testget_type_name() {
-		$res = $this->attendance->get_type_name();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-    * Has anyone done this exercise yet ?
-    */
-
-	public function testhas_results() {
-		$res = $this->attendance->has_results();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testis_allowed_to_change_name() {
-		$res = $this->attendance->is_allowed_to_change_name();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testis_valid_link() {
-		$res = $this->attendance->is_valid_link();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testneeds_max() {
-		$res = $this->attendance->needs_max();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testneeds_name_and_description() {
-		$res = $this->attendance->needs_name_and_description();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testneeds_results() {
-		$res = $this->attendance->needs_results();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function __destruct() {
-		// The destructor acts like a global tearDown for the class
-		TestManager::delete_test_course('COURSEATTENDANCELINK');
-	}
-}
-?>

+ 0 - 423
tests/main/gradebook/lib/be/category.class.test.php

@@ -1,423 +0,0 @@
-<?php
-
-class TestCategoryClass extends UnitTestCase {
-
-	public function TestCategoryClass() {
-		$this->UnitTestCase('Test Category Class');
-	}
-
-	public function __construct() {
-        $this->UnitTestCase('Gradebook categories library - main/gradebook/lib/be/category.class.test.php');
-	    // The constructor acts like a global setUp for the class
-		TestManager::create_test_course('COURSECATEGORYCLASS');
-		$this->category = new Category();
-		$this->category->set_id(1);
-		$this->category->set_name('test');
-		$this->category->set_description('test description');
-		$this->category->set_user_id(1);
-		$this->category->set_course_code('COURSECATEGORYCLASS');
-		$this->category->set_certificate_min_score(20);
-		$this->category->set_parent_id(0);
-		$this->category->set_session_id(1);
-		$this->category->set_weight(1);
-		$this->category->set_visible(1);
-	}
-
-	/**
-     * Insert this category into the database
-     */
-
-	public function testadd() {
-		$_SESSION['id_session'] = 1;
-		$res = $this->category->add();
-		$this->assertTrue(is_null($res));
-		$_SESSION['id_session'] = null;
-		//var_dump($res);
-	}
-
-	/**
-	 * Apply the same visibility to every subcategory, evaluation and link
-	 */
-
-	public function testapply_visibility_to_children() {
-		$res = $this->category->apply_visibility_to_children();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Calculate the score of this category
-	 * @param $stud_id student id (default: all students - then the average is returned)
-	 * @return	array (score sum, weight sum)
-	 * 			or null if no scores available
-	 */
-
-	public function testcalc_score() {
-		$res = $this->category->calc_score($stud_id = null);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Check if a category name (with the same parent category) already exists
-	 * @param $name name to check (if not given, the name property of this object will be checked)
-	 * @param $parent parent category
-	 * @return bool
-	 */
-
-	public function testdoes_name_exist() {
-		$name = 'test';
-		$parent=1;
-		$res = $this->category->does_name_exist($name, $parent);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	/**
-     * Find category by name
-     * @param string $name_mask search string
-     * @return array category objects matching the search criterium
-     */
-
-	public function testfind_category() {
-		$name_mask = 'test';
-		$allcat=array();
-		$res = $this->category->find_category($name_mask,$allcat);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Generate an array of all courses that a teacher is admin of.
-	 * @return array 2-dimensional array - every element contains 2 subelements (code, title)
-	 */
-
-	public function testget_all_courses() {
-		$user_id = 1;
-		$res = $this->category->get_all_courses($user_id);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testget_certificate_min_score() {
-		$res = $this->category->get_certificate_min_score();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testget_course_code() {
-		$res = $this->category->get_course_code();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testget_description() {
-		$res = $this->category->get_description();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Get appropriate evaluations visible for the user
-	 * @param int $stud_id student id (default: all students)
-	 * @param boolean $recursive process subcategories (default: no recursion)
-	 */
-
-	public function testget_evaluations() {
-		$res = $this->category->get_evaluations($stud_id = null, $recursive = false);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testget_icon_name() {
-		$res = $this->category->get_icon_name();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testget_id() {
-		$res = $this->category->get_id();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testget_independent_categories_with_result_for_student() {
-		$cat_id=1;
-		$stud_id=1;
-		$res = $this->category->get_independent_categories_with_result_for_student($cat_id, $stud_id, $cats = array());
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testget_item_type() {
-		$res = $this->category->get_item_type();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testget_links() {
-		$res = $this->category->get_links($stud_id = null, $recursive = false);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testget_name() {
-		$res = $this->category->get_name();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testget_not_created_course_categories() {
-		$user_id = 1;
-		$res = $this->category->get_not_created_course_categories($user_id);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testget_parent_id() {
-		$res = $this->category->get_parent_id();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Return array of Category objects where a student is subscribed to.
-	 * @param int       student id
-     * @param string    Course code
-     * @param int       Session id
-	 */
-
-	public function testget_root_categories_for_student() {
-		$stud_id=1;
-		$res = $this->category->get_root_categories_for_student($stud_id, $course_code = null, $session_id = null);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Return array of Category objects where a teacher is admin for.
-	 * @param int user id (to return everything, use 'null' here)
-     * @param string course code (optional)
-     * @param int session id (optional)
-	 */
-
-	public function testget_root_categories_for_teacher() {
-		$user_id=1;
-		$res = $this->category->get_root_categories_for_teacher($user_id, $course_code = null, $session_id = null);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testget_session_id() {
-		$user_id=1;
-		$res = $this->category->get_session_id($user_id, $course_code = null, $session_id = null);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Get appropriate subcategories visible for the user (and optionally the course and session)
-	 * @param int      $stud_id student id (default: all students)
-     * @param string   Course code (optional)
-     * @param int      Session ID (optional)
-     * @return  array   Array of subcategories
-	 */
-
-	public function testget_subcategories() {
-		$res = $this->category->get_subcategories($stud_id = null, $course_code = null, $session_id = null);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Generate an array of possible categories where this category can be moved to.
-	 * Notice: its own parent will be included in the list: it's up to the frontend
-	 * to disable this element.
-	 * @return array 2-dimensional array - every element contains 3 subelements (id, name, level)
-	 */
-
-	public function testget_target_categories() {
-		$res = $this->category->get_target_categories();
-		if(is_array($res)) {
-		$this->assertTrue(is_array($res));
-		} else {
-			$this->assertTrue(is_null($res));
-		}
-		var_dump($res);
-
-	}
-
-	/**
-	 * Generate an array of all categories the user can navigate to
-	 */
-
-	public function testget_tree() {
-		$res = $this->category->get_tree();
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testget_user_id() {
-		$res = $this->category->get_user_id();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testget_weight() {
-		$res = $this->category->get_weight();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Check if a category contains evaluations with a result for a given student
-	 */
-
-	public function testhas_evaluations_with_results_for_student() {
-		$stud_id = 1;
-		$res = $this->category->has_evaluations_with_results_for_student($stud_id);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Checks if the certificate is available for the given user in this category
-	 * @param	integer	User ID
-	 * @return	boolean	True if conditions match, false if fails
-	 */
-
-	public function testis_certificate_available() {
-		$user_id = 1;
-		$res = $this->category->is_certificate_available($user_id);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Is this category a course ?
-	 * A category is a course if it has a course code and no parent category.
-	 */
-
-	public function testis_course() {
-		$res = $this->category->is_course();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Can this category be moved to somewhere else ?
-	 * The root and courses cannot be moved.
-	 */
-
-	public function testis_movable() {
-		$res = $this->category->is_movable();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testis_visible() {
-		$res = $this->category->is_visible();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Retrieve categories and return them as an array of Category objects
-	 * @param int      category id
-	 * @param int      user id (category owner)
-	 * @param string   course code
-	 * @param int      parent category
-	 * @param bool     visible
-     * @param int      session id (in case we are in a session)
-     * @param bool     Whether to show all "session" categories (true) or hide them (false) in case there is no session id
-	 */
-
-	public function testload() {
-		$res = $this->category->load($id = null, $user_id = null, $course_code = null, $parent_id = null, $visible = null, $session = null, $show_session_categories = true);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Move this category to the given category.
-	 * If this category moves from inside a course to outside,
-	 * its course code must be changed, as well as the course code
-	 * of all underlying categories and evaluations. All links will
-	 * be deleted as well !
-	 */
-
-	public function testmove_to_cat() {
-		$res = $this->category->move_to_cat($this->category);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-
-	/**
-	 * Update the properties of this category in the database
-	 */
-
-	public function testsave() {
-		$res = $this->category->save();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Show message resource delete
-	 */
-
-	public function testshow_message_resource_delete() {
-		$course_id = 1;
-		$res = $this->category->show_message_resource_delete($course_id);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Shows all information of an category
-	 */
-
-	public function testshows_all_information_an_category() {
-		$res = $this->category->shows_all_information_an_category($selectcat='');
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Not delete this category from the database,when visible=3 is category eliminated
-	 */
-
-	public function testupdate_category_delete() {
-		$course_id = 1;
-		$res = $this->category->update_category_delete($course_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Delete this evaluation from the database
-	 */
-
-	public function testdelete() {
-		$res = $this->category->delete();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Delete this category and every subcategory, evaluation and result inside
-	 */
-
-	public function testdelete_all() {
-		$res = $this->category->delete_all();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function __destruct() {
-		// The destructor acts like a global tearDown for the class
-		TestManager::delete_test_course('COURSECATEGORYCLASS');
-	}
-}
-?>

+ 0 - 42
tests/main/gradebook/lib/be/dropboxlink.class.test.php

@@ -1,42 +0,0 @@
-<?php
-
-class TestDropBoxLink extends UnitTestCase {
-
-	public function TestDropBoxLink() {
-		$this->UnitTestCase('Test Drop Box Link');
-	}
-
-	public function __construct() {
-        $this->UnitTestCase('Gradebook dropbox library - main/gradebook/lib/be/dropboxlink.class.test.php');
-	    // The constructor acts like a global setUp for the class
-		TestManager::create_test_course('COURSEDROPBOXLINK');
-		$this->dropbox = new DropboxLink();
-		$this->dropbox->set_course_code('COURSEDROPBOXLINK');
-		$this->dropbox->set_name('test');
-	}
-
-	public function testget_type_name() {
-		$res = $this->dropbox->get_type_name();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testget_view_url() {
-		$stud_id = 1;
-		$res = $this->dropbox->get_view_url($stud_id);
-		//$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testis_allowed_to_change_name() {
-		$res = $this->dropbox->is_allowed_to_change_name();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function __destruct() {
-		// The destructor acts like a global tearDown for the class
-		TestManager::delete_test_course('COURSEDROPBOXLINK');
-	}
-}
-?>

+ 0 - 347
tests/main/gradebook/lib/be/evaluation.class.test.php

@@ -1,347 +0,0 @@
-<?php
-class TestEvaluation extends UnitTestCase {
-
-	public function TestEvaluation() {
-		$this->UnitTestCase('Test Evaluation');
-	}
-
-	public function __construct() {
-        $this->UnitTestCase('Gradebook evaluation library - main/gradebook/lib/be/evaluation.class.test.php');
-	    // The constructor acts like a global setUp for the class
-		global $date;
-		TestManager::create_test_course('COURSEEVALUATION');
-		$this->evaluation = new Evaluation();
-		$this->evaluation-> set_id (1);
-		$this->evaluation-> set_name ('test');
-		$this->evaluation-> set_description ('test description');
-		$this->evaluation-> set_user_id (1);
-		$this->evaluation-> set_course_code ('COURSEEVALUATION');
-		$this->evaluation-> set_category_id (1);
-		$this->evaluation-> set_date ($date);
-		$this->evaluation-> set_weight (1);
-		$this->evaluation-> set_max (1);
-		$this->evaluation-> set_visible (1);
-	}
-
-	/**
-	* Insert this evaluation into the database
-	*/
-
-	public function testadd() {
-		$res = $this->evaluation->add();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testadd_evaluation_log() {
-		$idevaluation = 1;
-		$res = $this->evaluation->add_evaluation_log($idevaluation);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-	* Calculate the score of this evaluation
-	* @param $stud_id student id (default: all students who have results for this eval - then the average is returned)
-	* @return	array (score, max) if student is given
-	* 			array (sum of scores, number of scores) otherwise
-	* 			or null if no scores available
-	*/
-
-	public function testcalc_score() {
-		$res = $this->evaluation->calc_score($stud_id = null);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-	* Delete this evaluation from the database
-	*/
-
-	public function testdelete() {
-		$res = $this->evaluation->delete();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-    * Delete all results for this evaluation
-    */
-
-    public function testdelete_results() {
-		$res = $this->evaluation->delete_results();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-    * Delete this evaluation and all underlying results.
-    */
-
-    public function testdelete_with_results() {
-		$res = $this->evaluation->delete_with_results();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Check if an evaluation name (with the same parent category) already exists
-	 * @param $name name to check (if not given, the name property of this object will be checked)
-	 * @param $parent parent category
-	 */
-
-	public function testdoes_name_exist() {
-		$name = 'test name';
-		$parent = 1;
-		$res = $this->evaluation->does_name_exist($name, $parent);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	/**
-	* Find evaluations by name
-	* @param string $name_mask search string
-	* @return array evaluation objects matching the search criterium
-	* @todo can be written more efficiently using a new (but very complex) sql query
-	*/
-	//problem with the call get_evaluations():  Call to a member function get_evaluations() on a non-object
-	/*public function testfind_evaluations() {
-		$name_mask = 'test name mask';
-		$selectcat = 1;
-		$res = Evaluation::find_evaluations($name_mask,$selectcat);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}*/
-
-	public function testget_category_id() {
-		$res = $this->evaluation->get_category_id();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testget_course_code() {
-		$res = $this->evaluation->get_course_code();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testget_date() {
-		$res = $this->evaluation->get_date();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testget_description() {
-		$res = $this->evaluation->get_description();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Retrieve evaluations where a student has results for
-	 * and return them as an array of Evaluation objects
-	 * @param $cat_id parent category (use 'null' to retrieve them in all categories)
-	 * @param $stud_id student id
-	 */
-
-	public function testget_evaluations_with_result_for_student() {
-		$stud_id = 1;
-		$res = $this->evaluation->get_evaluations_with_result_for_student($cat_id = null, $stud_id);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testget_icon_name() {
-		$res = $this->evaluation->get_icon_name();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testget_id() {
-		$res = $this->evaluation->get_id();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testget_item_type() {
-		$res = $this->evaluation->get_item_type();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testget_max() {
-		$res = $this->evaluation->get_max();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testget_name() {
-		$res = $this->evaluation->get_name();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-     * Get a list of students that do not have a result record for this evaluation
-     */
-
-	public function testget_not_subscribed_students() {
-		$res = $this->evaluation->get_not_subscribed_students($first_letter_user = '');
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Generate an array of possible categories where this evaluation can be moved to.
-	 * Notice: its own parent will be included in the list: it's up to the frontend
-	 * to disable this element.
-	 * @return array 2-dimensional array - every element contains 3 subelements (id, name, level)
-	 */
-
-	public function testget_target_categories() {
-		$res = $this->evaluation->get_target_categories();
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testget_user_id() {
-		$res = $this->evaluation->get_user_id();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testget_weight() {
-		$res = $this->evaluation->get_weight();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Are there any results for this evaluation yet ?
-	 * The 'max' property should not be changed then.
-	 */
-
-	public function testhas_results() {
-		$res = $this->evaluation->has_results();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testis_valid_score() {
-		$score = 1;
-		$res = $this->evaluation->is_valid_score($score);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testis_visible() {
-		$res = $this->evaluation->is_visible();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Retrieve evaluations and return them as an array of Evaluation objects
-	 * @param $id evaluation id
-	 * @param $user_id user id (evaluation owner)
-	 * @param $course_code course code
-	 * @param $category_id parent category
-	 * @param $visible visible
-	 */
-
-	public function testload() {
-		$res = $this->evaluation->load($id = null, $user_id = null, $course_code = null, $category_id = null, $visible = null);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Move this evaluation to the given category.
-	 * If this evaluation moves from inside a course to outside,
-	 * its course code is also changed.
-	 */
-
-	public function testmove_to_cat() {
-		$cat = $this->evaluation;
-		$res = $this->evaluation->move_to_cat($cat);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Update the properties of this evaluation in the database
-	 */
-
-	public function testsave() {
-		$res = $this->evaluation->save();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testset_category_id() {
-		$res = $this->evaluation->set_category_id(1);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testset_course_code() {
-		$res = $this->evaluation->set_course_code('COURSEEVALUATION');
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testset_date() {
-		global $date;
-		$res = $this->evaluation->set_date('02/02/2010');
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testset_description() {
-		$res = $this->evaluation->set_description('test description');
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testset_id() {
-		$res = $this->evaluation->set_id(1);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testset_max() {
-		$res = $this->evaluation->set_max(1);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testset_name() {
-		$res = $this->evaluation->set_name('test name');
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testset_user_id() {
-		$res = $this->evaluation->set_user_id(1);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testset_visible() {
-		$res = $this->evaluation->set_visible(1);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testset_weight() {
-		$res = $this->evaluation->set_weight(1);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function __destruct() {
-		// The destructor acts like a global tearDown for the class
-		TestManager::delete_test_course('COURSEEVALUATION');
-	}
-}
-?>

+ 0 - 153
tests/main/gradebook/lib/be/exerciselink.class.test.php

@@ -1,153 +0,0 @@
-<?php
-class TestExerciseLink extends UnitTestCase {
-
-	public function TestExerciseLink() {
-		$this->UnitTestCase('Test Exercise Link');
-	}
-
-	public function __construct() {
-        $this->UnitTestCase('Gradebook exercises library - main/gradebook/lib/be/exerciselink.class.test.php');
-	    global $date;
-		// The constructor acts like a global setUp for the class
-		TestManager::create_test_course('COURSEEXERCISELINK');
-		$this->exerciselink = new ExerciseLink();
-		$this->exerciselink-> set_id (1);
-		$this->exerciselink-> set_name ('test');
-		$this->exerciselink-> set_description ('test description');
-		$this->exerciselink-> set_user_id (1);
-		$this->exerciselink-> set_course_code ('COURSEEXERCISELINK');
-		$this->exerciselink-> set_category_id (1);
-		$this->exerciselink-> set_date ($date);
-		$this->exerciselink-> set_weight (1);
-		$this->exerciselink-> set_max (1);
-		$this->exerciselink-> set_visible (1);
-	}
-
-	/**
-	 * Generate an array of all exercises available.
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
-	 */
-
-	public function testget_all_links() {
-		$res = $this->exerciselink->get_all_links();
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Get the score of this exercise. Only the first attempts are taken into account.
-	 * @param $stud_id student id (default: all students who have results - then the average is returned)
-	 * @return	array (score, max) if student is given
-	 * 			array (sum of scores, number of scores) otherwise
-	 * 			or null if no scores available
-	 */
-
-	public function testcalc_score() {
-		$res = $this->exerciselink->calc_score($stud_id = null);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-
-
-	/**
-     * Get description to display: same as exercise description
-     */
-
-	public function testget_description() {
-		$res = $this->exerciselink->get_description();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-    * Get URL where to go to if the user clicks on the link.
-    * First we go to exercise_jump.php and then to the result page.
-    * Check this php file for more info.
-    */
-
-	public function testget_link() {
-		$res = $this->exerciselink->get_link();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-     * Get name to display: same as exercise title
-     */
-
-    public function testget_name() {
-		$res = $this->exerciselink->get_name();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Generate an array of exercises that a teacher hasn't created a link for.
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
-	 */
-
-	public function testget_not_created_links() {
-		$_SESSION['id_session'] = 1;
-		$res = $this->exerciselink->get_not_created_links();
-		$this->assertTrue(is_array($res));
-		$_SESSION['id_session'] = null;
-		//var_dump($res);
-	}
-
-	public function testget_type_name() {
-		$res = $this->exerciselink->get_type_name();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-     * Has anyone done this exercise yet ?
-     */
-
-    public function testhas_results() {
-		$res = $this->exerciselink->has_results();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testis_allowed_to_change_name() {
-		$res = $this->exerciselink->is_allowed_to_change_name();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	/**
-    * Check if this still links to an exercise
-    */
-
-	public function testis_valid_link() {
-		$res = $this->exerciselink->is_valid_link();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-    public function testneeds_max() {
-		$res = $this->exerciselink->needs_max();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testneeds_name_and_description() {
-		$res = $this->exerciselink->needs_name_and_description();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testneeds_results() {
-		$res = $this->exerciselink->needs_results();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function __destruct() {
-		// The destructor acts like a global tearDown for the class
-		TestManager::delete_test_course('COURSEEXERCISELINK');
-	}
-}
-?>

+ 0 - 42
tests/main/gradebook/lib/be/forumthreadlink.class.test.php

@@ -1,42 +0,0 @@
-<?php
-class TestForumThreadLink extends UnitTestCase {
-
-	public function TestForumThreadLink() {
-		$this->UnitTestCase('Test Forum Thread Link');
-	}
-
-	public function __construct() {
-        $this->UnitTestCase('Gradebook forum library - main/gradebook/lib/be/forumthreadlink.class.test.php');
-	    // The constructor acts like a global setUp for the class
-		TestManager::create_test_course('COURSEFORUMTHREAD');
-		$this->forumthreadlink = new ForumThreadLink();
-		$this->forumthreadlink->set_id(1);
-		$this->forumthreadlink->set_type(5);
-		$this->forumthreadlink->set_ref_id(1);
-		$this->forumthreadlink->set_user_id(1);
-		$this->forumthreadlink->set_course_code('COURSEFORUMTHREAD');
-		$this->forumthreadlink->set_category_id(1);
-		$this->forumthreadlink->set_date(date);
-		$this->forumthreadlink->set_weight(1);
-		$this->forumthreadlink->set_visible('visible');
-
-	}
-
-	public function testcalc_score() {
-		$res = $this->forumthreadlink->calc_score(null);
-		$this->assertNull($res);
-		//var_dump($res);
-		$res2 = $this->forumthreadlink->calc_score(1);
-		$this->assertTrue(is_array($res2));
-		//var_dump($res2);
-	}
-
-
-
-	public function __destruct() {
-		// The destructor acts like a global tearDown for the class
-		TestManager::delete_test_course('COURSEFORUMTHREAD');
-	}
-
-}
-?>

+ 0 - 20
tests/main/inc/banner.inc.test.php

@@ -1,20 +0,0 @@
-<?php
-
-class TestBanner extends UnitTestCase{
-
-	public function TestBanner(){
-		$this->UnitTestCase('Banners library - main/inc/banner.inc.test.php');
-	}
-	public function testGetTabs(){
-		global $_course, $rootAdminWeb, $_user;
-		ob_start();
-    	require_once(api_get_path(SYS_CODE_PATH).'inc/banner.inc.php');
-    	ob_end_clean();
-        $res = get_tabs();
-		$this->assertTrue(is_array($res));
-		$this->assertTrue($res);
-		//var_dump($res);
-	}
-
-}
-?>

+ 0 - 17
tests/main/inc/banner.lib.test.php

@@ -1,17 +0,0 @@
-<?php
-
-class TestBanner extends UnitTestCase{
-
-	public function TestBanner(){
-		$this->UnitTestCase('Tabs library - main/inc/banner.lib.test.php');
-    }
-
-	public function testGetTabs(){
-		global $_course, $rootAdminWeb, $_user;
-    	$res = get_tabs();
-		$this->assertTrue(is_array($res));
-		$this->assertTrue($res);
-	}
-
-}
-?>

+ 0 - 40
tests/main/inc/course_document.lib.test.php

@@ -1,40 +0,0 @@
-<?php
-
-class Testcdocu extends UnitTestCase{
-
-    public function __construct(){
-        $this->UnitTestCase('Course documents display library - main/inc/course_document.inc.test.php');
-    }
-
-	public function testGetlist(){
-		global $is_allowed_in_course;
-		$is_allowed_in_course = true;
-		$directory = api_get_path(SYS_COURSE_PATH).'/document/audio/';
-		$res = getlist($directory);
-		if (is_bool($res)){
-			$this->assertTrue(is_bool($res));
-			$this->assertTrue($res ===false);
-		} else{
-			$this->assertTrue(is_null($res));
-		}
-
-
-	}
-
-	public function testCheckAndCreateResourceDirectory(){
-		global $_course, $_user;
-		global $group_properties, $to_group_id;
-		global $permissions_for_new_directories;
-		$repository_path='';
-		$resource_directory='';
-		$resource_directory_name='';
-		$res = check_and_create_resource_directory($repository_path, $resource_directory, $resource_directory_name);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === true || $res === false);
-	}
-
-}
-
-
-
-?>

+ 0 - 35
tests/main/inc/lib/access_url_edit_courses_to_url_functions.lib.test.php

@@ -1,35 +0,0 @@
-<?php
-//require_once(api_get_path(INCLUDE_PATH).'global.inc.php');
-//require_once(api_get_path(SYS_CODE_PATH).'admin/access_url_edit_courses_to_url.php');
-require_once(api_get_path(LIBRARY_PATH).'access_url_edit_courses_to_url_functions.lib.php');
-
-class TestAccessUrlEditCoursesToUrlFunctions extends UnitTestCase{
-
-    public function __construct(){
-        $this->UnitTestCase('Access URL courses library - main/inc/lib/access_url_edit_courses_to_url_functions.lib.test.php');
-    }
-
-	public function setUp(){
-		$this->AccessUrlEditCoursesToUrl = new Accessurleditcoursestourl();
-	}
-
-	public function tearDown(){
-		$this->AccessUrlEditCoursesToUrl = null;
-	}
-
-	public function TestSearchCourses(){
-		global $_course, $user_id;
-		$needle = '';
-		$id = $_course['id'];
-		$res = Accessurleditcoursestourl::search_courses($needle, $id);
-		$this->assertTrue($res);
-		$this->assertTrue(is_object($res));
-		$this->assertFalse(is_null($res));
-		//var_dump($res);
-	}
-
-
-
-}
-
-?>

+ 0 - 32
tests/main/inc/lib/access_url_edit_sessions_to_url_functions.lib.test.php

@@ -1,32 +0,0 @@
-<?php
-
-require_once(api_get_path(LIBRARY_PATH).'access_url_edit_sessions_to_url_functions.lib.php');
-
-class TestAccessUrlEditSessionsToUrlFunctions extends UnitTestCase{
-
-    public function __construct(){
-        $this->UnitTestCase('Access URL sessions library - main/inc/lib/access_url_edit_sessions_to_url_functions.lib.test.php');
-    }
-
-	public function setUp(){
-		$this->AccessUrlEditSessionsToUrl = new Accessurleditsessionstourl();
-	}
-
-	public function tearDown(){
-		$this->AccessUrlEditSessionsToUrl = null;
-	}
-
-	public function TestSearchSessions(){
-		global $_courses;
-		$needle = '';
-		$id = $_courses['id'];
-		$res = Accessurleditsessionstourl::search_sessions($needle, $id);
-		$this->assertTrue($res);
-		$this->assertTrue(is_object($res));
-		$this->assertFalse(is_null($res));
-		//var_dump($res);
-
-	}
-
-}
-?>

+ 0 - 33
tests/main/inc/lib/access_url_edit_users_to_url_functions.lib.test.php

@@ -1,33 +0,0 @@
-<?php
-
-require_once(api_get_path(LIBRARY_PATH).'access_url_edit_users_to_url_functions.lib.php');
-
-class TestAccessUrlEditUsersToUrlFunctions extends UnitTestCase{
-
-    public function __construct(){
-        $this->UnitTestCase('Access URL users library - main/inc/lib/access_url_edit_users_to_url_functions.lib.test.php');
-    }
-
-	public function setUp(){
-		$this->AccessUrlEditUsersToUrl = new AccessurleditUserstourl();
-	}
-
-	public function tearDown(){
-		$this->AccessUrlEditUsersToUrl = null;
-	}
-
-	public function TestSearchUsers(){
-		global $_courses;
-		$needle = '';
-		$id = $_courses['id'];
-		$res = AccessurleditUserstourl::search_users($needle, $id);
-		$this->assertTrue($res);
-		$this->assertTrue(is_object($res));
-		$this->assertFalse(is_null($res));
-		//var_dump($res);
-
-	}
-
-}
-
-?>

+ 0 - 170
tests/main/inc/lib/add_course.lib.inc.test.php

@@ -1,170 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
-require_once api_get_path(LIBRARY_PATH).'course.lib.php';
-
-class TestAddCourse extends UnitTestCase {
-
-    function TestAddCourse() {
-        $this->UnitTestCase('Courses creation - main/inc/lib/add_course.lib.inc.test.php');
-    }
-
-
-    function TestCreateCourse(){
-        global $_configuration;
-        $course_datos = array(
-                'wanted_code'=> 'testcourse',
-                'title'=>'prueba01',
-                'tutor_name'=>'John Doe',
-                'category_code'=>'Lang',
-                'course_language'=>'english',
-                'course_admin_id'=>'1',
-                'db_prefix'=> $_configuration['db_prefix'],
-                'firstExpirationDelay'=>'120'
-                );
-        $res = create_course($course_datos['wanted_code'], $course_datos['title'],
-                             $course_datos['tutor_name'], $course_datos['category_code'],
-                             $course_datos['course_language'],$course_datos['course_admin_id'],
-                             $course_datos['db_prefix'], $course_datos['firstExpirationDelay']);
-        //should be code string if succeeded (false if failed)
-        $this->assertTrue(is_string($res));
-    }
-
-    function testRegisterCourse() {
-        global $_configuration;
-         $course = array(
-            'courseSysCode'=> 'testcourse',
-            'courseScreenCode' =>'testcourse',
-            'courseRepository' =>'testcourse',
-            'courseDbName' => $_configuration['db_prefix'].'testcourse',
-            'titular' =>'John Doe',
-            'category' =>'Lang',
-            'title' =>'test course',
-            'course_language' =>'english',
-            'uidCreator'=> '1',
-            );
-        $res = register_course($course['courseSysCode'],$course['courseScreenCode'],
-                            $course['courseRepository'],$course['courseDbName'],
-                            $course['titular'],$course['category'],$course['title'],
-                            $course['course_language'],$course['uidCreator'],
-                            null,null
-                            );
-
-        $this->assertTrue($res === 0);
-        $res = CourseManager::delete_course($course['courseSysCode']);
-
-    }
-
-    function TestGenerateCourseCode(){
-        global $charset;
-        $course_title = 'testcourse';
-        $res = generate_course_code($course_title);
-        $this->assertTrue($res);
-    }
-
-
-    function TestDefineCourseKeys(){
-        global $prefixAntiNumber, $_configuration;
-        $wantedCode = generate_course_code($wantedCode);
-        $res = define_course_keys(generate_course_code($wantedCode), null, null, null,null, null);
-        $this->assertTrue($res);
-    }
-
-/*  // 26 excepciones
-    function TestPrepareCourseRepository(){
-        //umask(0); // This function is not thread-safe.
-        $perm = '0777';
-        $courseRepository = 'C16';
-        $courseId = 'COD16';
-        $res = prepare_course_repository($courseRepository, $courseId);
-        $res1 = CourseManager::delete_course('C16');
-
-
-
-
-        $this->assertTrue($res===0);
-    }
-    // Problemas con este archivo - falta analizar esta función
-    function TestUpdateDbCourse(){
-        global $_configuration;
-        $dbcourse = array('courseDbName'=> 'COD16');
-        $res = update_Db_course($dbcourse['courseDbName']);
-        $this->assertTrue($res===0);
-        //var_dump($res);
-    }
-*/
-
-    function TestBrowseFolders(){
-        $browse = array('path'=>'','file'=>'','media'=>'');
-        $res = browse_folders($browse['path'], $browse['files'],$browse['media']);
-        $this->assertFalse($res);
-    }
-    /*
-    // 1 excepcion
-    function TestSortPictures(){
-        $picture = array('files'=>'science.jpg', 'type'=>'jpg');
-        $res = sort_pictures($picture['file'],$picture['type']);
-        $this->assertTrue(is_array($res));
-        //var_dump($res);
-    }
-    */
-    /*
-    function TestFillCourseRepository(){
-        $courseRepository = 'testcourse';
-        $res = fill_course_repository($courseRepository);
-        $this->assertTrue($res);
-    }
-*/
-    function TestLang2db(){
-        $string = 'test';
-        $res = lang2db($string);
-        $this->assertTrue($res);
-    }
-
-    function TestFillDbCourse(){
-        global $_configuration, $clarolineRepositoryWeb, $_user;
-        $courseDbName = $_configuration['table_prefix'].$courseDbName.$_configuration['db_glue'];
-        $courseRepository = (api_get_path(SYS_COURSE_PATH).$courseRepository . "/dropbox/.htaccess");
-        $language = 'english';
-        $language_interface = $language;
-        $default_document_array = array();
-        $sys_course_path = api_get_path(SYS_COURSE_PATH);
-        $courseDbName = $_configuration['db_prefix'].$courseDbName.$_configuration['db_glue'];
-        $courseRepository = 'testcourse';
-        $language = 'english';
-        $default_document_array ='testdocument';
-        $res = fill_Db_course($courseDbName, $courseRepository, $language,array());
-        $this->assertTrue($res === 0);
-    }
-
-    function TestString2Binary(){
-        $variable = true;
-        $res = string2binary($variable);
-        $this->assertTrue($res);
-    }
-
-    function TestCheckArchive(){
-        $dirarchive = api_get_path(SYS_PATH);
-        $pathToArchive = $dirarchive.'archive';
-        $res = checkArchive($pathToArchive);
-        $this->assertTrue($res === TRUE);
-    }
-
-    public function TestDeleteCourse(){
-        $code = 'testcourse';
-        $res = CourseManager::delete_course($code);
-        $path = api_get_path(SYS_PATH).'archive';
-        if ($handle = opendir($path)) {
-            while (false !== ($file = readdir($handle))) {
-                if (strpos($file,$code)!==false) {
-                    if (is_dir($path.'/'.$file)) {
-                        rmdirr($path.'/'.$file);
-                    }
-                }
-            }
-            closedir($handle);
-        }
-    }
-
-}

+ 0 - 34
tests/main/inc/lib/add_courses_to_sessions_functions.lib.test.php

@@ -1,34 +0,0 @@
-<?php
-
-require_once(api_get_path(LIBRARY_PATH).'add_courses_to_session_functions.lib.php');
-
-class TestAddCoursesToSessionFunctions extends UnitTestCase{
-
-    public function __construct(){
-        $this->UnitTestCase('Courses-sessions library - main/inc/lib/add_courses_to_sessions_functions.lib.test.php');
-    }
-
-	public function setUp(){
-		$this->TestAddCoursesToSessionFunctions = new AddCourseToSession();
-	}
-
-	public function tearDown(){
-		$this->TestAddCoursesToSessionFunctions = null;
-	}
-
-	public function TestSearchCourses(){
-		global $_courses;
-		global $tbl_course, $tbl_session_rel_course, $id_session;
-		$needle = '';
-		$type = '';
-		$res = AddCourseToSession::search_courses($needle, $type);
-		$this->assertTrue($res);
-		$this->assertTrue(is_object($res));
-		$this->assertFalse(is_null($res));
-		//var_dump($res);
-
-	}
-
-}
-
-?>

+ 0 - 29
tests/main/inc/lib/add_many_session_to_category_functions.lib.test.php

@@ -1,29 +0,0 @@
-<?php
-
-require_once (api_get_path(LIBRARY_PATH).'add_many_session_to_category_functions.lib.php');
-
-class TestAddManySessionToCategoryFunctions extends UnitTestCase {
-
-    public function __construct(){
-        $this->UnitTestCase('Sessions to category library - main/inc/lib/add_many_session_to_category_functions.lib.test.php');
-    }
-
-	public function setUp(){
-		$this-> AddManySessionToCategory = new AddManySessionToCategoryFunctions();
-	}
-
-	public function tearDown(){
-		$this-> AddManySessionToCategory = null;
-
-	}
-	public function Testsearchcourses(){
-		global $_courses, $tbl_course, $tbl_session, $id_session;
-		$needle ='';
-		$type ='';
-		$res = AddManySessionToCategoryFunctions::search_courses($needle,$type);
-		$this->assertTrue($res);
-		$this->assertTrue(is_object($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 600
tests/main/inc/lib/blog.lib.test.php

@@ -1,600 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'blog.lib.php');
-ob_start();
-require_once (api_get_path(INCLUDE_PATH).'lib/fckeditor/fckeditor.php');
-require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
-
-//require_once(api_get_path(SYS_CODE_PATH).'permissions/blog_permissions.inc.php');
-ob_end_clean();
-class TestBlog extends UnitTestCase
-
-{
-	 public $oblog;
-	 public function TestBlog()
-
-	 {
-
-	 	$this->UnitTestCase('Blog Manipulation tests');
-
-	 }
-
-	 public function setUp()
-	 {
- 	 	$this-> oblog = new Blog();
-	 }
-
-	 public function tearDown()
-	 {
-	 	$this->oblog = null;
-	 }
-
-	 /*
-	 * todo public function testGetBlobTitle()
-	 * todo public function testGetBlogSubtitle()
-	 * todo public function testGetBlogUsers()
-	 * todo public function testCreateBlog()
-	 * todo public function testEditBlog()
-	 * todo public function testDeleteBlog()
-	 * todo public function testCreatePost()
-	 * todo public function testEditPost()
-	 * todo public function testDeletePost()
-	 * todo public function testCreateComment()
-	 * todo public function testDeleteComment()
-	 * todo public function testCreateTask()
-	 * todo public function testEditTask()
-	 * todo public function testDeleteTask()
-	 * todo public function testDeleteAssignedTask()
-	 * todo public function testGetPersonalTaskList()
-	 * todo public function testChangeBlogVisibility()
-	 * todo public function testDisplayBlogPosts()
-	 * todo public function testDisplaySearchResults()
-	 * todo public function testDisplayDayResults()
-	 * todo public function testDisplayPost()
-	 * todo public function testAddRating()
-	 * todo public function testDisplayRating()
-	 * todo public function testDisplayRatingForm()
-	 * todo public function testGetThreadedComments()
-	 * todo public function testDisplayformNewPost()
-	 * todo public function testDisplayFormEditPost()
-	 * todo public function testDisplayTaskList()
-	 * todo public function testDisplayAssignedTaskList()
-	 * todo public function testDisplayNewTaskForm()
-	 * todo public function testDisplayEditTaskForm()
-	 * todo public function testDisplayAssignTaskForm()
-	 * todo public function testDisplayEditAssignedTaskForm()
-	 * todo public function testAssignTask()
-	 * todo public function testEditAssignedTask()
-	 * todo public function testDisplaySelectTaskPost()
-	 * todo public function testSetUserSubscribed()
-	 * todo public function testSetUserUnsubscribed()
-	 * todo public function testDisplayFormUserSubscribe()
-	 * todo public function testDisplayFormUserUnsubscribe()
-	 * todo public function testDisplayNewCommentForm()
-	 * todo public function testDisplayMinimonthcalendar()
-	 * todo public function testDisplayNewBlogForm()
-	 * todo public function testDisplayEditBlogForm()
-	 * todo public function testDisplayBlogList()
-	 * todo public function testDisplayBlogList()
-	 */
-
-	 /**
-	  * Test about get Title to a Blog
-	 */
-	 
-	 public function testGetBlogTitle(){
-	 	
-	 	global $_course;
-	 	$res = $this->oblog->get_Blog_title(11);
-	 	$this->assertFalse($this->oblog->get_Blog_title(11)===String);
-	 	$this->assertTrue(is_String($res));
-	 }
-
-	 public function testGetBlogSubtitle(){
-	  	$res = $this->oblog->get_Blog_subtitle(0);
-	 	$this->assertFalse($this->oblog->get_Blog_subtitle(0)=== null);
-	 	$this->assertTrue(is_String($res));
-	 	$this->assertNotNull($res);
-	 }
-
-	 public function testGetBlogUsers(){
-	 	$res = $this->oblog->get_Blog_users(11);
-	 	$this->assertTrue($this->oblog->get_Blog_users(1110)===array());
-	 	$this->assertTrue(is_array($res));
-	 }
-
-	 public function testCreateBlog(){
-	 	global $_user;
-	 	$res = $this->oblog->create_Blog('testingBlog','pass');
-	 	$this->assertTrue(is_null($res));
-	 	$this->assertNull($res);
-		$this->assertFalse($res);
-	 }
-
-	 public function testEditBlog(){
-	 	global $_user;
-	 	$blog_id = 1;
-	 	$title = 'titulo1';
-	 	$subtitle = 'subtitulo1';
-	 	$res = $this->oblog->edit_Blog($blog_id, $title, $subtitle);
-	 	$this->assertNull($res);
-	 	$this->assertTrue($this->oblog->edit_Blog($blog_id, $title, $subtitle)=== $res);
-		$this->assertFalse($res);
-	 }
-
-	 public function testDeleteBlog(){
-	 	$blog_id = 1;
-	 	$res = $this->oblog->delete_Blog($blog_id);
-	 	$this->assertTrue(is_null($res));
-	 	$this->assertFalse(is_array($res));
-	 }
-
-	 public function testCreatePost(){
-	 	global $_user, $_course;
-	 	$title = 'xxxxtestxxxx';
-	 	$full_text = 'xxxxx';
-	 	$file_comment = 'xxxxx';
-	 	$blog_id = 1;
-	 	$res = $this->oblog->create_post($title, $full_text, $file_comment, $blog_id);
-	 	$this->assertTrue($this->oblog->create_post($title, $full_text, $file_comment, $blog_id)=== null);
-	 	$this->assertNotNull(is_null,$res);
-	 	$this->assertFalse($res);
-
-	 }
-
-	 public function testEditPost(){
-	 	ob_start();
-	 	$post_id =3;
-	 	$title = 'xxTestxx';
-	 	$full_text = 'testing public function';
-	 	$Blog_id = 11;
-		$res = $this->oblog->edit_post(3,'xtestx','test',11);
-		ob_end_clean();
-		$this->assertNotNull($this->oblog->edit_post(3, 'xtestx','test',11)===null);
-		$this->assertFalse($res);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-	 public function testDeletePost(){
-	 	$Blog_id = 11;
-	 	$post_id = 21;
-	 	$res = $this->oblog->delete_post(11,21);
-	 	$this->assertTrue($this->oblog->delete_post(11,21)===null);
-	 	$this->assertNull(null,$res);
-	 	$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-	 public function testCreateComment(){
-	 	global $_user, $_course, $Blog_table_attachment;
-	 	$res = $this->oblog->create_comment('tesingBlog','xxxxxxx','xxx',12,1,null);
-	 	$this->assertNotNull($this->oblog->create_comment('tesingBlog','xxxxxxx','xxx',12,1,null)===null);
-	 	$this->assertTrue(is_null($res));
-	 	$this->assertFalse($res);
-	 }
-
-	 public function testDeleteComment(){
-	 	$res = $this->oblog->delete_comment(11,12,2);
-	 	$this->assertNotNull($this->oblog->delete_comment(11,12,2)===null);
-	 	$this->assertNull(null,$res);
-	 }
-
-	 public function testCreateTask(){
-		$res = $this->oblog->create_task(1,'xxx','xxxxxxx','xxxx','zzzzz','xxzz','blue');
-		$this->assertNotNull($this->oblog->create_task(1,'xxx','xxxxxxx','xxxx','zzzzz','xxzz','blue')=== null);
-		$this->assertTrue(is_null($res));
-		$this->assertFalse($res);
-		$this->assertFalse(null,$res);
-	 }
-
-	 public function testEditTask() {
-	 	$blog_id = 1;
-	 	$task_id = 2;
-	 	$title = 'xxxxxx';
-	 	$description = 'xx';
-	 	$articleDelete = 'aaa';
-	 	$articleEdit = 'axa';
-	 	$commentsDelete  = 'xax';
-	 	$color = 'red';
-	 	$res = $this->oblog->edit_task($blog_id, $task_id, $title, $description, $articleDelete, $articleEdit, $commentsDelete, $color);
-	 	//$res = Blog::edit_task();
-	 	$this->assertTrue($this->oblog->edit_task($blog_id, $task_id, $title, $description, $articleDelete, $articleEdit, $commentsDelete, $color)===null);
-	 	$this->assertTrue(is_null($res));
-	 	$this->assertFalse(is_string($res));
-	 	$this->assertNull($res);
-	 }
-
-	 public function testDeleteTask(){
-	 	$blog_id = 1;
-	 	$task_id = 2;
-	 	$res = $this->oblog->delete_task($blog_id, $task_id);
-	 	$this->assertTrue($this->oblog->delete_task($blog_id, $task_id)===null);
-	 	$this->assertTrue(is_null($res));
-	 }
-
-	 public function testDeleteAssignedTask(){
-	 	$blog_id = 1;
-	 	$task_id = 2;
-	 	$user_id = 1;
-	 	$res = $this->oblog->delete_assigned_task($blog_id, $task_id,$user_id);
-	 	$this->assertTrue($this->oblog->delete_assigned_task($blog_id, $task_id,$user_id)===null);
-	 	$this->assertNotNull(is_null($res));
-	 	$this->assertFalse($res);
-	 }
-
-	 public function testGetPersonalTaskList(){
-	 	global $_user;
-	 	ob_start();
-	 	$res = Blog::get_personal_task_list('a');
-	 	$this->assertFalse($res);
-	 	ob_end_clean();
-	 }
-
-	 public function testChangeBlogVisibility(){
-	 	$blog_id = 1;
-	 	$res = $this->oblog->change_blog_visibility($blog_id);
-	 	$this->assertTrue($this->oblog->change_blog_visibility($blog_id)=== null);
-	 	$this->assertTrue(is_null($res));
-	 }
-
-	 public function testDisplayBlogPosts(){
-	 	ob_start();
-	 	$blog_id = 1;
-	 	$filter = '1=1';
-	 	$max_number_of_posts = 20;
-	 	$res = BLog::display_blog_posts($blog_id, $filter, $max_number_of_posts);
-	 	$this->assertTrue($this->oblog->display_blog_posts($blog_id, $filter, $max_number_of_posts)=== null);
-	 	ob_end_clean();
-	 	$this->assertNull($res);
-	 	$this->assertTrue(is_null($res));
-	 	$this->assertFalse(null, $res);
-	 }
-
-	 public function testDisplaySearchResults(){
-	 	ob_start();
-	 	$blog_id = 1;
-	 	$query_string = '"SELECT post.*, user.lastname, user.firstname FROM $tbl_blogs_posts"';
-	 	$res = $this->oblog->display_search_results($blog_id, $query_string);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		$this->assertNull($res);
-	 }
-
-	 public function testDisplayDayResults(){
-	 	ob_start();
-	 	$blog_id = 1;
-	 	$query_string = '01-01-2010';
-	 	$res = $this->oblog->display_day_results($blog_id, $query_string);
-	 	ob_end_clean();
-	 	$this->assertTrue(is_null($res));
-	 	$this->assertFalse($res);
-	 	$this->assertNull(null,$res);
-	 }
-
-	 public function testDisplayPost(){
-	 	ob_start();
-	 	$blog_id = 1;
-	 	$post_id = 2;
-	 	$res = $this->oblog->display_post($blog_id, $post_id);
-	 	ob_end_clean();
-	 	$this->assertTrue(is_null($res));
-	 	$this->assertFalse($res);
-	 }
-
-	 public function testAddRating(){
-	 	global $_user;
-	 	$res = $this->oblog->add_rating(null,11,2,5);
-	 	$this->assertFalse($this->oblog->add_rating(null,11,2,5)=== bool);
-	 	$this->assertTrue(is_bool($res));
-	 	$this->assertFalse(null,$res);
-	 }
-
-	 public function testDisplayRating(){
-	 	ob_start();
-	 	$res = $this->oblog->display_rating('xxx',11,1);
-	 	$this->assertFalse($this->oblog->display_rating('xxx',11,1)===null);
-	 	$this->assertTrue(is_numeric($res));
-	 	$this->assertFalse($res);
-	 	ob_end_clean();
-	 }
-
-	 public function testDisplayRatingForm(){
-	 	global $_user;
-	 	$res = $this->oblog->display_rating_form('xxx',11,1,null);
-	 	$this->assertFalse($this->oblog->display_rating_form('xxx',11,1,null)===null);
-	 	$this->assertTrue(is_string($res));
-	 	$this->assertNotNull($res,null);
-	 }
-
-	 public function testGetThreadedComments(){
-	 	ob_start();
-	 	$current = 0;
-	 	$current_level = 0;
-	 	$blog_id = 1;
-	 	$post_id = 2;
-	 	$task_id = 0;
-	 	global $charset, $dataFormatLong;
-	 	$res = $this->oblog->get_threaded_comments($current, $current_level, $blog_id, $post_id, $task_id);
-	 	ob_end_clean();
-	 	$this->assertFalse($res);
-	 	$this->assertTrue(is_null($res));
-	 }
-
-	 public function testDisplayFormNewPost(){
-	 	ob_start();
-	 	$blog_id = 1;
-	 	$res = Blog::display_form_new_post($blog_id);
-	 	$this->assertTrue(is_null($res));
-	 	$this->assertNull($res);
-	 	ob_end_clean();	 	
-	 } 
-	
-	 public function testDisplayFormEditPost(){
-	 	ob_start();
-	 	$blog_id = 1;
-	 	$post_id = 2;
-	 	$res = $this->oblog->display_form_edit_post($blog_id, $post_id);
-	 	$this->assertNotNull(is_null($res));
-	 	$this->assertFalse($res);
-	 	ob_end_clean();
-	 	//var_dump($res);
-	 }	
-
-	 public function testDisplayTaskList(){
-	 	ob_start();
-	 	$res = $this->oblog->display_task_list(11);
-	 	$this->assertTrue($this->oblog->display_task_list(11)===null);
-	 	ob_end_clean();
-	 }
-
-	 public function testDisplayAssignedTaskList(){
-	 	ob_start();
-	 	global $charset, $color2;
-	 	$res = $this->oblog->display_assigned_task_list(11);
-	 	$this->assertTrue($this->oblog->display_assigned_task_list(11)===null);
-	 	ob_end_clean();
-	 	$this->assertFalse($res);
-	 	
-	 }
-
-	 public function testDisplayNewTaskForm(){
-	 	ob_start();
-	 	$res = $this->oblog->display_new_task_form(11);
-	 	$this->assertTrue($this->oblog->display_new_task_form(11)===null);
-	 	ob_end_clean();
-	 	$this->assertFalse($res);
-	 	
-
-	 }
-
-	 public function testDisplayEditTaskForm(){
-	 	ob_start();
-	 	$res = $this->oblog->display_edit_task_form(11,12);
-	 	$this->assertTrue($this->oblog->display_edit_task_form(11,12)===null);
-	 	ob_end_clean();
-	 	$this->assertTrue(is_null($res));
-	 	$this->assertFalse($res);
-
-	 }
-
-	 public function testDisplayAssignTaskForm(){
-	 	ob_start();
-	 	$res = $this->oblog->display_assign_task_form(11);
-	 	$this->assertTrue($this->oblog->display_assign_task_form(11)===null);
-	 	ob_end_clean();
-	 	$this->assertFalse($res);
-	 	$this->assertTrue(is_null($res));
-	 	
-	 }
-
-	 public function testDisplayEditAssignedTaskForm(){
-	 	global $MonthsLong;
-	 	ob_start();
-	 	$res = $this-> oblog->display_edit_assigned_task_form(11,12,1);
-	 	$this->assertTrue($this->oblog->display_edit_assigned_task_form(11,12,1)===null);
-	 	ob_end_clean();
-	 	$this->assertFalse($res);
-
-	 }
-
-	 public function testAssignTask(){
-	 	ob_start();
-	 	$res = $this->oblog->assign_task(11,1,12,null);
-	 	$this->assertTrue($this->oblog->assign_task(11,1,12,null)===null);
-	 	ob_end_clean();
-	 	$this->assertFalse(is_numeric($res));
-	 	$this->assertNull(null,$res);
-	 	
-	 }
-
-	 public function testEditAssignedTask(){
-	 	$task = array('blog_id'=>11,
-					  'user_id'=>1,
-                      'task_id'=>12,
-                      'target_date'=>'xxxxxxx',
-                 	  'old_user_id'=>10,
-                 	  'old_task_id'=>11,
-                 	  'old_target_date'=>'xxxzxxx'
-                 	 );
-        $res = $this->oblog->edit_assigned_task($task['blog_id'],$task['user_id'], $task['task_id'], $task['target_date'], $task['old_user_id'], $task['old_task_id'], $task['old_target_date']);
-        $this->assertNull($res);
-        $this->assertTrue(is_null($res));
-	 }
-
-	 public function testDisplaySelectTaskPost(){
-	 	ob_start();
-	 	$res = $this->oblog->display_select_task_post(11,12);
-	 	$this->assertTrue($this->oblog->display_select_task_post(11,12)===null);
-	 	ob_end_clean();
-	 	$this->assertTrue(is_null($res));
-	 	$this->assertFalse($res);
-	 	
-     }
-
-	 public function testSetUserSubscribed(){
-	 	$res = $this->oblog->set_user_subscribed(11,12);
-	 	$this->assertTrue($this->oblog->set_user_subscribed(11,12)===null);
-	 	$this->assertFalse($res);
-	 	$this->assertTrue(is_null($res));
-     }
-
-	 public function testUserUnsubscribed(){
-	 	$res = $this->oblog->set_user_unsubscribed(11,12);
-	 	$this->assertTrue($this->oblog->set_user_unsubscribed(11,12)===null);
-	 	$this->assertFalse($res);
-	 	$this->assertTrue(is_null($res));
-	 }
-	
-	 public function testDisplayFormUserSubscribe(){
-	 	ob_start();
-	 	$res = $this->oblog->display_form_user_subscribe(12);
-	 	$this->assertTrue($this->oblog->display_form_user_subscribe(12)===null);
-	 	ob_end_clean();
-	 	$this->assertNotNull(is_null($res));
-	 	$this->assertFalse($res);
-	 	
-	}
-
-	/**
-	 * this function have been tested modified the function
-	 * display_form_user_unsubscribe in the blog.lib.php
-	 * main_table and course_table.
-	 *
-	 */
-	 
-    public function testDisplayFormUserUnsubscribe(){
-		
-		global $_user;
-		ob_start();
-		$blog_id = '1';
-		$res = Blog::display_form_user_unsubscribe($blog_id);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));		
-		$this->assertNull($res);
-		
-	}
-
-	public function testDisplayFormUserRights(){
-		ob_start();
-		$res = $this->oblog->display_form_user_rights(12);
-		$this->assertTrue($this->oblog->display_form_user_rights(12)===null);
-		ob_end_clean();
-		$this->assertFalse($res);
-		
-	} 
-	
-	public function testDisplayNewCommentForm(){
-		$blog_id = '12';
-		$post_id='1';
-		$title='test';
-		ob_start();
-		$res =$this->oblog->display_new_comment_form($blog_id,$post_id,$title);
-		ob_end_clean();
-		$this->assertFalse($res);
-		$this->assertNotNull(is_null($res));
-		
-	}
-    
-	public function testDisplayMinimonthcalendar(){
-		global $_user,$DaysShort, $MonthsLong;
-		ob_start();
-		$month = 12;
-		$year = 2010;
-		$blog_id = 1;
-		$res = $this->oblog->display_minimonthcalendar($month, $year, $blog_id);
-		$this->assertTrue($this->oblog->display_minimonthcalendar($month, $year, $blog_id)=== null);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		
-	}
-     
-	public function testDisplayNewBlogForm(){
-		ob_start();
-		$res = $this->oblog->display_new_blog_form();
-		$this->assertFalse($res);
-		$this->assertTrue(is_null($res));
-		$this->assertTrue($this->oblog->display_new_blog_form()===null);
-		ob_end_clean();
-	}
-    
-	public function testDisplayEditBlogForm(){
-		ob_start();
-		$res = $this->oblog->display_edit_blog_form(12);
-		$this->assertTrue($this->oblog->display_edit_blog_form(12)===null);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		
-	}
-
-	public function testDisplayBlogList(){
-		ob_start();
-		$res = $this->oblog->display_blog_list();
-		$this->assertTrue($this->oblog->display_blog_list()===null);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		
-	}
-	
-	public function testGetBlogAttachment(){
-		ob_start();
-		ob_end_clean();
-		global $_configuration;
-		$blog_id = '0';
-		$post_id = null; 
-		$comment_id = null;
-		$res = get_blog_attachment($blog_id, $post_id,$comment_id);
-		$this->assertFalse($res);
-		$this->assertTrue(is_array($res));
-	}
-    
-	public function testDeleteAllBlogAttachment(){
-		global $_course,$_configuration;		
-		$blog_id = 1;
-		$post_id=null;
-		$comment_id=null;
-		$res = delete_all_blog_attachment($blog_id,$post_id,$comment_id);
-		$this->assertFalse($res);
-		$this->assertNull($res);
-	} 
- 	
-	public function testGetBlogPostFromUser(){
-		global $_configuration;
-		$res = get_blog_post_from_user('chamilo_COURSETEST',1);
-		$this->assertFalse($res);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-    
-	public function testGetBlogCommentFromUser(){
-		global $_configuration;
-		$course_datos['wanted_code'] = 'chamilo_COURSETEST';
-		$user_id = 1;
-		$res = get_blog_comment_from_user($course_datos['wanted_code'],1);
-		$this->assertFalse($res);
-		$this->assertTrue(is_string($res));
-		$path = api_get_path(SYS_PATH).'archive';		
-		if ($handle = opendir($path)) {
-			while (false !== ($file = readdir($handle))) {				
-				if (strpos($file,'COURSETEST')!==false) {										
-					if (is_dir($path.'/'.$file)) {						
-						rmdirr($path.'/'.$file);						
-					}				
-				}				
-			}
-		closedir($handle);
-		}
-	} 
-/*	
-	public function testDeleteCourse() {
-		global $cidReq;			
-		$resu = CourseManager::delete_course($cidReq);				
-	}
-	
-	*/
-	
-	
-	
-	
-	
-}   
-?>

+ 0 - 94
tests/main/inc/lib/classmanager.lib.test.php

@@ -1,94 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'classmanager.lib.php');
-
-class TestClassManager extends UnitTestCase {
-
-	public function __construct(){
-		$this->UnitTestCase('Class (students) manager library - main/inc/lib/classmanager.lib.test.php');
-	}
-	function testAddUser() {
-		$user_id='1';
-		$class_id='1';
-		$res=ClassManager::add_user($user_id, $class_id);
-		$this->assertNull($res);
-		$this->assertTrue(is_null($res));
-	}
-
-	function testclass_name_exists() {
-		$name='arthur';
-		$res=ClassManager::class_name_exists($name);
-		$this->assertTrue(is_bool($res));
-	}
-
-	function testCreateClass() {
-		$name='new class';
-		$res=ClassManager::create_class($name);
-		$this->assertTrue(is_bool($res));
-	}
-
-	function testDeleteClass() {
-		$class_id='new class';
-		$res=ClassManager::delete_class($class_id);
-		$this->assertTrue(is_null($res));
-	}
-
-	function testGetClassId() {
-		$name='new class';
-		$res=ClassManager::get_class_id($name);
-		$this->assertTrue(is_numeric($res));
-	}
-
-	function testGetClassInfo() {
-		$class_id='1';
-		$res=ClassManager::get_class_info($class_id);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testGetClassesInCourse() {
-		$course_code='FDI';
-		$res=ClassManager::get_classes_in_course($course_code);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testGetCourses() {
-		$class_id='1';
-		$res=ClassManager::get_courses($class_id);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testGetUsers() {
-		$class_id='1';
-		$res=ClassManager::get_users($class_id);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testSetName() {
-		$name='new class';
-		$class_id='1';
-		$res=ClassManager::set_name($name, $class_id);
-		$this->assertTrue(is_null($res));
-	}
-
-	function testSubscribeToCourse() {
-		$class_id='1';
-		$course_code='FDI';
-		$res=ClassManager::subscribe_to_course($class_id,$course_code);
-		$this->assertTrue(is_null($res));
-	}
-
-	function testUnsubscribeFromCourse() {
-		$class_id='1';
-		$course_code='FDI';
-		$res=ClassManager::unsubscribe_from_course($class_id, $course_code);
-		$this->assertTrue(is_null($res));
-	}
-
-	function testUnsubscribeUser() {
-		$user_id='1';
-		$class_id='1';
-		$res=ClassManager::unsubscribe_user($user_id, $class_id);
-		$this->assertTrue(is_null($res));
-	}
-
-}
-?>

+ 0 - 557
tests/main/inc/lib/course.lib.test.php

@@ -1,557 +0,0 @@
-<?php
-/*
- * To can run this test you need comment this line or "die(mysql_error())" in 1345 course.lib.php
- *
- */
-require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'mail.lib.inc.php');
-require_once(api_get_path(LIBRARY_PATH).'database.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
-
-Mock::generate('Database');
-Mock::generate('CourseManager');
-Mock::generate('Display');
-
-class TestCourse extends UnitTestCase{
-
-    public $tcourse;
-    public function TestCourse(){
-
-        $this->UnitTestCase('Courses library - main/inc/lib/course.lib.test.php');
-    }
-
-    public function setUp(){
-        global $_configuration;
-        $this->tcourse = new CourseManager();
-
-        $course_datos = array(
-                'wanted_code'=> 'COURSE1',
-                'title'=>'COURSE1',
-                'tutor_name'=>'R. J. Wolfagan',
-                'category_code'=>'2121',
-                'course_language'=>'english',
-                'course_admin_id'=>'1211',
-                'db_prefix'=> $_configuration['db_prefix'],
-                'firstExpirationDelay'=>'112'
-                );
-        $res = create_course($course_datos['wanted_code'], $course_datos['title'],
-                             $course_datos['tutor_name'], $course_datos['category_code'],
-                             $course_datos['course_language'],$course_datos['course_admin_id'],
-                             $course_datos['db_prefix'], $course_datos['firstExpirationDelay']);
-    }
-
-    public function tearDown(){
-        $this->tcourse = null;
-        $this->dbase = null;
-         $code = 'COURSE1';
-
-        $res = CourseManager::delete_course($code);
-        $path = api_get_path(SYS_PATH).'archive';
-        if ($handle = opendir($path)) {
-            while (false !== ($file = readdir($handle))) {
-                if (strpos($file,$code)!==false) {
-                    if (is_dir($path.'/'.$file)) {
-                        rmdirr($path.'/'.$file);
-                    }
-                }
-            }
-            closedir($handle);
-        }
-
-    }
-
-    /*
-     *todo public function testGetCourseInformation()
-     *todo public function testGetCoursesList()
-     *todo public function testGetAccessSettings()
-     *todo public function testGetUserInCourseStatus()
-     *todo public function testUnsubcribeUser()
-     *todo public function testSubscribeUser()
-     *todo public function testAddUserToCourse()
-     *todo public function testGetRealCourseCodeSelectHtml()
-     *todo public function testCheckParameter()
-     *todo public function testCheckParameterOrFail()
-     *todo public function testIsExistingCourseCode()
-     *todo public function testGetRealCourseList()
-     *todo public function testGetVirtualCourseList()
-     *todo public function testGetRealCourseListOfUserAsCourseAdmin()
-     *todo public function testGetCourseListOfUserAsCourseAdmin()
-     *todo public function testDetermineCourseTitleFromCourseInfo()
-     *todo public function testCreateCombinedName()
-     *todo public function testCreateCombinedCode()
-     *todo public function testGetVirtualCourseInfo()
-     *todo public function testIsVirtualCourseFromSystemCode()
-     *todo public function testIsVirtualCourseFromVisualCode()
-     *todo public function testHasVirtualCoursesFromCode()
-     *todo public function testGetVirtualCoursesLinkedToRealCourse()
-     *todo public function testGetTargetOfLinkedCourse()
-     *todo public function testIsCourseTeacher()
-     *todo public function testIsUserSubscribedInRealOrLinkedCourse()
-     *todo public function testGetUserListFromCourseCode()
-     *todo public function testGetCoachListFromCourseCode()
-     *todo public function testGetStudentListFromCourseCode()
-     *todo public function testGetTeacherListFromCourseCode()
-     *todo public function testGetRealAndLinkedUserList()
-     *todo public function testGetListOfVirtualCoursesForSpecificUserAndRealCourse()
-     *todo public function testGetGroupListOfCourse()
-     *todo public function testAttemptCreateVirtualCourse()
-     *todo public function testCreateVirtualCourse()
-     *todo public function testDeleteCourse()
-     *todo public function testCreateDatabaseDump()
-     *todo public function testUserCourseSort()
-     *todo public function testSelectAndSortCategories()
-     *todo public function testCourseExists()
-     *todo public function testEmailToTutor()
-     *todo public function testGetCourseListByUserId()
-     *todo public function testGetCourseIdFromPath()
-     *todo public function testGetCourseInfoVisualCode()
-     *todo public function testGetEmailOfTutorsToCourse()
-     *todo public function testGetEmailOfTutorToSession()
-     *todo public function testCreateCourseExtrField()
-     *todo public function testUpdateCourseExtraFieldValue()
-     */
-
-     public function testGetCourseInformation(){
-          $res = $this->tcourse->get_course_information(1211);
-         $this->assertFalse($res);
-        $this->assertTrue(is_bool($res));
-         $this->assertTrue($this->tcourse->get_course_information(1211)=== is_array($res));
-     }
-
-     public function testGetCoursesList(){
-         $res = $this->tcourse->get_courses_list();
-         $this->assertTrue(is_array($res));
-         //var_dump($res);
-     }
-
-     public function testGetAccessSettings(){
-         $res = $this->tcourse->get_access_settings(0001);
-         $this->assertFalse($res);
-         $this->assertTrue($this->tcourse->get_access_settings(0001)===is_array($res));
-         $this->assertFalse(is_null($res));
-     }
-
-     public function testGetUserInCourseStatus(){
-         $res = $this->tcourse->get_user_in_course_status(01,0001);
-        $this->assertFalse($res);
-        $this->assertTrue($this->tcourse->get_user_in_course_status(01,0001)===null);
-        $this->assertTrue(is_null($res));
-     }
-
-     public function testUnsubscribeUser(){
-         $user_id = 1;
-         $course_code = 'COURSE1';
-         $res = CourseManager::unsubscribe_user($user_id, $course_code);
-         $this->assertNull($res);
-         $this->assertFalse(is_string($res));
-     }
-
-     public function testSubscribeUser(){
-         $user_id = 1;
-         $course_code = 'COURSE1';
-         $status = STUDENT;
-         $res = CourseManager::subscribe_user($user_id, $course_code, $status);
-         $this->assertTrue(is_bool($res));
-     }
-
-    public function testAddUserToCourse(){
-        $user_id = 1;
-        $course_code = 'COURSE1';
-        $status = STUDENT;
-        $res = CourseManager::add_user_to_course($user_id, $course_code, $status);
-        $this->assertTrue($res);
-        $this->assertTrue(is_bool($res));
-        //var_dump($res);
-    }
-    //function deprecated public function testGetRealCourseCodeSelectHtml(){}
-    public function testCheckParameter(){
-        $parameter = '123';
-        $error_message = 'oops!!';
-        $res = $this->tcourse->check_parameter($parameter, $error_message);
-        $this->assertTrue($res);
-        $this->assertTrue(is_bool($res));
-    }
-
-    public function testCheckParameterOrFail(){
-        $parameter = 'course';
-        $error_message = 'upps';
-        $res = $this->tcourse->check_parameter_or_fail($parameter,$error_message); //ob_get_contents();
-        $this->assertTrue(is_null($res));
-        $this->assertFalse($res);
-        $this->assertTrue($res=== null);
-        $this->assertEqual($res,null);
-    }
-
-    public function testCourseCodeExists() {
-        $wanted_course_code = 'COURSE1';
-        $res = $this->tcourse->course_code_exists($wanted_course_code);
-        $this->assertTrue(is_bool($res));
-        $this->assertTrue($res);
-    }
-
-   /** Return a array() but now its empty, with this test is cheking is get the list course
-     * @author Arthur Portugal <arthur.portugal@dokeos.com> -
-     * doesn't work correctly refactoring by Ricardo Rodriguez <ricardo.rodriguez@beeznest.com>
-     **/
-
-    public function testGetRealCourseList(){
-        $res = CourseManager::get_real_course_list();
-        $this->assertTrue(is_array($res));
-        $this->assertTrue($res);
-        //var_dump($res);
-    }
-
-    public function testGetVirtualCourseList(){
-        $course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
-        $sql_query = "SELECT * FROM $course_table WHERE target_course_code IS NOT NULL";
-        $sql_result = Database::query($sql_query);
-        $num = Database::num_rows($sql_result);
-        $res = $this->tcourse->get_virtual_course_list();
-        $this->assertEqual($num,count($res));
-    }
-
-    public function testGetRealCourseListOfUserAsCourseAdmin(){
-        $user_id = 1;
-        $res = $this->tcourse->get_real_course_list_of_user_as_course_admin($user_id);
-            $this->assertTrue(is_array($res));
-    }
-
-    public function testGetCourseListOfUserAsCourseAdmin(){
-        $user_id = 1;
-        $res = $this->tcourse->get_course_list_of_user_as_course_admin($user_id);
-        $this->assertTrue(is_array($res));
-    }
-
-    public function testDetermineCourseTitleFromCourseInfo(){
-        $user_id = 1;
-        $course_info = 'abcd123';
-        $res = $this->tcourse->determine_course_title_from_course_info($user_id, $course_info);
-        $this->assertTrue($res);
-        $this->assertTrue(is_array($res));
-    }
-
-    public function testCreateCombinedName(){
-        $complete_course_name = array();
-        $user_is_registered_in_real_course = false;
-        $real_course_name = 'COURSE1';
-        $virtual_course_list = array();
-        $res = CourseManager::create_combined_name($user_is_registered_in_real_course,
-                                                   $real_course_name,
-                                                   $virtual_course_list
-                                                   );
-        $this->assertFalse($res);
-        $this->assertTrue(is_string($res));
-        //var_dump($res);
-    }
-
-    public function testCreateCombinedCode(){
-        $complete_course_code = array();
-        $user_is_registered_in_real_course = false;
-        $real_course_code = 'COURSE1';
-        $virtual_course_list = array();
-        $res = CourseManager::create_combined_code($user_is_registered_in_real_course,
-                                                    $real_course_code,
-                                                    $virtual_course_list);
-        if(is_array($res)){
-        $this->assertFalse($res);
-        $this->assertTrue(is_string($res));
-        } else {
-        $this->assertFalse(is_null($res));
-        }
-        //var_dump($res);
-    }
-
-    public function testGetVirtualCourseInfo(){
-        $real_course_code = 'COURSE1';
-        $res = $this->tcourse->get_virtual_course_info($real_course_code);
-        if(is_array($res)){
-        $this->assertTrue(is_array($res));
-        } else {
-            $this->assertTrue($res);
-        }
-        //var_dump($res);
-    }
-
-    public function testIsVirtualCourseFromSystemCode(){
-        $system_code = 'COURSE1';
-        $res = $this->tcourse->is_virtual_course_from_system_code($system_code);
-        $this->assertFalse($res);
-        $this->assertTrue(is_bool($res));
-        $this->assertFalse($res,null);
-    }
-
-    public function testIsVirtualCourseFromVisualCode(){
-        $system_code = 'COURSE1';
-        $res = $this->tcourse->is_virtual_course_from_visual_code($system_code);
-        $this->assertFalse($res);
-        $this->assertTrue(is_bool($res));
-    }
-
-    public function testHasVirtualCourseFromCode(){
-        $real_course_code = 'COURSE1';
-        $user_id = 1;
-        $res = CourseManager::has_virtual_courses_from_code($real_course_code, $user_id);
-        if(is_bool($res)){
-            $this->assertFalse($res);
-            $this->assertTrue(is_bool($res));
-        } else {
-            $this->assertFalse(is_null($res));
-        }
-        //var_dump($res);
-    }
-
-    public function testGetVirtualCourseLinkedToRealCourse(){
-        $real_course_code = 'COURSE1';
-        $res = CourseManager::get_virtual_courses_linked_to_real_course($real_course_code);
-        $this->assertFalse($res);
-        $this->assertTrue(is_array($res));
-        $this->assertFalse(is_null($res));
-    }
-
-    public function testGetTargetOfLinkedCourse(){
-        $virtual_course_code = 'COURSE1';
-        $res = CourseManager::get_target_of_linked_course($virtual_course_code);
-        $this->assertFalse($res);
-        $this->assertTrue(is_null($res));
-        $this->assertNull($res,true);
-    }
-
-    public function testIsUserSubscribedInCourse(){
-        $user_id = 1;
-        $course_code = 'COURSE1';
-        $in_a_session = false;
-        $res = CourseManager::is_user_subscribed_in_course($user_id, $course_code, $in_a_session);
-        $this->assertTrue(is_bool($res));
-        //var_dump($res);
-    }
-
-    public function testIsCourseTeacher(){
-        $user_id = 1;
-        $course_code = 'COURSE1';
-        $res = CourseManager::is_course_teacher($user_id, $course_code);
-        $this->assertTrue(is_bool($res));
-        $this->assertFalse($res);
-    }
-
-    public function testIsUserSubscribedInRealOrLinkedCourse(){
-        $user_id = 1;
-        $course_code = 'COURSE1';
-        $session_id = '';
-        $res = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_code, $session_id);
-        if(is_bool($res)){
-            $this-> assertTrue(is_bool($res));
-            $this->assertFalse($res);
-        } else {
-            $this->assertTrue($res);
-        }
-        //var_dump($res);
-    }
-
-    public function testGetUserListFromCourseCode(){
-        $course_code = 'COURSE1';
-        $with_session = true;
-        $session_id = 0;
-        $limit = '';
-        $order_by = '';
-        $res = CourseManager::get_user_list_from_course_code($course_code, $with_session, $session_id, $limit, $order_by);
-        //$this->assertTrue($res);
-        $this->assertTrue(is_array($res));
-        //var_dump($res);
-    }
-
-    public function testGetCoachListFromCourseCode(){
-        $course_code = 'COURSE1';
-        $session_id = '';
-        $res = CourseManager::get_coach_list_from_course_code($course_code, $session_id);
-        $this->assertFalse($res);
-        $this->assertTrue(is_array($res));
-    }
-
-    public function testGetStudentListFromCourseCode(){
-        $course_code = 'COURSE1';
-        $session_id = '001';
-        $res = $this->tcourse->get_student_list_from_course_code($course_code, $session_id);
-        //$this->assertTrue($res);
-        $this->assertTrue(is_array($res));
-        //var_dump($res);
-    }
-
-    public function testGetTeacherListFromCourseCode(){
-        $course_code = 'COURSE1';
-        $res = $this->tcourse->get_teacher_list_from_course_code($course_code);
-        $this->assertFalse($res);
-        $this->assertFalse(is_null($res));
-        //var_dump($res);
-    }
-
-    public function testGetRealAndLinkedUserList(){
-        $course_code = 'COURSE1';
-        $with_sessions = true;
-        $session_id = 0;
-        $res = $this->tcourse->get_real_and_linked_user_list($course_code, $with_sessions, $session_id);
-        $this->assertNull($res);
-        $this->assertTrue(is_null($res));
-        //$this->assertTrue($this->tcourse->get_real_and_linked_user_list()===null);
-        //var_dump($res);
-    }
-
-    public function testGetListOfVirtualCoursesForSpecificUserAndRealCourse(){
-        $result_array = array('user_id' => 1, 'real_course_code' => 'COURSE1');
-        $res = CourseManager::get_list_of_virtual_courses_for_specific_user_and_real_course($result_array['user_id'],$result_array['real_course_code']);
-        if(is_array($res)){
-        $this->assertTrue(is_array($res));
-        } else {
-            $this->assertTrue($res);
-        }
-        //var_dump($res);
-    }
-
-    public function testGetGroupListOfCourse(){
-        $course_code = 'COURSE1';
-        $sql= 	"SELECT * FROM chamilo_COURSE1";
-        $result = CourseManager::get_group_list_of_course($course_code);
-        $this->assertTrue(is_array($result));
-        $this->assertFalse($result);
-        //var_dump($res);
-    }
-
-    public function testAttemptCreateVirtualCourse(){
-        $real_course_code = 'COURSE1';
-        $course_title = 'COURSE1';
-        $wanted_course_code = 'COURSE1';
-        $course_language = 'english';
-        $course_category = 'LANG';
-        ob_start();
-        $res = CourseManager::attempt_create_virtual_course($real_course_code, $course_title, $wanted_course_code, $course_language, $course_category);
-        ob_end_clean();
-        $this->assertTrue(is_bool($res));
-    }
-
-    public function testCreateVirtualCourse(){
-        $real_course_code = 'COURSE1';
-        $course_title = 'COURSE1';
-        $wanted_course_code = 'COURSE1';
-        $course_language = 'english';
-        $course_category = 'LANG';
-        ob_start();
-        $res = CourseManager::create_virtual_course($real_course_code, $course_title, $wanted_course_code, $course_language, $course_category);
-        ob_end_clean();
-        if(is_bool($res)){
-            $this->assertTrue(is_bool($res));
-        } else {
-            $this->assertTrue($res);
-        }
-        //var_dump($res);
-    }
-
-    public function testCreateDatabaseDump(){
-        global $_configuration;
-        $course_code='COURSE1';
-        $res = $this->tcourse->create_database_dump($course_code);
-        $this->assertFalse($res);
-        $this->assertTrue(is_null($res));
-    }
-
-    public function testUserCourseSort(){
-        $user_id ='01';
-        $course_code='COURSE1';
-        $res = CourseManager::UserCourseSort($user_id,$course_code);
-        $this->assertTrue($res);
-        $this->assertTrue(is_numeric($res));
-    }
-
-    public function testSelectAndSortCategories(){
-        $form = new FormValidator('add_course');
-        $categories = array('name' => 'prueba');
-        $categories_select = $form->addElement('select', 'category_code', get_lang('Fac'), $categories);
-        $res = $this->tcourse->select_and_sort_categories($categories_select);
-        $this->assertFalse($res);
-        $this->assertTrue(is_null($res));
-    }
-
-    public function testCourseExists(){
-        $course_code='COURSE1';
-        $accept_virtual = false;
-        $res=$this->tcourse->course_exists($course_code, $accept_virtual);
-        $this->assertTrue(is_numeric($res));
-    }
-
-    public function testEmailToTutor() {
-        $user_id= '01';
-        $course_code= 'COURSE1';
-        $res=CourseManager::email_to_tutor($course_code,$user_id);
-        $this->assertTrue(is_string($course_code));
-        //var_dump($res);
-    }
-
-    public function testGetCoursesListByUserId(){
-        $user_id = '01';
-        $res = $this->tcourse->get_courses_list_by_user_id($user_id);
-        $this->assertTrue(is_array($res));
-        //var_dump($res);
-    }
-
-    public function testGetCourseIdFromPath(){
-        $path = '/var/www/path';
-        $res = $this->tcourse->get_course_id_from_path($path);
-        $this->assertTrue(is_bool($res));
-        $this->assertTrue($res === false);
-    }
-
-    public function testGetCoursesInfoFromVisualCode(){
-        $code = '0001';
-        $res=$this->tcourse->get_courses_info_from_visual_code($code);
-        $this->assertTrue(is_array($res));
-        //var_dump($res);
-    }
-
-    public function testGetEmailsOfTutorsToCourse(){
-        $code = '0001';
-        $res= $this->tcourse->get_emails_of_tutors_to_course($code);
-        $this->assertTrue(is_array($res));
-        //var_dump($res);
-    }
-
-    public function testGetEmailOfTutorToSession(){
-        $session_id = '01';
-        $course_code = 'COURSE1';
-        ob_start();
-        $res = CourseManager::get_email_of_tutor_to_session($session_id,$course_code);
-        ob_end_clean();
-        $this->assertTrue(is_array($res));
-        //var_dump($res);
-    }
-
-    public function testCreateCourseExtraField(){
-        $fieldvarname = '';
-        $fieldtype = '5';
-        $fieldtitle = '';
-        $res = $this->tcourse->create_course_extra_field($fieldvarname, $fieldtype, $fieldtitle);
-        $this->assertTrue(is_numeric($res));
-        $this->assertTrue($res);
-    }
-
-    public function testUpdateCourseExtraFieldValue(){
-        $course_code = 'COURSE1';
-        $fname = '';
-        $fvalue= '';
-        $res = $this->tcourse->update_course_extra_field_value($course_code,$fname,$fvalue='');
-        $this->assertTrue($res);
-        $this->assertTrue(is_bool($res));
-        $this->assertFalse(is_null($res));
-    }
-
-    public function testDeleteCourse(){
-        global $_configuration;
-        $code = 'COURSE1';
-        if (!empty($course_code)) {
-            $code = $course_code;
-        }
-        $res = CourseManager::delete_course($code);
-        $this->assertTrue(is_null($res));
-    }
-
-
-}
-
-?>

+ 0 - 314
tests/main/inc/lib/database.lib.test.php

@@ -1,314 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'database.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'add_course.lib.inc.php');
-require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
-class TestDatabase extends UnitTestCase {
-
-	 public $dbase;
-	 public function TestDatabase() {
-	 	$this->UnitTestCase('Database library - main/inc/lib/database.lib.test.php');
-	 }
-
-	 public function setUp() {
-	 	global $_configuration;
- 	 	$this->dbase = new Database();
-	 }
-
-	 public function tearDown() {
-	 	$this->dbase = null;
-	 }
-
-	public function testAffectedRows() {
-		$res=$this->dbase->affected_rows();
-		$this->assertTrue(is_numeric($res));
-	}
-
-	public function testCountRows() {
-		$table='class';
-		$res=$this->dbase->count_rows($table);
-		if(!is_string($res)){
-			$this->assertTrue(is_numeric($res));
-		}
-	}
-
-	public function testError() {
-		$res=$this->dbase->error();
-		$this->assertTrue(is_string($res));
-	}
-
-	public function testEscapeString() {
-		$string='Lore"May';
-		$res=$this->dbase->escape_string($string);
-		$this->assertTrue(is_string($res));
-	}
-
-	public function testFetchArray() {
-		$sql = 'select 1';
-		$res=Database::query($sql);
-		$resu=$this->dbase->fetch_array($res);
-		$this->assertTrue(is_array($resu));
-		$this->assertFalse(is_null($resu));
-	}
-
-	public function testFetchArrayError() {
-		$sql = 'SELECT  1';
-		$res=Database::query($sql);
-		$resu=$this->dbase->fetch_array($res);
-		$this->assertTrue(is_array($resu));
-	}
-
-	function testFetchObject() {
-		$sql = 'SELECT  1';
-		$res=Database::query($sql);
-		$resu=$this->dbase->fetch_object($res);
-		$this->assertTrue(is_object($resu));
-	}
-
-	function testFetchRow() {
-		$sql = 'SELECT  1';
-		$res=Database::query($sql);
-		$resu=$this->dbase->fetch_row($res);
-		$this->assertTrue(is_array($resu));
-	}
-
-	/* // Contains a private unaccessible method, Database::fix_database_parameter().
-	function testFixDatabaseParameterEmpty() {
-		$course_info = api_get_course_info();
-		$database_name= $course_info[""];
-		$res=$this->dbase->fix_database_parameter($database_name);
-		if(!is_null($res)) :
-		$this->assertTrue(is_string($res));
-		endif;
-		//var_dump($res);
-	}
-	*/
-
-	/* // Contains a private unaccessible method, Database::fix_database_parameter().
-	function testFixDatabaseParameterReturnString() {
-		$course_info = api_get_course_info();
-		$database_name= $course_info["dbName"];
-		$res=$this->dbase->fix_database_parameter($course_info);
-		$this->assertTrue(is_string($res));
-	}
-	*/
-
-	/* // Contains a private unaccessible method, Database::format_glued_course_table_name().
-	function testFormatGluedCourseTableName()  {
-		$database_name_with_glue='';
-		$table='';
-		$res=$this->dbase->format_glued_course_table_name($database_name_with_glue, $table);
-		$this->assertTrue(is_string($res));
-	}
-	*/
-
-	/* // Contains a private unaccessible method, Database::format_table_name().
-	function testFormatTableName() {
-		$database='';
-		$table='';
-		$res=$this->dbase->format_table_name($database, $table);
-		$this->assertTrue(is_string($res));
-	}
-	*/
-
-	function testGenerateAbstractCourseFieldNames() {
-		$result_array='';
-		$res=$this->dbase->generate_abstract_course_field_names($result_array);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testGenerateAbstractUserFieldNames() {
-		$result_array='';
-		$res=$this->dbase->generate_abstract_user_field_names($result_array);
-		$this->assertTrue(is_array($res));
-	}
-
-	function get_course_by_category() {
-		$category_id='1';
-		$res=$this->dbase->get_course_by_category($category_id);
-		$this->assertTrue(is_string($res));
-	}
-
-	function testGetCourseChatConnectedTable() {
-		$database_name='dokeosla';
-		$res=$this->dbase->get_course_chat_connected_table($database_name);
-		$this->assertTrue(is_string($res));
-	}
-
-	function testGetCourseInfo() {
-		$course_code='AYDD';
-		$res=$this->dbase->get_course_info($course_code);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testGetCourseList() {
-		$sql_query = "SELECT * FROM $table";
-		$res=$this->dbase->get_course_list($sql_query);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testGetCourseTable() {
-		$short_table_name='';
-		$database_name='';
-		$res=$this->dbase->get_course_table($short_table_name,$database_name);
-		$this->assertTrue(is_string($res));
-	}
-
-	function testGetCourseTableFromCode() {
-		$course_code='AYDD';
-		$table='course';
-		$ret = NULL;
-		$res=$this->dbase->get_course_table_from_code($course_code, $table);
-		$this->assertTrue(is_string($res));
-	}
-
-	function testGetCourseTablePrefix() {
-		global $_configuration;
-		$res=$this->dbase->get_course_table_prefix($_configuration);
-		$this->assertTrue(is_string($res));
-	}
-
-	function testGetCurrentCourseDatabase() {
-		$res=$this->dbase->get_current_course_database();
-        if (empty($GLOBALS['_course']['dbName'])) {
-            $this->assertFalse($res);
-        } else {
-            $this->assertTrue(is_string($res));
-        }
-        $res=$this->dbase->get_current_course_database('___');
-        $this->assertFalse($res);
-	}
-
-	function testGetCurrentCourseGluedDatabase() {
-	    global $_course;
-	    $res=$this->dbase->get_current_course_glued_database();
-	    if (empty($_course['dbNameGlu'])) {
-	        $this->assertFalse($res);
-	    } else {
-	        $this->assertTrue(is_string($res));
-	    }
-	}
-
-	function testGetDatabaseGlue() {
-		global $_configuration;
-		$res=$this->dbase->get_database_glue($_configuration);
-		$this->assertTrue(is_string($res));
-	}
-
-	function testGetDatabaseNamePrefix() {
-		global $_configuration;
-		$res=$this->dbase->get_database_name_prefix($_configuration);
-		$this->assertTrue(is_string($res));
-	}
-
-	function testGetMainDatabase() {
-		global $_configuration;
-		$res=$this->dbase->get_main_database();
-		$this->assertTrue(is_string($res));
-	}
-
-	function testGetMainTable() {
-		$short_table_name='';
-		$res=$this->dbase->get_main_table($short_table_name);
-		$this->assertTrue(is_string($res));
-	}
-
-	function testGetScormDatabase() {
-		global $_configuration;
-		$res=$this->dbase->get_scorm_database();
-		$this->assertTrue(is_string($res));
-	}
-
-		function testGetScorm_table() {
-		$short_table_name='';
-		$res=$this->dbase->get_scorm_table($short_table_name);
-		$this->assertTrue(is_string($res));
-		$this->assertTrue($res);
-	}
-
-	function testGetStatisticDatabase() {
-		global $_configuration;
-		$res=$this->dbase->get_statistic_database($_configuration);
-		$this->assertTrue(is_string($res));
-		$this->assertTrue($res);
-	}
-
-	function testGetStatisticTable() {
-		$short_table_name='';
-		$res=$this->dbase->get_statistic_table($short_table_name);
-		$this->assertTrue(is_string($res));
-		$this->assertTrue($res);
-	}
-
-	function testGetUserInfoFromIdOneIsArray() {
-		$res=$this->dbase->get_user_info_from_id(1);
-		$this->assertTrue(is_array($res));
-	}
-/* Fails for some reason on automated tests server
-    function testGetUserInfoFromIdNullIsFalse() {
-        // should be returning GLOBALS[_user] (=null) if param is null (in testing context)
-        $res=$this->dbase->get_user_info_from_id(null);
-        $this->assertFalse($res);
-    }
-*/
-	function testGetUserInfoFromIdHighValueIsArray() {
-        	// should be returning array with empty values if user doesn't exist
-	        $res=$this->dbase->get_user_info_from_id(5000000);
-        	$this->assertTrue(is_array($res));
-	}
-
-	function testGetUserPersonalDatabase() {
-		global $_configuration;
-		$res=$this->dbase->get_user_personal_database($_configuration);
-		$this->assertTrue(is_string($res));
-		$this->assertTrue($res);
-	}
-
-	function testGetUserPersonalTable(){
-		$short_table_name='';
-		$res=$this->dbase->	get_user_personal_table($short_table_name);
-		$this->assertTrue(is_string($res));
-		$this->assertTrue($res);
-	}
-
-	/* // Contains a private unaccessible method, Database::glue_course_database_name().
-	function testGlueCourseDatabaseName() {
-		$database_name='';
-		$res=$this->dbase->glue_course_database_name($database_name);
-		$this->assertTrue(is_string($res));
-		$this->assertTrue($res);
-	}
-	*/
-
-	function testInsertId() {
-		$res = $this->dbase->insert_id();
-		$this->assertTrue(is_numeric($res));
-	}
-
-	function testNumRows() {
-		$sql = 'SELECT * FROM user';
-		$res = Database::query($sql);
-		$resul=Database::num_rows($res);
-		$this->assertTrue(is_numeric($resul));
-	}
-
-	function testQuery() {
-		$sql = 'SELECT 1';
-		$res = Database::query($sql);
-		$this->assertTrue(is_resource($res));
-	}
-
-	function testResult() {
-		$sql = 'SELECT email FROM user';
-		$resource = Database::query($sql);
-		$res = Database::result($resource, 1);
-		$this->assertTrue(is_string($res));
-	}
-
-	function testStoreResult(){
-		$sql = 'SELECT 1';
-		$resource = $this->dbase->query($sql);
-		$res = $this->dbase->store_result($resource);
-		$this->assertTrue(is_array($res));
-	}
-}
-?>

+ 0 - 65
tests/main/inc/lib/debug.lib.inc.test.php

@@ -1,65 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'debug.lib.php');
-
-
-class TestDebug extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Debug helper library - main/inc/lib/debug.lib.inc.test.php');
-    }
-	function test_printr_is_string() {
-		$variable='br';
-		ob_start();
-		Debug::printr($variable);
-		$res=ob_get_contents();
-		ob_end_clean();
-		//print_r($res);
-		$this->assertTrue(is_string($res));
-		$this->assertTrue(is_scalar($res));
-	}
-
-	function test_debug_course_is_string() {
-		global $_course;
-		ob_start();
-		Debug::course($_course);
-		$res=ob_get_contents();
-		ob_end_clean();
-		//print_r($res);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-
-	}
-
-	function test_debug_paths_is_string() {
-		ob_start();
-		Debug::debug_paths();
-		$res=ob_get_contents();
-		ob_end_clean();
-		//print_r($res);
-		$this->assertTrue(is_string($res));
-		$this->assertTrue(is_scalar($res));
-	}
-
-	function test_debug_user_is_array() {
-		global $_user;
-		ob_start();
-		Debug::user($_user);
-		$res=ob_get_contents();
-		ob_end_clean();
-		//print_r($res);
-		$this->assertTrue(array($_user));
-		//var_dump($res);
-	}
-
-	function test_print_var_is_string() {
-		$var='';
-		GLOBAL $DEBUG;
-		ob_start();
-		Debug::print_var($var, $varName = "@");
-		$res=ob_get_contents();
-		ob_end_clean();
-		//print_r($res);
-		$this->assertTrue(is_string($res));
-	}
-}
-?>

+ 0 - 321
tests/main/inc/lib/display.lib.test.php

@@ -1,321 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'display.lib.php');
-
-class TestDisplay extends UnitTestCase {
-    public function __construct(){
-        $this->UnitTestCase('Display library - main/inc/display.lib.test.php');
-    }
-	public function testdisplay_introduction_section() {
-		$tool=api_get_tools_lists($my_tool=null);
-		ob_start();
-		$res = Display::display_introduction_section($tool);
-		ob_end_clean();
-		$this->assertTrue(is_array($tool));
-		//var_dump($tool);
-	}
-
-	public function testdisplay_localised_html_file(){
-		global $language_interface;
-		$doc_url = str_replace('/..', '', $doc_url);
-		$full_file_name=api_get_path(SYS_COURSE_PATH).'/index'.$doc_url;
-		ob_start();
-		$res = Display::display_localised_html_file($full_file_name);
-		ob_end_clean();
-		$this->assertTrue(is_string($full_file_name));
-		//var_dump($full_file_name);
-	}
-
-		/**
-	*	Display html header of table with several options.
-	*
-	*	@param $properties, array with elements
-	*	@param column_header, array with the header elements.
-	*	@author Arthur Portugal
-	*	@return return type string, bgcolor
-	*/
-	public function testdisplay_complex_table_header() {
-		$properties='HTML_WHITE';
-		$column_header=array();
-		ob_start();
-		$res= Display::display_complex_table_header($properties, $column_header);
-		ob_end_clean();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-	*	Displays a table row.
-	*
-	*	@param $bgcolor the background colour for the table
-	*	@param $table_row an array with the row elements
-	*	@param $is_alternating true: the row colours alternate, false otherwise
-	*	@return string color
-	*/
-	public function testdisplay_table_row() {
-		$bgcolor = 'red';
-		$table_row = array();
-		$is_alternating = true;
-		ob_start();
-		$res=Display::display_table_row($bgcolor, $table_row,$is_alternating);
-		ob_end_clean();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testdisplay_sortable_table() {
-		$header='';
-		$content='';
-		global $origin;
-		ob_start();
-		$res=Display::display_sortable_table($header, $content);
-		ob_end_clean();
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-
-		/**
-	 * Display a table with a special configuration
-	 * @param array $header Titles for the table header
-	 * 						each item in this array can contain 3 values
-	 * 						- 1st element: the column title
-	 * 						- 2nd element: true or false (column sortable?)
-	 * 						- 3th element: additional attributes for
-	 *  						th-tag (eg for column-width)
-	 * 						- 4the element: additional attributes for the td-tags
-	 * @param array $content 2D-array with the tables content
-	 * @return void String about header
-	 */
-	public function testdisplay_sortable_config_table() {
-		$header='';
-		$content='';
-		global $origin;
-		ob_start();
-		$res=Display::display_sortable_config_table($header, $content);
-		ob_end_clean();
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-
-		/**
-	* Displays a normal message. It is recommended to use this public function
-	* to display any normal information messages.
-	*
-	* @param string $message - include any additional html
-	*                          tags if you need them
-	* @param bool	Filter (true) or not (false)
-	* @return void String message
-	*/
-	public function testdisplay_normal_message() {
-		global $charset;
-		$message=api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : $charset);
-		ob_start();
-		$res=Display::display_normal_message($message);
-		ob_end_clean();
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-
-	/**
-	 * Display the reduced page header (without banner)
-	 */
-	// [/var/www/chamilo/main/inc/reduced_header.inc.php line 30] - exception
-/*	public function testdisplay_reduced_header() {
-		global $_plugins,$lp_theme_css,$mycoursetheme,$user_theme,$platform_theme;
-		global $httpHeadXtra, $htmlHeadXtra, $htmlIncHeadXtra, $_course, $_user, $clarolineRepositoryWeb, $text_dir, $plugins, $_user, $rootAdminWeb, $_cid, $interbreadcrumb, $charset, $language_file, $noPHP_SELF, $language_interface;
-		global $menu_navigation;
-		ob_start();
-		$res=Display::display_reduced_header();
-		ob_end_clean();
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-*/
-	/**
-	* Displays an confirmation message. Use this if something has been done successfully
-	*
-	* @param string $message
-	* @param bool	Filter (true) or not (false)
-	* @return void String message
-	*/
-	public function testdisplay_confirmation_message() {
-		global $charset;
-		$message=api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : $charset);
-		ob_start();
-		$res=Display::display_confirmation_message($message);
-		ob_end_clean();
-		$this->assertTrue(is_string($message));
-		//var_dump($message);
-	}
-
-	/**
-	* Displays an error message.
-	* @author Arthur Portugal
-	* @param string $message - include any additional html tags if you need them
-	* @param bool	Filter (true) or not (false)
-	* @param object Not display the object in the test browser
-	* @return string Code HTML
-	*/
-	public function testdisplay_error_message() {
-		global $charset;
-		$message = "error message";
-		ob_start();
-		$res=Display::display_error_message($message);
-		ob_end_clean();
-		$this->assertTrue(is_string($message));
-		//var_dump($message);
-	}
-
-	/**
-	 * Display the page footer
-	 * @author Arthur Portugal
-	 * @return string Code HTML about the footer
-	 */
-	public function testdisplay_footer() {
-		global $_plugins;
-		ob_start();
-		$res=Display::display_footer();
-		ob_end_clean();
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-
-	/**
-	 * Display the page header
-	 * @param string The name of the page (will be showed in the page title)
-	 * @param string Optional help file name
-	 * @return string Display the hearders messages
-	 */
-	// [/var/www/chamilo/main/inc/header.inc.php line 31] - exception
-/*	public function testdisplay_header() {
-		global $_plugins,$lp_theme_css,$mycoursetheme,$user_theme,$platform_theme;
-		global $httpHeadXtra, $htmlHeadXtra, $htmlIncHeadXtra, $_course, $_user, $clarolineRepositoryWeb, $text_dir, $plugins, $_user, $rootAdminWeb, $_cid, $interbreadcrumb, $charset, $language_file, $noPHP_SELF;
-		global $menu_navigation;
-		$tool_name = '';
-		$help = NULL;
-		$nameTools = $tool_name;
-		ob_start();
-		$res=Display::display_header($tool_name, $help);
-		ob_end_clean();
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-*/
-	/**
-	 * This public function displays an icon
-	 * @param string $image the filename of the file (in the main/img/ folder
-	 * @param string $alt_text the alt text (probably a language variable)
-	 * @param array additional attributes (for instance height, width, onclick, ...)
-	 * @return return icon like string in this test (path)
-	*/
-	public function testdisplay_icon() {
-		$image='file';
-		ob_start();
-		$res=Display::display_icon($image);
-		ob_end_clean();
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-
-	/**
-	* Displays an warning message. Use this if you want to draw attention to something
-	*
-	* @author Arthur Portugal
-	* @param string $message
-	* @param bool	Filter (true) or not (false)
-	* @return string with the message (also void)
-	*/
-	public function testdisplay_warning_message() {
-		$message="warning-message";
-		ob_start();
-		$res=Display::display_warning_message($message);
-		ob_end_clean();
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-
-	/**
-	 * Return an encrypted mailto hyperlink
-	 * @author Arthur Portugal
-	 * @param - $email (string) - e-mail
-	 * @return - encrypted mailto hyperlink
-	 */
-	public function testencrypted_mailto_link() {
-		$email='';
-		$clickable_text = null;
-		$style_class = '';
-		ob_start();
-		$res=Display::encrypted_mailto_link($email, $clickable_text, $style_class);
-		ob_end_clean();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * Print an <option>-list with all letters (A-Z).
-	 * @param char $selected_letter The letter that should be selected
-	 */
-	public function testget_alphabet_options() {
-		$selected_letter = 5;
-		ob_start();
-		$res=Display::get_alphabet_options();
-		ob_end_clean();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testget_numeric_options() {
-		$min='';
-		$max='';
-		ob_start();
-		$res=Display::get_numeric_options($min,$max);
-		ob_end_clean();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-	*	Create a hyperlink to the platform homepage.
-	*	@param string $name, the visible name of the hyperlink, default is sitename
-	*	@return string with html code for hyperlink
-	*/
-	public function testget_platform_home_link_html() {
-		ob_start();
-		$res=Display::get_platform_home_link_html();
-		ob_end_clean();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-	 * This public function returns the htmlcode for an icon
-	 *
-	 * @param string $image the filename of the file (in the main/img/ folder
-	 * @param string $alt_text the alt text (probably a language variable)
-	 * @param array additional attributes (for instance height, width, onclick, ...)
-	 *
-     */
-	public function testreturn_icon() {
-		$image='';
-		ob_start();
-		$res=Display::return_icon($image);
-		ob_end_clean();
-		//$res=ob_get_contents();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-	* Show the so-called "left" menu for navigating
-	*/
-	public function testshow_course_navigation_menu() {
-		global $output_string_menu;
-		global $_setting;
-		ob_start();
-		$res=Display::show_course_navigation_menu();
-		ob_end_clean();
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-
-}
-?>

+ 0 - 300
tests/main/inc/lib/document.lib.test.php

@@ -1,300 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'document.lib.php');
-
-class TestDocumentManager extends UnitTestCase {
-
-
-    public function __construct() {
-        $this->UnitTestCase('Document Manager library - main/inc/lib/document.lib.test.php');
-    }
-
-    /**
-	 * This checks if a document has the readonly property checked, then see if
-	 * the user is the owner of this file, if all this is true then return true.
-	 *
-	 * @param array  $_course
-	 * @param int    $user_id id of the current user
-	 * @param string $file path stored in the database
-	 * @param int    $document_id in case you dont have the file path ,insert the
-	 * id of the file here and leave $file in blank ''
-	 * @return boolean true/false
-	 **/
-	public function testcheck_readonly() {
-		global $user_id, $_course;
-		$file='';
-		$res=DocumentManager::check_readonly($_course,$user_id,$file);
-		$this->assertTrue(is_bool($res));
-	}
-
-	/**
-	 * This deletes a document by changing visibility to 2, renaming it to
-	 * filename_DELETED_#id
-	 * Files/folders that are inside a deleted folder get visibility 2
-	 *
-	 * @param array $_course
-	 * @param string $path, path stored in the database
-	 * @param string ,$base_work_dir, path to the documents folder
-	 * @return boolean true/false
-	 * @todo now only files/folders in a folder get visibility 2, we should
-	 * rename them too.
-	 */
-	function testdelete_document() {
-		global $_course;
-		$path='';
-		$base_work_dir='';
-		ob_start();
-		$res=DocumentManager::delete_document($_course, $path, $base_work_dir);
-		ob_end_clean();
-		$this->assertTrue(is_bool($res));
-	}
-
-	/**
-	 * Removes documents from search engine database
-	 *
-	 * @param string $course_id Course code
-	 * @param int $document_id Document id to delete
-	 * @return void
-	 */
-	function testdelete_document_from_search_engine() {
-		global $cidReq;
-		$course_id = $cidReq;
-		$document_id='';
-		$res=DocumentManager::delete_document_from_search_engine($course_id, $document_id);
-		$this->assertNull($res);
-	}
-
-	/**
-	*	Get the content type of a file by checking the extension
-	*	We could use mime_content_type() with php-versions > 4.3,
-	*	but this doesn't work as it should on Windows installations
-	*
-	*	@param string $filename or boolean TRUE to return complete array
-	*
-	*/
-	function testfile_get_mime_type() {
-		$filename='';
-		$res=DocumentManager::file_get_mime_type($filename);
-		$this->assertTrue(is_string($res));
-	}
-
-	/**
-	* This function streams a file to the client
-	*
-	* @param string $full_file_name
-	* @param boolean $forced
-	* @param string $name
-	* @return false if file doesn't exist, true if stream succeeded
-	*/
-	function testfile_send_for_download() {
-		$full_file_name='';
-		$forced = false;
-		$name = '';
-		$res=DocumentManager::file_send_for_download($full_file_name, $forced, $name);
-		$this->assertTrue(is_bool($res));
-	}
-
-	/**
-	*   @todo ??not only check if a file is visible, but also check if the user
-	* 	is allowed to see the file??
-	*   @return true if the user is allowed to see the document, false otherwise
-	* 	(bool)
-	*/
-	function testfile_visible_to_user() {
-		global $_course,$tbl_document;
-		$tbl_document = Database::get_course_table(TABLE_DOCUMENT);
-		$this_course= $_course['dbName'].'.';
-		$dirurl = api_get_path(WEB_COURSE_PATH);
-		$doc_url= $dirurl.'COURSETEST/document/video/painting.mpg?cidReq=COURSETEST';
-		$res=DocumentManager::file_visible_to_user($this_course, $doc_url);
-		$this->assertTrue(is_bool($res));
-	}
-
-	/**
-	* Fetches all document data for the given user/group
-	*
-	* @param array $_course
-	* @param string $path
-	* @param int $to_group_id
-	* @param int $to_user_id
-	* @param boolean $can_see_invisible
-	* @return array with all document data
-	*/
-	function testget_all_document_data() {
-		global $_course;
-		$path = '/';
-		$to_group_id = 0;
-		$to_user_id = NULL;
-		$can_see_invisible = false;
-		$res=DocumentManager::get_all_document_data($_course, $path,
-		$to_group_id, $to_user_id, $can_see_invisible);
-		if (empty($_course['dbName'])) {
-            $this->assertFalse($res);
-		} else {
-			$this->assertTrue(is_array($res));
-		}
-	}
-
-	/**
-	 * Gets the paths of all folders in a course
-	 * can show all folders (exept for the deleted ones) or only visible ones
-	 * @param array $_course
-	 * @param boolean $can_see_invisible
-	 * @param int $to_group_id
-	 * @return array with paths
-	 */
-	function testget_all_document_folders() {
-		global $_course;
-		$to_group_id = '0';
-		$can_see_invisible = false;
-		$res = DocumentManager::get_all_document_folders($_course, $to_group_id, $can_see_invisible);
-        if (empty($_course['dbName'])) {
-            $this->assertFalse($res);
-        } else {
-            $this->assertTrue(is_array($res));
-        }
-	}
-
-	/**
-	* @return the document folder quota of the current course, in bytes
-	*/
-	/* Removed temporarily, causing problems for some reason on automated tests
-	 * server
-	function testget_course_quota() {
-		global $_course, $maxFilledSpace;
-		$res = DocumentManager::get_course_quota();
-		$this->assertTrue(is_string($res));
-	}
-*/
-	/** Gets the id of a document with a given path
-	 *
-	 * @param array $_course
-	 * @param string $path
-	 * @return int id of document / false if no doc found
-	 */
-	function testget_document_id() {
-		global $_course;
-		$path = Database::escape_string($path);
-		$res=DocumentManager::get_document_id($_course, $path);
-		$this->assertTrue(is_bool($res));
-	}
-
-	/** This check if a document is a folder or not
-	 * @param array  $_course
-	 * @param int    $document_id of the item
-	 * @return boolean true/false
-	 **/
-	function testis_folder() {
-		global $_course;
-		$document_id = 1;
-		$res=DocumentManager::is_folder($_course, $document_id);
-		$this->assertTrue(is_bool($res));
-	}
-
-	/**
-	 * return true if the documentpath have visibility=1 as item_property
-	 *
-	 * @param string $document_path the relative complete path of the document
-     * @param array  $course the _course array info of the document's course
-	 */
-	function testis_visible() {
-		global $_course;
-		$doc_path = Database::escape_string($doc_path);
-		$res=DocumentManager::is_visible($doc_path, $_course);
-		$this->assertTrue(is_bool($res));
-	}
-
-	/**
-	 * Allow to set a specific document as a new template for FCKEditor for a
-	 * particular user in a particular course
-	 *
-	 * @param string $title
-	 * @param string $description
-	 * @param int $document_id_for_template the document id
-	 * @param string $couse_code
-	 * @param int $user_id
-	 */
-	function testset_document_as_template() {
-		global $_course,$_user;
-		$title='test';
-		$description='test';
-		$document_id_for_template='';
-		$couse_code=$_course;
-		$user_id=$_user;
-		$image='';
-		$res=DocumentManager::set_document_as_template($title, $description,
-													   $document_id_for_template,
-													   $couse_code, $user_id,
-													   $image
-													  );
-		$this->assertTrue(is_bool($res));
-	}
-    function testdocuments_total_space() {
-        $to_group_id='0';
-        $res= DocumentManager::documents_total_space($to_group_id);
-        if(!is_null($res)):
-        $this->assertTrue(is_numeric($res));
-        endif;
-    }
-
-    function testenough_space() {
-        $file_size='';
-        $max_dir_space='';
-        $res= DocumentManager::enough_space($file_size, $max_dir_space);
-        $this->assertTrue(is_bool($res));
-    }
-
-    
- //The following function throws exceptions because of SimpleTest, because
- // it declares uncapturable headers
-/*	function teststring_send_for_download() {
-		$full_string='';
-		$forced = false;
-		$name = '';
-		$filename = $name;
-		$len = strlen($full_string);
-		if (!headers_sent()) {
-			$res=DocumentManager::string_send_for_download($full_string, $forced, $name);
-		}
-		$this->assertTrue(empty($res));
-	}
-*/
-	/**
-	 * Unset a document as template
-	 *
-	 * @param int $document_id
-	 * @param string $couse_code
-	 * @param int $user_id
-	 * @return void null
-	 */
-	function testunset_document_as_template() {
-		$document_id=Database::escape_string($document_id);
-		$course_code=Database::escape_string($course_code);
-		$user_id=Database::escape_string($user_id);
-		$res=DocumentManager::unset_document_as_template($document_id,
-														 $course_code,
-														 $user_id
-														);
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-	/*
-	public function testdeleteCourseInDocument(){
-		$this->dmanager = null;
-		global $_course;
-	 	$code = $_course;
-		$res = CourseManager::delete_course($code);
-		$path = api_get_path(SYS_PATH).'archive';
-		if ($handle = opendir($path)) {
-			while (false !== ($file = readdir($handle))) {
-				if (strpos($file,$code)!==false) {
-					if (is_dir($path.'/'.$file)) {
-						rmdirr($path.'/'.$file);
-					}
-				}
-			}
-			closedir($handle);
-		}
-
-	}*/
-}
-?>

+ 0 - 150
tests/main/inc/lib/events.lib.inc.test.php

@@ -1,150 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'events.lib.inc.php');
-
-class TestEvents extends UnitTestCase {
-
-    public function __construct(){
-        $this->UnitTestCase('Events library - main/inc/events.lib.inc.test.php');
-    }
-
-	function testCreateEventExerciceEmptyExoId() {
-		global $_user, $_cid, $_configuration;
-		$exo_id='';
-		$res=create_event_exercice($exo_id);
-		$this->assertFalse($res);
-		//var_dump($res);
-	}
-
-    function testCreateEventExerciceUnexistingExoId() {
-        global $_user, $_cid, $_configuration;
-        $exo_id=3589534; //unexisting exe ID
-        $res=create_event_exercice($exo_id);
-        $this->assertFalse($res);
-        //var_dump($res);
-    }
-
-	function testEventAccessCourse() {
-		global $_configuration;
-		global $_user;
-		global $_cid;
-		global $TABLETRACK_ACCESS;
-		global $TABLETRACK_LASTACCESS;
-		$res=event_access_course();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testEventAccessTool() {
-		global $_configuration;
-		global $_cid;
-		global $TABLETRACK_ACCESS;
-		global $_configuration;
-		global $_course;
-		global $TABLETRACK_LASTACCESS;
-		$tool = '';
-		$id_session = 0;
-		$res=event_access_tool($tool, $id_session);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testEventDownload() {
-		global $_configuration;
-		global $_user;
-		global $_cid;
-		global $TABLETRACK_DOWNLOADS;
-		$doc_url= '';
-		$res=event_download($doc_url);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testEventLink() {
-		global $_configuration;
-		global $_user;
-		global $_cid;
-		global $TABLETRACK_LINKS;
-		$link_id='';
-		$res=event_link($link_id);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testEventLogin() {
-		global $_configuration;
-		global $_user;
-		global $TABLETRACK_LOGIN;
-		$res=event_login();
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-
-	function testEventOpen() {
-		global $_configuration;
-		global $TABLETRACK_OPEN;
-		$res=event_open();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testEventSystem() {
-		global $_configuration;
-		global $_user;
-		global $TABLETRACK_DEFAULT;
-		$event_type = Database::escape_string($event_type);
-		$event_value_type = Database::escape_string($event_value_type);
-		$event_value = Database::escape_string($event_value);
-		$res=event_system($event_type, $event_value_type,$event_value);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-
-	function testEventUpload() {
-		global $_configuration;
-		global $_user;
-		global $_cid;
-		global $TABLETRACK_UPLOADS;
-		$doc_id='';
-		$res=event_upload($doc_id);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testExerciseAttempt() {
-		$score = Database::escape_string($score);
-		$answer = Database::escape_string($answer);
-		$quesId = Database::escape_string($quesId);
-		$exeId = Database::escape_string($exeId);
-		$j = Database::escape_string($j);
-		global $_configuration, $_user, $_cid;
-		$res=exercise_attempt($score,$answer,$quesId,$exeId,$j);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testExerciseAttemptHotspot() {
-		global $_configuration, $_user, $_cid;
-		$exe_id='';
-		$question_id='';
-		$answer_id='';
-		$correct='';
-		$coords='';
-		$res=exercise_attempt_hotspot($exe_id, $question_id, $answer_id, $correct, $coords);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testUpdateEventExercice() {
-		$exeid='';
-		$exo_id='';
-		$score='';
-		$weighting='';
-		$session_id='';
-		$duration='';
-		$res=update_event_exercice($exeid,$exo_id, $score, $weighting,$session_id,$learnpath_id=0,$learnpath_item_id=0, $duration);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 121
tests/main/inc/lib/exercise_show_functions.lib.test.php

@@ -1,121 +0,0 @@
-<?php
-
-class TestExerciseShowFunctions extends UnitTestCase {
-	
-	/**
-	 * Shows the answer to a fill-in-the-blanks question, as HTML
-	 * @param string    Answer text
-	 * @param int       Exercise ID
-	 * @param int       Question ID
-	 * @return void
-	 */
-	
-	function testdisplay_fill_in_blanks_answer() {
-		$answer= 'test';
-		$id=1;
-		$questionId=1;
-		ob_start();
-		$res = ExerciseShowFunctions::display_fill_in_blanks_answer($answer,$id,$questionId);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * Shows the answer to a free-answer question, as HTML
-	 * @param string    Answer text
-	 * @param int       Exercise ID
-	 * @param int       Question ID
-	 * @return void
-	 */
-	 
-	function testdisplay_free_answer() {
-		$answer= 'test';
-		$id=1;
-		$questionId=1;
-		ob_start();
-		$res = ExerciseShowFunctions::display_free_answer($answer,$id,$questionId);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * Displays the answer to a hotspot question
-	 * @param int $answerId
-	 * @param string $answer
-	 * @param string $studentChoice
-	 * @param string $answerComment
-	 * @return void
-	 */
-	 
-	 function testdisplay_hotspot_answer() {
-	 	$answerId = 1;
-		$answer= 'testanswer';
-		$studentChoice='testchoise';
-		$answerComment='testcomment';
-		ob_start();
-		$res = ExerciseShowFunctions::display_hotspot_answer($answerId, $answer, $studentChoice, $answerComment);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * Display the answers to a multiple choice question
-	 * @param integer Answer type
-	 * @param integer Student choice
-	 * @param string  Textual answer
-	 * @param string  Comment on answer
-	 * @param string  Correct answer comment
-	 * @param integer Exercise ID
-	 * @param integer Question ID
-	 * @param boolean Whether to show the answer comment or not
-	 * @return void
- 	 */
- 	 
-	 function testdisplay_unique_or_multiple_answer() {
-	 	global $feedback_type, $_course;
-	 	$answerType = 1;
-		$studentChoice='testchoise';
-		$answer= 'testanswer';
-		$answerComment='testcomment';
-		$answerCorrect='testcorrect';
-		$id = 1;
-		$questionId = 1;
-		$ans=true;
-		ob_start();
-		$res = ExerciseShowFunctions::display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect, $id, $questionId, $ans);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	
-	/**
-	 * This function gets the comments of an exercise
-	 *
-	 * @param int $id
-	 * @param int $question_id
-	 * @return str the comment
-	 */
-	 
-	 function testget_comments() {
-		$id = 1;
-		$question_id = 1;
-		ob_start();
-		$res = ExerciseShowFunctions::get_comments($id,$question_id);
-		ob_end_clean();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	} 
-	
-	 function testsend_notification() {
-		$arrques = 'test';
-		$arrans = 'test';
-		$to = 'test';
-		$res = ExerciseShowFunctions::send_notification($arrques, $arrans, $to);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	} 	
-}
-?>

+ 0 - 109
tests/main/inc/lib/export.lib.inc.test.php

@@ -1,109 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'export.lib.inc.php');
-require_once(api_get_path(LIBRARY_PATH).'document.lib.php');
-
-/** Test about export csv using class document manager
- * @author Arthur portugal
- * To can test and show the var_dump is necesary comment inside the class
- * DocumentManager in the file document.lib.php the word "exit()", because
- * "exit" not permit show the result.
- */
-class TestExport extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Export library - main/inc/lib/export.lib.inc.test.php');
-    }
-
-    /**
-     * Checks the export_table_csv method.
-     * @todo check that a new file is created in api_get_path(SYS_ARCHIVE_PATH)
-     */
-    function testExportTableCsv() {
-        $data = array();
-        // can only be tested if headers were not sent
-        ob_start();
-       	$res = Export::export_table_csv($data, $filename = 'export');
-		$this->assertFalse($res);
-		ob_end_clean();
-    }
-
-
- 	function testExportTableXls() {
-		$data = array();
-		$filename = 'export';
-        ob_start();
-		$res=Export::export_table_xls($data,$filename);
-		$this->assertFalse($res);
-        ob_end_clean();
- 	}
-
- 	function testExportTableXml() {
-		$data = array();
-		$filename = 'export';
-		$item_tagname = 'item';
-		$wrapper_tagname = null;
-		$encoding=null;
-        ob_start();
-		$res=Export::export_table_xml($data,$filename,$item_tagname,
-									  $wrapper_tagname,$encoding);
-        $this->assertFalse($res);
-        ob_end_clean();
- 	}
-
- 	function testExportComplexTableXml() {
-		$data = array();
-		$filename = 'export';
-		$wrapper_tagname=null;
- 		$encoding='ISO-8859-1';
-        ob_start();
- 		$res=Export::export_complex_table_xml($data,$filename,
-	 		                                        $wrapper_tagname,$encoding);
-        $this->assertFalse($res);
-        ob_end_clean();
- 	}
-
-  	function testExportComplexTableXmlHelper() {
-  		$data = array();
-		$level=1;
-        ob_start();
-		$res=Export::_export_complex_table_xml_helper($data,$level);
-        $this->assertTrue(is_string($res));
-        ob_end_clean();
-  	}
-
- 	function testBackupDatabase() {
- 		$link='';
- 		$db_name='';
- 		$structure='';
- 		$donnees='';
- 		$format = 'SQL';
- 		$whereSave = '.';
- 		$insertComplet = '';
- 		$verbose = false;
- 		global $error_msg, $error_no;
- 		$res=backupDatabase($link, $db_name, $structure, $donnees);
- 		$this->assertTrue(is_bool($res));
- 		//var_dump($res);
- 	}
- 	/* DEPRECATED
- 	function testCopydir() {
- 		$origine='';
- 		$destination='';
- 		$verbose = '';
- 		$res =Export::copydir($origine, $destination, $verbose = false);
- 		$this->assertTrue($res);
- 		var_dump($verbose);
- 	}*/
-
- 	function testmakeTheBackup() {
- 		global $error_msg, $error_no, $db, $archiveRepositorySys,
- 		       $archiveRepositoryWeb, $appendCourse, $appendMainDb, $archiveName,
- 			   $_configuration, $_course, $TABLEUSER, $TABLECOURSUSER,
- 			   $TABLECOURS, $TABLEANNOUNCEMENT;
-		$exportedCourseId='';
-		$res=makeTheBackup($exportedCourseId);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
- 	}
-}
-?>

+ 0 - 76
tests/main/inc/lib/fileDisplay.lib.test.php

@@ -1,76 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'fileDisplay.lib.php');
-class TestFileDisplay extends UnitTestCase {
-
-	public function TestFileDisplay(){
-		$this->UnitTestCase('File display library - main/inc/lib/fileDisplay.lib.test.php');
-	}
-	//todo public function testArraySearch()
-	//todo public function testChooseImage()
-	//todo public function testFormatFileSize()
-	//todo public function testFormatDate()
-	//todo public function testFormatUrl()
-	//todo public function testRecentModifiedFileTime()
-	//todo public function testFolderSize()
-	//todo public function testGetTotalFolderSize()
-
-	public function testChooseImage(){
-		global $_course;
-
-		static $type, $image;
-		$file_name = '';
-		$res = choose_image($file_name);
-		$this->assertEqual($res,'defaut.gif');
-		$this->assertTrue(is_string($res));
-		//var_dump($file_name);
-	}
-
-	public function testFormatFileSize(){
-		$file_size = '100';
-		$res = format_file_size($file_size);
-		$this->assertTrue($res);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-
-	}
-
-	public function testFormatDate(){
-		$date = '11/02/2009';
-		$res = format_date($date);
-		$this->assertTrue($res);
-		//var_dump($res);
-
-	}
-
-	public function testFormatUrl(){
-		$file_path ='/var/www/path/';
-		$res = format_url($file_path);
-		$this->assertTrue($res);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-
-	}
-
-	public function testRecentModifiedFileTime(){
-		$dir_name = '';
-		$$do_recursive =true;
-		$res = recent_modified_file_time($dir_name, $do_recursive);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-
-	}
-
-	public function testFolderSize(){
-		$dir_name ='';
-		$res = folder_size($dir_name);
-		$this->assertFalse($res);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-
-
-	}
-
-}
-
-
-?>

+ 0 - 191
tests/main/inc/lib/fileManage.lib.test.php

@@ -1,191 +0,0 @@
-<?php
-//require_once(api_get_path(LIBRARY_PATH).'classManager.lib.php');
-class TestFileManager extends UnitTestCase {
-
-	public $fmanager;
-	public function TestFileManager(){
-		$this->UnitTestCase ('File Manager library - main/inc/lib/fileManage.lib.test.php');
-	}
-
-	public function setUp(){
-		$this->fmanager = new FileManager();
-	}
-
-	public function tearDown(){
-		$this->fmanager = null;
-	}
-
-	//todo public function testUpdatedbInfo
-	//todo public function testCheckNameExist
-	//todo public function testMyDelete
-	//todo public function testRemoveDir
-	//todo public function testMyRename
-	//todo public function testMove
-	//todo public function testCopyDirTo
-	//todo public function testIndexDir
-	//todo public function testIndexAndSortDir
-	//todo public function testFormDirList
-	//todo public function testMkpath
-	//todo public function testGetextension
-	//todo public function testDirsize
-	//todo public function testListAllDirectories
-	//todo public function testListAllFiles
-	//todo public function testCompatLoadFile
-	//todo public function testSetDefaultSettings
-	//todo public function testMkdirs
-
-	public function testUpdatedbInfo(){
-		$action ='';
-		$oldPath ='';
-		$res = update_db_info($action, $oldPath, $newPath="");
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-
-	public function testCheckNameExist(){
-		$filePath ='';
-		$res = check_name_exist($filePath);
-		$this->assertFalse($res);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === false);
-		//var_dump($res);
-	}
-
-	public function testMyDelete(){
-		$file='';
-		$res = my_delete($file);
-		$this->assertFalse($res);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res===false);
-		//var_dump($res);
-	}
-
-	public function testRemoveDir(){
-		$dir='';
-		$res = removeDir($dir);
-		$this->assertTrue(is_bool($res));
-		$this->assertFalse($res === true);
-		//var_dump($res);
-	}
-
-	public function testMyRename(){
-		$filePath ='document/';
-		$newFileName='';
-		$res = my_rename($filePath, $newFileName);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === false);
-		//var_dump($res);
-	}
-
-	public function testMove(){
-		$source ='';
-		$target ='';
-		$res = move($source, $target);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === false);
-		$this->assertFalse($res);
-		//var_dump($res);
-	}
-
-	public function testCopyDirTo(){
-		$origDirPath=api_get_path(SYS_COURSE_PATH).'document/audio';
-		$destination=api_get_path(SYS_COURSE_PATH).'document/flash/audio';
-		$res = copyDirTo($origDirPath, $destination, $move = false);
-		$this->assertTrue($res===null);
-		$this->assertNull($res);
-	}
-
-	public function testIndexDir(){
-		$path=api_get_path(SYS_COURSE_PATH).'document/';
-	  	$res = index_dir($path);
-	  	if(!is_null($res)) {
-			$this->assertTrue(is_array($res));
-	  	} else {
-	  		$this->assertFalse($res);
-	  	}
-		//var_dump($res);
-	}
-
-	public function testIndexAndSortDir(){
-		$path=api_get_path(SYS_COURSE_PATH).'document/';
-		$res = index_and_sort_dir($path);
-		if(!is_bool($res)) {
-			$this->assertTrue($res);
-			$this->assertTrue(is_array($res));
-		}
-		//var_dump($res);
-	}
-
-	public function testFormDirList(){
-		$sourceType = '';
-		$sourceComponent = '';
-		$command = '';
-		$baseWorkDir = api_get_path(SYS_COURSE_PATH).'document/';
-		$res = form_dir_list($sourceType, $sourceComponent, $command, $baseWorkDir);
-		$this->assertTrue($res);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testMkpath(){
-		$path=api_get_path(SYS_COURSE_PATH).'document/';
-		$res =mkpath($path, $verbose=false);
-		if(!is_null($res)) {
-		$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res);
-	}
-
-	public function testGetextension(){
-		$filename='documents';
-		$res =getextension($filename);
-		$this->assertTrue($res);
-		$this->assertTrue(is_array($res));
-	}
-
-	public function testDirsize(){
-		$root='';
-		$res =dirsize($root,$recursive=true);
-		$this->assertFalse($res);
-		$this->assertTrue(is_numeric($res));
-		$this->assertTrue($res ===0);
-		//var_dump($res);
-	}
-
-	public function testListAllDirectories(){
-		$path=api_get_path(SYS_COURSE_PATH).'document/';
-		$res = $this->fmanager->list_all_directories($path);
-		if(!is_null($res)) {
-			$this->assertTrue($res);
-			$this->assertTrue(is_array($res));
-		}
-		//var_dump($res);
-	}
-
-	public function testListAllFiles(){
-		$dirArray = array('COURSETEST, document, images');
-		$res = $this->fmanager->list_all_files($dirArray);
-		$this->assertFalse($res);
-		$this->assertTrue(is_array($res));
-		$this->assertTrue($res === array());
-		//var_dump($res);
-	}
-
-	public function testCompatLoadFile(){
-		$file_name='README.txt';
-		$res = $this->fmanager->compat_load_file($file_name);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testSetDefaultSettings(){
-		global $_course, $_configuration;
-		$upload_path=api_get_path(SYS_COURSE_PATH);
-		$filename='index.html';
-		$glue_table = $_course['dbName'].'.document';
-		$res = $this->fmanager->set_default_settings($upload_path, $filename, $filetype="file", $glue_table, $default_visibility='v');
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 196
tests/main/inc/lib/fileManager.lib.test.php

@@ -1,196 +0,0 @@
-<?php
-//require_once(api_get_path(LIBRARY_PATH).'classManager.lib.php');
-
-
-class TestFileManager extends UnitTestCase {
-
-	public $fmanager;
-	public function TestFileManager(){
-
-		$this->UnitTestCase ('File Display Manager');
-
-
-	}
-
-	public function setUp(){
-
-		$this->fmanager = new FileManager();
-	}
-
-	public function tearDown(){
-
-		$this->fmanager = null;
-	}
-
-	//todo public function testUpdatedbInfo
-	//todo public function testCheckNameExist
-	//todo public function testMyDelete
-	//todo public function testRemoveDir
-	//todo public function testMyRename
-	//todo public function testMove
-	//todo public function testCopyDirTo
-	//todo public function testIndexDir
-	//todo public function testIndexAndSortDir
-	//todo public function testFormDirList
-	//todo public function testMkpath
-	//todo public function testGetextension
-	//todo public function testDirsize
-	//todo public function testListAllDirectories
-	//todo public function testListAllFiles
-	//todo public function testCompatLoadFile
-	//todo public function testSetDefaultSettings
-	//todo public function testMkdirs
-
-	public function testUpdatedbInfo(){
-		$action ='';
-		$oldPath ='';
-		$res = update_db_info($action, $oldPath, $newPath="");
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testCheckNameExist(){
-		$filePath ='';
-		$res = check_name_exist($filePath);
-		$this->assertFalse($res);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === false);
-		//var_dump($res);
-	}
-
-	public function testMyDelete(){
-		$file='';
-		$res = my_delete($file);
-		$this->assertFalse($res);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res===false);
-		//var_dump($res);
-	}
-
-	public function testRemoveDir(){
-		$dir='';
-		$res = removeDir($dir);
-		$this->assertTrue(is_bool($res));
-		$this->assertFalse($res === true);
-		//var_dump($res);
-	}
-
-	public function testMyRename(){
-		$filePath ='documents';
-		$newFileName='';
-		$res = my_rename($filePath, $newFileName);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === false);
-		//var_dump($res);
-	}
-
-	public function testMove(){
-		$source ='';
-		$target ='';
-		$res = move($source, $target);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === false);
-		$this->assertFalse($res);
-		//var_dump($res);
-	}
-
-	public function testCopyDirTo(){
-		$origDirPath='';
-		$destination='';
-		$res = copyDirTo($origDirPath, $destination, $move=true);
-		$this->assertTrue($res===null);
-		$this->assertNull($res);
-	}
-
-	public function testIndexDir(){
-		$path='/var/www/path/';
-	  	$res = index_dir($path);
-		$this->assertFalse(is_array($res));
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-
-	public function testIndexAndSortDir(){
-		$path='/var/www/path/';
-		$res = index_and_sort_dir($path);
-		$this->assertFalse($res);
-		$this->assertFalse(is_array($res));
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === false);
-		//var_dump($res);
-	}
-
-	public function testFormDirList(){
-		$sourceType='';
-		$sourceComponent='';
-		$command='';
-		$baseWorkDir='';
-		$res =form_dir_list($sourceType, $sourceComponent, $command, $baseWorkDir);
-		$this->assertTrue($res);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testMkpath(){
-		$path='/var/www/path/';
-		$res =mkpath($path, $verbose=false);
-		$this->assertFalse($res);
-		$this->assertNull($res);
-		$this->assertTrue($res === null);
-		//var_dump($res);
-	}
-
-	public function testGetextension(){
-		$filename='documents';
-		$res =getextension($filename);
-		$this->assertTrue($res);
-		$this->assertTrue(is_array($res));
-	}
-
-	public function testDirsize(){
-		$root='';
-		$res =dirsize($root,$recursive=true);
-		$this->assertFalse($res);
-		$this->assertTrue(is_numeric($res));
-		$this->assertTrue($res ===0);
-		//var_dump($res);
-	}
-
-	public function testListAllDirectories(){
-		$path='/var/www/path/';
-		$res = $this->fmanager->list_all_directories($path);
-		$this->assertFalse($res);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testListAllFiles(){
-		$dirArray='documents';
-		$res = $this->fmanager->list_all_files($dirArray);
-		$this->assertFalse($res);
-		$this->assertTrue(is_null($res));
-		$this->assertTrue($res ===null);
-		//var_dump($res);
-	}
-
-	public function testCompatLoadFile(){
-		$file_name='images';
-		$res = $this->fmanager->compat_load_file($file_name);
-		$this->assertFalse($res);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testSetDefaultSettings(){
-		$upload_path='/var/www/path/ruta';
-		$filename='doc';
-		$glued_table='xxx';
-		$res = $this->fmanager->set_default_settings($upload_path, $filename, $filetype="file", $glued_table, $default_visibility='v');
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-}
-
-
-?>

+ 0 - 382
tests/main/inc/lib/fileUpload.lib.test.php

@@ -1,382 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'document.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php');
-
-class TestFileUpload extends UnitTestCase {
-
-    public function __construct(){
-        $this->UnitTestCase('File upload library - main/inc/lib/fileUpload.lib.test.php');
-    }
-/*
- 		//Deprecated
- 		//settings
-
-		function testset_default_settings() {
-			global $dbTable,$_configuration;
-			global $default_visibility;
-			$upload_path = api_get_path(SYS_PATH).'courses';
-			$filename = 'test.txt';
-			$res= set_default_settings($upload_path,$filename,$filetype="file");
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-		}
-*/
-		//Creating
-
-		function testCreateUnexistingDirectory()  {
-			global $_course, $user_id;
-			$to_group_id = 1;
-			$to_user_id = 1;
-			$base_work_dir = api_get_path(SYS_COURSE_PATH).'document/';
-			$desired_dir_name = 'images';
-			$res= create_unexisting_directory($_course,$user_id,$to_group_id,$to_user_id,$base_work_dir,$desired_dir_name);
-
-			if(!is_null($res)) {
-				$this->assertTrue(is_bool($res));
-				$this->assertFalse($res);
-			}
-		}
-
-		/**
-		 * Creates a file containing an html redirection to a given url
-		 * @param string $filePath
-		 * @param string $url
-		 * @return void
-		 */
-		function testCreateLinkFile() {
-			$base_work_dir=api_get_path(SYS_COURSE_PATH);
-			$filePath = $base_work_dir.'upload/blog';
-			$dirurl = api_get_path(WEB_COURSE_PATH);
-			$url = $dirurl.'doc.php';
-			$res= create_link_file($filePath, $url);
-			if (!is_numeric($res)) {
-				$this->assertFalse($res);
-			} else {
-				 $this->assertTrue($res);
-			}
-		}
-
-		/**
-		 * This recursive function can be used during the upgrade process form older versions of Dokeos
-		 * It crawls the given directory, checks if the file is in the DB and adds it if it's not
-		 *
-		 * @param string $base_work_dir
-		 * @param string $current_path, needed for recursivity
-		 */
-		function testAddAllDocumentsInFolderToDatabase() {
-			global $_course, $user_id;
-			$base_work_dir= api_get_path(SYS_PATH).'';
-			$current_path = 'courses/';
-			$to_group_id =0;
-			$res=add_all_documents_in_folder_to_database($_course,$user_id,$base_work_dir,$current_path,$to_group_id);
-	        $this->assertTrue(is_null($res));
-	        //var_dump($res);
-		}
-
-		function testAddDocument() {
-			global $_course;
-			$path='';
-			$filetype='';
-			$filesize='';
-			$title='';
-			$res=add_document($_course,$path,$filetype,$filesize,$title);
-			if(!is_numeric($res)) :
-			$this->assertTrue(is_bool($res));
-			endif;
-			//var_dump($res);
-		}
-
-		function testAddExtOnMime() {
-			$fileName='';
-			$fileType='';
-			$res=add_ext_on_mime($fileName,$fileType);
-			$this->assertTrue(is_string($res));
-			//var_dump($res);
-		}
-
-		//build
-
-		function testBuildMissingFilesForm() {
-			global	$_course;
-			$missing_files = array();
-			$upload_path=api_get_path(SYS_CODE_PATH).'default_course_document/images';
-			$file_name = 'board.jpg';
-			$res=build_missing_files_form($missing_files,$upload_path,$file_name);
-			$this->assertTrue(is_string($res));
-			//var_dump($res);
-		}
-
-		//check
-
-		function testCheckForMissingFiles() {
-			$file='';
-			$res=check_for_missing_files($file);
-			$this->assertTrue(is_bool($res));
-		}
-
-		//space
-
-		function testDirTotalSpace() {
-			$dirPath= api_get_path(SYS_CODE_PATH).'default_course_document/images';
-			$res= dir_total_space($dirPath);
-			$this->assertTrue($res>0,'The default_course_document/images dir should be larger than 0 bytes');
-		}
-
-		//filter
-
-		function testfilter_extension() {
-			$filename='index.php';
-			$res= filter_extension($filename);
-			$this->assertTrue(is_numeric($res));
-		}
-
-		//get
-
-		function testget_document_title() {
-			$name='';
-			$res= get_document_title($name);
-			$this->assertTrue(is_string($res));
-			//var_dump($res);
-		}
-
-		function testget_levels() {
-			$filename='readme.txt';
-			$res= get_levels($filename);
-			$this->assertTrue(is_numeric($res));
-			//var_dump($res);
-		}
-
-		//access
-
-		function testhtaccess2txt() {
-			$filename = 'readme.txt';
-			$res= htaccess2txt($filename);
-			$this->assertTrue(is_string($res));
-			//var_dump($res);
-		}
-
-		//moving
-
-		function testmove_uploaded_file_collection_into_directory() {
-			global $_course;
-			$uploaded_file_collection=array();
-			$base_work_dir=api_get_path(SYS_COURSE_PATH).'upload/';
-			$missing_files_dir='';
-			$user_id=1;
-			$to_group_id='';
-			$to_user_id='';
-			$max_filled_space='';
-			$res= move_uploaded_file_collection_into_directory($_course, $uploaded_file_collection, $base_work_dir, $missing_files_dir,$user_id,$to_group_id,$to_user_id,$max_filled_space);
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-		}
-
-		//php?
-
-		function testphp2phps () {
-			$fileName = 'index.php';
-			$res= php2phps($fileName);
-			$this->assertTrue(is_string($res));
-			//var_dump($res);
-		}
-
-		//searching
-
-		function testsearch_img_from_html() {
-			$imgFilePath = array();
-			$htmlFile= 'file:///var/www/chamilotest/documentation/credits.html';
-			$res= search_img_from_html($htmlFile);
-			if(is_array($res)){
-			$this->assertTrue(is_array($res));
-			} else {
-			$this->assertTrue(is_null($res));
-			}
-			//var_dump($res);
-		}
-
-		//uploading
-
-		function testprocess_uploaded_file() {
-			$uploaded_file='';
-			ob_start();
-			$res= process_uploaded_file($uploaded_file);
-			ob_end_clean();
-			$this->assertTrue(is_bool($res));
-		}
-
-		function testtreat_uploaded_file() {
-			$uploadedFile['name']=stripslashes($uploadedFile['name']);
-			$uploadedFile='';
-			$baseWorkDir='';
-			$uploadPath='';
-			$maxFilledSpace='';
-			$uncompress= '';
-			$res= treat_uploaded_file($uploadedFile, $baseWorkDir, $uploadPath, $maxFilledSpace, $uncompress= '');
-			$this->assertTrue(is_bool($res));
-			//var_dump($res);
-		}
-
-		function testhandle_uploaded_document() {
-			global $_course;
-			$uploaded_file='';
-			$base_work_dir='';
-			$upload_path='';
-			$user_id=1;
-			$to_group_id=0;
-			$to_user_id=NULL;
-			$maxFilledSpace='';
-			$unzip=0;
-			$what_if_file_exists='';
-			$output=true;
-			$clean_name = disable_dangerous_file($clean_name);
-			$where_to_save = $base_work_dir.$upload_path;
-			$new_name = unique_name($where_to_save, $clean_name);
-			$new_file_path = $upload_path.$new_name;
-			$clean_name = disable_dangerous_file($clean_name);
-			$file_path = $upload_path.$clean_name;
-			ob_start();
-			$res= handle_uploaded_document($_course,$uploaded_file,$base_work_dir,$upload_path,$user_id,$to_group_id=0,$to_user_id=NULL,$maxFilledSpace='',$unzip=0,$what_if_file_exists='',$output=true);
-			$this->assertTrue(is_null($res));
-			ob_end_clean();
-			//var_dump($res);
-		}
-
-		//updating
-
-		function testupdate_existing_document() {
-			$_course='';
-			$document_id='';
-			$filesize='';
-			$res= update_existing_document($_course,$document_id,$filesize,$readonly=0);
-			$this->assertTrue(is_bool($res));
-			//var_dump($res);
-		}
-
-		function testitem_property_update_on_folder() {
-			global $_course, $user_id;
-			$path=api_get_path(SYS_COURSE_PATH).'document/license.txt';
-			$res= item_property_update_on_folder($_course,$path,$user_id);
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-		}
-
-		//unique name
-
-		function testunique_name() {
-			$path='';
-			$name='';
-			$res= unique_name($path,$name);
-			$this->assertTrue(is_string($res));
-			//var_dump($res);
-		}
-
-		//unzipping
-
-		function testunzip_uploaded_document() {
-			//require_once(api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php');
-			global $_course;
-			global $_user;
-			global $to_user_id;
-			global $to_group_id;
-			$uploaded_file='';
-			$upload_path='';
-			$base_work_dir='';
-			$max_filled_space='';
-			ob_start();
-			$res= unzip_uploaded_document($uploaded_file, $upload_path, $base_work_dir, $max_filled_space, $output = true, $to_group_id=0);
-			ob_end_clean();
-			$this->assertTrue(is_bool($res));
-			//var_dump($res);
-		}
-
-		function testunzip_uploaded_file() {
-			global $_course;
-			$uploadedFile   = 'README.txt';
-			$uploadPath     = api_get_path(SYS_PATH).$_course.'/document';
-			$baseWorkDir    = api_get_path(SYS_PATH);
-			$maxFilledSpace = 1000;
-			$res= unzip_uploaded_file($uploadedFile, $uploadPath, $baseWorkDir, $maxFilledSpace);
-			$this->assertTrue(is_bool($res));
-			//var_dump($res);
-		}
-
-		//disable
-
-		function testDisableDangerousFile() {
-			$filename = 'index.php';
-			$res= disable_dangerous_file($filename);
-			$this->assertTrue(is_string($res));
-			//var_dump($res);
-		}
-
-		//replace
-
-		function testreplace_img_path_in_html_file() {
-			global $_course;
-			$originalImgPath='';
-			$newImgPath='';
-			$htmlFile='file:///var/www/chamilotest/documentation/credits.html';
-			$res= replace_img_path_in_html_file($originalImgPath, $newImgPath, $htmlFile);
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-		}
-
-		function testApiReplaceLinksInHtml() {
-			$base_work_dir=api_get_path(SYS_COURSE_PATH);
-			$upload_path=$base_work_dir.'upload/blog';
-			$full_file_name = 'doc.php';
-			$res=api_replace_links_in_html($upload_path,$full_file_name);
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-		}
-
-		function testApiReplaceLinksInString() {
-			$base_work_dir=api_get_path(SYS_COURSE_PATH);
-			$upload_path=$base_work_dir.'upload/blog';
-			$buffer=ob_get_contents();
-			$res=api_replace_links_in_string($upload_path,$buffer);
-			$this->assertTrue(is_string($res));
-			//var_dump($res);
-		}
-
-		function testApiReplaceParameter() {
-			$count = 0;
-			$matches = array();
-			$href_list=array();
-			$file_path_list[] = $matches[1];
-			$base_work_dir=api_get_path(SYS_COURSE_PATH);
-			$upload_path=$base_work_dir.'upload/blog';
-			$replaceWhat[$count] = $href_list[$count];
-			/** To can test this function you need to comment "die ('can not create file')"
-			 *  $res return void
-		 	*/
-		 	$replaceBy[$count] = " $param_name=\"" . $file_path_list[$count] . "\" target =\"_top\"";
-			$replaceBy[$count] = $replaceWhat[$count];
-			$buffer = str_replace($replaceWhat, $replaceBy, $buffer);
-			$param_name="src";
-			$res=api_replace_parameter($upload_path, $buffer, $param_name="src");
-			$this->assertTrue(is_string($res));
-			//var_dump($res);
-		}
-
-		//clenaning
-
-
-		function testCleanUpFilesInZip() {
-			$p_event='';
-			$p_header['filename']='';
-			$res=clean_up_files_in_zip($p_event, &$p_header);
-			$this->assertTrue(is_numeric($res));
-			//var_dump($res);
-		}
-
-		function testCleanUpPath() {
-			$base_work_dir=api_get_path(SYS_COURSE_PATH);
-			$path = $base_work_dir.'upload/blog';
-			$res = clean_up_path($path);
-			$this->assertTrue(is_numeric($res));
-
-		}
-}
-?>

+ 0 - 9
tests/main/inc/lib/geometry.lib.test.php

@@ -1,9 +0,0 @@
-<?php
-class TestGeometry extends UnitTestCase {
-
-	public function TestGeometry(){
-		$this->UnitTestCase('Geometry library - main/inc/lib/geometry.lib.test.php');
-	}
-    //@TODO: Removed deprecated tests. Make sure to rebuild new tests here
-}
-?>

+ 0 - 157
tests/main/inc/lib/glossary.lib.test.php

@@ -1,157 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'glossary.lib.php');
-
-class TestGlossary extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Glossary library - main/inc/lib/glossary.lib.test.php');
-        //build a course for these tests
-        TestManager::create_test_course('COURSEGLOSSARY');
-    }
-
-    public function __destruct() {
-    	TestManager::delete_test_course('COURSEGLOSSARY');
-    }
-
-	function testGetGlossaryTerms() {
-		$res = GlossaryManager::get_glossary_terms();
-		$this->assertTrue(is_array($res));
-	}
-
-	function testSaveGlossaryIncomplete() {
-		$values = 'stuffing';
-        ob_start();
-		$res = GlossaryManager::save_glossary($values);
-        ob_end_clean();
-		$this->assertFalse($res);
-	}
-	function testSaveGlossaryComplete() {
-		$values = array('glossary_title'=>'stuffing','glossary_description'=>'something to fill');
-        ob_start();
-        $res = GlossaryManager::save_glossary($values);
-        ob_end_clean();
-        $this->assertTrue(is_numeric($res));
-        $this->assertTrue($res > 0);
-        //clean
-        ob_start();
-        GlossaryManager::delete_glossary($res);
-        ob_end_clean();
-	}
-
-	function testGetGlossaryTermByGlossaryIdIsString() {
-		$glossary_id = 1;
-		$res = GlossaryManager::get_glossary_term_by_glossary_id($glossary_id);
-		$this->assertTrue(is_string($res));
-	}
-	function testGetGlossaryTermByGlossaryIdIsEmpty() {
-		$glossary_id = 1000000;
-        $res = GlossaryManager::get_glossary_term_by_glossary_id($glossary_id);
-        $this->assertEqual($res,'');
-	}
-
-	function testGetGlossaryTermByGlossaryName() {
-		$glossary_name = '';
-		$res = GlossaryManager::get_glossary_term_by_glossary_name($glossary_name);
-		$this->assertTrue(is_string($res));
-	}
-
-	function testUpdateGlossary() {
-		ob_start();
-		$values = '';
-		$res = GlossaryManager::update_glossary($values);
-        ob_end_clean();
-		$this->assertFalse($res);
-	}
-
-	function testGetMaxGlossaryItem() {
-		$res = GlossaryManager::get_max_glossary_item();
-		$this->assertTrue(is_numeric($res));
-	}
-
-
-	function testGlossaryExists() {
-		$term = '';
-		$not_id = 1;
-		$res = GlossaryManager::glossary_exists($term,$not_id);
-		$this->assertTrue(is_bool($res));
-	}
-
-	function testGetGlossaryInformation() {
-		$glossary_id = 1;
-		$res = GlossaryManager::get_glossary_information($glossary_id);
-		$this->assertTrue(is_bool($res));
-	}
-
-
-	function testDisplayGlossary() {
-		ob_start();
-		$res = GlossaryManager::display_glossary();
-        ob_end_clean();
-		$this->assertTrue(is_null($res));
-	}
-
-	function testDisplayGlossaryList() {
-		ob_start();
-		$res = GlossaryManager::display_glossary_list();
-		ob_end_clean();
-        $this->assertTrue($res);
-	}
-
-	function testGetNumberGlossaryTerms() {
-		$res = GlossaryManager::get_number_glossary_terms();
-		$this->assertTrue(is_numeric($res));
-	}
-
-	function testGetGlossaryData() {
-		$from = 1;
-		$number_of_items = 2;
-		$column = 1;
-		$direction = 'ASC';
-		$res = GlossaryManager::get_glossary_data($from, $number_of_items, $column, $direction);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testActionsFilter() {
-		$glossary_id = 1;
-		$url_params = '';
-		$row = '';
-		$res = GlossaryManager::actions_filter($glossary_id,$url_params,$row);
-		$this->assertTrue(is_string($res));
-	}
-
-	function testJavascriptGlossary() {
-		$res = GlossaryManager::javascript_glossary();
-		$this->assertTrue(is_string($res));
-	}
-
-	function testReorderGlossary() {
-		$res = GlossaryManager::reorder_glossary();
-		$this->assertTrue(is_null($res));
-	}
-
-	function testMoveGlossary() {
-		ob_start();
-		$direction = '';
-		$glossary_id = '';
-		$res = GlossaryManager::move_glossary($direction, $glossary_id);
-        ob_end_clean();
-		$this->assertTrue(is_null($res));
-	}
-
-	function testDeleteGlossaryIsFalse() {
-		ob_start();
-		$glossary_id = 1;
-		$res = GlossaryManager::delete_glossary($glossary_id);
-        ob_end_clean();
-		$this->assertFalse($res);
-	}
-
-	function testDeleteGlossaryIsTrue() {
-		$values = array('glossary_title'=>'stuffing','glossary_description'=>'something to fill');
-		ob_start();
-		$id = GlossaryManager::save_glossary($values);
-		$res = GlossaryManager::delete_glossary($id);
-		ob_end_clean();
-        $this->assertTrue($res);
-	}
-}

+ 0 - 464
tests/main/inc/lib/groupmanager.lib.test.php

@@ -1,464 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'database.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'classmanager.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'fileManage.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'tablesort.lib.php');
-
-
-class TestGroupManager extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Group manager library - main/inc/lib/groupmanager.lib.test.php');
-        TestManager::create_test_course('COURSEGROUP');
-    }
-
-    public function __destruct() {
-        TestManager::delete_test_course('COURSEGROUP');
-    }
-
-	/**
-	 *  Tests about groupmanager csv using many class database, class manager,
-	 * file manager, course manager and table sort.
-	 * @author Ricardo Rodriguez Salazar
-	 */
-	public function testGetGroupList(){
-		global $_user;
-		$res = GroupManager::get_group_list();
-		$this->assertTrue(is_array($res));
-	}
-
-	public function testCreateGroupIsNumeric(){
-		$name='1';
-		$category_id='1';
-		$tutor='';
-		$places='1';
-		global $_course, $_user;
-		$res = GroupManager::create_group($name, $category_id, $tutor, $places);
-		$this->assertTrue(is_numeric($res));
-		$this->assertTrue($res > 0);
-	}
-
-	public function testCreateSubgroups(){
-		global $_course;
-		$group_id = 1;
-		$number_of_groups = 2;
-		$res = GroupManager::create_subgroups($group_id, $number_of_groups);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testCreateGroupsFromVirtualCourses(){
-		$res = GroupManager::create_groups_from_virtual_courses();
-		$this->assertTrue($res);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testCreateClassGroups(){
-		$category_id=2;
-		$res =GroupManager::create_class_groups($category_id);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testDeleteGroups(){
-		$group_ids='01';
-		$course_code=null;
-		$res =GroupManager::delete_groups($group_ids, $course_code = null);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testGetGroupProperties(){
-		$group_id=01;
-		$res = GroupManager::get_group_properties($group_id);
-		$this->assertTrue($res);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testSetGroupProperties(){
-		$group= array('group_id'=>'01',
-					  'name'=>'1',
-					  'description'=>'',
-					  'maximum_number_of_students'=>'2',
- 					  'doc_state' =>'',
-                      'work_state' =>'',
-					  'calendar_state' =>'',
-					  'announcements_state'=>'',
-					  'forum_state'=>'',
-					  'wiki_state'=>'',
-					  'chat_state' =>'',
-					  'self_registration_allowed'=>'',
-					  'self_unregistration_allowed'=>'');
-		$res = GroupManager::set_group_properties($group['group_id'], $group['name'], $group['description'],
-													  $group['maximum_number_of_students'], $group['doc_state'],
-													  $group['work_state'], $group['calendar_state'], $group['announcements_state'],
-													  $group['forum_state'],$group['wiki_state'],$group['chat_state'], $group['self_registration_allowed'],
-													  $group['self_unregistration_allowed']);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testGetNumberOfGroups(){
-		$res = GroupManager::get_number_of_groups();
-		$this->assertTrue(($res));
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testGetCategories(){
-		$course_code ='COURSETEST';
-		$course_db = 'chamilo_COURSETEST';
-		$res = GroupManager::get_categories($course_code);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testGetCategory(){
-		$id =2;
-		$course_code = 'COURSETEST';
-		$res = GroupManager::get_category($id,$course_code);
-		$this->assertTrue(is_array($res));
-		$this->assertTrue($res);
-		//var_dump($res);
-	}
-
-	public function testGetCategoryFromGroup(){
-		$course_code='COURSETEST';
-		$group_id= 1;
-		$course_db = 'chamilo_COURSETEST';
-		$resu = GroupManager::get_category_from_group($group_id,$course_code);
-		$this->assertTrue(is_bool($resu));
-		//var_dump($res);
-		//var_dump($cat);
-	}
-
-	public function testDeleteCategory(){
-		$cat_id=1;
-		$course_code = 'COURSETEST';
-		$course_db = 'chamilo_COURSETEST';
-		$res = GroupManager::delete_category($cat_id, $course_code);
-		$this->assertTrue(is_null($res));
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-
-	public function testCreateCategory(){
-		$categ = array(
-		'title'=>'group test',
-		'description'=>'description test',
-		'doc_state'=> 1,
-		'work_state'=> 1,
-		'calendar_state'=> 1,
-		'announcements_state' => 1,
-		'forum_state' => 1,
-		'wiki_state' => 1,
-		'chat_state' => 1,
-		'self_registration_allowed' => TRUE,
-		'self_unregistration_allowed' => FALSE,
-		'maximum_number_of_students'=> 2,
-		'groups_per_user'=>4);
-		$res = GroupManager::create_category($categ['title'], $categ['description'],
-		$categ['doc_state'], $categ['work_state'], $categ['calendar_state'],
-		$categ['announcements_state'], $categ['forum_state'],$categ['wiki_state'],
-		$categ['chat_state'],$categ['self_registration_allowed'],$categ['self_unregistration_allowed'],
-		$categ['maximum_number_of_students'],$categ['groups_per_user']);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-
-	}
-
-	public function testUpdateCategory(){
-		$categ = array(
-		'id'=>2,
-		'title'=>'DefaultGroupCategory',
-		'description'=>'xxxxx',
-		'doc_state'=>'xxxx',
-		'work_state'=>'xxxxx',
-		'calendar_state'=>'',
-		'announcements_state'=>'',
-		'forum_state'=>'',
-		'wiki_state'=>'',
-		'chat_state' =>'',
-		'self_registration_allowed'=>'',
-		'self_unregistration_allowed'=>'',
-		'maximum_number_of_students'=>'',
-		'groups_per_user'=>'0');
-		$res = GroupManager::update_category($categ['id'], $categ['title'], $categ['description'],
-		$categ['doc_state'], $categ['work_state'], $categ['calendar_state'], $categ['announcements_state'],
-		$categ['forum_state'],$categ['wiki_state'], $categ['chat_state'],$categ['self_registration_allowed'],$categ['self_unregistration_allowed'],
-		$categ['maximum_number_of_students'],$categ['groups_per_user']);
-		$this->assertTrue(is_null($res));
-		$this->assertTrue($res ===null);
-	}
-
-	public function testGetCurrenMaxGroupsPerUser(){
-		$category_id = 2;
-		$course_code = 'COURSEGROUP';
-		$res =GroupManager::get_current_max_groups_per_user($category_id = null, $course_code = null);
-		$this->assertTrue(is_Null($res));
-	}
-
-	public function testSwapCategoryOrder(){
-		$id1= 1;
-		$id2= 3;
-		$res = GroupManager::swap_category_order($id1,$id2);
-		$this->assertFalse($res);
-		$this->assertNull($res,true);
-	}
-
-	public function testGetUsers(){
-		$group_id= 1;
-		$res =GroupManager::get_users($group_id);
-		$this->assertTrue(is_array($res));
-		$this->assertTrue($res ===array());
-	}
-
-	public function testFillGroups(){
-		global $_course;
-		$group_ids= 2;
-		$res = GroupManager::fill_groups($group_ids);
-		$this->assertNull($res);
-		$this->assertEqual($res,0);
-	}
-
-	public function testNumberOfStudents(){
-		global $_course;
-		$group_id= 2;
-		$res = GroupManager::number_of_students($group_id);
-		$this->assertFalse($res);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testMaximumNumberOfStudents(){
-		global $_course;
-		$group_id = 2;
-		$res =GroupManager::maximum_number_of_students($group_id);
-		$this->assertTrue($res);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testUserInNumberOfGroups(){
-		global $_course;
-		$user_id= 1;
-		$cat_id = 6;
-		$res = GroupManager::user_in_number_of_groups($user_id,$cat_id);
-		$this->assertTrue(is_numeric($cat_id));
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testIsSelfRegistrationAllowed(){
-		$user_id = 1;
-		$group_id = 6;
-		$res = GroupManager::is_self_registration_allowed($user_id,$group_id);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === false);
-		//var_dump($res);
-	}
-
-	public function testIsSelfUnregistrationAllowed(){
-		$user_id = 2 ;
-		$group_id = 6;
-		$res =GroupManager::is_self_unregistration_allowed($user_id,$group_id);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === false);
-		//var_dump($res);
-	}
-
-	public function testIsSubscribed(){
-		$db_result = 2;
-		$user_id = 2;
-		$group_id = 6;
-		$res = GroupManager::is_subscribed($user_id, $group_id);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testCanUserSubscribe(){
-		global $user_id;
-		$group_id = 2;
-		global $_course;
-		$res = GroupManager::can_user_subscribe($user_id, $group_id);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testCanUserUnsubscribe(){
-		global $user_id;
-		$group_id = 6;
-		$res = GroupManager::can_user_unsubscribe($user_id, $group_id);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === false);
-		//var_dump($res);
-	}
-
-	public function testGetSubscribedUsers(){
-		$group_id = 2;
-		$res = GroupManager::get_subscribed_users($group_id);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testGetSubscribedTutors(){
-		$group_id = 2;
-		$res = GroupManager::get_subscribed_tutors($group_id);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testSubscribeUsers(){
-		global $user_ids;
-		$group_id = 2;
-		$res = GroupManager::subscribe_users($user_ids, $group_id);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testSubscribeTutors(){
-		global $user_id;
-		$group_id='6';
-		$res &= GroupManager::subscribe_tutors($user_id, $group_id);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testUnsubscribeUsers(){
-		$user_ids = array(5);
-		$group_id = 5;
-		$res &= GroupManager::unsubscribe_users($user_ids, $group_id);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testUnsubscribeAllUsers(){
-		$group_ids=array(2);
-		$res = GroupManager::unsubscribe_all_users($group_ids);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testUnsubscribeAllTutors(){
-		$group_ids =array(6,9,10,11,14,15,16,19);
-		$res = GroupManager::unsubscribe_all_tutors($group_ids);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testIsTutorOfGroup(){
-		global $user_id;
-		$group_id=2;
-		$res = GroupManager::is_tutor_of_group($user_id,$group_id);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	public function testIsUserInGroup(){
-		global $user_id;
-		$group_id= 4;
-		$res =GroupManager::is_user_in_group($user_id, $group_id);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === false);
-		$this->assertFalse($res);
-		//var_dump($res);
-	}
-
-	public function testGetAllTutors(){
-		$res =GroupManager::get_all_tutors();
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testIsTutor(){
-		global $user_id, $_course;
-		$res = GroupManager::is_tutor($user_id);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === false);
-		//var_dump($res);
-
-	}
-
-	public function testGetGroupIds(){
-		global $user_id;
-		$course_db= 'chamilo_COURSETEST';
-		$res = GroupManager::get_group_ids($course_db,$user_id);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testGetCompleteListOfUsersThatCanBeAddedToGroup(){
-		global $_course, $_user;
-		$course_code= 'chamilo_COURSETEST';
-		$group_id=2;
-		$res = GroupManager::get_complete_list_of_users_that_can_be_added_to_group($course_code, $group_id);
-		$this->assertTrue(is_array($res));
-		$this->assertTrue($res);
-		//var_dump($res);
-	}
-
-	public function testfilter_duplicates(){
-		$user_array_in = '';
-		$compare_field = '';
-		$res = GroupManager::filter_duplicates($user_array_in, $compare_field);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testFilterUsersAlreadyInGroup(){
-		global $_course;
-		$user_array_in = array();
-		$group_id = 2;
-		$res = GroupManager::filter_users_already_in_group($user_array_in, $group_id);
-		$this->assertTrue(is_null($res));
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-
-	public function testFilterOnlyStudents(){
-		$user_array_in=array();
-		$res= GroupManager::filter_only_students($user_array_in);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testUserHasAccess(){
-		global $user_id;
-		$group_id='5';
-		$tool='wiki_state';
-		$res = GroupManager::user_has_access($user_id, $group_id, $tool);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === false);
-		//var_dump($res);
-	}
-
-	public function testGetUserGroupName(){
-		global $user_id;
-		$res=GroupManager::get_user_group_name($user_id);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-/*
-	public function TestDeleteCourse(){
-		$code = 'COURSETEST';
-		$res = CourseManager::delete_course($code);
-		$path = api_get_path(SYS_PATH).'archive';
-		if ($handle = opendir($path)) {
-			while (false !== ($file = readdir($handle))) {
-				if (strpos($file,$code)!==false) {
-					if (is_dir($path.'/'.$file)) {
-						rmdirr($path.'/'.$file);
-					}
-				}
-			}
-			closedir($handle);
-		}
-	}
-*/
-}
-?>

+ 0 - 113
tests/main/inc/lib/image.lib.test.php

@@ -1,113 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'image.lib.php');
-
-class TestImage extends UnitTestCase {
-
-	public $timage;
-	public function TestImage(){
-		$this->UnitTestCase('All main image function tests');
-	}
-
-	public function setUp(){
-		$this->timage = new image();
-	}
-
-	public function tearDown(){
-		$this->timage = null;
-	}
-
-	public function testAddBackGround() {
-			$bgfile='';
-			$res = image::addbackground($bgfile);
-			$this->assertTrue(is_null($res));
-			//var_dump($bgfile);
-	}
-
-	public function testAddLogo() {
-			$file='';
-			$res = image::addlogo($file);
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-	}
-
-	public function testaddtext() {
-			$text='';
-			$res = image::addtext($text);
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-	}
-
-	public function testcreateimagefromtype() {
-			$file='';
-			$handler='';
-			$res = image::createimagefromtype($file,$handler);
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-	}
-
-	public function testimageaddback() {
-			$bgfile='';
-			$res = image::image($bgfile);
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-	}
-
-	public function testmakecolor() {
-	 		$red='';
-	 		$green='';
-	 		$blue='';
-	 		$res = image::makecolor($red, $green, $blue);
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-	}
-
-	public function testmergelogo() {
-	 		$x='';
-	 		$y='';
-	 		$res = image::mergelogo($x,$y);
-			$this->assertTrue(is_bool($res));
-			//var_dump($res);
-	}
-
-	public function testresize() {
-			$thumbw='';
-			$thumbh='';
-			$border='';
-			$res = image::resize($thumbw , $thumbh , $border);
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-	}
-
-	public function testsend_image() {
-	 		$type='';
-	 		$res = image::send_image($type);
-			$this->assertTrue(is_numeric($res));
-			//var_dump($res);
-	}
-
-
-	public function testsetfont() {
-			$fontfile=$this->fontfile;
-			$res = image::setfont($fontfile);
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-	}
-/*
-	public function TestDeleteCourse(){				
-		$code = 'COURSETEST';				
-		$res = CourseManager::delete_course($code);			
-		$path = api_get_path(SYS_PATH).'archive';		
-		if ($handle = opendir($path)) {
-			while (false !== ($file = readdir($handle))) {				
-				if (strpos($file,$code)!==false) {										
-					if (is_dir($path.'/'.$file)) {						
-						rmdirr($path.'/'.$file);						
-					}				
-				}				
-			}
-			closedir($handle);
-		}
-	}
-*/
-}
-?>

+ 0 - 16
tests/main/inc/lib/import.lib.test.php

@@ -1,16 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'import.lib.php');
-
-class TestImport extends UnitTestCase {
-
-    public function __construct(){
-        $this->UnitTestCase('Import library - main/inc/lib/import.lib.test.php');
-    }
-	function testCsvToArray(){
-		$filename='';
-		$res=Import::csv_to_array($filename);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-}
-?>

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 83
tests/main/inc/lib/internationalization.lib.test.php


+ 0 - 81
tests/main/inc/lib/legal.lib.test.php

@@ -1,81 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'legal.lib.php');
-
-class TestLegal extends UnitTestCase{
-
-	public function __construct() {
-		$this->UnitTestCase('Legal terms library - main/inc/lib/legal.lib.test.php');
-	}
-
-	public function testAdd(){
-		$language='english';
-		$content='english';
-		$type='';
-		$changes='';
-		$res = LegalManager::add($language, $content, $type, $changes);
-		if(is_bool($res))
-		$this->assertTrue($res === true || $res === false);
-		else
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testGetLastConditionVersion(){
-		$language='english';
-		$res = LegalManager::get_last_condition_version($language);
-		if(!is_array($res)):
-		$this->assertTrue(is_numeric($res));
-		endif;
-		//var_dump($res);
-	}
-
-	public function testGetLastCondition(){
-		$language='english';
-		$result=2;
-		$res = LegalManager::get_last_condition($language);
-		if(is_bool($res)){
-		$this->assertTrue($res===true || $res === false);
-		$this->assertTrue(is_bool($res));
-		}else{
-		$this->assertTrue(is_array($res));}
-		//var_dump($res);
-	}
-
-	public function testShowLastCondition(){
-		$term_preview=1;
-		$preview =true;
-		$res = LegalManager::show_last_condition($term_preview);
-		$this->assertTrue($res);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testGetLastVersion(){
-		$language='english';
-		$$res = LegalManager::get_last_version($language);
-		if(is_bool($res)){
-			$this->assertTrue(is_bool($res));
-			$this->assertTrue($res === true || $res === false);
-		}else{
-			$this->assertTrue(is_null($res));
-			$this->assertNull($res);
-		}
-		//var_dump($res);
-	}
-
-	public function testget_legal_data(){
-		$from='test';
-		$number_of_items=5;
-		$column=5;
-		$res = LegalManager::get_legal_data($from, $number_of_items, $column);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testCount(){
-		$res = LegalManager::count();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 33
tests/main/inc/lib/mail.lib.inc.test.php

@@ -1,33 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'mail.lib.inc.php');
-
-class TestMail extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Mailing library - main/inc/lib/mail.lib.inc.test.php');
-    }
-
-	function testApiMail() {
-		ob_start();
- 		$recipient_name='';
- 		$recipient_email='';
- 		$subject='';
- 		$message='';
- 		$res=@api_mail($recipient_name, $recipient_email, $subject, $message);
- 		ob_end_clean();
- 		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testApiMailHtml() {
-		ob_start();
- 		$recipient_name='';
- 		$recipient_email='';
- 		$subject='';
- 		$res=@api_mail_html($recipient_name, $recipient_email, $subject);
- 		ob_end_clean();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 867
tests/main/inc/lib/main_api.lib.test.php

@@ -1,867 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
-
-class TestMainApi extends UnitTestCase {
-
-	function TestMainApi() {
-        	$this->UnitTestCase('Main API library - main/inc/lib/main_api.lib.test.php');
-	}
-/*
-	function testApiProtectCourseScript(){
-		ob_start();
-		$res= api_protect_course_script($print_headers=null);
-		ob_get_contents();
-		$this->assertTrue(is_string($res));
-		ob_end_clean();
-	}
-
-	function testApiProtectAdminScript(){
-		ob_start();
-	 	$res = api_protect_admin_script($allow_sessions_admins=false);
-	 	ob_end_clean();
-	 	//$this->assertTrue(is_string($res));
-
-	}
-
-	function testApiBlockAnonymousUser(){
-		ob_start();
-		$res = api_block_anonymous_users();
-	 	$this->assertTrue(is_string($res));
-	 	ob_end_clean();
-	}
-*/
-	function testApiGetNavigator(){
-		ob_start();
-	 	$res=api_get_navigator();
-	 	$this->assertTrue($res);
-	 	ob_end_clean();
-	}
-
-	function testApiIsSelfRegistrationAllowed(){
-		$res = api_is_self_registration_allowed();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testApiGetPath() {
-		$path_type = trim($path_type);
-		$path = array(
-		WEB_PATH => '',
-		SYS_PATH => '',
-		REL_PATH => '',
-		WEB_SERVER_ROOT_PATH => '',
-		SYS_SERVER_ROOT_PATH => '',
-		WEB_COURSE_PATH => '',
-		SYS_COURSE_PATH => '',
-		REL_COURSE_PATH => '',
-		REL_CODE_PATH => '',
-		WEB_CODE_PATH => '',
-		SYS_CODE_PATH => '',
-		SYS_LANG_PATH => 'lang/',
-		WEB_IMG_PATH => 'img/',
-		WEB_CSS_PATH => 'css/',
-		GARBAGE_PATH => 'archive/', // Deprecated?
-		SYS_PLUGIN_PATH => 'plugin/',
-		WEB_PLUGIN_PATH => 'plugin/',
-		SYS_ARCHIVE_PATH => 'archive/',
-		WEB_ARCHIVE_PATH => 'archive/',
-		INCLUDE_PATH => 'inc/',
-		LIBRARY_PATH => 'inc/lib/',
-		CONFIGURATION_PATH => 'inc/conf/',
-		WEB_LIBRARY_PATH => 'inc/lib/',
-		WEB_AJAX_PATH => 'inc/ajax/'
-	);
-		$res=api_get_path($path_type, $path);
-	 	$this->assertTrue(is_null($res));
-	 	//var_dump($res);
-	}
-
-	function testApiGetUserId(){
-		$res= api_get_user_id();
-		$this->assertPattern('/\d/',$res);
-	}
-    function testApiGetUserCoursesReturnTrueWhenOutOfCoursesContext(){
-    	global $tbl_user;
-    	$userid=1;
-    	$fetch_session=true;
-    	$res = api_get_user_courses($userid,$fetch_session);
-    	if(!is_null($res)) :
-    	$this->assertTrue(is_array($res));
-    	endif;
-    	//var_dump($res);
-    }
-
-    function testApiGetUserInfoReturnFalseWhenOutOfUserInfoContext(){
-    	$user_id= 1;
-    	$res = api_get_user_info($user_id);
-   		$this->assertTrue(is_array($res));
-   		//var_dump($res);
-    }
-    function testApiGetUserInfoUsernameReturnTrueWhenOutOfUserInfoUsernameContext(){
-    	$res=api_get_user_info_from_username();
-    	$this->assertTrue(is_bool($res));
-    	//var_dump($res);
-    }
-    /* Causing problems for some reason on automated tests server
-    function testApiGetCourseIdReturnFalseWhenOutOfCourseIdContext(){
-        $res = api_get_course_id();
-    	$this->assertEqual($res,-1);
-    }
-    function testApiGetCoursePathReturnFalseWhenOutOfCoursePathContext(){
-        $res = api_get_course_path();
-    	$this->assertTrue(empty($res));
-    }
-    */
-    function testApiGetCourseSettingReturnFalseWhenOutOfCourseSeetingContext(){
-        global $_course;
-        $course_code = $_course;
-        $setting_name = 1;
-        $res = api_get_course_setting($setting_name, $course_code);
-        $this->assertTrue($res);
-    }
-
-    function testApiGetAnonymousId(){
-        $res = api_get_anonymous_id();
-        $this->assertTrue(is_numeric($res));
-    }
-
-    function testApiGetCidreq(){
-        $res=api_get_cidreq();
-        $this->assertTrue(is_string($res));
-    }
-
-    function testApiGetCourseInfo(){
-        ob_start();
-        $res=api_get_course_info();
-        $this->assertTrue($res);
-        ob_end_clean();
-    }
-
-    function testApiSessionStart(){
-        if (!headers_sent()) {
-            $res = api_session_start($already_sintalled=true);
-        }
-        $this->assertTrue(is_null($res));
-    }
-
-    function testApiSessionRegister(){
-        $$variable[session_register]=false;
-        global $$variable;
-        if (!headers_sent()) {
-            $res=api_session_register($$variable);
-        }
-        $this->assertTrue(is_null($res));
-        $this->assertTrue(is_null($variable[session_register]));
-    }
-
-    function testApiSessionUnregister() {
-        $variable=strval($variable);
-        $res=api_session_unregister($variable);
-        $this->assertTrue(is_null($res));
-        $this->assertTrue(is_null($_SESSION[$variable]=null));
-    }
-
-	function testApiSessionClear() {
-		$variable = 'test';
-		 if (!headers_sent()) {
-			$res=api_session_clear($variable);
-		 }
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testApiSessionDestroy(){
-		 if (!headers_sent()) {
-			$res=api_session_destroy();
-		 }
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testApiAddUrlParamReturnsUrlWhenNoParam() {
-		global $url;
-		$res=api_add_url_param($url, null, $filter_xss=true);
-		$this->assertEqual($res,$url);
-	}
-
-	function testApiGeneratePassword() {
-		$res = api_generate_password($length = 8);
-	    $this->assertTrue(is_string($res));
-	    //var_dump($res);
-	}
-
-	function testApiCheckPassword(){
-		$password = '';
-		$res = api_check_password($password);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testApiClearAnonymous(){
-		global $_user;
-		$_user['user_id'] = 1;
-		$res = api_clear_anonymous($db_check=false);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-		$this->assertTrue(isset($_user['user_id'] ));
-	}
-
-	function testApiTruncStr() {
-		$text= 'test';
-		$res= api_trunc_str($text, $length = 30, $suffix = '...', $middle = false, $encoding = null);
-		$this->assertTrue(is_string($res));
-	}
-
-	function testDomesticate(){
-		$input= 'dome';
-		$res = domesticate($input);
-		$this->assertTrue($res);
-	}
-
-	function testGetStatusFromCode(){
-		$status_code = 1;
-		$res=get_status_from_code($status_code);
-		$this->assertTrue($res);
-	}
-
-	function testApiSetFailure(){
-		global $api_failureList;
-		$failureType=true;
-		$res = api_set_failure($failureType);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($api_failureList);
-	}
-
-	function testApiSetAnonymous(){
-		$res = api_set_anonymous();
-		$this->assertTrue(is_bool($res));
-	}
-
-	function testApiGetLastFailure(){
-		$res= api_Get_last_failure();
-		$this->assertTrue($res);
-	}
-
-	function testApiGetSessionId(){
-		$res = api_get_session_id();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-    }
-
-
-    function testApiGetSessionName(){
-   		$session_id='';
-   		$res = api_get_session_name($session_id);
-   		//$this->assertTrue(is_string($res));
-   		$this->assertTrue(is_null($res));
-   		//var_dump($res);
-    }
-
-   	function testAPiGetSetting(){
-   		global $variable, $_setting;
-   	    $res=api_get_setting($variable, $key= NULL);
-    	$this->assertTrue(is_null($res));
-    	//var_dump($res);
-   	}
-
-    function testApiGetSelf(){
-   		$res = api_get_self();
-    	$this->assertTrue(is_string($res));
-    	//var_dump($res);
-	}
-
-/* function deprecated
-   	function testGetLang(){
-        global $language_interface, $language_interface_initial_value, $language_file,$variable;
-   	 	$res = get_lang($variable, $notrans = 'DLTT', $language = null);
-   	 	$this->assertTrue(is_string($res));
-   	 	//var_dump($res);
-   	}
-
-   	function testGetLangToSystemEncoding(){
-		global $language, $name;
-		$res=&get_lang_to_system_encoding(& $string, $language);
-		ob_start();
-		api_disp_html_area($name, $content ='', $height='', $width='100%', $optAttrib='');
-		$res = ob_get_contents();
-		$this->assertNotEqual($res,'');
-   		ob_end_clean();
-   	}
-
-   	function testApiGetInterfaceLanguage(){
-		global $language_interface;
-		$language_interface=false;
-		ob_start();
-		$res = api_get_interface_language();
-		$res = ob_get_contents();
-		$this->assertTrue(is_string($res));
-		$this->assertTrue(isset($language_interface));
-		ob_end_clean();
-		//var_dump($res);
-   	}
-*/
-   	function testApiIsPlatformAdmin(){
-   		ob_start();
-		global $_user;
-		$_user['status']=true;
-		$allow_sessions_admins=true;
-		$res= api_is_platform_admin($allow_sessions_admins=true);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($_SESSION['is_platformAdmin']=true);
-		$this->assertTrue(isset($_user['status']));
-		ob_end_clean();
-		//var_dump($res);
-   	}
-
-   	function testApiIsAllowedToCreateCourse() {
-		$res=api_is_allowed_to_create_course();
-		if(!is_bool($res)){
-			$this->assertTrue(is_null($res));
-		}
-   	}
-
-   	function testApiIsCourseAdminIsFalseWhenNoCourseContextDefined() {
-		$res=api_is_course_admin();
-		if($_SESSION['is_courseAdmin'] === 1) {
-			$this->assertTrue($res);
-		} else {
-			$this->assertFalse($res);
-		}
-   	}
-
-    function testApiIsCourseCoach() {
-		$res=api_is_course_coach();
-		if(!is_bool($res)){
-			$this->assertTrue(is_null($res));
-		}
-   	}
-
-   	function testApiIsCoach(){
-		global $_user;
-		global $sessionIsCoach;
-		$_user['user_id']=2;
-		$sessionIsCoach=Database::store_result($result=false);
-		$res=api_is_coach();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-		$this->assertTrue($_user['user_id']);
-		$this->assertTrue(is_array($sessionIsCoach));
-		//var_dump($sessionIsCoach);
-   	}
-
-   	function testApiIsSessionAdmin(){
-		global $_user;
-		$_user['status']=true;
-		$res=api_is_session_admin();
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue(is_array($_user));
-		//var_dump($_user);
-
-    }
-
-   	function testApiDisplayToolTitle(){
-		$tit=true;
-		$titleElement['mainTitle']=$tit;
-		ob_start();
-		api_display_tool_title($titleElement);
-		$res = ob_get_contents();
-		$this->assertEqual($res,'<h3>1</h3>');
-		$this->assertTrue(isset($titleElement));
-		$this->assertTrue($titleElement['mainTitle']);
-		$this->assertPattern('/<h3>1<\/h3>/', $res);
-		ob_end_clean();
-	}
-/* This test fails but it doesn't say much anyway
-	function testApiDisplayToolViewOption(){
-		ob_start();
-		api_display_tool_view_option();
-		$res = ob_get_contents();
-		ob_end_clean();
-		$this->assertTrue(empty($res));
-	}
-*/
-	function testApiDisplayArray(){
-		global $info_array;
-		ob_start();
-		api_display_array($info_array);
-		$res = ob_get_contents();
-		$this->assertNotEqual($res,'');
-		ob_end_clean();
-	}
-
-	function testApiDisplayDebugInfo(){
-		$message = "mensaje de error"; // siempre que puedas, te conviene probar con valores creados al azar
-		ob_start();
-		api_display_debug_info($message);
-		$res = ob_get_contents();
-		$this->assertNotEqual($res,'');
-		ob_end_clean();
-	}
-
-
-	function testApiIsAllowedToEdit(){
-	 	$is_courseAdmin=false;
-	 	$res=api_is_allowed_to_edit($tutor=false,$scoach=false);
-	 	$this->assertTrue(is_bool($res));
-	 	$this->assertTrue(isset($is_courseAdmin));
-	}
-
-	function testApiIsAllowed(){
-	    global $_course, $_user;
-	  	$tool= 'full';
-	 	$action = 'delete';
-	 	$res=api_is_allowed($tool, $action, $task_id=0);
-	 	if(!is_bool($res)){
-	  	$this->assertTrue(is_null($res));
-	  	}
-	  	$this->assertTrue($action);
-	 	$this->assertTrue($_user['user_id']);
-	}
-
-	function testApiIsAnonymous(){
-	 	global $_user, $use_anonymous;
-	  	$_user['is_anonymous']=False;
-	 	$res=api_is_anonymous($user_id=null, $db_check=false);
-	 	$this->assertTrue(is_bool($res));
-	 	$this->assertFalse(isset($user_id));
-	 	$this->assertTrue(isset($_user['is_anonymous']));
-	 	$this->assertTrue(is_null($use_anonymous));
-	 	$this->assertTrue(is_bool($db_check));
-	 	//var_dump($db_check);
-	}
-
-	function testApiNotAllowed(){
-		ob_start();
-		//api_not_allowed($print_headers = false);
-		$res = ob_get_contents();
-		$this->assertEqual($res,'');
-		ob_end_clean();
-	}
-
-	function testConvertMysqlDate(){
-	 	$last_post_datetime = array();
-	 	$res=convert_mysql_date($last_post_datetime);
-	 	$this->assertTrue($res);
-	}
-
-	function testApiGetDatetime(){
-	 	$res=api_get_datetime($time=null);
-	 	$this->assertTrue($res);
-	 	$this->assertFalse(isset($time));
-	}
-
-	function testApiGetItemVisibility(){
-	 	global $_course;
-	 	$tool = 'document';
-	 	$id=1;
-	 	$_course['dbName']=false;
-	 	$res =api_get_item_visibility($_course,$tool,$id);
-	 	$this->assertTrue(is_numeric($res));
-	 	$this->assertFalse(is_bool($res));
-	}
-
-	function testApiItemPropertyUpdate(){
-	  	global $_course, $tool, $item_id, $lastedit_type, $user_id;
-	  	$res=api_item_property_update($_course, $tool, $item_id, $lastedit_type, $user_id, $to_group_id = 0, $to_user_id = NULL, $start_visible = 0, $end_visible = 0);
-	 	$this-> assertTrue($res);
-	}
-
-	function testApiGetLanguagesCombo(){
-		$res=api_get_languages_combo($name="language");
-		$this->assertTrue($res);
-	}
-
-	function testApiDisplayLanguageForm(){
-		ob_start();
-		api_display_language_form($hide_if_no_choice=false);
-		$res = ob_get_contents();
-		$this->assertNotEqual($res,'');
-		ob_end_clean();
-	}
-
-	function testApiGetLanguages(){
-		$res= api_get_languages();
-		$this->assertTrue($res);
-	}
-
-	function testApiGetThemes(){
-		$cssdir= api_get_path(SYS_PATH).'main/css/';
-		$res=api_get_themes();
-		$this->assertTrue($res);
-		$this->assertTrue($cssdir);
-	}
-
-	function testApiDispHtmlArea(){
-		$name = 'name';
-		global $_configuration, $_course, $fck_attribute;
-		ob_start();
-		api_disp_html_area($name, $content ='', $height='', $width='100%', $optAttrib='');
-		$res = ob_get_contents();
-		$this->assertNotEqual($res,'');
-		ob_end_clean();
-	}
-
-	function testApiReturnHtmlArea(){
-		$name = true;
-		global $_configuration, $_course, $fck_attribute;
-		$res=api_return_html_area($name, $content='', $height='', $width='100%', $optAttrib='');
-		$this->assertTrue($res);
-	}
-
-	function testApiSendMail(){
-		$to= 'chamilotest@beeznest.com';
-		$subject='Hello';
-		$message='test message';
-		$res=api_send_mail($to, $subject, $message, $additional_headers = null, $additional_parameters = null);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-		//var_dump($send_mail);
-	}
-
-	function testApiMaxSortValue(){
-	    $user_course_category=1;
-	    $user_id =1;
-		$res= api_max_sort_value($user_course_category,$user_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testString2Boolean(){
-		global $string;
-		$res=string_2_boolean($string);
-		$this->assertFalse($res);
-	}
-
-	function testApiNumberOfPlugins(){
-		global $_plugins;
-		$location=2;
-		$_plugins[$location]=1;
-		$res=api_number_of_plugins($location);
-		$this->assertFalse($res);
-		$this->assertTrue($_plugins[$location]);
-	}
-
-	function testApiPlugin(){
-		global $_plugins;
-		$location=2;
-		$_plugins[$location]=1;
-		$res1 = api_plugin($location);
-		$this->assertFalse($res1);
-		$this->assertTrue($_plugins[$location]);
-	}
-
-	function testApiIsPluginInstalled(){
-		$plugin_name = false;
-		$plugin_list = true;
-		$res = api_is_plugin_installed($plugin_list, $plugin_name);
-		$this->assertTrue(is_bool($res));
-	}
-
-	function testApiTimeToHms(){
-		$seconds = -1;
-		ob_start();
-		api_time_to_hms($seconds);
-		$res = ob_get_contents();
-		$this-> assertTrue(is_string($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-
-	public function testApiGetPermissionsForNewDirectories() {
-		$perm = trim(api_get_setting('permissions_for_new_directories'));
-		$perm = octdec(!empty($perm) ? $perm : '0777');
-		$res = api_get_permissions_for_new_directories();
-		$this->assertTrue($res === $perm);
-		//var_dump($res);
-	}
-
-	public function testApiGetPermissionsForNewFiles() {
-		$perm = trim(api_get_setting('permissions_for_new_files'));
-		$perm = octdec(!empty($perm) ? $perm : '0666');
-		$res = api_get_permissions_for_new_files();
-		$this->assertTrue($res === $perm);
-		//var_dump($res);
-	}
-
-	function testCopyr_file_to_nothing(){
-		$source = api_get_path(SYS_CODE_PATH).'admin/add_users_to_session.php';
-		$dest = '';
-		$res = copyr($source, $dest, $exclude=array(), $copied_files=array());
-		$this->assertFalse($res,'Function coyr() should have not proceeeded because of empty destination');
-		//var_dump($res);
-	}
-
-	/* This function is behaving differently on automated test server
-	function testApiChmod_R(){
-		// We know, it does not work for Windows.
-		if (IS_WINDOWS_OS) { return true; }
-		$dirname = api_get_path(SYS_LANG_PATH);
-		$perm_dir = substr(sprintf('%o', fileperms($dirname)), -4);
-		$this->assertEqual($perm_dir,'0777');
-		$new_filemode = '0775';
-		$res = api_chmod_R($dirname, $new_filemode);
-		$this->assertTrue($res);
-	}
-    */
-	function testApiGetVersion(){
-		global $_configuration;
-		$res = api_get_version();
-		$this->assertTrue($res);
-	}
-
-	function testApiStatusExists(){
-		$status_asked = 'user';
-		$res = api_status_exists($status_asked);
-		$this->assertTrue(is_bool($res));
-	}
-/* Fails for some reason on automated tests server
-	function testApiStatusKey(){
-		$status = 'user';
-		$res = api_status_key($status);
-		//var_dump($res);
-		$this->assertEqual($res,STUDENT);
-	}
-*/
-	function testApiGetStatusLangvars(){
-		$res = api_get_status_langvars();
-		$this->assertTrue(is_array($res));
-	}
-
-	function testApiSetSetting(){
-		ob_start();
-		$var = 0;
-		$value = 2;
-		$res = api_set_setting($var,$value,$subvar=null,$cat=null,$access_url=1);
-		$this->assertTrue(is_bool($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-
-	function testApiSetSettingsCategory(){
-		$category = $_GET['category'];
-		$res = api_set_settings_category($category,$value=null,$access_url=1);
-		$this->assertTrue(is_null($category));
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-		//var_dump($category);
-	}
-
-	function testApiGetAccessUrls(){
-		$res = api_get_access_urls($from=0,$to=1000000,$order='url',$direction='ASC');
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testApiGetAccessUrl(){
-		$id=1;
-		$res = api_get_access_url($id);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testApiAddAccessUrl(){
-		$u = Database::escape_string($u);
-		$d = Database::escape_string($d);
-		$res = api_add_access_url($u,$d='',$a=1);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testApiGetSettings(){
-		$res = api_get_settings($cat=null,$ordering='list',$access_url=1,$url_changeable=0);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testApiGetSettingsCategories(){
-		$res = api_get_settings_categories($exceptions=array(),$access_url=1);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testApiDeleteSetting(){
-		$v = false;
-		$res = api_delete_setting($v, $s=NULL, $a=1);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testApiDeleteCategorySettings(){
-		$c= false;
-		$res = api_delete_category_settings($c,$a=1);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testApiAddSetting(){
-		$sk=null;
-		$type='textfield';
-		$c=null;
-		$title='';
-		$com='';
-		$sc=null;
-		$skt=null;
-		$a=1;
-		$v=0;
-		$va=array('val'=>10, 'var'=>'name');
-		$res= api_add_setting($va['val'],$va['var'],null,null,null,null,null,null,null,null,null);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testApiIsCourseVisibleForUser() {
-		global $_user, $cidReq;
-		$userid = $_user;
-		$cid = $cidReq ;
-		$res = api_is_course_visible_for_user($userid, $cid);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testApiIsElementInTheSession(){
-		ob_start();
-		$_tool['tool'] = 'TOOL_SURVEY';
-		$_id['element_id']=3;
-		$res = api_is_element_in_the_session($_tool['tool'], $_id['element_id'], $session_id=null);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue((isset($_tool['tool'],$_id['element_id'])));
-		ob_end_clean();
-		//var_dump($res);
-	}
-
-	function testReplaceDangerousChar(){
-		$filename =ereg_replace("\.+$", "", substr(strtr(ereg_replace(
-	    "[^!-~\x80-\xFF]", "_", trim($filename)), '\/:*?"<>|\'',
-        /*Keep C1 controls for UTF-8 streams **/ '-----_---_'), 0, 250));
-		$res = replace_dangerous_char($filename, $strict = 'loose');
-		$this->assertEqual($res,$filename, $message = 'no se pudo');
-	}
-
-	function testApiRequestUri(){
-		$res = api_request_uri();
-		$this->assertTrue($res);
-	}
-
-	function testApiCreateIncludePathSetting(){
-		$res=api_create_include_path_setting();
-		$this->assertTrue($res);
-	}
-
-	function testApiGetCurrentAccessUrlId(){
-		$res=api_get_current_access_url_id();
-		$this->assertTrue($res);
-	}
-
-	function testApiGetAccessUrlFromUser(){
-		$user_id=1;
-		$res= api_get_access_url_from_user($user_id);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testApiGetStatusOfUserInCourse(){
-		$id = array(
-					'course_code'=>'TEST',
-					'user_id'=>'1');
-		$res=api_get_status_of_user_in_course($id['course_code'],$id['user_id']);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testApiIsInCourse(){
-		$_SESSION['_course']['sysCode']=0;
-		$res=api_is_in_course($course_code=null);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue(isset($_SESSION['_course']['sysCode']));
-		//var_dump($res);
-	}
-
-	function testApiIsInGroup(){
-		$res=api_is_in_group($group_id=null, $course_code=null);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testApiIsXmlHttpRequest(){
-		$res=api_is_xml_http_request();
-		$this->assertTrue(isset($res));
-	}
-
-	function testApiGetEncryptedPassword(){
-		global $userPasswordCrypted;
-		$pass= array ('password'=> '2222');
-		$res=api_get_encrypted_password($pass['password'],null);
-		$this->assertTrue($res);
-		$this->assertPattern('/\d/',$res);
-	}
-
-	function testApiIsValidSecretKey(){
-		global $_configuration;
-		$key = array(
-		'original_key_secret'=>'2121212',
-		'security_key'=>'2121212');
-		$res = api_is_valid_secret_key($key['original_key_secret'],$key['security_key']);
-		$this->assertTrue($_configuration);
-		$this->assertFalse($res);
-		$this->assertTrue($key);
-		$this->assertEqual($key['original_key_secret'],$key['security_key'], $message ='%s');
-	}
-
-	function testApiIsUserOfCourse(){
-		$course_id = 1;
-		$user_id = 1;
-		$tbl_course_rel_user =false;
-		$sql='SELECT user_id FROM '.$tbl_course_rel_user.' WHERE course_code="'.Database::escape_string($course_id).'" AND user_id="'.Database::escape_string($user_id).'"';
-		$res= api_is_user_of_course($course_id, $user_id);
-		$this->assertFalse($res);
-		$this->assertFalse($tbl_course_rel_user);
-		$this->assertTrue($sql);
-	}
-
-	function testApiIsWindowsOs(){
-		$res= api_is_windows_os();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testApiResizeImage(){
-		//global $image, $target_width, $target_height;
-		$resize = array('image' =>'image.jpg', 'target_width'=>100, 'target_height'=>100);
-		$res = api_resize_image($resize['image'],$resize['target_width'],$resize['target_height']);
-		$this->assertTrue(is_array($res));
-		$this->assertWithinMargin($first = 10, $second=20,$margin=200, $message = 'no se pudo redimensionar imagen');
-		//var_dump($res);
-	}
-
-	function testApiCalculateImageSize(){
-		global $image_width, $image_height, $target_width, $target_height;
-		$result = array($image_width, $image_height);
-		$res = api_calculate_image_size($image_width, $image_height, $target_width, $target_height);
-		$this->assertTrue(is_array($res));
-		$this->assertTrue($result);
-		//var_dump($res);
-	}
-
-	function testApiGetToolsLists(){
-		$tool_list = 'false';
-		$res = api_get_tools_lists($my_tool =null);
-		$this->assertTrue(is_array($res));
-		$this->assertTrue($tool_list);
-		//var_dump($res);
-	}
-	public function TestDeleteCourse() {
-		$code = 'COURSETEST';
-		$res = CourseManager::delete_course($code);
-		$path = api_get_path(SYS_PATH).'archive';
-		if ($handle = opendir($path)) {
-			while (false !== ($file = readdir($handle))) {
-				if (strpos($file,$code)!==false) {
-					if (is_dir($path.'/'.$file)) {
-						rmdirr($path.'/'.$file);
-					}
-				}
-			}
-			closedir($handle);
-		}
-	}
-}
-?>

+ 0 - 539
tests/main/inc/lib/main_api.lib.test_standalone.php

@@ -1,539 +0,0 @@
-<?php //$id:$
-/**
- * A simple set of tests for the main API.
- * @author Ivan Tcholakov, 2009.
- * For licensing terms, see /dokeos_license.txt
- */
-
-class TestMainApi extends UnitTestCase {
-
-    function TestMainApi() {
-        $this->UnitTestCase('Main API tests');
-    }
-
-    public function testApiGetPath() {
-
-        $common_paths = array(
-            WEB_PATH,
-            SYS_PATH,
-            REL_PATH,
-            WEB_SERVER_ROOT_PATH,
-            SYS_SERVER_ROOT_PATH,
-            WEB_COURSE_PATH,
-            SYS_COURSE_PATH,
-            REL_COURSE_PATH,
-            REL_CODE_PATH,
-            WEB_CODE_PATH,
-            SYS_CODE_PATH,
-            SYS_LANG_PATH,
-            WEB_IMG_PATH,
-            WEB_CSS_PATH,
-            SYS_PLUGIN_PATH,
-            WEB_PLUGIN_PATH,
-            SYS_ARCHIVE_PATH,
-            WEB_ARCHIVE_PATH,
-            INCLUDE_PATH,
-            LIBRARY_PATH,
-            CONFIGURATION_PATH,
-            WEB_LIBRARY_PATH
-        );
-
-        $specific_paths = array(
-            FLASH_PLAYER_AUDIO,
-            FLASH_PLAYER_VIDEO,
-            SCRIPT_SWFOBJECT,
-            SCRIPT_ASCIIMATHML,
-            DRAWING_ASCIISVG
-        );
-
-        $res = array();
-        $is_ok = array();
-        $message = array();
-        $paths = array();
-
-        $message[] = '';
-        $message[] = '<strong>A test about api_get_path()</strong>';
-        $message[] = '---------------------------------------------------------------------------------------------------------------';
-        $message[] = '';
-
-        $message[] = '';
-        $message[] = 'Changed behaviour of the function api_get_path() after Dokeos 1.8.6.1, i.e. as of Chamilo 1.8.6.2.';
-        $message[] = '---------------------------------------------------------------------------------------------------------------';
-        $message[] = '';
-        $message[] = 'Old behaviour (1.8.6.1) api_get_path(INCLUDE_PATH) = '.api_get_path_1_8_6_1(INCLUDE_PATH).'&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;'.'New behaviour (1.8.6.2) api_get_path(INCLUDE_PATH) = '.api_get_path(INCLUDE_PATH);
-        $message[] = '* Reason for this change: Difference here is due to the fact that the etalonic old function api_get_path() has ben moved in this file ( see api_get_path_1_8_6_1() ). Even for such rare, hypothetical cases, this widely used function should be stable. Now, after installation, the function returns results based on configuration settings only, as it should be.';
-        $message[] = '';
-        $message[] = 'Old behaviour (1.8.6.1) api_get_path(WEB_CSS_PATH) = '.api_get_path_1_8_6_1(WEB_CSS_PATH).'&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;'.'New behaviour (1.8.6.2) api_get_path(WEB_CSS_PATH) = '.api_get_path(WEB_CSS_PATH);
-        $message[] = '* This is a proposed implementation. Retrieving css paths through user\'s configuration options has not been implemented yet.';
-        $message[] = '';
-
-        $message[] = '';
-        $message[] = 'Reading common purpose paths';
-        $message[] = '---------------------------------------------------------------------------------------------------------------';
-        $message[] = '';
-
-        foreach ($common_paths as $path) {
-
-            $test_case = "api_get_path($path)";
-            $res[$test_case] = api_get_path($path);
-            switch ($path) {
-                case INCLUDE_PATH:
-                case WEB_CSS_PATH:
-                    $is_ok[$test_case] = is_string($res[$test_case]) && !empty($res[$test_case]);
-                    break;
-                default:
-                    $is_ok[$test_case] = is_string($res[$test_case]) && !empty($res[$test_case]) && $res[$test_case] == api_get_path_1_8_6_1($path);
-            }
-            $message[] = ($is_ok[$test_case] ? '<span style="color: green; font-weight: bold;">Ok</span>' : '<span style="color: red; font-weight: bold;">Failed</span>').' : '.$test_case.' => '.$res[$test_case];
-        }
-
-        $message[] = '';
-        $message[] = '';
-        $message[] = 'Reading specific purpose paths';
-        $message[] = '---------------------------------------------------------------------------------------------------------------';
-        $message[] = '';
-
-        foreach ($specific_paths as $path) {
-
-            $test_case = "api_get_path(TO_WEB, $path)";
-            $test_case = str_replace(array('{', '}'), '', $test_case);
-            $res[$test_case] = api_get_path(TO_WEB, $path);
-            $is_ok[$test_case] = is_string($res[$test_case]) && !empty($res[$test_case]);
-            $message[] = ($is_ok[$test_case] ? '<span style="color: green; font-weight: bold;">Ok</span>' : '<span style="color: red; font-weight: bold;">Failed</span>').' : '.$test_case.' => '.$res[$test_case];
-            $paths[] = $path;
-
-            $test_case = "api_get_path(TO_SYS, $path)";
-            $test_case = str_replace(array('{', '}'), '', $test_case);
-            $res[$test_case] = api_get_path(TO_SYS, $path);
-            $is_ok[$test_case] = is_string($res[$test_case]) && !empty($res[$test_case]);
-            $message[] = ($is_ok[$test_case] ? '<span style="color: green; font-weight: bold;">Ok</span>' : '<span style="color: red; font-weight: bold;">Failed</span>').' : '.$test_case.' => '.$res[$test_case];
-            $paths[] = $path;
-
-            $test_case = "api_get_path(TO_REL, $path)";
-            $test_case = str_replace(array('{', '}'), '', $test_case);
-            $res[$test_case] = api_get_path(TO_REL, $path);
-            $is_ok[$test_case] = is_string($res[$test_case]) && !empty($res[$test_case]);
-            $message[] = ($is_ok[$test_case] ? '<span style="color: green; font-weight: bold;">Ok</span>' : '<span style="color: red; font-weight: bold;">Failed</span>').' : '.$test_case.' => '.$res[$test_case];
-            $paths[] = $path;
-        }
-
-        $message[] = '';
-        $message[] = '';
-        $message[] = 'Testing path conversions';
-        $message[] = '---------------------------------------------------------------------------------------------------------------';
-        $message[] = '';
-
-        $paths = array();
-        foreach ($common_paths as $path) {
-            $paths[] = array($path, api_get_path($path));
-        }
-        foreach ($specific_paths as $path) {
-            $paths[] = array($path, api_get_path(TO_WEB, $path));
-            $paths[] = array($path, api_get_path(TO_SYS, $path));
-            $paths[] = array($path, api_get_path(TO_REL, $path));
-        }
-
-        foreach ($paths as $path) {
-
-            $test_case = 'api_get_path(TO_WEB, '.$path[0].')';
-            $test_case = str_replace(array('{', '}'), '', $test_case);
-            $res[$test_case] = api_get_path(TO_WEB, $path[0]);
-            $test_case_1 = 'api_get_path(TO_WEB, \''.$path[1].'\')';
-            $res[$test_case_1] = api_get_path(TO_WEB, $path[1]);
-            $is_ok[$test_case] =
-                is_string($res[$test_case]) && !empty($res[$test_case])
-                && is_string($res[$test_case_1]) && !empty($res[$test_case_1])
-                && $res[$test_case] == $res[$test_case_1];
-            $message[] = ($is_ok[$test_case] ? '<span style="color: green; font-weight: bold;">Ok</span>' : '<span style="color: red; font-weight: bold;">Failed</span>').' : ';
-            $message[] = $test_case.' => '.$res[$test_case];
-            $message[] = $test_case_1.' => '.$res[$test_case_1];
-            $message[] = '';
-
-            $test_case = 'api_get_path(TO_SYS, '.$path[0].')';
-            $test_case = str_replace(array('{', '}'), '', $test_case);
-            $res[$test_case] = api_get_path(TO_SYS, $path[0]);
-            $test_case_1 = 'api_get_path(TO_SYS, \''.$path[1].'\')';
-            $res[$test_case_1] = api_get_path(TO_SYS, $path[1]);
-            $is_ok[$test_case] =
-                is_string($res[$test_case]) && !empty($res[$test_case])
-                && is_string($res[$test_case_1]) && !empty($res[$test_case_1])
-                && $res[$test_case] == $res[$test_case_1];
-            $message[] = ($is_ok[$test_case] ? '<span style="color: green; font-weight: bold;">Ok</span>' : '<span style="color: red; font-weight: bold;">Failed</span>').' : ';
-            $message[] = $test_case.' => '.$res[$test_case];
-            $message[] = $test_case_1.' => '.$res[$test_case_1];
-            $message[] = '';
-
-            $test_case = 'api_get_path(TO_REL, '.$path[0].')';
-            $test_case = str_replace(array('{', '}'), '', $test_case);
-            $res[$test_case] = api_get_path(TO_REL, $path[0]);
-            $test_case_1 = 'api_get_path(TO_REL, \''.$path[1].'\')';
-            $res[$test_case_1] = api_get_path(TO_REL, $path[1]);
-            $is_ok[$test_case] =
-                is_string($res[$test_case]) && !empty($res[$test_case])
-                && is_string($res[$test_case_1]) && !empty($res[$test_case_1])
-                && $res[$test_case] == $res[$test_case_1];
-            $message[] = ($is_ok[$test_case] ? '<span style="color: green; font-weight: bold;">Ok</span>' : '<span style="color: red; font-weight: bold;">Failed</span>').' : ';
-            $message[] = $test_case.' => '.$res[$test_case];
-            $message[] = $test_case_1.' => '.$res[$test_case_1];
-            $message[] = '';
-
-        }
-
-        $message[] = '';
-        $message[] = 'Random examples, check them visually';
-        $message[] = '---------------------------------------------------------------------------------------------------------------';
-        $message[] = '';
-        $message[] = '$_SERVER[\'REQUEST_URI\'] => '.$_SERVER['REQUEST_URI'];
-        $message[] = '<strong>Note:</strong> Try some query strings. They should be removed from the results.';
-        $message[] = 'api_get_path(TO_WEB, $_SERVER[\'REQUEST_URI\']) => '.api_get_path(TO_WEB, $_SERVER['REQUEST_URI']);
-        $message[] = 'api_get_path(TO_SYS, $_SERVER[\'REQUEST_URI\']) => '.api_get_path(TO_SYS, $_SERVER['REQUEST_URI']);
-        $message[] = 'api_get_path(TO_REL, $_SERVER[\'REQUEST_URI\']) => '.api_get_path(TO_REL, $_SERVER['REQUEST_URI']);
-        $message[] = '';
-        $message[] = '__FILE__ => '.__FILE__;
-        $message[] = 'api_get_path(TO_WEB, __FILE__) => '.api_get_path(TO_WEB, __FILE__);
-        $message[] = 'api_get_path(TO_SYS, __FILE__) => '.api_get_path(TO_SYS, __FILE__);
-        $message[] = 'api_get_path(TO_REL, __FILE__) => '.api_get_path(TO_REL, __FILE__);
-        $message[] = '';
-        $message[] = '$_SERVER[\'PHP_SELF\'] => '.$_SERVER['PHP_SELF'];
-        $message[] = 'api_get_path(TO_WEB, $_SERVER[\'PHP_SELF\']) => '.api_get_path(TO_WEB, $_SERVER['PHP_SELF']);
-        $message[] = 'api_get_path(TO_SYS, $_SERVER[\'PHP_SELF\']) => '.api_get_path(TO_SYS, $_SERVER['PHP_SELF']);
-        $message[] = 'api_get_path(TO_REL, $_SERVER[\'PHP_SELF\']) => '.api_get_path(TO_REL, $_SERVER['PHP_SELF']);
-        $message[] = '';
-
-        $message[] = '';
-        $message[] = '---------------------------------------------------------------------------------------------------------------';
-        $message[] = 'This test and changes of behaviour of api_get_path() have been done by Ivan Tcholakov, September 22, 2009.';
-        $message[] = '';
-
-        $result = !in_array(false, $is_ok);
-         $this->assertTrue($result);
-         //var_dump($res);
-         foreach ($message as $line) { echo $line.'<br />'; }
-
-         // Sample code for showing results in different context.
-         /*
-        $common_paths = array(
-            WEB_PATH,
-            SYS_PATH,
-            REL_PATH,
-            WEB_SERVER_ROOT_PATH,
-            SYS_SERVER_ROOT_PATH,
-            WEB_COURSE_PATH,
-            SYS_COURSE_PATH,
-            REL_COURSE_PATH,
-            REL_CODE_PATH,
-            WEB_CODE_PATH,
-            SYS_CODE_PATH,
-            SYS_LANG_PATH,
-            WEB_IMG_PATH,
-            WEB_CSS_PATH,
-            SYS_PLUGIN_PATH,
-            WEB_PLUGIN_PATH,
-            SYS_ARCHIVE_PATH,
-            WEB_ARCHIVE_PATH,
-            INCLUDE_PATH,
-            LIBRARY_PATH,
-            CONFIGURATION_PATH,
-            WEB_LIBRARY_PATH
-        );
-
-        $specific_paths = array(
-            FLASH_PLAYER_AUDIO,
-            FLASH_PLAYER_VIDEO,
-            SCRIPT_SWFOBJECT,
-            SCRIPT_ASCIIMATHML,
-            DRAWING_ASCIISVG
-        );
-
-        $res = array();
-        $is_ok = array();
-        $message = array();
-        $paths = array();
-
-        $message[] = '';
-        $message[] = 'Reading common purpose paths';
-        $message[] = '---------------------------------------------------------------------------------------------------------------';
-        $message[] = '';
-
-        foreach ($common_paths as $path) {
-
-            $test_case = "api_get_path($path)";
-            $res[$test_case] = api_get_path($path);
-            $message[] = $test_case.' => '.$res[$test_case];
-        }
-
-        $message[] = '';
-        $message[] = '';
-        $message[] = 'Reading specific purpose paths';
-        $message[] = '---------------------------------------------------------------------------------------------------------------';
-        $message[] = '';
-
-        foreach ($specific_paths as $path) {
-
-            $test_case = "api_get_path(TO_WEB, $path)";
-            $test_case = str_replace(array('{', '}'), '', $test_case);
-            $res[$test_case] = api_get_path(TO_WEB, $path);
-            $message[] = $test_case.' => '.$res[$test_case];
-            $paths[] = $path;
-
-            $test_case = "api_get_path(TO_SYS, $path)";
-            $test_case = str_replace(array('{', '}'), '', $test_case);
-            $res[$test_case] = api_get_path(TO_SYS, $path);
-            $message[] = $test_case.' => '.$res[$test_case];
-            $paths[] = $path;
-
-            $test_case = "api_get_path(TO_REL, $path)";
-            $test_case = str_replace(array('{', '}'), '', $test_case);
-            $res[$test_case] = api_get_path(TO_REL, $path);
-            $message[] = $test_case.' => '.$res[$test_case];
-            $paths[] = $path;
-        }
-
-        foreach ($message as $line) { echo $line.'<br />'; }
-        */
-    }
-
-    public function testApiIsInternalPath() {
-        $path1 = api_get_path(WEB_IMG_PATH);
-        $path2 = 'http://kdflskfsenfnmzsdn/fnefsdsmdsdmsdfsdcmxaddfdafada/index.html';
-        $path3 = api_get_path(TO_SYS, WEB_IMG_PATH);
-        $path4 = 'C:\Inetpub\wwwroot\fnefsdsmdsdmsdfsdcmxaddfdafada/index.html';
-        $path5 = api_get_path(TO_REL, WEB_IMG_PATH);
-        $path6 = '/fnefsdsmdsdmsdfsdcmxaddfdafada/index.html';
-        $res1 = api_is_internal_path($path1);
-        $res2 = api_is_internal_path($path2);
-        $res3 = api_is_internal_path($path3);
-        $res4 = api_is_internal_path($path4);
-        $res5 = api_is_internal_path($path5);
-        $res6 = api_is_internal_path($path6);
-        $this->assertTrue(is_bool($res1) && is_bool($res2) && is_bool($res3) && is_bool($res4) && is_bool($res5) && is_bool($res6)
-            && $res1 && !$res2 && $res3 && !$res4 && $res5 && !$res6);
-        //var_dump($res1);
-        //var_dump($res2);
-        //var_dump($res1);
-        //var_dump($res2);
-        //var_dump($res1);
-        //var_dump($res2);
-    }
-
-    public function testApiAddTrailingSlash() {
-        $string1 = 'path';
-        $string2 = 'path/';
-        $res1 = api_add_trailing_slash($string1);
-        $res2 = api_add_trailing_slash($string2);
-        $this->assertTrue(is_string($res1) && is_string($res2) && $res1 == $res2);
-        //var_dump($res1);
-        //var_dump($res2);
-    }
-
-    public function testRemoveAddTrailingSlash() {
-        $string1 = 'path';
-        $string2 = 'path/';
-        $res1 = api_remove_trailing_slash($string1);
-        $res2 = api_remove_trailing_slash($string2);
-        $this->assertTrue(is_string($res1) && is_string($res2) && $res1 == $res2);
-        //var_dump($res1);
-        //var_dump($res2);
-    }
-}
-
-/**
- *	Returns a full path to a certain Dokeos area, which you specify
- *	through a parameter.
- *
- *	See $_configuration['course_folder'] in the configuration.php
- *	to alter the WEB_COURSE_PATH and SYS_COURSE_PATH parameters.
- *
- *	@param one of the following constants:
- *	WEB_SERVER_ROOT_PATH, SYS_SERVER_ROOT_PATH,
- *	WEB_PATH, SYS_PATH, REL_PATH, WEB_COURSE_PATH, SYS_COURSE_PATH,
- *	REL_COURSE_PATH, REL_CODE_PATH, WEB_CODE_PATH, SYS_CODE_PATH,
- *	SYS_LANG_PATH, WEB_IMG_PATH, GARBAGE_PATH, WEB_PLUGIN_PATH, SYS_PLUGIN_PATH, WEB_ARCHIVE_PATH, SYS_ARCHIVE_PATH,
- *	INCLUDE_PATH, WEB_LIBRARY_PATH, LIBRARY_PATH, CONFIGURATION_PATH
- *
- * 	@example assume that your server root is /var/www/ dokeos is installed in a subfolder dokeos/ and the URL of your campus is http://www.mydokeos.com
- * 	The other configuration paramaters have not been changed.
- * 	The different api_get_paths will give
- *	WEB_SERVER_ROOT_PATH	http://www.mydokeos.com/
- *	SYS_SERVER_ROOT_PATH	/var/www/ - This is the physical folder where the system Dokeos has been placed. It is not always equal to $_SERVER['DOCUMENT_ROOT'].
- * 	WEB_PATH				http://www.mydokeos.com/dokeos/
- * 	SYS_PATH				/var/www/dokeos/
- * 	REL_PATH				dokeos/
- * 	WEB_COURSE_PATH			http://www.mydokeos.com/dokeos/courses/
- * 	SYS_COURSE_PATH			/var/www/dokeos/courses/
- *	REL_COURSE_PATH			/dokeos/courses/
- * 	REL_CODE_PATH			/dokeos/main/
- * 	WEB_CODE_PATH			http://www.mydokeos.com/dokeos/main/
- * 	SYS_CODE_PATH			/var/www/dokeos/main/
- * 	SYS_LANG_PATH			/var/www/dokeos/main/lang/
- * 	WEB_IMG_PATH			http://www.mydokeos.com/dokeos/main/img/
- * 	GARBAGE_PATH
- * 	WEB_PLUGIN_PATH			http://www.mydokeos.com/dokeos/plugin/
- * 	SYS_PLUGIN_PATH			/var/www/dokeos/plugin/
- * 	WEB_ARCHIVE_PATH		http://www.mydokeos.com/dokeos/archive/
- * 	SYS_ARCHIVE_PATH		/var/www/dokeos/archive/
- *	INCLUDE_PATH			/var/www/dokeos/main/inc/
- * 	WEB_LIBRARY_PATH		http://www.mydokeos.com/dokeos/main/inc/lib/
- * 	LIBRARY_PATH			/var/www/dokeos/main/inc/lib/
- * 	CONFIGURATION_PATH		/var/www/dokeos/main/inc/conf/
- */
-function api_get_path_1_8_6_1($path_type) {
-
-    global $_configuration;
-    if (!isset($_configuration['access_url']) || $_configuration['access_url']==1 || $_configuration['access_url']=='') {
-        //by default we call the $_configuration['root_web'] we don't query to the DB
-        //$url_info= api_get_access_url(1);
-        //$root_web = $url_info['url'];
-        if(isset($_configuration['root_web']))
-            $root_web = $_configuration['root_web'];
-    } else {
-        //we look into the DB the function api_get_access_url
-        //this funcion have a problem because we can't called to the Database:: functions
-        $url_info= api_get_access_url($_configuration['access_url']);
-        if ($url_info['active']==1) {
-            $root_web = $url_info['url'];
-        } else {
-            $root_web = $_configuration['root_web'];
-        }
-    }
-
-    switch ($path_type) {
-
-        case WEB_SERVER_ROOT_PATH:
-            // example: http://www.mydokeos.com/
-            $result = preg_replace('@'.api_get_path(REL_PATH).'$@', '', api_get_path(WEB_PATH));
-            if (substr($result, -1) == '/') {
-                return $result;
-            } else {
-                return $result.'/';
-            }
-            break;
-
-        case SYS_SERVER_ROOT_PATH:
-            $result = preg_replace('@'.api_get_path(REL_PATH).'$@', '', api_get_path(SYS_PATH));
-            if (substr($result, -1) == '/') {
-                return $result;
-            } else {
-                return $result.'/';
-            }
-            break;
-
-        case WEB_PATH :
-            // example: http://www.mydokeos.com/ or http://www.mydokeos.com/dokeos/ if you're using
-            // a subdirectory of your document root for Dokeos
-            if (substr($root_web,-1) == '/') {
-                return $root_web;
-            } else {
-                return $root_web.'/';
-            }
-            break;
-
-        case SYS_PATH :
-            // example: /var/www/dokeos/
-            if (substr($_configuration['root_sys'],-1) == '/') {
-                return $_configuration['root_sys'];
-            } else {
-                return $_configuration['root_sys'].'/';
-            }
-            break;
-
-        case REL_PATH :
-            // example: dokeos/
-            if (substr($_configuration['url_append'], -1) === '/') {
-                return $_configuration['url_append'];
-            } else {
-                return $_configuration['url_append'].'/';
-            }
-            break;
-
-        case WEB_COURSE_PATH :
-            // example: http://www.mydokeos.com/courses/
-            return $root_web.$_configuration['course_folder'];
-            break;
-
-        case SYS_COURSE_PATH :
-            // example: /var/www/dokeos/courses/
-            return $_configuration['root_sys'].$_configuration['course_folder'];
-            break;
-
-        case REL_COURSE_PATH :
-            // example: courses/ or dokeos/courses/
-            return api_get_path(REL_PATH).$_configuration['course_folder'];
-            break;
-
-        case REL_CODE_PATH :
-            // example: main/ or dokeos/main/
-            return api_get_path(REL_PATH).$_configuration['code_append'];
-            break;
-
-        case WEB_CODE_PATH :
-            // example: http://www.mydokeos.com/main/
-            //return $GLOBALS['clarolineRepositoryWeb']; // this was changed
-            return $root_web.$_configuration['code_append'];
-            break;
-
-        case SYS_CODE_PATH :
-            // example: /var/www/dokeos/main/
-            return $GLOBALS['clarolineRepositorySys'];
-            break;
-
-        case SYS_LANG_PATH :
-            // example: /var/www/dokeos/main/lang/
-            return api_get_path(SYS_CODE_PATH).'lang/';
-            break;
-
-        case WEB_IMG_PATH :
-            // example: http://www.mydokeos.com/main/img/
-            return api_get_path(WEB_CODE_PATH).'img/';
-            break;
-
-        case SYS_PLUGIN_PATH :
-            // example: /var/www/dokeos/plugin/
-            return api_get_path(SYS_PATH).'plugin/';
-            break;
-
-        case WEB_PLUGIN_PATH :
-            // example: http://www.mydokeos.com/plugin/
-            return api_get_path(WEB_PATH).'plugin/';
-            break;
-
-        case GARBAGE_PATH : //now set to be same as archive
-        case SYS_ARCHIVE_PATH :
-            // example: /var/www/dokeos/archive/
-            return api_get_path(SYS_PATH).'archive/';
-            break;
-
-        case WEB_ARCHIVE_PATH :
-            // example: http://www.mydokeos.com/archive/
-            return api_get_path(WEB_PATH).'archive/';
-            break;
-
-        case INCLUDE_PATH :
-            // Generated by main/inc/global.inc.php
-            // example: /var/www/dokeos/main/inc/
-            $incpath = realpath(dirname(__FILE__).'/../');
-            return str_replace('\\', '/', $incpath).'/';
-            break;
-
-        case LIBRARY_PATH :
-            // example: /var/www/dokeos/main/inc/lib/
-            return api_get_path(INCLUDE_PATH).'lib/';
-            break;
-
-        case WEB_LIBRARY_PATH :
-            // example: http://www.mydokeos.com/main/inc/lib/
-            return api_get_path(WEB_CODE_PATH).'inc/lib/';
-            break;
-
-        case CONFIGURATION_PATH :
-            // example: /var/www/dokeos/main/inc/conf/
-            return api_get_path(INCLUDE_PATH).'conf/';
-            break;
-
-        default :
-            return;
-            break;
-    }
-}
-
-?>

+ 0 - 61
tests/main/inc/lib/message.lib.test.php

@@ -1,61 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'message.lib.php');
-
-class TestMessage extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Messages library - main/inc/lib/message.lib.test.php');
-    }
-
-	function testGetNumberOfMessagesMask() {
-		$res=get_number_of_messages_mask();
-		$this->assertTrue(is_string($res));
-        //var_dump($res);
-	}
-
-	function testGetMessageDataMask() {
-		$from='';
-		$number_of_items=get_number_of_messages_mask();
-		$column='3';
-		$direction='';
-		$res=get_message_data_mask($from, $number_of_items, $column, $direction);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testGetMessageDataSendMask() {
-		$from='';
-		$number_of_items=get_number_of_messages_send_mask();
-		$column= '3';
-		$direction='';
-		$res=get_message_data_send_mask($from, $number_of_items, $column, $direction);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testGetNumberOfMessagesSendMask() {
-		$res=get_number_of_messages_send_mask();
-		$this->assertTrue(is_string($res));
-        //var_dump($res);
-
-	}
-
-	function testInboxDisplay() {
-		global $charset;
-		ob_start();
-		$res=inbox_display();
-		$this->assertTrue(is_null($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-
-	function testOutboxDisplay() {
-		global $charset;
-		ob_start();
-		$res=outbox_display();
-		$this->assertTrue(is_null($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 87
tests/main/inc/lib/notebook.lib.test.php

@@ -1,87 +0,0 @@
-<?php
-class TestNotebook extends UnitTestCase {
-
-	public function __construct() {
-        $this->UnitTestCase('Glossary library - main/inc/lib/notebook.lib.test.php');
-		TestManager::create_test_course('COURSENOTEBOOK');
-	}
-
-    public function __destruct() {
-        TestManager::delete_test_course('COURSENOTEBOOK');
-    }
-
-	public function testJavascriptNotebookOutputsString() {
-		$res = NotebookManager::javascript_notebook(null);
-		$lang = get_lang("NoteConfirmDelete");
-		$this->assertTrue(is_string($res));
-		$this->assertPattern('/script/m',$res);
-        $this->assertPattern('/\/script/m',$res);
-	}
-
-	public function testSaveNoteIsFalseWhenNoteIsNull() {
-		$resNull = NotebookManager::save_note(null);
-		$this->assertFalse($resNull);
-    }
-
-    public function testSaveNoteIsFalseWhenNoteIsNegativeInt() {
-		$resFalse = NotebookManager::save_note(-1);
-	 	$this->assertFalse($resFalse);
-    }
-
-    public function testSaveNoteIsFalseWhenNoteIsEmptyArray() {
-	 	$res = NotebookManager::save_note(array());
-		$this->assertTrue(is_bool($res));
-	}
-
-	public function testGetNoteInformationIsFalseWhenNoteIsNull() {
-		$resNull = NotebookManager::get_note_information(null);
-	 	$this->assertFalse($resNull);
-    }
-
-    public function testGetNoteInformationIsFalseWhenNoteIsNegativeInt() {
-	 	$resFalse = NotebookManager::get_note_information(-1);
-	 	$this->assertFalse($resFalse);
-    }
-
-    public function testGetNoteInformationIsArray() {
-	 	$res = NotebookManager::get_note_information(1);
-	 	$this->assertTrue(is_array($res));
-	}
-
-	public function testUpdateNoteIsFalseWhenNoteIsNull() {
-		$resNull = NotebookManager::update_note(null);
-	 	$this->assertFalse($resNull);
-    }
-
-    public function testUpdateNoteIsFalseWhenNoteDoesNotExist() {
-	 	$resFalse = NotebookManager::update_note('char');
-	 	$this->assertFalse($resFalse);
-    }
-
-    public function testUpdateNoteIsFalseWhenNoteIsEmptyArray() {
-	 	$res = NotebookManager::update_note(array());
-	 	$this->assertFalse($res);
-	}
-
-	public function testDisplayNotes() {
-		ob_start();
-		$res = NotebookManager::display_notes();
-		$this->assertTrue(is_null($res));
-		ob_end_clean();
-	}
-
-	public function testDeleteNoteIsFalseWhenNoteIsNull() {
-		$resNull = NotebookManager::delete_note(null);
-	 	$this->assertFalse($resNull);
-    }
-
-    public function testDeleteNoteIsFalseWhenNoteIsNegative() {
-	 	$resFalse = NotebookManager::delete_note(-1);
-	 	$this->assertFalse($resFalse);
-    }
-
-    public function testDeleteNoteISFalseWhenNoteDoesNotExist() {
-	 	$res = NotebookManager::delete_note(1);
-		$this->assertFalse($res);
-	}
-}

+ 0 - 64
tests/main/inc/lib/online.inc.test.php

@@ -1,64 +0,0 @@
-<?php
-/**
- * To can test this file you need commet the line 125 in "online.inc.php"
- */
-require_once(api_get_path(LIBRARY_PATH).'online.inc.php');
-
-class TestOnline extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Online (chat) library - main/inc/lib/online.inc.test.php');
-    }
-
-	function testLoginCheck() {
-		global $_course;
-		$uid=1;
-		$res=LoginCheck($uid);
-		$this->assertTrue(is_null($res));
-	}
-
-	function testLoginDelete() {
-		$user_id=1;
-		$res=LoginDelete($user_id);
-		$this->assertTrue(is_null($res));
-	}
-
-	function testonline_logout(){
-		global $_configuration, $extAuthSource;
-		global $logout_no_redirect;
-		$logout_no_redirect = 'prueba';
-		$res=online_logout();
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testwho_is_online_in_this_course() {
-		$uid='';
-		$valid='';
-		$rarray = array();
-		$barray = array();
-		$login_user_id= '';
-		$login_date= '';
-		array_push($rarray,$barray);
-		array_push($barray,$login_user_id);
-		array_push($barray,$login_date);
-
-		$res=who_is_online_in_this_course($uid, $valid, $coursecode=null);
-		if(!empty($barray)){
-		$this->assertTrue(is_array($barray));
-		//var_dump($str);
-		} else {
-			$this->assertTrue(is_bool($barray));
-			//var_dump($rarray);
-		}
-		//var_dump($rarray);
-	}
-
-	function testwho_is_online()  {
-		$valid='';
-		$res=who_is_online($valid);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 72
tests/main/inc/lib/rmdirr.lib.test.php

@@ -1,72 +0,0 @@
-<?php
-
-/**
- * Testing the function rmdirr() for recursive directory deletion.
- * This test is an adaptation of a published sample test.
- * @link http://aidanlister.com/2004/04/recursively-deleting-a-folder-in-php/
- * @author Aidan Lister, April, 2004
- * @author Ivan Tcholakov, September, 2009 - adaptation for the Dokeos LMS.
- */
-
-class Test_RmDirRFunction extends UnitTestCase {
-
-	function Test_RmDirRFunction() {
-        $this->UnitTestCase('Testing the function rmdirr() for recursive directory deletion');
-	}
-
-	public function test_rmdirr() {
-
-		$current_dir = dirname(__FILE__).'/';
-		$test_dir = $current_dir.'../../../../archive/'; // Write-access is needed for this directory.
-		$test_dir = realpath($test_dir).'/';
-
-		// Let us not clean backwars slashes on Windows, intentionally.
-		//$test_dir = str_replace('\\', '/', $test_dir);
-
-		// Create a directory and file tree
-		mkdir($test_dir.'testdelete');
-		mkdir($test_dir.'testdelete/one-a');
-		touch($test_dir.'testdelete/one-a/testfile');
-		mkdir($test_dir.'testdelete/one-b');
-
-		// Add some hidden files for good measure
-		touch($test_dir.'testdelete/one-b/.hiddenfile');
-		mkdir($test_dir.'testdelete/one-c');
-		touch($test_dir.'testdelete/one-c/.hiddenfile');
-
-		// Add some more depth
-		mkdir($test_dir.'testdelete/one-c/two-a');
-		touch($test_dir.'testdelete/one-c/two-a/testfile');
-		mkdir($test_dir.'testdelete/one-d/');
-
-		// Test that symlinks are not followed
-		// The function symlink() does not work on some Windows OS versions. For these cases this part of the test is skipped.
-		$function_symlink_exists = function_exists('symlink');
-		if ($function_symlink_exists) {
-			mkdir($test_dir.'testlink');
-			touch($test_dir.'testlink/testfile');
-			symlink($test_dir.'testlink/testfile', 'testdelete/one-d/my-symlink');
-			symlink($test_dir.'testlink', 'testdelete/one-d/my-symlink-dir');
-		}
-
-		// Run the actual delete
-		$status = rmdirr($test_dir.'testdelete');
-
-		// Check if we passed the test
-		if ($status === true && !file_exists($test_dir.'testdelete') && ($function_symlink_exists ? file_exists($test_dir.'testlink/testfile') : true)) {
-			//echo 'TEST PASSED';
-			$res = true;
-		} else {
-			//echo 'TEST FAILED';
-			$res = false;
-		}
-		if ($function_symlink_exists) {
-			@rmdirr($test_dir.'testlink');
-		}
-
-		// Pass the result of this test
-		$this->assertTrue($res === true);
-		//var_dump($test_dir);
-	}
-
-}

+ 0 - 105
tests/main/inc/lib/security.lib.test.php

@@ -1,105 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'security.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
-
-class TestSecurity extends UnitTestCase {
-
-	public $clean = array();
-
-    public function __construct() {
-        $this->UnitTestCase('Security library - main/inc/lib/security.lib.test.php');
-    }
-
-	function testcheck_abs_path() {
-			$abs_path='';
-			$checker_path='';
-			$res=Security::check_abs_path($abs_path,$checker_path);
-			$this->assertTrue(is_bool($res));
-			//var_dump($res);
-	}
-
-	function testcheck_rel_path() {
-			$rel_path='';
-			$checker_path='';
-			$res=Security::check_rel_path($rel_path,$checker_path);
-			$this->assertTrue(is_bool($res));
-			//var_dump($res);
-
-	}
-
-	function testcheck_token() {
-			$res=Security::check_token();
-			$this->assertTrue(is_bool($res));
-			//var_dump($res);
-	}
-
-	function testcheck_ua() {
-			$res=Security::check_ua();
-			$this->assertTrue(is_bool($res));
-			//var_dump($res);
-	}
-	function testclear_token() {
-			$res=Security::clear_token();
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-	}
-
-	function testfilter() {
-			$var ='';
-			$type='string';
-			$options=array();
-			$res=Security::filter($var, $type, $options);
-			$this->assertTrue(is_bool($res));
-			//var_dump($res);
-	}
-
-	function testfilter_filename() {
-	 		$filename = 'security/.htaccess';
-	 		$res=Security::filter_filename($filename);
-			$this->assertTrue(is_string($res));
-			//var_dump($res);
-	 }
-
-	 function testget() {
-	 		$varname='';
-	 		$res=Security::get($varname);
-	 		if(!empty($res)) {
-	 				$this->assertTrue(is_string($res));
-	 		}	else {
-	 				$this->assertTrue(is_null($res));
-	 		}
-			//var_dump($res);
-	 }
-
-	 function testget_HTML_token() {
-	 		$res=Security::get_HTML_token();
-			$this->assertTrue(is_string($res));
-			//var_dump($res);
-	 }
-
-	function testget_token() {
-			$res=Security::get_token();
-			$this->assertTrue(is_string($res));
-			//var_dump($res);
-	}
-
-	function testget_ua() {
-			$res=Security::get_ua();
-			$this->assertTrue(is_null($res));
-			//var_dump($res);
-	}
-
-	function testremove_XSS() {
-			global $charset;
-			$var ='';
-			$user_status=ANONYMOUS;
-			$res=Security::remove_XSS($var,$user_status=ANONYMOUS);
-			if(!empty($res)) {
-				$this->assertTrue(is_array($res));
-			} else {
-				$this->assertTrue(is_string($res));
-			}
-			//var_dump($res);
-	}
-}
-?>

+ 0 - 107
tests/main/inc/lib/session_handler.class.test.php

@@ -1,107 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'session_handler.class.php');
-
-class TestSessionHandler extends UnitTestCase {
-
-	var $connection;
-	var $connection_handler;
-	var $lifetime;
-	var $session_name;
-
-
-	public function TestSessionHandler(){
-		$this->UnitTestCase('Session handler library - main/inc/lib/session_handler.class.test.php');
-	}
-	function testClose() {
-		$instancia = new session_handler();
-		$res=$instancia->close();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testdestroy() {
-		$instancia = new session_handler();
-		$sess_id='';
-		$res=$instancia->destroy($sess_id);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testgarbage() {
-		$instancia = new session_handler();
-		$lifetime='';
-		$res=$instancia->garbage($lifetime);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testopen() {
-		$instancia = new session_handler();
-		$path='';
-		$name='';
-		$res=$instancia->open($path,$name);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testread() {
-		$instancia = new session_handler();
-		$sess_id='';
-		$res=$instancia->read($sess_id);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/*
-	//No se puede probar por tener el mismo nombre de la clase
-	function testsessionhandler() {
-		$instancia = new session_handler();
-		global $_configuration;
-		$res=$instancia->session_handler();
-		$this->assertTrue(is_string($res));
-		var_dump($res);
-	}
-	*/
-
-	function testsqlClose() {
-		$instancia = new session_handler();
-		$res=$instancia->sqlClose();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testsqlConnect() {
-		$instancia = new session_handler();
-		$res=$instancia->sqlConnect();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testsqlQuery() {
-
-		global $_configuration;
-
-		$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
-		$query = 'select user_id from '.$tbl_user;
-
-		$instancia = new session_handler();
-		$instancia->connection_handler = mysql_connect($_configuration['db_host'],
-												$_configuration['db_user'],
-												$_configuration['db_password']);
-
-		$res= $instancia->sqlQuery($query, false);
-		$this->assertTrue(is_resource($res));
-		$this->assertTrue($res);
-
-	}
-
-	function testwrite() {
-		$instancia = new session_handler();
-		$sess_id='';
-		$sess_value='';
-		$res=$instancia->write($sess_id,$sess_value);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 127
tests/main/inc/lib/sessionmanager.lib.test.php

@@ -1,127 +0,0 @@
-<?php
-
-require_once(api_get_path(LIBRARY_PATH).'sessionmanager.lib.php');
-
-class TestSessionManager extends UnitTestCase {
-
-	public function TestSessionManager(){
-		$this->UnitTestCase('Sessions manager library - main/inc/lib/sessionmanager.lib.test.php');
-	}
-	function testadd_courses_to_session() {
-		$id_session='';
-		$course_list='';
-		ob_start();
-		$res=SessionManager::add_courses_to_session($id_session,$course_list);
-		if(!empty($res)) {
-			$this->assertTrue(is_null($res));
-		} else {
-			$this->assertTrue(is_bool($res));
-		}
-		ob_end_clean();
-		//var_dump($res);
-	}
-
-	function testcreate_session() {
-		global $_user;
-		$sname='';
-		$syear_start='';
-		$smonth_start='';
-		$sday_start='';
-		$syear_end='';
-		$smonth_end='';
-		$sday_end='';
-		$snb_days_acess_before='';
-		$snb_days_acess_after='';
-		$nolimit='';
-		$coach_username='';
-		$id_session_category='';
-		$id_visibility='';
-		$id_session=Database::insert_id();
-		ob_start();
-		$res=SessionManager::create_session($sname,$syear_start,$smonth_start,$sday_start,$syear_end,$smonth_end,$sday_end,$snb_days_acess_before,$snb_days_acess_after,$nolimit,$coach_username,$id_session_category,$id_visibility);
-		$this->assertTrue(is_numeric($id_session));
-		$this->assertTrue(is_string($res));
-		ob_end_clean();
-		//var_dump($id_session);
-	}
-
-	function testcreate_session_extra_field() {
-		$fieldvarname='';
-		$fieldtype='';
-		$fieldtitle='';
-		ob_start();
-		$res=SessionManager::create_session_extra_field($fieldvarname, $fieldtype, $fieldtitle);
-		$this->assertTrue(is_numeric($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-	/*
-	//Esta prueba muestra pantallaso, lo dejo comentado
-	function testdelete_session() {
-		$idsesion = new MockDatabase();
-		$idse = new Mockapi_failure();
-		global $_user;
-		$id_checked='';
-		$this->sessionmanager = new SessionManager();
-		$res=SessionManager::delete_session($id_checked);
-		$idsesion->expectOnce(Database :: get_main_table(TABLE_MAIN_SESSION));
-		$this->assertTrue(is_object($idsesion));
-		$this->assertTrue(is_null($res));
-		var_dump($res);
-	}
-	*/
-
-	function testedit_session() {
-		global $_user;
-		$id=1;
-		$name='';
-		$year_start='';
-		$month_start='';
-		$day_start='';
-		$year_end='';
-		$month_end='';
-		$day_end='';
-		$nb_days_acess_before='';
-		$nb_days_acess_after='';
-		$nolimit='';
-		$id_coach='';
-		$id_session_category='';
-		$id_visibility='';
-		$res=SessionManager::edit_session($id,$name,$year_start,$month_start,$day_start,$year_end,$month_end,$day_end,$nb_days_acess_before,$nb_days_acess_after,$nolimit,$id_coach, $id_session_category, $id_visibility);
-		$this->assertTrue(is_numeric($id));
-		$this->assertTrue(is_string($res));
-		//var_dump($id);
-	}
-
-	function testget_session_by_name() {
-		$session_name='';
-		$res=SessionManager::get_session_by_name($session_name);
-		if(!is_bool($res)) $this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testrelation_session_course_exist() {
-		$session_id=1;
-		$course_id='';
-		$res=SessionManager::relation_session_course_exist($session_id, $course_id);
-		if(!is_numeric($res)) $this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testsuscribe_users_to_session() {
-		$id_session='';
-		$user_list='';
-		$res=SessionManager::suscribe_users_to_session($id_session,$user_list,$empty_users=true);
-		if(!is_null($res)) $this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testupdate_session_extra_field_value() {
-		$session_id='';
-		$fname='';
-		$fvalue='';
-		$res=SessionManager::update_session_extra_field_value($session_id,$fname,$fvalue='');
-		$this->assertTrue(is_bool($res));
-	}
-}
-?>

+ 0 - 152
tests/main/inc/lib/social.lib.test.php

@@ -1,152 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'social.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'main_api.lib.php');
-
-class TestSocial extends UnitTestCase{
-    //public $social;
-
-    public function __construct() {
-        $this->UnitTestCase('Social network library - main/inc/lib/social.lib.test.php');
-    }
-/*
-	public function setUp(){
-		$this->social = new SocialManager();
-	}
-
-	public function tearDown(){
-		$this->social = null;
-	}
-	*/
-
-	public function testShowListTypeFriends(){
-		$res =SocialManager::show_list_type_friends();
-		$this->assertTrue($res);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testGetRelationTypeByName (){
-		$relation_type_name=1;
-		$res = SocialManager::get_relation_type_by_name($relation_type_name);
-		if(is_null($res))
-		{
-			$this->assertNull($res);
-			$this->assertTrue(is_null($res));
-		} else
-		  {
-			$this->assertTrue(is_numeric($res));
-			$this->assertTrue($res);
-		  }
-		//var_dump($res);
-	}
-
-	public function testGetRelationBetweenContacts (){
-		$user_id=1;
-		$user_friend=3;
-		$res =SocialManager::get_relation_between_contacts($user_id,$user_friend);
-		if(is_numeric($res)){
-			$this->assertFalse($res);
-			$this->assertTrue(is_numeric($res));
-		} else
-		  {
-			$this->assertTrue(is_string($res));
-			$this->assertTrue($res);
-		  }
-		//var_dump($res);
-
-	}
-
-	public function testGetListPathWebByUserId(){
-		$user_id=1;
-		$id_group=null;
-		$search_name=null;
-		$res = SocialManager::get_list_path_web_by_user_id($user_id,$id_group,$search_name);
-		if(!($res===true)):
-		$this->assertTrue(is_array($res));
-		endif;
-		//var_dump($res);
-	}
-
-	public function testGetListWebPathUserInvitationByUserId(){
-		$user_id=1;
-		$res = SocialManager::get_list_web_path_user_invitation_by_user_id($user_id);
-		if(is_array($res))
-		$this->assertTrue(is_array($res));
-		else
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testSendInvitationFriend(){
-		$user_id=1;
-		$friend_id=3;
-		$message_title='hello';
-		$message_content='hola';
-		$res = SocialManager::send_invitation_friend($user_id,$friend_id,$message_title,$message_content);
-		if(!is_null($res)):
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue(is_bool($res===true || $res === false));
-		endif;
-		//var_dump($res);
-	}
-
-	public function testGetMessageNumberInvitationByUserId(){
-		$user_receiver_id=3;
-		$res = SocialManager::get_message_number_invitation_by_user_id($user_receiver_id);
-		if(is_string($res)):
-		$this->assertTrue(is_numeric($res));
-		endif;
-		//var_dump($res);
-	}
-
-	public function testGetListInvitationOfFriendsByUserId(){
-		$user_id=1;
-		$res = SocialManager::get_list_invitation_of_friends_by_user_id($user_id);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testInvitationAccepted(){
-		$user_send_id=1;
-		$user_receiver_id=3;
-		$res = SocialManager::invitation_accepted($user_send_id,$user_receiver_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testInvitationDenied(){
-		$user_send_id=1;
-		$user_receiver_id=3;
-		$res = SocialManager::invitation_denied($user_send_id,$user_receiver_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testQualifyFriend(){
-		$id_friend_qualify=2;
-		$type_qualify=1;
-		$res = SocialManager::qualify_friend($id_friend_qualify,$type_qualify);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testSendInvitationFriendUser(){
-		global $_course, $charset;
-		ob_start();
-		$userfriend_id = 1;
-		$subject_message = 'test';
-		$content_message = 'this message is a test';
-		$res = SocialManager::send_invitation_friend_user ($userfriend_id,$subject_message,$content_message);
-		ob_end_clean();
-		if(is_string($res)){
-			$this->assertTrue($res);
-			$this->assertTrue(is_string($res));
-		} else {
-			$this->assertTrue(is_bool($res));
-			$this->assertTrue($res === false);
-		}
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 165
tests/main/inc/lib/sortabletable.class.test.php

@@ -1,165 +0,0 @@
-<?php
-require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
-require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
-
-class TestSortableTable extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Sortabletable library - main/inc/lib/sortabletable.class.test.php');
-    }
-
-	function testdisplay() {
-		$instancia = new SortableTable();
-		global $charset;
-		ob_start();
-		$res=$instancia->display();
-		$this->assertTrue(is_null($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-
-	function testfilter_data() {
-		$instancia = new SortableTable();
-		$row=array();
-		$res=$instancia->filter_data($row);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testget_additional_url_paramstring() {
-		$instancia = new SortableTable();
-		$res=$instancia->get_additional_url_paramstring();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testget_navigation_html() {
-		$instancia = new SortableTable();
-		$res=$instancia->get_navigation_html();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testget_page_select_form() {
-		$instancia = new SortableTable();
-		$res=$instancia->get_page_select_form();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testget_pager() {
-		$instancia = new SortableTable();
-		$res=$instancia->get_pager();
-		$this->assertTrue(is_object($res));
-		//var_dump($res);
-	}
-
-	function testget_sortable_table_param_string() {
-		$instancia = new SortableTable();
-		$res=$instancia->get_sortable_table_param_string();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testget_table_data() {
-		$instancia = new SortableTable();
-		$res=$instancia->get_table_data();
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testget_table_html() {
-		$instancia = new SortableTable();
-		$res=$instancia->get_table_html();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testget_table_title() {
-		$instancia = new SortableTable();
-		$res=$instancia->get_table_title();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testget_total_number_of_items() {
-		$instancia = new SortableTable();
-		$res=$instancia->get_total_number_of_items();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testset_additional_parameters() {
-		$instancia = new SortableTable();
-		$parameters='';
-		$res=$instancia->set_additional_parameters($parameters);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testset_column_filter() {
-		$instancia = new SortableTable();
-		$column='';
-		$function='';
-		$res=$instancia->set_column_filter($column, $function);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testset_form_actions() {
-		$instancia = new SortableTable();
-		$actions='';
-		$checkbox_name = 'id';
-		$res=$instancia->set_form_actions($actions, $checkbox_name = 'id');
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testset_header() {
-		$instancia = new SortableTable();
-		$column='';
-		$label='';
-		$res=$instancia->set_header($column, $label, $sortable = true, $th_attributes = null, $td_attributes = null);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testset_other_tables() {
-		$instancia = new SortableTable();
-		$tablenames='';
-		$res=$instancia->set_other_tables($tablenames);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-}
-
-class TestSortableTableFromArray extends UnitTestCase {
-
-	function testget_table_data() {
-		$res=SortableTableFromArray::get_table_data($from=1);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testget_total_number_of_items() {
-		$res=SortableTableFromArray::get_total_number_of_items();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-}
-
-class TestSortableTableFromArrayConfig extends UnitTestCase {
-
-	public function testget_table_data() {
-		$res=SortableTableFromArray::get_table_data($from=1);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testget_total_number_of_items() {
-		$res=SortableTableFromArray::get_total_number_of_items();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 99
tests/main/inc/lib/specific_fields_manager.lib.test.php

@@ -1,99 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php');
-
-class TestSpecificFieldsManager extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Specific (extra) fields library - main/inc/lib/specific_fields_manager.lib.test.php');
-    }
-
-	function testadd_specific_field() {
-		$name='';
-		$res=add_specific_field($name);
-		if(!is_bool($res)) {$this->assertTrue(is_string($res));}
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testadd_specific_field_value() {
-		$id_specific_field='';
-		$course_id='';
-		$tool_id='';
-		$ref_id='';
-		$value='';
-		$res=add_specific_field_value($id_specific_field, $course_id, $tool_id, $ref_id, $value);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testdelete_all_specific_field_value() {
-		$course_id='';
-		$id_specific_field='';
-		$tool_id='';
-		$ref_id='';
-		$res=delete_all_specific_field_value($course_id, $id_specific_field, $tool_id, $ref_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testdelete_all_values_for_item() {
-		$course_id='';
-		$tool_id='';
-		$ref_id='';
-		$id_specific_field='';
-		$res=delete_all_specific_field_value($course_id, $id_specific_field, $tool_id, $ref_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testdelete_specific_field() {
-		$id='';
-		$res=delete_specific_field($id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testedit_specific_field() {
-		$id='';
-		$name='';
-		$res=edit_specific_field($id,$name);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testget_specific_field_code_from_name() {
-		$name='';
-		$res=get_specific_field_code_from_name($name);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testget_specific_field_list() {
-		$res=get_specific_field_list($conditions = array(), $order_by = array());
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testget_specific_field_values_list() {
-		$res=get_specific_field_values_list($conditions = array(), $order_by = array());
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testget_specific_field_values_list_by_prefix() {
-		$prefix='';
-		$course_code='';
-		$tool_id='';
-		$ref_id=1;
-		$table_sf = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD);
-  		$table_sfv = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
-		$sql = sprintf($sql, $table_sf, $table_sfv, $prefix, $course_code, $tool_id, $ref_id);
-		$res=get_specific_field_values_list_by_prefix($prefix, $course_code, $tool_id, $ref_id);
-		$return_array = array();
-		$this->assertTrue(is_null($res));
-		$this->assertTrue(is_array($return_array));
-		//var_dump($res);
-		//var_dump($return_array);
-	}
-}
-?>

+ 0 - 157
tests/main/inc/lib/stats.lib.inc.test.php

@@ -1,157 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'stats.lib.inc.php');
-class TestStats extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('System stats library - main/inc/lib/stats.lib.test.php');
-    }
-
-	function testaddBrowser() {
-		$browser='';
-		$browsers_array=array();
-		$res=addBrowser($browser,$browsers_array);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testaddCountry(){
-		$country='';
-		$countries_array=array();
-		$res=addCountry($country,$countries_array);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testaddOs() {
-		$os='';
-		$os_array=array();
-		$res=addOs($os,$os_array);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testaddProvider() {
-		$provider='';
-		$providers_array=array();
-		$res=addProvider($provider,$providers_array);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testaddReferer() {
-		$referer='';
-		$referers_array=array();
-		$res=addReferer($referer,$referers_array);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testcleanProcessedRecords() {
-		global $TABLETRACK_OPEN;
-		$limit='';
-		$res=cleanProcessedRecords($limit);
-		if(!is_null($res)) $this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testdecodeOpenInfos() {  // 3 excepciones
-    	//ob_start();
-    	global $_course, $TABLETRACK_OPEN, $_configuration;
-    	$TABLETRACK_OPEN        = $_configuration['statistics_database'].".track_e_open";
-    	$ignore = ignore_user_abort();
-      	$res=decodeOpenInfos();
-    	//ob_end_clean();
-    	if (!is_null($res)){
-	    	$this->assertTrue(is_null($res));
-	    	$this->assertTrue(is_numeric($ignore));
-	    	//var_dump($res);
-    	}
- 	}
-
-	function testextractAgent() {
-		$user_agent=$_SERVER['HTTP_USER_AGENT'];
-		$list_browsers=array();
-		$list_os=array();
-		$res=extractAgent($user_agent, $list_browsers, $list_os );
-		$this->assertTrue(is_string($res));
-    	//var_dump($res);
-	}
-
-	function testextractCountry() {
-		$remhost= @getHostByAddr($_SERVER['REMOTE_ADDR']);
-		$list_countries=array();
-		$res=extractCountry($remhost,$list_countries);
-		if(!is_null($res))$this->assertTrue(is_string($res));
-    	//var_dump($res);
-	}
-
-	function testextractProvider() {
-		$remhost=@getHostByAddr($_SERVER['REMOTE_ADDR']);
-		$res=extractProvider($remhost);
-		if(!is_null($res))$this->assertTrue(is_string($res));
-    	//var_dump($res);
-	}
-
-	function testfillBrowsersTable() {
-		global $TABLESTATS_BROWSERS;
-		$browsers_array=array();
-		$res=fillBrowsersTable($browsers_array);
-		if(!is_null($res)) $this->assertTrue(is_array($res));
-    	//var_dump($res);
-	}
-
-	function testfillCountriesTable() {
-		global $TABLESTATS_COUNTRIES,$_configuration;
-		$TABLESTATS_COUNTRIES   = $_configuration['statistics_database'].".track_c_countries";
-		$countries_array=array();
-		$res=fillCountriesTable($countries_array);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testfillOsTable() {
-		global $TABLESTATS_OS;
-		$os_array=array();
-		$res=fillOsTable($os_array);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testfillProvidersTable() {
-		global $TABLESTATS_PROVIDERS;
-		$providers_array=array();
-		$res=fillProvidersTable($providers_array);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testfillReferersTable() {
-		global $TABLESTATS_REFERERS;
-		$referers_array=array();
-		$res=fillReferersTable($referers_array);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testloadBrowsers() {
-		$res=loadBrowsers();
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testloadCountries() {
-		global $TABLESTATS_COUNTRIES,$_configuration;
-		$TABLESTATS_COUNTRIES   = $_configuration['statistics_database'].".track_c_countries";
-		$res=loadCountries();
-		if (!is_null($res)){
-	    	$this->assertTrue(is_array($res));
-		}
-		//var_dump($res);
-	}
-
-	function testloadOs() {
-		$res=loadOs();
-	    $this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 126
tests/main/inc/lib/statsUtils.lib.inc.test.php

@@ -1,126 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php');
-
-
-class TestStatsUtils extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Stats utilities library - main/inc/lib/statsUtil.lib.inc.test.php');
-    }
-
-	function testbuildTab2col() {
-		$array_of_results=array();
-		$title1='';
-		$title2='';
-		ob_start();
-		$res=buildTab2col($array_of_results, $title1, $title2);
-		$this->assertTrue(is_null($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-	function testbuildTab2ColNoTitle() {
-		$array_of_results=array();
-		ob_start();
-		$res=buildTab2ColNoTitle($array_of_results);
-		ob_end_clean();
-		$this->assertTrue(is_array($array_of_results));
-		//var_dump($array_of_results);
-	}
-
-	function testbuildTabDefcon() {
-		$array_of_results=array();
-		ob_start();
-		$res=buildTabDefcon($array_of_results);
-		$this->assertTrue(is_array($array_of_results));
-		ob_end_clean();
-		//var_dump($array_of_results);
-	}
-
-	function testdaysTab() {
-		$sql='';
-		ob_start();
-		$days_array = array('total' => 0);
-		$res=daysTab($sql);
-		ob_end_clean();
-		$this->assertTrue(is_array($days_array));
-		//var_dump($sql);
-	}
-
-	function testgetManyResults1Col() {
-		$sql='';
-		ob_start();
-		$res=getManyResults1Col($sql);
-		ob_end_clean();
-		$this->assertTrue(is_string($sql));
-		//var_dump($sql);
-	}
-
-	function testgetManyResults2Col() {
-		$sql='';
-		ob_start();
-		$res=getManyResults2Col($sql);
-		ob_end_clean();
-		$this->assertTrue(is_string($sql));
-		//var_dump($sql);
-	}
-
-	function testgetManyResults3Col() {
-		$sql='';
-		ob_start();
-		$res=getManyResults3Col($sql);
-		ob_end_clean();
-		$this->assertTrue(is_string($sql));
-		//var_dump($sql);
-	}
-
-	function testgetManyResultsXCol() {
-		$sql='';
-		$X='';
-		ob_start();
-		$res=getManyResultsXCol($sql,$X);
-		ob_end_clean();
-		$this->assertTrue(is_string($sql));
-		//var_dump($sql);
-	}
-
-	function testgetOneResult() {
-		$sql='';
-		ob_start();
-		$res=getOneResult($sql);
-		ob_end_clean();
-		$this->assertTrue(is_string($sql));
-		//var_dump($sql);
-	}
-
-	function testhoursTab() {
-		$sql='';
-		ob_start();
-		$res=hoursTab($sql);
-		ob_end_clean();
-		$this->assertTrue(is_string($sql));
-		//var_dump($sql);
-	}
-
-	function testmakeHitsTable() {
-		$period_array=array();
-		$periodTitle='';
-		ob_start();
-		$res=makeHitsTable($period_array, $periodTitle, $linkOnPeriod = '???');
-		$this->assertTrue(is_null($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-
-	function testmonthTab() {
-		$sql='';
-		ob_start();
-		$res=monthTab($sql);
-		ob_end_clean();
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-
-
-}
-?>

+ 0 - 313
tests/main/inc/lib/surveymanager.lib.test.php

@@ -1,313 +0,0 @@
-<?php
-require_once api_get_path(LIBRARY_PATH).'surveymanager.lib.php';
-//This class is deprecated
-/*
-class TestSurveyManager extends UnitTestCase {
-
-	public function TestSurveyManager(){
-		$this->UnitTestCase('Surveys library - main/inc/lib/surveymanager.lib.test.php');
-	}
-		function testcreate_survey() {
-		$surveycode='';
-		$surveytitle='';
-		$surveysubtitle='';
-		$author='';
-		$survey_language='';
-		$availablefrom='';
-		$availabletill='';
-		$isshare='';
-		$surveytemplate='';
-		$surveyintroduction='';
-		$surveythanks='';
-		$table_survey='';
-		$table_group='';
-		$res=SurveyManager::create_survey($surveycode,$surveytitle, $surveysubtitle, $author, $survey_language, $availablefrom, $availabletill,$isshare, $surveytemplate, $surveyintroduction, $surveythanks, $table_survey, $table_group);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testcreate_survey_attach() {
-		$surveycode='';
-		$surveytitle='';
-		$surveysubtitle='';
-		$author='';
-		$survey_language='';
-		$availablefrom='';
-		$availabletill='';
-		$isshare='';
-		$surveytemplate='';
-		$surveyintroduction='';
-		$surveythanks='';
-		$table_survey='';
-		$table_group='';
-		$res=SurveyManager::create_survey_attach($surveycode,$surveytitle, $surveysubtitle, $author, $survey_language, $availablefrom, $availabletill,$isshare, $surveytemplate, $surveyintroduction, $surveythanks, $table_survey, $table_group);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testattach_survey() {
-		$surveyid='';
-		$newsurveyid='';
-		$db_name='';
-		$curr_dbname='';
-		$res=SurveyManager::attach_survey($surveyid,$newsurveyid,$db_name,$curr_dbname);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testcreate_course_survey_rel() {
-		$cidReq='';
-		$survey_id='';
-		$table_course='';
-		$table_course_survey_rel='';
-		$res=SurveyManager::create_course_survey_rel($cidReq,$survey_id,$table_course,$table_course_survey_rel);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testdisplay_imported_group() {
-		$sid='';
-		$table_group='';
-		$table_question='';
-		ob_start();
-		$res=SurveyManager::display_imported_group($sid,$table_group,$table_question);
-		$this->assertTrue(is_null($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-
-	function testget_all_datas() {
-		global $_course;
-		$id='';
-		$res=SurveyManager::get_all_datas($id);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testget_author() {
-		$db_name='';
-		$survey_id='';
-		$res=SurveyManager::get_author($db_name,$survey_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testget_data() {
-		$id='';
-		$field='';
-		$res=SurveyManager::get_data($id, $field);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testget_groupname() {
-	    $db_name='';
-		$gid='0011';
-		$res=SurveyManager::get_groupname($db_name,$gid);
-		if(!is_null($res))$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testget_question_type() {
-		$questionid='';
-		$res=SurveyManager::get_question_type($questionid);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testget_status() {
-		global $_user;
-		$table_user = Database::get_main_table(TABLE_MAIN_USER);
-		$sqlm = "SELECT  status FROM  $table_user WHERE user_id = '".Database::escape_string($_user['user_id'])."'";
-		$resm = Database::query($sqlm);
-		$objm=@Database::fetch_object($resm);
-		$ss = $objm->status ;
-		$res=SurveyManager::get_status();
-		if(!$res = null ){
-		$this->assertTrue(is_null($res));
-		}else{
-		$this->assertTrue(is_string($res));
-		}
-		//var_dump($res);
-	}
-
-	function testget_survey_author() {
-		$user_table = Database :: get_main_table(TABLE_MAIN_USER);
-		$authorid = Database::escape_string($authorid);
-		$sql_query = "SELECT * FROM $user_table WHERE user_id='$authorid'";
-		$res = Database::query($sql_query);
-		$firstname=@Database::result($res,0,'firstname');
-		$res=SurveyManager::get_survey_author($authorid);
-		$this->assertTrue(is_null($firstname));
-		$this->assertNull($res);
-		//var_dump($firstname);
-	}
-
-	function testget_survey_code() {
-		$table_survey='';
-		$survey_code='';
-		$res=SurveyManager::get_survey_code($table_survey,$survey_code);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testget_survey_list() {
-		ob_start();
-		$res=SurveyManager::get_survey_list();
-		$this->assertTrue(is_null($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-
-	function testget_surveyid() {
-		$db_name='';
-		$group_id='';
-		$res=SurveyManager::get_surveyid($db_name,$group_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testget_surveyname() {
-		$db_name='';
-		$sid='';
-		$res=SurveyManager::get_surveyname($db_name,$sid);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testget_surveyname_display() {
-		$sid='';
-		$res=SurveyManager::get_surveyname_display($sid);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testimport_questions() {
-		$import_type='';
-		$ids='';
-		$res=SurveyManager::import_questions($import_type, $ids);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testinsert_into_group() {
-		$survey_id='';
-		$group_title='';
-		$introduction='';
-		$tb='';
-		$res=SurveyManager::insert_into_group($survey_id,$group_title,$introduction,$tb);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testno_of_question() {
-		$db_name='';
-		$gid='';
-		$res=SurveyManager::no_of_question($db_name,$gid);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testpick_author() {
-		$survey_id='';
-		$res=SurveyManager::pick_author($survey_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	 function testpick_surveyname() {
-	 	$sid='';
-	 	$res=SurveyManager::pick_surveyname($sid);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-	function testselect_group_list() {
-		$survey_id='';
-		$seleced_groupid='';
-		$extra_script='';
-		$res=SurveyManager::select_group_list($survey_id, $seleced_groupid='', $extra_script='');
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testupdate_group() {
-	 	$groupid='';
-	 	$surveyid='';
-	 	$groupnamme='';
-	 	$introduction='';
-	 	$curr_dbname='';
-	 	$res=SurveyManager::update_group($groupid,$surveyid,$groupnamme,$introduction,$curr_dbname);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-	 function testupdate_question() {
-	 	$qid='';
-	 	$qtype='';
-	 	$caption='';
-	 	$alignment='';
-	 	$answers='';
-	 	$open_ans='';
-	 	$curr_dbname='';
-	 	$res=SurveyManager::update_question($qid,$qtype,$caption,$alignment,$answers,$open_ans,$curr_dbname);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	 }
-
-	 function testupdate_survey() {
-	 	$surveyid='';
-	 	$surveycode='';
-	 	$surveytitle='';
-	 	$surveysubtitle='';
-	 	$author='';
-	 	$survey_language='';
-	 	$availablefrom='';
-	 	$availabletill='';
-	 	$isshare='';
-	 	$surveytemplate='';
-	 	$surveyintroduction='';
-	 	$surveythanks='';
-	 	$cidReq='';
-	 	$table_course='';
-	 	$res=SurveyManager::update_survey($surveyid,$surveycode,$surveytitle, $surveysubtitle, $author, $survey_language, $availablefrom, $availabletill,$isshare, $surveytemplate, $surveyintroduction, $surveythanks, $cidReq,$table_course);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-	function testdelete_group() {
-		$group_id='';
-		$res=SurveyManager::delete_group($group_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testdelete_survey() {
-		$survey_id='';
-		$res=SurveyManager::delete_survey($survey_id);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-}
-*/
-class TestSurveyTree extends UnitTestCase {
-
-	var $surveylist;
-	var $plainsurveylist;
-	var $numbersurveys;
-	public function TestSurveTree(){
-		$this->UnitTestCase('Survey trees library - main/inc/lib/surveymanager.lib.test.php');
-	}
-	function testgetParentId() {
-		$id='';
-		$res=SurveyTree::getParentId($id);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-	function testcreateList() {
-		$list=array();
-		$res=SurveyTree::createList($list);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 108
tests/main/inc/lib/system_announcements.lib.test.php

@@ -1,108 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'system_announcements.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'mail.lib.inc.php');
-
-
-class TestSystemAnnouncementManager extends UnitTestCase {
-
-    public function __construct(){
-        $this->UnitTestCase('System announcements library - main/inc/lib/system_announcements.lib.test.php');
-    }
-	function test_add_announcement() {
-		$title='Anuncio';
-		$content='Contenido del anuncio';
-		$date_start='2010-01-02';
-		$date_end='2010-01-03';
-		$visible_teacher = 0;
-		$visible_student = 0;
-		$visible_guest = 0;
-		$lang = null;
-		$send_mail=0;
-		$res=SystemAnnouncementManager::add_announcement($title, $content, $date_start, $date_end, $visible_teacher, $visible_student, $visible_guest, $lang, $send_mail);
-        $this->assertTrue(is_bool($res));
-	}
-
-	function test_count_nb_announcement() {
-		$res=SystemAnnouncementManager::count_nb_announcement($start = 0,$user_id = '');
-		$this->assertTrue(is_numeric($res));
-	}
-
-	function test_delete_announcement() {
-		$id='';
-		$res=SystemAnnouncementManager::delete_announcement($id);
-		$this->assertTrue(is_bool($res));
-	}
-
-	function test_display_all_announcements() {
-		$visible='';
-		$res=SystemAnnouncementManager::display_all_announcements($visible, $id = -1,$start = 0,$user_id='');
-		$this->assertTrue(is_null($res));
-	}
-
-	function test_display_announcements() {
-		$visible='';
-		$res=SystemAnnouncementManager::display_announcements($visible, $id = -1);
-		$this->assertNull($res);
-	}
-
-	function test_display_arrow() {
-		$user_id='';
-		$res=SystemAnnouncementManager::display_arrow($user_id);
-		$this->assertTrue(is_null($res));
-        //var_dump($res);
-	}
-
-	function test_get_all_announcements() {
-		$res=SystemAnnouncementManager::get_all_announcements();
-		$this->assertTrue(is_array($res));
-        //var_dump($res);
-	}
-
-	function test_get_announcement() {
-		$id='';
-		$res=SystemAnnouncementManager::get_announcement($id);
-		$this->assertTrue(is_bool($res));
-        //var_dump($res);
-	}
-
-	function test_send_system_announcement_by_email_is_true_on_teacher_null() {
-		global $_user, $_setting, $charset;
-		$title   = $content = $teacher = $student = '';
-		$res=SystemAnnouncementManager::send_system_announcement_by_email($title,$content,$teacher, $student);
-		$this->assertTrue($res);
-	}
-
-    //Test removed until we can make sure the e-mail is sent to a valid e-mail address, otherwise the function returns false because the e-mail sending fails
-    /*
-	function test_send_system_announcement_by_email_is_true_on_teacher_not_null() {
-		global $_user, $_setting, $charset;
-		$title   = 'abc';
-		$content = 'bcd';
-		$student = 0;
-		$teacher = 1;
-		$res=SystemAnnouncementManager::send_system_announcement_by_email($title,$content,$teacher, $student);
-		$this->assertTrue($res);
-	}*/
-
-	function test_set_visibility() {
-		$announcement_id = $user = $visible='';
-		$res=SystemAnnouncementManager::set_visibility($announcement_id, $user, $visible);
-		$this->assertTrue(is_bool($res));
-        //var_dump($res);
-	}
-
-	function test_update_announcement() {
-		$id=1;
-		$title='Anuncio';
-		$content='Contenido';
-		$date_start='2010-01-02';
-		$date_end='2010-01-03';
-		$send_mail=0;
-		ob_start();
-		$res=SystemAnnouncementManager::update_announcement($id, $title, $content, $date_start, $date_end, $visible_teacher = 0, $visible_student = 0, $visible_guest = 0,$lang=null, $send_mail);
-		$this->assertTrue(is_bool($res));
-		ob_end_clean();
-        //var_dump($res);
-	}
-}
-?>

+ 0 - 79
tests/main/inc/lib/tablesort.lib.test.php

@@ -1,79 +0,0 @@
-<?php
-define('SORT_DATE', 3);
-define('SORT_IMAGE',4);
-
-class TestTablesort extends UnitTestCase{
-
-	//public $table;
-	public function __construct(){
-		$this->UnitTestCase('Tablesort library - main/inc/lib/tablesort.lib.test.php');
-	}
-	/*
-	public function setUp(){
-		$this->table = new TableSort();
-	}
-
-	public function tearDown(){
-		$this->table = null;
-	}
-	*/
-
-	public function testSortTable(){
-		$data= array('a', 'cd', 'efd');
-		$column = 0;
-		$direction = SORT_ASC;
-		$type = SORT_REGULAR;
-		$res =TableSort::sort_table($data, $column, $direction, $type);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-/* private method
-	public function testIsNumericColumn(){
-		$data=array('aeiou', 'abcde', 'acedrf');
-		$column=0;
-		$res = TableSort::is_numeric_column($data, $column);
-		if(!is_numeric($res)):
-		$this->assertTrue(is_bool($res));
-		endif;
-		$this->assertTrue($res === 1 || $res === 0);
-		//var_dump($res);
-	}
-	public function testIsDateColumn(){
-		$data=array();
-		$column='';
-		$res = TableSort::is_date_column($data, $column);
-		if(is_bool($res))
-		$this->assertTrue(($res));
-		else{
-		$this->assertTrue(is_numeric($res));
-		}
-		//var_dump($res);
-	}
-	public function testIsImageColumn(){
-		$data=array();
-		$column='';
-		$res = TableSort::is_image_column($data, $column);
-		if(is_bool($res)){
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res);
-		}
-		else{
-		$this->assertTrue(is_numeric($res));
-		}
-		//var_dump($res);
-	}
-*/
-	public function testSortTableConfig(){
-		$data=array('a','b','c','d','e','z');
-		$column = 0;
-		$direction = SORT_ASC;
-		$column_show=null;
-        $column_order=null;
-		$type = SORT_REGULAR;
-		$res =  TableSort::sort_table_config($data, $column, $direction, $column_show, $column_order,$type);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 150
tests/main/inc/lib/text.lib.test.php

@@ -1,150 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'text.lib.php');
-
-class TestText extends UnitTestCase {
-
-	public function test_api_html_to_text() {
-		$filename = api_get_path(SYS_PATH).'documentation/installation_guide.html';
-		$res = @file_get_contents($filename);
-		if ($res !== false) {
-			$res = api_html_to_text($res);
-			$this->assertTrue(is_string($res));
-		} else {
-			$this->assertTrue(true); // The file is missing, skip this test.
-		}
-		//var_dump('<pre>'.$res.'</pre>');
-	}
-
-	public function test_api_str_getcsv() {
-		$strings = array('FirstName;LastName;Email', 'John;Doe;john.doe@mail.com', '"Иван";\\Чолаков;ivan@mail.com');
-		$expected_results = array(array('FirstName', 'LastName', 'Email'), array('John', 'Doe', 'john.doe@mail.com'), array('Иван', 'Чолаков', 'ivan@mail.com'));
-		$res = array();
-		foreach ($strings as $string) {
-			$res[] = api_str_getcsv($string, ';');
-		}
-		$this->assertTrue($res === $expected_results);
-		//var_dump($res);
-	}
-
-	public function test_api_fgetcsv() {
-		$filename = api_get_path(SYS_CODE_PATH).'admin/exemple.csv';
-		$res = array();
-		$handle = @fopen($filename, 'r');
-		if ($handle !== false) {
-			while (($line = @api_fgetcsv($handle, null, ';')) !== false) {
-				$res[] = $line;
-			}
-			@fclose($handle);
-			$this->assertTrue(is_array($res) && count($res) > 0);
-		} else {
-			$this->assertTrue(true); // The file is missing, skip this test.
-		}
-		//var_dump($res);
-	}
-
-	public function test_api_camel_case_to_underscore() {
-		$input_strings    = array('myDocuments', 'MyProfile', 'CreateNewCourse', 'Create_New_course');
-		$expected_results = array('my_documents', 'my_profile', 'create_new_course', 'create_new_course');
-		$results = array_map('api_camel_case_to_underscore', $input_strings);
-		$this->assertTrue($results == $expected_results);
-		//var_dump($results);
-	}
-
-	function test_api_underscore_to_camel_case() {
-		$input_strings     = array('my_documents', 'My_profile', 'create_new_course');
-		$expected_results1 = array('MyDocuments', 'MyProfile', 'CreateNewCourse');
-		$expected_results2 = array('myDocuments', 'MyProfile', 'createNewCourse');
-		$func = create_function('$param', 'return api_underscore_to_camel_case($param, false);');
-		$results1 = array('MyDocuments', 'MyProfile', 'CreateNewCourse');
-		$results2 = array('myDocuments', 'MyProfile', 'createNewCourse');
-		$results1 = array_map('api_underscore_to_camel_case', $input_strings);
-		$results2 = array_map($func, $input_strings);
-		$this->assertTrue($results1 == $expected_results1 && $results2 == $expected_results2);
-		//var_dump($results1);
-		//var_dump($results2);
-	}
-
-	function test_text_parse_glossary() {
-		$input='';
-		$res=_text_parse_glossary($input);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function test_text_parse_tex() {
-		$textext='';
-		$res=_text_parse_tex($textext);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function test_text_parse_texexplorer() {
-		$textext='';
-		$res=_text_parse_texexplorer($textext);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function test_text_parse_tool() {
-		$input='';
-		$res=_text_parse_tool($input);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testcut() {
-		$text='';
-		$maxchar='';
-		$res=cut($text,$maxchar,$embed=false);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testdate_to_str_ago() {
-		$date='';
-		$res=date_to_str_ago($date);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testfloat_format() {
-		$number='';
-		$res=float_format($number, $flag = 1);
-		if(!is_numeric($res) or !is_float($res)) {
-			$this->assertTrue(is_null($res));
-		}
-		//var_dump($res);
-	}
-
-	function testlatex_gif_renderer() {
-		ob_start();
-		$latex_code="";
-		global $_course;
-		$res=latex_gif_renderer($latex_code);
-		ob_end_clean();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testmake_clickable() {
-		$string='';
-		$res=make_clickable($string);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testtext_filter() {
-		$input='';
-		$res=text_filter($input, $filter=true);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testApiParseTex(){
-		$textext = 'abc';
-		$res = api_parse_tex($textext); //this function is practically deprecated now, it doesn't do anything
-		$this->assertEqual($textext,$res);
-	}
-
- }
-?>

+ 0 - 485
tests/main/inc/lib/tracking.lib.test.php

@@ -1,485 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'tracking.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'document.lib.php');
-
-class TestTracking extends UnitTestCase {
-
-	function testget_first_connection_date() {
-		global $_user;
-		$student_id=$_user;
-		$res=Tracking::get_first_connection_date($student_id);
-	 	if(!is_bool($res)){
-	 		$this->assertTrue(is_string($res));
-	 	}
-	}
-
-	function testget_first_connection_date_on_the_course() {
-		global $_course;
-		$student_id='';
-		$course_code=$_course;
-		$res=Tracking::get_first_connection_date_on_the_course($student_id, $course_code);
-	 	if(!is_null($res))$this->assertTrue(is_bool($res));
-	 	//var_dump($res);
-	}
-	
-	
-	function testchat_connections_during_last_x_days_by_course() {
-	 	global $_course;
-	 	$course_code=$_course;
-		$last_days=8;
-		$this->tracking = new Tracking();
-		$res=$this->tracking->chat_connections_during_last_x_days_by_course($course_code,$last_days);
-		$this->assertTrue(is_object($this->tracking));
-		if(!is_numeric($res))$this->assertTrue(is_null($res));
-        //var_dump($docman);
-    }
-
-	function testcount_course_per_student() {
-		$user_id=1;
-		$this->tracking = new Tracking();
-		$res=$this->tracking->count_course_per_student($user_id);
-		$this->assertTrue(is_object($this->tracking));
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testcount_login_per_student() {
-		$student_id=1;
-		$course_code=001;
-		$this->tracking = new Tracking();
-		$res=$this->tracking->count_login_per_student($student_id, $course_code);
-		$this->assertTrue(is_object($this->tracking));
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testcount_number_of_forums_by_course() {
-	 	global $_course;
-	 	$course_code=$_course;
-		$this->tracking = new Tracking();
-		$res=$this->tracking->count_number_of_forums_by_course($course_code);
-		$this->assertTrue(is_object($this->tracking));
-		if(!is_numeric($res))$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-	 function testcount_number_of_posts_by_course() {
-	 	global $_course;
-	 	$course_code=$_course;
-		$this->tracking = new Tracking();
-		$res=$this->tracking->count_number_of_posts_by_course($course_code);
-		$this->assertTrue(is_object($this->tracking));
-		if(!is_numeric($res))$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-	 function testcount_number_of_threads_by_course() {
-		global $_course;
-	 	$course_code=$_course;
-		$this->tracking = new Tracking();
-		$res=$this->tracking->count_number_of_threads_by_course($course_code);
-		$this->assertTrue(is_object($this->tracking));
-		if(!is_numeric($res))$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-	 function testcount_student_assignments() {
-	 	require_once (api_get_path(LIBRARY_PATH) . 'course.lib.php');
-		global $_user,$_course;
-	 	$student_id=$_user;
-	 	$course_code=$_course;
-		$a_course = CourseManager :: get_course_information($course_code);
-		$this->tracking = new Tracking();
-		$res=$this->tracking->count_student_assignments($student_id, $course_code);
-		$this->assertTrue(is_object($this->tracking));
-		if(!is_numeric($res))$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-	 function testcount_student_downloaded_documents() {
-	 	global $_user,$_course;
-	 	$student_id=$_user;
-	 	$course_code=$_course;
-	 	$this->tracking = new Tracking();
-	 	$res=$this->tracking->count_student_downloaded_documents($student_id, $course_code);
-	 	$this->assertTrue(is_object($this->tracking));
-		if(!is_numeric($res))$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-	 function testcount_student_messages() {
-	 	require_once (api_get_path(LIBRARY_PATH) . 'course.lib.php');
-		global $_user,$_course;
-	 	$student_id=$_user;
-	 	$course_code=$_course;
-	 	$a_course = CourseManager :: get_course_information($course_code);
-		$this->tracking = new Tracking();
-		$res=$this->tracking->count_student_messages($student_id, $course_code);
-		$this->assertTrue(is_object($this->tracking));
-		if(!is_numeric($res))$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-	 function testcount_student_visited_links() {
-	 	global $_user,$_course;
-	 	$student_id=$_user;
-	 	$course_code=$_course;
-	 	$this->tracking = new Tracking();
-	 	$res=$this->tracking->count_student_visited_links($student_id, $course_code);
-	 	$this->assertTrue(is_object($this->tracking));
-		if(!is_numeric($res))$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-	 function testget_average_test_scorm_and_lp () {
-	 	global $_user,$_course;
-	 	$user_id=$_user;
-	 	$course_id=$_course;
-	 	$this->tracking = new Tracking();
-	 	$res=$this->tracking->get_average_test_scorm_and_lp($user_id,$course_id);
-	 	$this->assertTrue(is_object($this->tracking));
-
-		if(!is_numeric($res))$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-	 function testget_avg_student_exercise_score() {
-	 	global $_user,$_course;
-	 	$student_id=$_user;
-	 	$course_code=$_course;
-	 	$this->tracking = new Tracking();
-	 	$res=$this->tracking->get_avg_student_exercise_score($student_id, $course_code);
-	 	$this->assertTrue(is_object($this->tracking));
-		if(!is_numeric($res))$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-	 function testget_avg_student_progress() {
-		require_once (api_get_path(LIBRARY_PATH) . 'course.lib.php');
-		global $_user,$_course;
-	 	$this->tracking = new Tracking();
-	 	$res = $this->tracking->get_avg_student_progress($_user['user_id'], $_course['cidReq']);
-		$this->assertWithinMargin(0,100,$res);
-	 	$res = $this->tracking->get_avg_student_progress($_user['user_id'], $_course['cidReq'], $_SESSION['id_session']);
-		$this->assertWithinMargin(0,100,$res);
-	 	$res = $this->tracking->get_avg_student_progress(null, $_course['cidReq']);
-		$this->assertNull($res);
-		$res = $this->tracking->get_avg_student_progress(array(1,2,3), $_course['cidReq']);
-		$this->assertWithinMargin(0,100,$res);
-		// manda un usuario que no existe para entrar en condicion de retorno de 0
-		$res = $this->tracking->get_avg_student_progress(500, $_course['cidReq']);
-		$this->assertEqual(0,$res);
-	 	$res = $this->tracking->get_avg_student_progress($_user['user_id'], $_course['cidReq'], 0);
-		$this->assertWithinMargin(0,100,$res);
-	 	$res = $this->tracking->get_avg_student_progress($_user['user_id'], $_course['cidReq'], 1);
-		$this->assertWithinMargin(0,100,$res);
-	 	$res = $this->tracking->get_avg_student_progress($_user['user_id'], $_course['cidReq'], 5000);
-		$this->assertWithinMargin(0,100,$res);
-	 }
-
-	 function testget_avg_student_score() {
-	 	global $_user,$_course;
-		$student_id=$_user;
-	 	$course_code=$_course;
-	 	$res=$this->tracking->get_avg_student_score($student_id, $course_code, $lp_ids=array());
-		if(!is_string($res))$this->assertTrue(is_null($res));
-		//var_dump($res);
-	 }
-
-
-	 function testget_course_list_in_session_from_student() {
-	 	global $_user;
-		$user_id = $_user;
-	 	$session_id= 1;
-	 	$res=Tracking::get_course_list_in_session_from_student($user_id, $session_id);
-	 	$this->assertTrue(is_array($res));
-	 }
-
-
-	function testget_courses_followed_by_coach() {
-		$coach_id='';
-		$res=Tracking::get_courses_followed_by_coach($coach_id, $id_session='');
-	 	if(!is_null($res))$this->assertTrue(is_array($res));
-	 	//var_dump($res);
-	}
-
-	function testget_courses_list_from_session() {
-		$session_id='';
-		$res=Tracking::get_courses_list_from_session($session_id);
-	 	if(!is_null($res))$this->assertTrue(is_array($res));
-	 	//var_dump($res);
-	}
-
-	function testget_inactives_students_in_course() {
-		global $_course;
-		$course_code = $_course; 
-		$since='2010-10-02';
-		$session_id='';
-		$res=Tracking::get_inactives_students_in_course($course_code, $since, $session_id);
-	 	if(!is_null($res))$this->assertTrue(is_array($res));
-	 	//var_dump($res);
-	}
-
-	function testget_sessions_coached_by_user() {
-		$coach_id='';
-		$res=Tracking::get_sessions_coached_by_user($coach_id);
-	 	if(!is_null($res))$this->assertTrue(is_array($res));
-	 	//var_dump($res);
-	}
-
-	function testget_student_followed_by_coach() {
-		$coach_id='';
-		$res=Tracking::get_student_followed_by_coach($coach_id);
-	 	if(!is_null($res))$this->assertTrue(is_array($res));
-	 	//var_dump($res);
-	}
-
-	function testget_student_followed_by_coach_in_a_session() {
-		$id_session='';
-		$coach_id='';
-		$res=Tracking::get_student_followed_by_coach_in_a_session($id_session, $coach_id);
-	 	if(!is_null($res))$this->assertTrue(is_array($res));
-	 	//var_dump($res);
-	}
-
-	function testget_student_followed_by_drh() {
-		$hr_dept_id='';
-		$res=Tracking::get_student_followed_by_drh($hr_dept_id);
-	 	if(!is_null($res))$this->assertTrue(is_array($res));
-	 	//var_dump($res);
-	}
-
-	function testget_time_spent_on_the_course() {
-		$user_id='';
-		$course_code='';
-		$res=Tracking::get_time_spent_on_the_course($user_id, $course_code);
-	 	if(!is_null($res))$this->assertTrue(is_numeric($res));
-	 	//var_dump($res);
-	}
-
-	function testget_time_spent_on_the_platform(){
-		$user_id='';
-		$res=Tracking::get_time_spent_on_the_platform($user_id);
-	 	if(!is_null($res))$this->assertTrue(is_numeric($res));
-	 	//var_dump($res);
-	}
-
-	function testis_allowed_to_coach_student() {
-		$coach_id='';
-		$student_id='';
-		$res=Tracking::is_allowed_to_coach_student($coach_id, $student_id);
-	 	if(!is_null($res))$this->assertTrue(is_bool($res));
-	 	//var_dump($res);
-	}
-	
-	function testchat_last_connection() {
-		require_once (api_get_path(LIBRARY_PATH) . 'course.lib.php');
-		global $_course;
-		$student_id= $_POST['student_id'];
-		$course_code= $_course;
-		$this->tracking = new Tracking();
-		$res=$this->tracking->chat_last_connection($student_id,$course_code);
-		$this->assertTrue(is_object($this->tracking));
-		if(!is_string($res))$this->assertTrue(is_null($res));
-	}
-	
-		function testget_last_connection_date() {
-		$student_id=1;
-		$res=Tracking::get_last_connection_date($student_id);
-	 	if(!is_bool($res))$this->assertTrue(is_string($res));
-	}
-
-	function testget_last_connection_date_on_the_course() {
-		$student_id='';
-		$course_code='';
-		$res=Tracking::get_last_connection_date_on_the_course($student_id, $course_code);
-	 	if(!is_null($res))$this->assertTrue(is_bool($res));
-	 	//var_dump($res);
-	}
-}
-
-class TestTrackingCourseLog extends UnitTestCase {
-
-
-	function testCountItemResources() {
-		//ob_start();
-		$res = TrackingCourseLog::count_item_resources();
-		$this->assertTrue(is_numeric($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}	
-
-	function testDisplayAdditionalProfileFields() {
-		//ob_start();
-		$res = TrackingCourseLog::display_additional_profile_fields();
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	function testGetAddtionalProfileInformationOfField() {
-		//ob_start();
-		$field_id=1;
-		$res = TrackingCourseLog::get_addtional_profile_information_of_field($field_id);
-		$this->assertTrue(is_null($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	function testGetAddtionalProfileInformationOfFieldByUser() {
-		//ob_start();
-		$field_id=1;
-		$users=array(1,2,3);
-		$res = TrackingCourseLog::get_addtional_profile_information_of_field_by_user($field_id, $users);
-		$this->assertTrue(is_null($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	function testGetItemResourcesData() {
-		//ob_start();
-		$from=3;
-		$number_of_items=2;
-		$column=1;
-		$direction='ASC';
-		$res = TrackingCourseLog::get_item_resources_data($from, $number_of_items, $column, $direction);
-		$this->assertTrue(is_array($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	function testGetNumberOfUsers() {
-		//ob_start();
-		$res = TrackingCourseLog::get_number_of_users();
-		$this->assertTrue(is_numeric($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	function testGetToolNameTable() {
-		//ob_start();
-		$tool='';
-		$res = TrackingCourseLog::get_tool_name_table($tool);
-		$this->assertTrue(is_array($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	function testGetUserData() {
-		//ob_start();
-		$from='';
-		$number_of_items='';
-		$column='';
-		$direction='';
-		$res = TrackingCourseLog::get_user_data($from, $number_of_items, $column, $direction);
-		$this->assertTrue(is_array($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	
-}
-
-class TestTrackingUserLog extends UnitTestCase {
-	
-	function testDisplayDocumentTrackingInfo() {
-		ob_start();
-		$view = '';
-		$user_id = 1;
-		$course_id = 1;
-		$res = TrackingUserLog::display_document_tracking_info($view, $user_id, $course_id);
-		$this->assertTrue(is_null($res)); 
-		ob_end_clean();
-		//var_dump($res);
-	}	
-	function testDisplayExerciseTrackingInfo() {
-		ob_start();
-		$view = '';
-		$user_id = 1;
-		$course_id = 1;
-		$res = TrackingUserLog::display_exercise_tracking_info($view, $user_id, $course_id);
-		$this->assertTrue(is_null($res)); 
-		ob_end_clean();
-		//var_dump($res);
-	}
-	function testDisplayLinksTrackingInfo() {
-		ob_start();
-		$view = '';
-		$user_id = 1;
-		$course_id = 1;
-		$res = TrackingUserLog::display_links_tracking_info($view, $user_id, $course_id);
-		$this->assertTrue(is_null($res)); 
-		ob_end_clean();
-		//var_dump($res);
-	}
-	function testDisplayLoginTrackingInfo() {
-		ob_start();
-		$view = '';
-		$user_id = 1;
-		$course_id = 1;
-		$res = TrackingUserLog::display_login_tracking_info($view, $user_id, $course_id);
-		$this->assertTrue(is_null($res)); 
-		ob_end_clean();
-		//var_dump($res);
-	}
-	function testDisplayStudentPublicationsTrackingInfo() {
-		ob_start();
-		$view = '';
-		$user_id = 1;
-		$course_id = 1;
-		$res = TrackingUserLog::display_student_publications_tracking_info($view, $user_id, $course_id);
-		$this->assertTrue(is_null($res)); 
-		ob_end_clean();
-		//var_dump($res);
-	}
-	
-}
-
-class TestTrackingUserLogCSV extends UnitTestCase {
-	
-	function testDisplayDocumentTrackingInfo() {
-		//ob_start();
-		$view = '';
-		$user_id = 1;
-		$course_id = 1;
-		$res = TrackingUserLogCSV::display_document_tracking_info($view, $user_id, $course_id);
-		$this->assertTrue(is_array($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}	
-	function testDisplayExerciseTrackingInfo() {
-		//ob_start();
-		$view = '';
-		$user_id = 1;
-		$course_id = 1;
-		$res = TrackingUserLogCSV::display_exercise_tracking_info($view, $user_id, $course_id);
-		$this->assertTrue(is_array($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	} 
-	
-	function testDisplayLinksTrackingInfo() {
-		//ob_start();
-		$view = '';
-		$user_id = 1;
-		$course_id = 1;
-		$res = TrackingUserLogCSV::display_links_tracking_info($view, $user_id, $course_id);
-		$this->assertTrue(is_array($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	function testDisplayLoginTrackingInfo() {
-		//ob_start();
-		$view = '';
-		$user_id = 1;
-		$course_id = 1;
-		$res = TrackingUserLogCSV::display_login_tracking_info($view, $user_id, $course_id);
-		$this->assertTrue(is_array($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	function testDisplayStudentPublicationsTrackingInfo() {
-		//ob_start();
-		$view = '';
-		$user_id = 1;
-		$course_id = 1;
-		$res = TrackingUserLogCSV::display_student_publications_tracking_info($view, $user_id, $course_id);
-		$this->assertTrue(is_array($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}	
-}
-?>

+ 0 - 25
tests/main/inc/lib/upload.xajax.test.php

@@ -1,25 +0,0 @@
-<?php
-/** To can run this test you need change the line 17 in upload.xajax.php by:
- * $ul_info = array();
- *	if(function_exists('uploadprogress_get_info'))
- *	{
- *		$ul_info = uploadprogress_get_info($upload_id);
- *	}
- */
-
-require_once(api_get_path(LIBRARY_PATH).'upload.xajax.php');
-require_once(api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php');
-require_once(api_get_path(LIBRARY_PATH).'xajax/xajaxResponse.inc.php');
-
-
-
-class TestUpdateXajax extends UnitTestCase {
-	 /*
-	function testUpdateProgress(){
-		$div_id='';
-		$upload_id='';
-		$res = updateProgress($div_id, $upload_id, $waitAfterupload=false);
-		$this->assertTrue($res);
-	}*/
-}
-?>

+ 0 - 225
tests/main/inc/lib/urlmanager.lib.test.php

@@ -1,225 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'urlmanager.lib.php');
-
-class TestUrlManager extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('URL manager library - main/inc/lib/urlmanager.lib.test.php');
-    }
-
-	function testadd() {
-		$url='';
-		$description='';
-		$active='';
-		$res=UrlManager::add($url, $description, $active);
-		$this->assertTrue(is_bool($res));
-        //var_dump($res);
-	}
-
-	function testadd_course_to_url() {
-		$course_code=1;
-		$res=UrlManager::add_course_to_url($course_code, $url_id=1);
-		$this->assertTrue(is_bool($res));
-       	//var_dump($res);
-	}
-
-	function testadd_courses_to_urls() {
-		$url_list='';
-		$course_list='';
-		$res=UrlManager::add_courses_to_urls($course_list,$url_list);
-		$this->assertTrue(is_array($res));
-        //var_dump($res);
-	}
-
-	function testadd_session_to_url() {
-		$session_id=1; //arbitrary session name - isn't checked in the function anyway
-		$res=UrlManager::add_session_to_url($session_id, $url_id=1);
-		$this->assertTrue($res);
-        UrlManager::delete_url_rel_session($session_id,$url_id);
-	}
-
-	function testadd_user_to_url() {
-		$user_id=1;
-		$url_id=1;
-		$res=UrlManager::add_user_to_url($user_id, $url_id);
-		$this->assertTrue(is_bool($res));
-        //var_dump($res);
-	}
-
-	function testadd_users_to_urls()  {
-		$user_list='';
-		$url_list='';
-		$res=UrlManager::add_users_to_urls($user_list, $url_list);
-		$this->assertTrue(is_array($res));
-        //var_dump($res);
-	}
-
-	function testdelete() {
-		$id='';
-		$res=UrlManager::delete($id);
-		$this->assertTrue(is_bool($res));
-        //var_dump($res);
-	}
-
-	function testdelete_url_rel_course() {
-		$course_code='';
-		$url_id='';
-		$res=UrlManager::delete_url_rel_course($course_code, $url_id);
-		$this->assertTrue(is_bool($res));
-        //var_dump($res);
-	}
-
-	function testdelete_url_rel_session() {
-		$session_id='';
-		$url_id='';
-		$res=UrlManager::delete_url_rel_session($session_id, $url_id);
-		$this->assertTrue(is_bool($res));
-        //var_dump($res);
-	}
-
-	function testdelete_url_rel_user() {
-		$user_id='';
-		$url_id='';
-		$res=UrlManager::delete_url_rel_user($user_id, $url_id);
-		$this->assertTrue(is_bool($res));
-        //var_dump($res);
-	}
-
-	function testget_access_url_from_user() {
-		$user_id='';
-		$res=UrlManager::get_access_url_from_user($user_id);
-		$this->assertTrue(is_array($res));
-        //var_dump($res);
-	}
-
-	function testget_url_data() {
-		$res=UrlManager::get_url_data();
-		$this->assertTrue(is_array($res));
-        //var_dump($res);
-	}
-
-	function testget_url_data_from_id() {
-		$url_id=1;
-		$resu=UrlManager::get_url_data_from_id($url_id);
-		$this->assertTrue(is_array($resu));
-		//var_dump($resu);
-	}
-
-	function testget_url_id() {
-		$url='';
-		$resu=UrlManager::get_url_id($url);
-		$this->assertTrue(is_string($resu));
-		//var_dump($resu);
-	}
-
-	function testget_url_rel_course_data() {
-		$resu=UrlManager::get_url_rel_course_data($access_url_id='');
-		$this->assertTrue(is_array($resu));
-		//var_dump($resu);
-	}
-
-	function testget_url_rel_session_data() {
-		$resu=UrlManager::get_url_rel_session_data($access_url_id='');
-		$this->assertTrue(is_array($resu));
-		//var_dump($resu);
-	}
-
-	function testget_url_rel_user_data() {
-		$resu=UrlManager::get_url_rel_user_data($access_url_id='');
-		$this->assertTrue(is_array($resu));
-		//var_dump($resu);
-	}
-
-	function testrelation_url_course_exist() {
-		$course_id = 'COURSETEST';
-		$url_id=1;
-		$resu=UrlManager::relation_url_course_exist($course_id, $url_id);
-		if(!is_numeric($resu)){
-			$this->assertTrue(is_bool($resu));
-		}
-		//var_dump($resu);
-	}
-
-	function testrelation_url_session_exist() {
-		$session_id=1;
-		$url_id=1;
-		$res=UrlManager::relation_url_session_exist($session_id, $url_id);
-		if(!is_numeric($res)){
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res);
-	}
-
-	function testrelation_url_user_exist() {
-		$user_id=1;
-		$url_id=1;
-		$res=UrlManager::relation_url_user_exist($user_id, $url_id);
-		if(!is_numeric($res)){
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res);
-	}
-
-	function testset_url_status() {
-		$status='';
-		$url_id='';
-		$res=UrlManager::set_url_status($status, $url_id);
-		if(!is_bool($res)) $this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testudpate() {
-		$url_id='';
-		$url='';
-		$description='';
-		$active='';
-		$res=UrlManager::udpate($url_id, $url, $description, $active);
-		if(!is_null($res))$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testupdate_urls_rel_course() {
-		$course_list=array();
-		$access_url_id=1;
-		$res=UrlManager::update_urls_rel_course($course_list,$access_url_id);
-		if(!is_null($res)) $this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	function testupdate_urls_rel_session(){
-		$session_list=array();
-		$access_url_id=1;
-		$res=UrlManager::update_urls_rel_session($session_list,$access_url_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testupdate_urls_rel_user() {
-		$user_list=array();
-		$access_url_id=1;
-		$res=UrlManager::update_urls_rel_user($user_list,$access_url_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testurl_count() {
-		$res=UrlManager::url_count();
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testurl_exist() {
-		$url='';
-		$res=UrlManager::url_exist($url);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testurl_id_exist() {
-		$url='';
-		$res=UrlManager::url_id_exist($url);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 360
tests/main/inc/lib/usermanager.lib.test.php

@@ -1,360 +0,0 @@
-<?php
-//require_once('../../../simpletest/autorun.php');
-require_once (api_get_path(LIBRARY_PATH).'urlmanager.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
-
-class TestUserManager extends UnitTestCase {
-        public function __construct() {
-            $this->UnitTestCase('User Manager library - main/inc/lib/usermanager.lib.test.php');
-        }
-    	public function testCreateUser() {
-	    	$firstName='test_first';
-	    	$lastName='test_last';
-	    	$status='1';
-	    	$email='test@chamilo.org';
-	    	$loginName='testlogin';
-	    	$password='testlogin';
-    		$official_code='testcode';
-    		$language='english';
-    		$phone = '';
-    		$picture_uri ='';
-    		global $_user, $userPasswordCrypted;
-    		ob_start();
-    		$res= ob_get_contents();
-    		UserManager::create_user($firstName, $lastName, $status, $email, $loginName, $password, $official_code, $language, $phone, $picture_uri);
-    		ob_end_clean();
-        	$this->assertTrue(is_string($res));
-    	}
-/*
-    function testDeleteUserReturnsTrue() {
-        $user = array('username' => 'ywarnier',
-        			  'pass' => 'ywarnier',
-      				  'firstname' => 'Yannick',
-     				  'lastname' => 'Warnier',
-      				  'status' => 6,
-     				  'auth_source' => 'platform',
-     				  'email' => 'yannick.warnier@testdokeos.com',
-     				  'creator_id' => 1,
-      				  'active' => 1,
-        			 );
-        $res = UserManager::create_user($user['firstname'],$user['lastname'],$user['status'],$user['email'],$user['username'],$user['pass'],null,null,null,null,$user['auth_source'],null,$user['active']);
-        $res = UserManager::delete_user($res);
-        $this->assertTrue($res);
-    }
-*/
-    function testDeleteUser() {
-    	$user_id='';
-    	$res = UserManager::delete_user($user_id);
-    	$this->assertTrue(is_bool($res));
-    	$_configuration['user_id']='';
-    	$res1= UserManager::delete_user($_configuration['user_id']);
-    	$this->assertTrue(is_bool($res1));
-    	//var_dump($res1);
-    }
-    /*
-    function testUpdateUser() {
-		$user = array('username' => 'ywarnier',
-	    			  'pass' => 'ywarnier',
-	    			  'firstname' => 'Yannick',
-	    			  'lastname' => 'Warnier',
-	    			  'status' => 6,
-	    			  'auth_source' => 'platform',
-	   				  'email' => 'yannick.warnier@testdokeos.com',
- 			          'creator_id' => 1,
-	  				  'active' => 1,
-					 );
-
-		$update = array('user_id'=>'12',
-					    'firstname'=>'Ricardo',
-  						'lastname'=>'Rodriguez',
-						'username'=>'richi',
-						'email'=>'xxxx@xxxx.com',
-						'status'=>6,
-						'official_code'=>'2121',
-						'phone'=>'',
-						'picture_uri'=>'',
-						'expiration_date'=>'',
-						'active'=>1
-					   );
-
-		$res = UserManager::create_user($user['firstname'],$user['lastname'],$user['status'],$user['email'],$user['username'],$user['pass'],null,null,null,null,$user['auth_source'],null,$user['active']);
-		$this->assertTrue(is_bool($res));
-		$res = UserManager::update_user($update['user_id'],$update['firstname'],$update['lastname'],$update['username'],null,null,$update['email'],$update['status'],$update['official_code'],$update['phone'],
-										$update['picture_uri'],$update['expiration_date'],$update['active'],null,null,null,null);
-		$this->assertTrue($res);
-		$res=UserManager::delete_user($res);
-		$this->assertTrue(is_bool($res));
-	}*/
-	/*
-    function testCreateExtraField() {
-    	$extra = array('fieldvarname' =>'nuevo campo',
-					   'fieldtype' => '2',
-					   'fieldtitle' => 'english',
-                       'fielddefault' => 'default'
-                      );
-    	$res = UserManager::create_extra_field($extra['fieldvarname'],$extra['fieldtype'],$extra['fieldtitle'],$extra['fielddefault'],null);
-    	$this->assertTrue('/\d/',$res);
-    }*/
-    function testCreateExtraField() {
-    	$fieldvarname='nuevo campo';
-    	$fieldtype='1';
-    	$fieldtitle='english';
-    	$fielddefault='5';
-    	$res=UserManager::create_extra_field($fieldvarname, $fieldtype, $fieldtitle, $fielddefault,null);
-    	//var_dump($res);
-    	$this->assertTrue(is_numeric($fieldtype));
-    }
-
-    function testCanDeleteUser() {
-    	$res=UserManager::can_delete_user(1);
-    	$this->assertTrue(is_bool($res));
-    }
-
-    function testAddApiKey() {
-      	$res=UserManager::add_api_key();
-    	$this->assertTrue(is_bool($res));
-    }
-
-    function testBuildProductionListIsFalse() {
-    	$res = UserManager::build_production_list(1, false, false);
-    	$this->assertFalse($res);
-    }
-
-	function testDeleteApiKey() {
-		$res=UserManager::delete_api_key(1);
-		//var_dump($res);
-		$this->assertTrue(is_bool($res));
-	}
-
-	function testGetApiKeyIdEmptyServiceReturnsFalse() {
-		$api_service = '';
-		$res = UserManager::get_api_key_id(1,$api_service);
-		$this->assertFalse($res);
-	}
-	function testGetApiKeyIdNonEmptyServiceWithExtremeUserIdReturnsFalse() {
-		$api_service = '';
-		$res = UserManager::get_api_key_id(5000000,$api_service);
-		$this->assertFalse($res);
-	}
-
-	function testGetApiKeys() {
-		$res=UserManager::get_api_keys();
-		$this->assertTrue(is_bool($res));
-	}
-
-	function testGetExtraFieldInformation() {
-		$res=UserManager::get_extra_field_information(1);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testGetExtraFieldInformationByName() {
-		$sql="SELECT 1";
-		$field_variable=Database::query($sql);
-		$res=UserManager::get_extra_field_information_by_name($field_variable);
-		//var_dump($res);
-		$this->assertTrue(is_bool($res));
-	}
-
-	function testGetExtraFieldOptions() {
-		$res=UserManager::get_extra_field_options('field name');
-		//var_dump($res);
-		$this->assertTrue(!(bool)$res);
-	}
-
-	function testGetEextraFields() {
-		$res=UserManager::get_extra_fields(0, 0, 5, 'ASC', true);
-		$this->assertTrue($res);
-	}
-
-	function testGetExtraUserData() {
-		$res=UserManager::get_extra_user_data(1, null,null,null);
-		$this->assertTrue(is_array($res),'Somehow there were no visible fields for user 1');
-        //since Chamilo 1.8.8 we always have 3 visible fields for notifications
-	}
-
-	function testGetExtraUserDataByField() {
-		$res=UserManager::get_extra_user_data_by_field(1, 'field variable', null,null, null);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testGetExtraUserDataByValue(){
-		$res=UserManager::get_extra_user_data_by_value('able', 45, null);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testGetNumberOfExtraFields() {
-		$res=UserManager::get_number_of_extra_fields($all_visibility=true);
-		$this->assertFalse(!(bool)$res);
-
-	}
-
-	function testGetNumberOfUsers() {
-		$res=UserManager::get_number_of_users();
-		$this->assertFalse(!(bool)$res);
-	}
-
-	function testGetPersonalSessionCourseList() {
-		global $_configuration;
-		$res=UserManager::get_personal_session_course_list(1);
-		//var_dump($res);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testGetPictureUser() {
-		$res=UserManager::get_picture_user(1, 'unknown.jpg', 200, null, null);
-		$this->assertFalse(!(bool)$res);
-	}
-
-	function testGetTeacherList() {
-		ob_start();
-		UserManager::get_teacher_list(1212,null);
-		$res =ob_get_contents();
-		ob_end_clean();
-		$this->assertFalse(!(bool)$res);
-	}
-
-	function testGetUserIdFromUsername() {
-		$res=UserManager::get_user_id_from_username('arthur3');
-		$this->assertTrue(!(bool)$res);
-	}
-
-	function testGetUserInfo() {
-		$res=UserManager::get_user_info('arthur2');
-		$this->assertTrue(!(bool)$res);
-	}
-
-	function testGetUserInfoById() {
-		$res=UserManager::get_user_info_by_id(2);
-		if(isset($user_id) && ($user_fields = false)){
-			$this->assertTrue(is_array($res));
-		}	 else {
-				$this->assertTrue($res);
-		}
-	}
-
-	function testGetUserList() {
-		$res=UserManager::get_user_list(null,null);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testGetUserListLike() {
-		$res=UserManager::get_user_list_like(null,null);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testGetUserPicturePathById() {
-		$id=5;
-		$res=UserManager::get_user_picture_path_by_id($id,null,null,null);
-		$this->assertTrue(is_array($res));
-	}
-
-	function testGetUserProductions() {
-		$user_id='1';
-		$res=UserManager::get_user_productions($user_id);
-		$this->assertFalse(is_array($res===0));
-	}
-
-	function testGetUserUploadFilesByCourse() {
-		$user_id='1';
-		$course='MATH';
-		$res=UserManager::get_user_upload_files_by_course($user_id, $course,null);
-		$this->assertTrue(is_string($res));
-	}
-
-	 function testIsAdmin() {
-	 	$user_id=1;
-	 	$res=UserManager::is_admin($user_id);
-	 	//var_dump($res);
-	 	$this->assertTrue(is_bool($res));
-	 }
-
-	 function testIsExtraFieldAvailable() {
-	 	$fieldname='name3';
-	 	$res=UserManager::is_extra_field_available($fieldname);
-	 	$this->assertFalse(is_string($res));
-	 }
-
-	 function testIsUsernameAvailable() {
-	 	$username='Arthur';
-	 	$res=UserManager::is_username_available($username);
-	 	$this->assertFalse(is_string($res));
-	 }
-
-	 function testRemoveUserProductionIsFalseWhenProductionDoesNotExist() {
-	 	$user_id=1;
-	 	$production='my_files/abc'; //shouldn't exist
-	 	$res=UserManager::remove_user_production($user_id,$production);
-	 	$this->assertFalse($res);
-	 }
-
-	function testResizePictureEmptyPicture() {
-		$file='';
-		$max_size_for_picture='';
-		$res=UserManager::resize_picture($file, $max_size_for_picture);
-	 	$this->assertNull($res);
-	}
-
-	function testSaveExtraFieldChanges() {
-		$fieldid='1';
-		$fieldvarname='name';
-		$fieldtype='1';
-		$fieldtitle='title';
-		$fielddefault='5';
-		$res=UserManager::save_extra_field_changes($fieldid, $fieldvarname, $fieldtype, $fieldtitle, $fielddefault, null);
-	 	$this->assertFalse(is_a($res,UserManager));
-	 	$this->assertNotNull($res,'');
-	 	$this->assertTrue($res);
-	}
-
-	function testSendMessageInOutbox() {
-		$email_administrator='arthur@dokeos.com';
-		$user_id='1';
-		$title='hola í';
-		$content='prueba de este í mensaje';
-		global $charset;
-		$res=UserManager::send_message_in_outbox($email_administrator,$user_id,$title, $content);
-	 	$this->assertNull($res);
-	 	$this->assertTrue(is_null($res));
-
-	}
-/*
-//DEPRECATED
-	function testSuscribeUsersToSession() {
-	  	$id_session=1;
-	  	$UserList='';
-	  	$res=UserManager::suscribe_users_to_session($id_session,$UserList);
-	 	$this->assertTrue(is_null($res));
-	}
-*/
-	function testUpdateApiKey() {
-		$user_id=121;
-		$api_service='string';
-		$res=UserManager::update_api_key($user_id,$api_service);
-	 	$this->assertTrue(is_numeric($user_id),is_string($api_service));
-	 	$this->assertTrue(is_numeric($res));
-	 	$this->assertTrue($this->$res===null);
-	 	$this->assertNull(null,$res);
-	}
-
-	function testUpdateExtraField() {
-		$fid=5;
-		$columns=array();
-		$res=UserManager::update_extra_field($fid,$columns);
-	 	$this->assertTrue(is_bool($res));
-	}
-
-	function testUpdateExtraFieldValue() {
-		$user_id='121';
-		$fname='name';
-		$res=UserManager::update_extra_field_value($user_id,$fname,null);
-	 	$this->assertTrue(is_bool($res));
-	}
-
-	function testUpdateOpenid() {
-		$user_id='121';
-		$openid='default';
-		$res=UserManager::update_openid($user_id, $openid);
-	 	$this->assertTrue(is_bool($res));
-	}
-}
-?>

+ 0 - 85
tests/main/inc/lib/xht.lib.test.php

@@ -1,85 +0,0 @@
-<?php
-
-class TestXht extends UnitTestCase {
-
-	public $xhtdoc;
-	public function TestXht(){
-		$this->UnitTestCase('test the library that define xht_htmlwchars & class xhtdoc with methods');
-	}
-	public function setUp(){
-		$this->xhtdoc = new xhtdoc();
-	}
-
-	public function tearDown(){
-		$this->xhtdoc = null;
-	}
-
-	public function testXhtHtmlwchars(){
-		global $charset;
-		$s='';
-		$res = xht_htmlwchars($s);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testXhtIsAssoclist(){
-		$s ='';
-		$res = xht_is_assoclist($s);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === true || $res === false);
-		//var_dump($res);
-	}
-
-	public function testXhtExplodeAssoclist(){
-		$S =array(aaasasa);
-		$res = xht_explode_assoclist($S);
-		if(is_array($res))
-		$this->assertTrue(is_array($res));
-		else
-		$this->assertFalse(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testXhtFillTemplate(){
-		$template_name=null;
-		$cur_elem = 0;
-		$res = xhtdoc::xht_fill_template($template_name, $cur_elem);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testxhtSubstitute(){
-		global $charset;
-		$subtext='';
-		$cur_elem = 0;
-		$pre = '';
-		$post = '';
-		$res = xhtdoc::xht_substitute($subtext, $cur_elem = 0, $pre = '', $post = '');
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testXhtAddTemplate(){
-		$template_name='';
-		$httext='';
-		$res = xhtdoc::xht_add_template($template_name, $httext);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testXhtdoc(){
-		$htt_file_contents='document';
-		$res = xhtdoc::xhtdoc($htt_file_contents);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testShowParam(){
-		global $charset;
-		$result = '';
-		$res = xhtdoc::_show_param();
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 211
tests/main/inc/lib/xmd.lib.test.php

@@ -1,211 +0,0 @@
-<?php
-class TestXmd extends UnitTestCase{
-
-	public $Xmddoc;
-	public function TestXmddoc(){
-
-		$this->UnitTestCase('XML Dom Library function tests');
-	}
-
-	public function setUp(){
-		$this->Xmddoc = new xmddoc();
-	}
-
-	public function tearDown(){
-		$this->Xmddoc= null;
-	}
-
-	public function testXmdGetElement(){
-		$parent=0;
-		array('?name' => $this->name[$parent],
-              '?parent' => $this->parent[$parent]);
-		$res = $this->Xmddoc->xmd_get_element($parent);
-		if(!is_array($res))
-		$this->assertTrue(is_null($res));
-		else
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testXmdGetNsUri(){
-		$parent = 0;
-		$attName = '';
-		$this->names[$this->ns[$parent]];
-		$res = Xmddoc::xmd_get_ns_uri($parent = 0, $attName = '');
-		if(is_array($res))
-		$this->assertTrue(is_array($res));
-		else
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testXmdRemoveElement(){
-		$child='';
-		$res = Xmddoc:: xmd_remove_element($child);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === true || $res ===false);
-		//var_dump($res);
-	}
-
-	public function testXmdRemoveNodes(){
-		$children=2;
-		$parent = 1;
-		$res = Xmddoc::xmd_remove_nodes($children, $parent = 0);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === true || $res === false);
-		//var_dump($res);
-	}
-	/**
-	 *
-	 */
-	public function testXmdUpdate(){
-		$xmPath='';
-		$text = '';
-		$parent = 0;
-		$res = $this->Xmddoc->xmd_update($xmPath, $text, $parent);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === true || $res === false);
-		//var_dump($res);
-	}
-	/**
-	 * this function have work with the method xmddoc
-	 */
-	public function testXmdUpdateMany(){
-		$xmPaths='';
-		$subPath='';
-		$text='';
-		$parent='';
-		$res = $this->Xmddoc->xmd_update_many($xmPaths, $subPath, $text, $parent);
-		$this->assertTrue($res);
-		//var_dump($res);
-	}
-
-	public function testXmdCopyForeignChild(){
-		$fdoc='';
-		$fchild='';
-		$parent='';
-		$res = $this->Xmddoc->xmd_copy_foreign_child($fdoc, $fchild, $parent);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	public function testXmdAddElement(){
-		$name='asasasas';
-		$parent = 0;
-		$attribs = array();
-		$res  = $this->Xmddoc->xmd_add_element($name, $parent, $attribs);
-		$this->assertTrue(is_numeric($res));
-		$this->assertTrue($res === -1 || $res === 0);
-		//var_dump($res);
-	}
-
-	public function testXmdSetAttribute(){
-		$parent=0;
-		$name='';
-		$value=0;
-		$checkurihaspfx = TRUE;
-		$res = $this->Xmddoc->xmd_set_attribute($parent, $name, $value, $checkurihaspfx);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testXmdAddText(){
-		$text='asasasasasa';
-		$parent = 1;
-		$res = $this->Xmddoc->xmd_add_text($text, $parent = 0);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === true || $res === false);
-		//var_dump($res);
-	}
-
-	public function testXmdAddTextElement(){
-		$name='';
-		$text='';
-		$parent = 0;
-		$attribs = array();
-		$res = $this->Xmddoc->xmd_add_text_element($name, $text, $parent = 0, $attribs = array());
-		$this->assertTrue(is_bool($res) || is_numeric($res));
-		//var_dump($res);
-	}
-
-	public function testXmdText(){
-		$parent = 0;
-		$res =$this->Xmddoc->xmd_text($parent = 0);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testXmdXml(){
-		$increase = '  ';
-		$indent = '';
-		$lbr = "\n";
-		$parent = 0;
-		$res = $this->Xmddoc->xmd_xml($increase, $indent, $lbr, $parent);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testXmdValue($xmPath, $parent, $fix, $fun){
-		$xmPath='';
-		$parent = 0;
-		$fix = array();
-		$fun = '';
-		$res = $this->Xmddoc->xmd_value($xmPath, $parent, $fix, $fun);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testXmdHtmlValue(){
-		$xmPath='';
-		$parent = 0;
-		$fun = 'htmlspecialchars';
-		$res = $this->Xmddoc->xmd_html_value($xmPath, $parent , $fun );
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	public function testXmdSelectSingleElement(){
-		$xmPath='';
-		$parent = 0;
-		$res = $this->Xmddoc->xmd_select_single_element($xmPath, $parent);
-		$this->assertTrue(is_numeric($res));
-		$this->assertTrue($res);
-		//var_dump($res);
-	}
-
-	public function testXmdSelectElementsWhere(){
-		$xmPath='';
-		$subPath = '.';
-		$value = '';
-		$parent = 0;
-		$res = $this->Xmddoc->xmd_select_elements_where($xmPath, $subPath, $value, $parent);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-
-	public function testXmdSelectElementsWhereNotempty(){
-		$xmPath='';
-		$subPath = '.';
-		$parent = 0;
-		$res = $this->Xmddoc->xmd_select_elements_where_notempty($xmPath,$subPath, $parent);
-        $this->assertTrue(is_array($res));
-        //var_dump($res);
-    }
-
-    public function testxmd_select_elements(){
-    	$xmPath='';
-    	$parent = 0;
-    	$res = $this->Xmddoc->xmd_select_elements($xmPath, $parent);
-    	$this->assertTrue(is_array($res));
-    	//var_dump($res);
-    }
-
-    public function testXmdSelectElements(){
-    	$xmPath='';
-    	$parent = 0;
-    	$res = $this->Xmddoc-> xmd_select_elements($xmPath, $parent);
-    	$this->assertTrue(is_array($res));
-    	//var_dump($res);
-    }
-}
-?>

+ 0 - 33
tests/main/inc/tool_navigation_menu.inc.test.php

@@ -1,33 +0,0 @@
-<?php
-
-class TestToolNavigationMenu extends UnitTestCase{
-
-    public function TestToolNavigationMenu(){
-        $this->UnitTestCase('Navigation menu display library - main/inc/tool_navigation_menu.inc.test.php');
-    }
-	public function testGetNavigationItemsIsArray() {
-		global $is_courseMember;
-		global $_user;
-		global $_course;
-		$include_admin_tools = false;
-		$res = get_navigation_items($include_admin_tools);
-		$this->assertTrue(is_array($res));
-	}
-
-	public function testShowNavigationMenuIsNull() {
-		ob_start();
-		$navigation_items = get_navigation_items(true);
-		$course_id = api_get_course_id();
-		$res = show_navigation_menu();
-		$this->assertNull($res);
-		ob_end_clean();
-	}
-
-	public function testShowNavigationToolShortcutsIsNull() {
-		ob_start();
-		$orientation = SHORTCUTS_HORIZONTAL;
-		$res = show_navigation_tool_shortcuts($orientation);
-		$this->assertNull($res);
-		ob_end_clean();
-	}
-}

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio