Jelajahi Sumber

Remove unused test code #1750

jmontoyaa 8 tahun lalu
induk
melakukan
8fd4492cff
100 mengubah file dengan 1 tambahan dan 16648 penghapusan
  1. 0 17
      tests/README.md
  2. 0 1
      tests/api/README.txt
  3. 1 1
      tests/behat/behat.yml
  4. 0 115
      tests/build.xml
  5. 0 6
      tests/chamilotest.php
  6. 0 49
      tests/internationalization.lib.test_standalone.php
  7. 0 1
      tests/logs/code-browser/README.txt
  8. 0 4
      tests/logs/index.html
  9. 0 0
      tests/logs/jdepend.xml
  10. 0 0
      tests/logs/junit.xml
  11. 0 101
      tests/main/admin/calendar.lib.test.php
  12. 0 188
      tests/main/admin/statistics/statistics.lib.test.php
  13. 0 206
      tests/main/admin/sub_language.class.test.php
  14. 0 43
      tests/main/announcements/announcements.inc.test.php
  15. 0 71
      tests/main/auth/openid/xrds.lib.test.php
  16. 0 35
      tests/main/chat/chat_functions.lib.test.php
  17. 0 299
      tests/main/dropbox/dropbox_class.inc.test.php
  18. 0 424
      tests/main/dropbox/dropbox_functions.inc.test.php
  19. 0 389
      tests/main/exercice/answer.class.test.php
  20. 0 539
      tests/main/exercice/exercise.class.test.php
  21. 0 42
      tests/main/exercice/exercise.lib.test.php
  22. 0 83
      tests/main/exercice/exercise_result.class.test.php
  23. 0 90
      tests/main/exercice/export/exercise_import.inc.test.php
  24. 0 189
      tests/main/exercice/export/qti2/qti2_classes.test.php
  25. 0 86
      tests/main/exercice/export/qti2/qti2_export.test.php
  26. 0 219
      tests/main/exercice/export/scorm/scorm_classes.test.php
  27. 0 45
      tests/main/exercice/fill_blanks.class.test.php
  28. 0 29
      tests/main/exercice/freeanswer.class.test.php
  29. 0 178
      tests/main/exercice/hotpotatoes.lib.test.php
  30. 0 1248
      tests/main/forum/forumfunction.inc.test.php
  31. 0 135
      tests/main/gradebook/lib/be/attendancelink.class.test.php
  32. 0 423
      tests/main/gradebook/lib/be/category.class.test.php
  33. 0 42
      tests/main/gradebook/lib/be/dropboxlink.class.test.php
  34. 0 347
      tests/main/gradebook/lib/be/evaluation.class.test.php
  35. 0 153
      tests/main/gradebook/lib/be/exerciselink.class.test.php
  36. 0 42
      tests/main/gradebook/lib/be/forumthreadlink.class.test.php
  37. 0 21
      tests/main/inc/banner.inc.test.php
  38. 0 35
      tests/main/inc/course_document.lib.test.php
  39. 0 35
      tests/main/inc/lib/access_url_edit_courses_to_url_functions.lib.test.php
  40. 0 32
      tests/main/inc/lib/access_url_edit_sessions_to_url_functions.lib.test.php
  41. 0 33
      tests/main/inc/lib/access_url_edit_users_to_url_functions.lib.test.php
  42. 0 132
      tests/main/inc/lib/add_course.lib.inc.test.php
  43. 0 34
      tests/main/inc/lib/add_courses_to_sessions_functions.lib.test.php
  44. 0 29
      tests/main/inc/lib/add_many_session_to_category_functions.lib.test.php
  45. 0 598
      tests/main/inc/lib/blog.lib.test.php
  46. 0 173
      tests/main/inc/lib/database.lib.test.php
  47. 0 65
      tests/main/inc/lib/debug.lib.inc.test.php
  48. 0 256
      tests/main/inc/lib/display.lib.test.php
  49. 0 300
      tests/main/inc/lib/document.lib.test.php
  50. 0 150
      tests/main/inc/lib/events.lib.inc.test.php
  51. 0 121
      tests/main/inc/lib/exercise_show_functions.lib.test.php
  52. 0 73
      tests/main/inc/lib/export.lib.inc.test.php
  53. 0 75
      tests/main/inc/lib/fileDisplay.lib.test.php
  54. 0 123
      tests/main/inc/lib/fileManage.lib.test.php
  55. 0 129
      tests/main/inc/lib/fileManager.lib.test.php
  56. 0 363
      tests/main/inc/lib/fileUpload.lib.test.php
  57. 0 9
      tests/main/inc/lib/geometry.lib.test.php
  58. 0 157
      tests/main/inc/lib/glossary.lib.test.php
  59. 0 435
      tests/main/inc/lib/groupmanager.lib.test.php
  60. 0 112
      tests/main/inc/lib/image.lib.test.php
  61. 0 16
      tests/main/inc/lib/import.lib.test.php
  62. 0 83
      tests/main/inc/lib/internationalization.lib.test.php
  63. 0 81
      tests/main/inc/lib/legal.lib.test.php
  64. 0 82
      tests/main/inc/lib/login.lib.test.php
  65. 0 32
      tests/main/inc/lib/mail.lib.inc.test.php
  66. 0 707
      tests/main/inc/lib/main_api.lib.test.php
  67. 0 515
      tests/main/inc/lib/main_api.lib.test_standalone.php
  68. 0 28
      tests/main/inc/lib/message.lib.test.php
  69. 0 87
      tests/main/inc/lib/notebook.lib.test.php
  70. 0 62
      tests/main/inc/lib/online.inc.test.php
  71. 0 72
      tests/main/inc/lib/rmdirr.lib.test.php
  72. 0 96
      tests/main/inc/lib/security.lib.test.php
  73. 0 107
      tests/main/inc/lib/session_handler.class.test.php
  74. 0 140
      tests/main/inc/lib/sessionmanager.lib.test.php
  75. 0 141
      tests/main/inc/lib/social.lib.test.php
  76. 0 165
      tests/main/inc/lib/sortable_table.class.test.php
  77. 0 99
      tests/main/inc/lib/specific_fields_manager.lib.test.php
  78. 0 55
      tests/main/inc/lib/statsUtils.lib.inc.test.php
  79. 0 313
      tests/main/inc/lib/surveymanager.lib.test.php
  80. 0 106
      tests/main/inc/lib/system_announcements.lib.test.php
  81. 0 79
      tests/main/inc/lib/tablesort.lib.test.php
  82. 0 71
      tests/main/inc/lib/text.lib.test.php
  83. 0 467
      tests/main/inc/lib/tracking.lib.test.php
  84. 0 192
      tests/main/inc/lib/urlmanager.lib.test.php
  85. 0 308
      tests/main/inc/lib/usermanager.lib.test.php
  86. 0 85
      tests/main/inc/lib/xht.lib.test.php
  87. 0 211
      tests/main/inc/lib/xmd.lib.test.php
  88. 0 55
      tests/main/install/install_upgrade.lib.test.php
  89. 0 213
      tests/main/mySpace/myspace.lib.test.php
  90. 0 1400
      tests/main/newscorm/learnpath.class.test.php
  91. 0 593
      tests/main/newscorm/learnpathItem.class.test.php
  92. 0 8
      tests/main/newscorm/openoffice_document.class.test.php
  93. 0 38
      tests/main/newscorm/openoffice_presentation.class.test.php
  94. 0 50
      tests/main/newscorm/openoffice_text.class.test.php
  95. 0 47
      tests/main/newscorm/openoffice_text_document.class.test.php
  96. 0 184
      tests/main/newscorm/scorm.class.test.php
  97. 0 26
      tests/main/newscorm/scormItem.class.test.php
  98. 0 39
      tests/main/newscorm/scormOrganization.class.test.php
  99. 0 30
      tests/main/newscorm/scormResource.class.test.php
  100. 0 235
      tests/main/permissions/permissions_functions.inc.test.php

+ 0 - 17
tests/README.md

@@ -49,24 +49,10 @@ Behat-specific folder
 
 
 Attempt at keeping a track of what Chamilo looked like over time.
 Attempt at keeping a track of what Chamilo looked like over time.
 
 
-### logs
-
-Meant as a destination for all logs generated by automated testing and building
-scripts. Should be writeable whenever tests (other than behat) are run (clover
-and stuff like that). Initially used when Chamilo was using its own Jenkins
-setup (now it tries to use Travis-CI).
-
-### main
-
-Deprecated PHPUnit code reflecting the internal code structure of Chamilo
-
 ### migrations
 ### migrations
 
 
 Combination of unofficial scripts to execute migrations from other systems
 Combination of unofficial scripts to execute migrations from other systems
 
 
-### phpunit
-
-Deprecated PHPUnit code
 
 
 ### procedures
 ### procedures
 
 
@@ -78,9 +64,6 @@ Chamilo.
 A collection of scripts used to fix or improve some things globally in Chamilo
 A collection of scripts used to fix or improve some things globally in Chamilo
 portals. Mostly for old versions.
 portals. Mostly for old versions.
 
 
-### simpletest
-
-Deprecated SimpleTest code (unused since 2009)
 
 
 ### translations
 ### translations
 
 

+ 0 - 1
tests/api/README.txt

@@ -1 +0,0 @@
-This directory will contain the auto-generated PHPDoc files

+ 1 - 1
tests/behat/behat.yml

@@ -1,7 +1,7 @@
 default:
 default:
     extensions:
     extensions:
         Behat\MinkExtension:
         Behat\MinkExtension:
-          base_url: http://localhost/
+          base_url: http://localhost/chamilo_111/
           goutte: ~
           goutte: ~
           show_cmd: 'open %s'
           show_cmd: 'open %s'
           selenium2:
           selenium2:

+ 0 - 115
tests/build.xml

@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="Chamilo LMS" default="build">
- <target name="build"
-   depends="prepare,phpunit,pdepend,phpdoc"/>
-
- <target name="clean" description="Cleanup build artifacts">
-  <delete dir="${basedir}/../tests/api"/>
-  <delete dir="${basedir}/../tests/code-browser"/>
-  <delete dir="${basedir}/../tests/coverage"/>
-  <delete dir="${basedir}/../tests/logs"/>
-  <delete dir="${basedir}/../tests/pdepend"/>
- </target>
-
- <target name="prepare" depends="clean" description="Prepare for build">
-  <mkdir dir="${basedir}/../tests/api"/>
-  <mkdir dir="${basedir}/../tests/code-browser"/>
-  <mkdir dir="${basedir}/../tests/coverage"/>
-  <mkdir dir="${basedir}/../tests/logs"/>
-  <mkdir dir="${basedir}/../tests/pdepend"/>
-  <mkdir dir="${basedir}/../tests/phpdox"/>
- </target>
-
- <target name="lint" description="Perform syntax check of sourcecode files">
-   <apply executable="php" failonerror="true">
-     <arg value="-l" />
-
-     <fileset dir="${basedir}/../main">
-       <include name="**/*.php"/>
-     </fileset>
-
-     <fileset dir="${basedir}">
-       <include name="**/*.php"/>
-     </fileset>
-
-   </apply>
- </target>
-
- <target name="pdepend" description="Calculate software metrics using PHP_Depend">
-  <exec executable="pdepend">
-   <arg value="--jdepend-xml=${basedir}/tests/logs/jdepend.xml" />
-   <arg value="--jdepend-chart=${basedir}/tests/pdepend/dependencies.svg" />
-   <arg value="--overview-pyramid=${basedir}/tests/pdepend/overview-pyramid.svg" />
-   <arg path="${basedir}" />
-  </exec>
- </target>
-
- <target name="phpmd"
-         description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
-  <exec executable="phpmd">
-   <arg path="${basedir}" />
-   <arg value="text" />
-   <arg value="${basedir}/tests/phpmd.xml" />
-  </exec>
- </target>
-
- <target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
-  <exec executable="phpmd">
-   <arg path="${basedir}" />
-   <arg value="xml" />
-   <arg value="${basedir}/tests/phpmd.xml" />
-   <arg value="--reportfile" />
-   <arg value="${basedir}/tests/logs/pmd.xml" />
-  </exec>
- </target>
-
- <target name="phpcs"
-         description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
-  <exec executable="phpcs">
-   <arg value="--standard=${basedir}/tests/phpcs.xml" />
-   <arg path="${basedir}" />
-  </exec>
- </target>
-
- <target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
-  <exec executable="phpcs" output="/dev/null">
-   <arg value="--report=checkstyle" />
-   <arg value="--report-file=${basedir}/tests/logs/checkstyle.xml" />
-   <arg value="--standard=${basedir}/tests/phpcs.xml" />
-   <arg path="${basedir}" />
-  </exec>
- </target>
-
- <!--target name="simpletest" description="Run simpletests">
-   <simpletest>
-     <formatter type="plain"/>
-     <fileset dir="${basedir}/tests">
-       <include name="test_suite.php"/>
-     </fileset>
-   </simpletest>
- </target-->
-
- <target name="phpunit" description="Run unit tests with PHPUnit" depends="lint">
-   <!--exec executable="phpunit" failonerror="true"-->
-   <exec executable="phpunit">
-     <arg line="-c ${basedir}/phpunit/phpunit.xml" />
-   </exec>
- </target>
-
- <target name="phpdoc" description="Generate API documentation">
-   <exec executable="phpdoc">
-     <arg line="-d ${basedir}/../ -t ${basedir}/logs/docs -ti ChamiloLMS -i archive/,home/,entity/,symfony/,phpdocx/,phpqrcode/,mpdf/,transliteration/*,phpmailer/*,htmlpurifier/,formvalidator/*,app/upload/users/,lang/,app/courses/,main/inc/lib/internationalization_database/,.htaccess -ct covers,assert" />
-   </exec>
- </target>
- <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
-  <exec executable="phpcb">
-   <arg value="--log" />
-   <arg path="${basedir}/tests/logs" />
-   <arg value="--source" />
-   <arg path="${basedir}" />
-   <arg value="--output" />
-   <arg path="${basedir}/tests/code-browser" />
-  </exec>
- </target>
-</project>

+ 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 - 49
tests/internationalization.lib.test_standalone.php

@@ -1,49 +0,0 @@
-<?php
-/**
- * A standalone test for the internationalization library.
- * @author Ricardo Rodriguez Salazar, 2009.
- * @author Ivan Tcholakov, September 2009.
- * For licensing terms, see /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 - 1
tests/logs/code-browser/README.txt

@@ -1 +0,0 @@
-Code browser report will be generated in this directory

+ 0 - 4
tests/logs/index.html

@@ -1,4 +0,0 @@
-<html>
-<body>
-</body>
-</html>

+ 0 - 0
tests/logs/jdepend.xml


+ 0 - 0
tests/logs/junit.xml


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

@@ -1,101 +0,0 @@
-<?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);
-	}
-
- 	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 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);
- 	}
-
-
- 	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));
- 	}
-
-	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 testShowUserFilterForm(){
-		ob_start();
- 		$res = show_user_filter_form();
- 		ob_end_clean();
- 		$this->assertTrue(is_null($res));
- 	}
-
- 	public function testIsRepeatedEvent() {
-	//This is deprecated or not used
- 	}
-}

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

@@ -1,188 +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::makeSizeString($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::countCourses();
-        $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::countUsers($status, $category_code,
-            $count_invisible_courses);
-        $this->assertTrue(is_numeric($res));
-        $this->assertTrue(count($res) === 0 || count($res) !== 0);
-    }
-
-    public function testGetNumberOfActivities()
-    {
-        $resu = Statistics::getNumberOfActivities();
-        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::getActivitiesData($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::getCourseCategories();
-        $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::printStats(
-            $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::printLoginStats($type);
-        ob_end_clean();
-        $this->assertTrue(is_null($resu));
-        //var_dump($resu);
-    }
-
-    public function testPrintRecentLoginStats()
-    {
-        ob_start();
-        $res = Statistics::printRecentLoginStats();
-        ob_end_clean();
-        $this->assertTrue(is_null($res));
-        //var_dump($res);
-    }
-
-    public function testPrintToolStats()
-    {
-        ob_start();
-        $resu = Statistics::printToolStats();
-        ob_end_clean();
-        $this->assertTrue(is_null($resu));
-    }
-
-    public function testPrintCourseByLanguageStats()
-    {
-        ob_start();
-        $resu = Statistics::printCourseByLanguageStats();
-        ob_end_clean();
-        $this->assertTrue(is_null($resu));
-        //var_dump($resu);
-    }
-
-    public function testPrintUserPicturesStats()
-    {
-        ob_start();
-        $resu = Statistics::printUserPicturesStats();
-        ob_end_clean();
-        $this->assertTrue(is_null($resu));
-    }
-
-    public function testPrintActivitiesStats()
-    {
-        ob_start();
-        $res = Statistics::printActivitiesStats();
-        ob_end_clean();
-        $this->assertTrue(is_null($res));
-        //var_dump($res);
-    }
-
-    public function testPrintCourseLastVisit()
-    {
-        ob_start();
-        $column = '';
-        $direction = '';
-        $parameters['action'] = 'courselastvisit';
-        $res = Statistics::printCourseLastVisit();
-        ob_end_clean();
-        $this->assertTrue(is_null($res));
-    }
-}
-
-?>

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

@@ -1,206 +0,0 @@
-<?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 - 43
tests/main/announcements/announcements.inc.test.php

@@ -1,43 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-class TestAnnouncements extends UnitTestCase {
-
-    function TestAnnouncements(){
-        $this->UnitTestCase('Displays one specific announcement test');
-    }
-
-
-    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);
-    }
-}

+ 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 - 35
tests/main/chat/chat_functions.lib.test.php

@@ -1,35 +0,0 @@
-<?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 CreateChatConnection($database_name) {
-		$session_id = 1;
-		$tbl_chat_connected = Database::get_main_table(TABLE_MAIN_CHAT);
-		$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);
-	}
-}
-?>

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

@@ -1,299 +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));
-	}
-
-	/**
-	 * 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 - 424
tests/main/dropbox/dropbox_functions.inc.test.php

@@ -1,424 +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));
-        }
-	}
-	/**
-	* 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);
-	}
-
-	/**
-	* @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 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).'exercise/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).'exercise/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 = ExerciseLib::showQuestion($questionId, $onlyAnswers=false, $origin=false,$current_item, $total_item);
- 	 	$this->assertTrue(is_null($res));
- 	 	var_dump($res);
- 	 }
-
-
-
-
-}
-?>

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

@@ -1,83 +0,0 @@
-<?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 - 90
tests/main/exercice/export/exercise_import.inc.test.php

@@ -1,90 +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 = qti_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);
-	}
-}
-?>

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

@@ -1,189 +0,0 @@
-<?php
-
-require_once(api_get_path(SYS_CODE_PATH).'/exercise/answer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercise/question.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercise/exercise.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercise/hotspot.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercise/unique_answer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercise/multiple_answer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercise/matching.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercise/freeanswer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'/exercise/fill_blanks.class.php');
-
-class TestQti2 extends UnitTestCase {
-
-	public $qIms2Question;
-	public $qImsAnswerFillInBlanks;
-	public $qImsAnswerFree;
-	public $qImsAnswerHotspot;
-	public $qImsAnswerMatching;
-	public $qImsAnswerMultipleChoice;
-
-	public function __construct() {
-        $this->UnitTestCase('QTI2 library - main/exercise/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 - 219
tests/main/exercice/export/scorm/scorm_classes.test.php

@@ -1,219 +0,0 @@
-<?php
-
-require_once(api_get_path(SYS_CODE_PATH).'exercise/question.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercise/exercise.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercise/unique_answer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercise/multiple_answer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercise/multiple_answer_combination.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercise/fill_blanks.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercise/freeanswer.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercise/hotspot.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercise/matching.class.php');
-require_once(api_get_path(SYS_CODE_PATH).'exercise/hotspot.class.php');
-
-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/exercise/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='.intval($_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='.intval($_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).'exercise/hotpotatoes.lib.php');
-
-class TestHotpotatoes extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Hotpotatoes exercises library - main/exercise/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/exercise/';
-		$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/exercise/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/exercise/hotpotatoes.lib.php';
-		$res=GetFileName($fname);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}*/
-
-	function testGetFolderName() {
-		$fname='main/exercise/hotpotatoes.lib.php';
-		$res=GetFolderName($fname);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	function testGetFolderPath() {
-		$fname='main/exercise/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/exercise/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.'exercise/';
-		$res=hotpotatoes_init($baseWorkDir);
-		$this->assertFalse($res);
-		//var_dump($res);
-	}
-
-	function testHotPotGCt() {
-		$folder='/main/exercise';
-		$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/exercise';
-		$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/exercise/';
-		$content='test test test';
-		$res=WriteFileCont($full_file_path,$content);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-}
-?>

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

@@ -1,1248 +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 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 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 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 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 testGetThreadScoreHistory() {
-		$user_id = 1;
-		$thread_id = 1;
-		$opt = true;
-		$res = getThreadScoreHistory($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);
-	 }
-
-	 /**
-	* 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 = getPosts($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 = 1;
-		$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);
-		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 testShowQualify() {
-	 	$option =  1;
-	 	$user_id = 1;
-	 	$thread_id = 1;
-        $res = showQualify($option, $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_forum_recursive_sort() {
-		$rows = array();
-		$res = forumRecursiveSort($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 testSaveThreadScoreHistory() {
-		$option = 1;
-		$couser_id = 1;
-		$forum_id = 1;
-		$user_id = 1;
-		$thread_id = 1;
-		$current_qualify = 1;
-		$qualify_user_id = 1;
-		$res = saveThreadScoreHistory($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 testSaveThreadScore()
-	 {
-        $user_id = 1;
-        $thread_id = 1;
-        $qualify_time = 1;
-        $res = saveThreadScore(
-            $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));
-        }
-	 }
-
-	 /**
-	* 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);
-	}
-	  /**
-	 * 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 testdeleteForumCategoryThread() {
-		 $content= 'testcontent';
-		 $id = 1;
-		 $res = deleteForumCategoryThread($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 - 21
tests/main/inc/banner.inc.test.php

@@ -1,21 +0,0 @@
-<?php
-
-class TestBanner extends UnitTestCase
-{
-
-    public function TestBanner()
-    {
-        $this->UnitTestCase('Banners library - main/inc/banner.inc.test.php');
-    }
-
-    public function testGetTabs()
-    {
-        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 - 35
tests/main/inc/course_document.lib.test.php

@@ -1,35 +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 - 132
tests/main/inc/lib/add_course.lib.inc.test.php

@@ -1,132 +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 = AddCourse::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 = CourseManager::generate_course_code($course_title);
-        $this->assertTrue($res);
-    }
-
-
-    function TestDefineCourseKeys(){
-        global $prefixAntiNumber, $_configuration;
-        $wantedCode = CourseManager::generate_course_code($wantedCode);
-        $res = AddCourse::define_course_keys(CourseManager::generate_course_code($wantedCode), null, null, null,null, null);
-        $this->assertTrue($res);
-    }
-
-    function TestBrowseFolders(){
-        $browse = array('path'=>'','file'=>'','media'=>'');
-        $res = AddCourse::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 TestFillDbCourse(){
-        global $_configuration, $_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 = AddCourse::fill_db_course($courseDbName, $courseRepository, $language);
-        $this->assertTrue($res === 0);
-    }
-
-    function TestString2Binary(){
-        $variable = true;
-        $res = AddCourse::string2binary($variable);
-        $this->assertTrue($res);
-    }
-
-    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 - 598
tests/main/inc/lib/blog.lib.test.php

@@ -1,598 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'blog.lib.php');
-ob_start();
-
-//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 - 173
tests/main/inc/lib/database.lib.test.php

@@ -1,173 +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 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 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 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));
-	}
-
-	/* // 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 - 256
tests/main/inc/lib/display.lib.test.php

@@ -1,256 +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);
-	}
-
-	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, $text_dir, $plugins, $_user, $_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, $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);
-	}
-
-	/**
-	 * 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);
-	}
-}

+ 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::accessCourse();
-		$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::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::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::event_link($link_id);
-		$this->assertTrue(is_numeric($res));
-		//var_dump($res);
-	}
-
-	function testEventLogin() {
-		global $_configuration;
-		global $_user;
-		global $TABLETRACK_LOGIN;
-		$res=Event::event_login(1);
-		$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 = 'bla';
-		$event_value_type = 'blo';
-		$event_value = 'bli';
-		$res=Event::addEvent($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::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=Event::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=Event::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='';
-		$question_list = array();
-		$res=Event::update_event_exercise($exeid,$exo_id, $score, $weighting,$session_id,$learnpath_id=0,$learnpath_item_id=0, $duration, $question_list);
-		$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 - 73
tests/main/inc/lib/export.lib.inc.test.php

@@ -1,73 +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 arrayToCsv method.
-     * @todo check that a new file is created in api_get_path(SYS_ARCHIVE_PATH)
-     */
-    function testArrayToCsv() {
-        $data = array();
-        // can only be tested if headers were not sent
-        ob_start();
-       	$res = Export::arrayToCsv($data, $filename = 'export');
-		$this->assertFalse($res);
-		ob_end_clean();
-    }
-
-
- 	function testExportTableXls() {
-		$data = array();
-		$filename = 'export';
-        ob_start();
-		$res=Export::arrayToXls($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::arrayToXml($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();
-  	}
-}

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

@@ -1,75 +0,0 @@
-<?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 - 123
tests/main/inc/lib/fileManage.lib.test.php

@@ -1,123 +0,0 @@
-<?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 = DocumentManager::updateDbInfo($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 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 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);
-	}
-}

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

@@ -1,129 +0,0 @@
-<?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 = DocumentManager::updateDbInfo($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 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 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);
-	}
-}

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

@@ -1,363 +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');
-    }
-
-    //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 testhandle_uploaded_document()
-    {
-        global $_course;
-        $uploaded_file = '';
-        $base_work_dir = '';
-        $upload_path = '';
-        $user_id = 1;
-        $to_group_id = 0;
-        $to_user_id = null;
-        $unzip = 0;
-        $what_if_file_exists = '';
-        $output = true;
-        $clean_name = disable_dangerous_file($clean_name);
-        $where_to_save = $base_work_dir.$upload_path;
-        $new_file_path = $upload_path.$clean_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,
-            $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);
-    }
-
-    //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 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_array($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::displayGlossaryList();
-		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 - 435
tests/main/inc/lib/groupmanager.lib.test.php

@@ -1,435 +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).'fileUpload.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'fileManage.lib.php');
-//require_once(api_get_path(LIBRARY_PATH).'tablesort.lib.php');moved to autoload
-
-
-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'=>'',
-            'category_id' => null
-        );
-
-		$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'],
-            $group['category_id']
-        );
-		$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 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 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 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 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 - 112
tests/main/inc/lib/image.lib.test.php

@@ -1,112 +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::csvToArray($filename);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-}
-?>

File diff ditekan karena terlalu besar
+ 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 - 82
tests/main/inc/lib/login.lib.test.php

@@ -1,82 +0,0 @@
-<?php
-require_once api_get_path(LIBRARY_PATH).'login.lib.php';
-require_once api_get_path(LIBRARY_PATH).'course.lib.php';
-
-class TestLogin 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() {
-		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('SignatureFormula').",\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 - 32
tests/main/inc/lib/mail.lib.inc.test.php

@@ -1,32 +0,0 @@
-<?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 - 707
tests/main/inc/lib/main_api.lib.test.php

@@ -1,707 +0,0 @@
-<?php
-
-use ChamiloSession as Session;
-
-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_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/',
-		SYS_PLUGIN_PATH => 'plugin/',
-		WEB_PLUGIN_PATH => 'plugin/',
-		SYS_ARCHIVE_PATH => 'archive/',
-		WEB_ARCHIVE_PATH => 'archive/',
-		SYS_INC_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 testApiSessionRegister(){
-//        $$variable[session_register]=false;
-//        global $$variable;
-//        if (!headers_sent()) {
-//            $res=Session::register($$variable, $$variable);
-//        }
-//        $this->assertTrue(is_null($res));
-//        $this->assertTrue(is_null($variable[session_register]));
-//    }
-
-	function testApiSessionClear() {
-		$variable = 'test';
-		 if (!headers_sent()) {
-			$res=Session::clear($variable);
-		 }
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
-	function testApiSessionDestroy(){
-		 if (!headers_sent()) {
-			$res=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 testApiSetAnonymous(){
-		$res = api_set_anonymous();
-		$this->assertTrue(is_bool($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 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 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_CSS_PATH);
-		$res=api_get_themes();
-		$this->assertTrue($res);
-		$this->assertTrue($cssdir);
-	}
-
-	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 testApiNumberOfPlugins(){
-		global $_plugins;
-		$location=2;
-		$_plugins[$location]=1;
-		$res=api_number_of_plugins($location);
-		$this->assertFalse($res);
-		$this->assertTrue($_plugins[$location]);
-	}
-
-	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);
-	}
-
-	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 testApiGetSettings(){
-		$res = api_get_settings($cat=null,$ordering='list',$access_url=1,$url_changeable=0);
-		$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 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 = api_replace_dangerous_char($filename);
-		$this->assertEqual($res,$filename, $message = 'no se pudo');
-	}
-
-	function testApiRequestUri(){
-		$res = api_request_uri();
-		$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(
-					'c_id'=>'1',
-					'user_id'=>'1');
-		$res=api_get_status_of_user_in_course($id['user_id'], $id['c_id']);
-		$this->assertTrue(is_null($res));
-		//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 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 - 515
tests/main/inc/lib/main_api.lib.test_standalone.php

@@ -1,515 +0,0 @@
-<?php //$id:$
-/**
- * A simple set of tests for the main API.
- * @author Ivan Tcholakov, 2009.
- * For licensing terms, see /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_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,
-            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/ chamilo is installed in a subfolder chamilo/ and the URL of your campus is http://www.mychamilo.com
- * 	The other configuration paramaters have not been changed.
- * 	The different api_get_paths will give
- *	WEB_SERVER_ROOT_PATH	http://www.mychamilo.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.mychamilo.com/chamilo/
- * 	SYS_PATH				/var/www/chamilo/
- * 	REL_PATH				chamilo/
- * 	WEB_COURSE_PATH			http://www.mychamilo.com/chamilo/courses/
- * 	SYS_COURSE_PATH			/var/www/chamilo/courses/
- *	REL_COURSE_PATH			/chamilo/courses/
- * 	REL_CODE_PATH			/chamilo/main/
- * 	WEB_CODE_PATH			http://www.mychamilo.com/chamilo/main/
- * 	SYS_CODE_PATH			/var/www/chamilo/main/
- * 	SYS_LANG_PATH			/var/www/chamilo/main/lang/
- * 	WEB_IMG_PATH			http://www.mychamilo.com/chamilo/main/img/
- * 	GARBAGE_PATH
- * 	WEB_PLUGIN_PATH			http://www.mychamilo.com/chamilo/plugin/
- * 	SYS_PLUGIN_PATH			/var/www/chamilo/plugin/
- * 	WEB_ARCHIVE_PATH		http://www.mychamilo.com/chamilo/archive/
- * 	SYS_ARCHIVE_PATH		/var/www/chamilo/archive/
- *	INCLUDE_PATH			/var/www/chamilo/main/inc/
- * 	WEB_LIBRARY_PATH		http://www.mychamilo.com/chamilo/main/inc/lib/
- * 	LIBRARY_PATH			/var/www/chamilo/main/inc/lib/
- * 	CONFIGURATION_PATH		/var/www/chamilo/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_PATH :
-            // example: http://www.mychamilo.com/ or http://www.mychamilo.com/chamilo/ 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/chamilo/
-            if (substr($_configuration['root_sys'],-1) == '/') {
-                return $_configuration['root_sys'];
-            } else {
-                return $_configuration['root_sys'].'/';
-            }
-            break;
-
-        case REL_PATH :
-            // example: chamilo/
-            if (substr($_configuration['url_append'], -1) === '/') {
-                return $_configuration['url_append'];
-            } else {
-                return $_configuration['url_append'].'/';
-            }
-            break;
-
-        case WEB_COURSE_PATH :
-            // example: http://www.mychamilo.com/courses/
-            return $root_web.$_configuration['course_folder'];
-            break;
-
-        case SYS_COURSE_PATH :
-            // example: /var/www/chamilo/courses/
-            return $_configuration['root_sys'].$_configuration['course_folder'];
-            break;
-
-        case REL_COURSE_PATH :
-            // example: courses/ or chamilo/courses/
-            return api_get_path(REL_PATH).$_configuration['course_folder'];
-            break;
-
-        case REL_CODE_PATH :
-            // example: main/ or chamilo/main/
-            return api_get_path(REL_PATH).$_configuration['code_append'];
-            break;
-
-        case WEB_CODE_PATH :
-            // example: http://www.mychamilo.com/main/
-            return $root_web.$_configuration['code_append'];
-            break;
-
-        case SYS_CODE_PATH :
-            // example: /var/www/chamilo/main/
-            return $_configuration['root_sys'].$_configuration['code_append'];
-            break;
-
-        case SYS_LANG_PATH :
-            // example: /var/www/chamilo/main/lang/
-            return api_get_path(SYS_CODE_PATH).'lang/';
-            break;
-
-        case WEB_IMG_PATH :
-            // example: http://www.mychamilo.com/main/img/
-            return api_get_path(WEB_CODE_PATH).'img/';
-            break;
-
-        case SYS_PLUGIN_PATH :
-            // example: /var/www/chamilo/plugin/
-            return api_get_path(SYS_PATH).'plugin/';
-            break;
-
-        case WEB_PLUGIN_PATH :
-            // example: http://www.mychamilo.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/chamilo/archive/
-            return api_get_path(SYS_PATH).'archive/';
-            break;
-
-        case WEB_ARCHIVE_PATH :
-            // example: http://www.mychamilo.com/archive/
-            return api_get_path(WEB_PATH).'archive/';
-            break;
-
-        case INCLUDE_PATH :
-            // Generated by main/inc/global.inc.php
-            // example: /var/www/chamilo/main/inc/
-            $incpath = realpath(dirname(__FILE__).'/../');
-            return str_replace('\\', '/', $incpath).'/';
-            break;
-
-        case LIBRARY_PATH :
-            // example: /var/www/chamilo/main/inc/lib/
-            return api_get_path(INCLUDE_PATH).'lib/';
-            break;
-
-        case WEB_LIBRARY_PATH :
-            // example: http://www.mychamilo.com/main/inc/lib/
-            return api_get_path(WEB_CODE_PATH).'inc/lib/';
-            break;
-
-        case CONFIGURATION_PATH :
-            // example: /var/www/chamilo/main/inc/conf/
-            return api_get_path(INCLUDE_PATH).'conf/';
-            break;
-
-        default :
-            return;
-            break;
-    }
-}
-
-?>

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

@@ -1,28 +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 testInboxDisplay() {
-		global $charset;
-		ob_start();
-		$res=MessageManager::inbox_display();
-		$this->assertTrue(is_null($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-
-	function testOutboxDisplay() {
-		global $charset;
-		ob_start();
-		$res=MessageManager::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 - 62
tests/main/inc/lib/online.inc.test.php

@@ -1,62 +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;		
-		$res=online_logout(null, true);
-		$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 - 96
tests/main/inc/lib/security.lib.test.php

@@ -1,96 +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_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 SessionHandler();
-		$res=$instancia->close();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testdestroy() {
-		$instancia = new SessionHandler();
-		$sess_id='';
-		$res=$instancia->destroy($sess_id);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testgarbage() {
-		$instancia = new SessionHandler();
-		$lifetime='';
-		$res=$instancia->garbage($lifetime);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testopen() {
-		$instancia = new SessionHandler();
-		$path='';
-		$name='';
-		$res=$instancia->open($path,$name);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testread() {
-		$instancia = new SessionHandler();
-		$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 SessionHandler();
-		$res=$instancia->sqlClose();
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-
-	function testsqlConnect() {
-		$instancia = new SessionHandler();
-		$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 SessionHandler();
-		$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 SessionHandler();
-		$sess_id='';
-		$sess_value='';
-		$res=$instancia->write($sess_id,$sess_value);
-		$this->assertTrue(is_bool($res));
-		//var_dump($res);
-	}
-}
-?>

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

@@ -1,140 +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='';
-		$start='';
-		$end='';
-		$coachStart='';
-		$coachEnd='';
-		$nolimit='';
-		$coach_username='';
-		$id_session_category='';
-		$id_visibility='';
-		$id_session=Database::insert_id();
-		ob_start();
-		$res=SessionManager::create_session(
-            $sname,
-            $start,
-            $end,
-            $coachStart,
-            $coachEnd,
-            $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($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='';
-		$start='';
-		$end='';
-        $coachStart='';
-        $coachEnd='';
-		$nolimit='';
-		$id_coach='';
-		$id_session_category='';
-		$id_visibility='';
-		$res=SessionManager::edit_session(
-            $id,
-            $name,
-            $start,
-            $end,
-            $coachStart,
-            $coachEnd,
-            $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 testsubscribe_users_to_session() {
-		$id_session='';
-		$user_list='';
-		$res=SessionManager::subscribe_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 - 141
tests/main/inc/lib/social.lib.test.php

@@ -1,141 +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).'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 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::sendInvitationToUser ($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/sortable_table.class.test.php

@@ -1,165 +0,0 @@
-<?php
-require_once api_get_path(LIBRARY_PATH).'sortable_table.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/sortable_table.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 - 55
tests/main/inc/lib/statsUtils.lib.inc.test.php

@@ -1,55 +0,0 @@
-<?php
-
-class TestStatsUtils extends UnitTestCase
-{
-    public function __construct()
-	{
-        $this->UnitTestCase('Stats utilities library - main/inc/lib/statsUtil.lib.inc.test.php');
-    }
-
-	function testgetManyResults1Col() {
-		$sql='';
-		ob_start();
-		$res=StatsUtils::getManyResults1Col($sql);
-		ob_end_clean();
-		$this->assertTrue(is_string($sql));
-		//var_dump($sql);
-	}
-
-	function testgetManyResults2Col() {
-		$sql='';
-		ob_start();
-		$res=StatsUtils::getManyResults2Col($sql);
-		ob_end_clean();
-		$this->assertTrue(is_string($sql));
-		//var_dump($sql);
-	}
-
-	function testgetManyResults3Col() {
-		$sql='';
-		ob_start();
-		$res=StatsUtils::getManyResults3Col($sql);
-		ob_end_clean();
-		$this->assertTrue(is_string($sql));
-		//var_dump($sql);
-	}
-
-	function testgetManyResultsXCol() {
-		$sql='';
-		$X='';
-		ob_start();
-		$res=StatsUtils::getManyResultsXCol($sql,$X);
-		ob_end_clean();
-		$this->assertTrue(is_string($sql));
-		//var_dump($sql);
-	}
-
-	function testgetOneResult() {
-		$sql='';
-		ob_start();
-		$res=StatsUtils::getOneResult($sql);
-		ob_end_clean();
-		$this->assertTrue(is_string($sql));
-		//var_dump($sql);
-	}
-}

+ 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 - 106
tests/main/inc/lib/system_announcements.lib.test.php

@@ -1,106 +0,0 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'system_announcements.lib.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 - 71
tests/main/inc/lib/text.lib.test.php

@@ -1,71 +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_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 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 testmake_clickable() {
-        $string='';
-        $res=make_clickable($string);
-        $this->assertTrue(is_string($res));
-        //var_dump($res);
-    }
-}

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

@@ -1,467 +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);
-
-		$res=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_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 testGetInactiveStudentsInCourse() {
-		global $_course;
-		$course_code = $_course;
-		$since='2010-10-02';
-		$session_id='';
-		$res=Tracking::getInactiveStudentsInCourse($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 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;
-		$courseCode = 'TEST';
-		$res = TrackingUserLog::display_exercise_tracking_info($view, $user_id, $courseCode);
-		$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;
-		$courseCode = 'TEST';
-		$res = TrackingUserLogCSV::display_exercise_tracking_info($view, $user_id, $courseCode);
-		$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 - 192
tests/main/inc/lib/urlmanager.lib.test.php

@@ -1,192 +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_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_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_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 testupdate() {
-		$url_id='';
-		$url='';
-		$description='';
-		$active='';
-		$res=UrlManager::update($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_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 - 308
tests/main/inc/lib/usermanager.lib.test.php

@@ -1,308 +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;
-    		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 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 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::getUserPicture(1, 'unknown.jpg');
-		$this->assertFalse(!(bool)$res);
-	}
-
-	function testGetUserIdFromUsername() {
-		$res=UserManager::get_user_id_from_username('arthur3');
-		$this->assertTrue(!(bool)$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);
-		$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 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::subscribe_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 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 - 55
tests/main/install/install_upgrade.lib.test.php

@@ -1,55 +0,0 @@
-<?php
-
-class TestInstallUpgrade extends UnitTestCase{
-
-	public function TestInstallUpgrade() {
-
-		$this->UnitTestCase('testing the function used by '.
-						    'the install and upgrade scripts');
-	}
-
-	public function testSetFileFolderPermissions() {
-		$res = set_file_folder_permissions();
-		$this->assertTrue(is_null($res));
-		$this->assertNull($res);
-		//var_dump($res);
-	}
-
-	/*public function testWriteCoursesHtaccessFile() {
-		$chamilo_path_folder = api_get_path(SYS_PATH);
-		$url_append=$chamilo_path_folder.'main/install/';
-		$res = write_courses_htaccess_file($url_append);
-		if(is_bool($res)){
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res === true || $res === false);
-		}else
-		$this->assertEqual($chamilo_path_folder.'main/install/',$res);
-		//var_dump($res);
-	}*/
-
-	public function testSplitSqlFile() {
-		$ret='';
-		$sql='';
-		$res = split_sql_file($ret, $sql);
-		$this->assertTrue($res);
-		$this->assertTrue(is_bool($res));
-		$this->assertTrue($res===true);
-	}
-
-	public function testMyDirectoryToArray() {
-		$chamilo_path_folder= api_get_path(SYS_PATH);
-		$directory= $chamilo_path_folder.'home';
-		$res = my_directory_to_array($directory);
-		$this->assertTrue(is_array($res));
-	}
-
-	/*
-	public function testDeleteCourse() {
-		global $cidReq;
-		$resu = CourseManager::delete_course($cidReq);
-		session_destroy();
-	}*/
-
-
-}
-?>

+ 0 - 213
tests/main/mySpace/myspace.lib.test.php

@@ -1,213 +0,0 @@
-<?php
-
-
-class TestMySpaceLib extends UnitTestCase {
-
-	public function TestMySpaceLib() {
-		$this->UnitTestCase('Test My Space');
-	}
-
-
-	public function __construct() {
-		// The constructor acts like a global setUp for the class
-		require_once api_get_path(SYS_TEST_PATH).'setup.inc.php';
-	}
-/*
-
-	public function testExportCsv() {
-		//ob_start();
-		$res = MySpace::export_csv($header = array(1, 2 ,3), $data = array(1, 2 ,3), $file_name = 'export.csv');
- 		$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-*/
-	public function testGetConnectionsToCourse() {
-		//ob_start();
-		$res = MySpace::get_connections_to_course($user_id = 1, $course_code = 'COURSETEST');
- 		$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testCourseInfoTrackingFilter() {
-		//ob_start();
-		$res = MySpace::course_info_tracking_filter($user_id = 1, $url_params = array(), $row = array());
- 		$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testDisplayTrackingUserOverview() {
-		ob_start();
-		$res = MySpace::display_tracking_user_overview();
- 		$this->assertTrue(is_null($res));
-		ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testDisplayUserOverviewExportOptions() {
-		//ob_start();
-		$res = MySpace::display_user_overview_export_options();
- 		$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testExercisesResults() {
-		//ob_start();
-		$res = MySpace::exercises_results($user_id = 1, $course_code = 'COURSETEST');
- 		$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testExportTrackingUserOverview() {
-		//ob_start();
-		$res = MySpace::export_tracking_user_overview();
- 		$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetCourseData() {
-		//ob_start();
-		$res = MySpace::get_course_data($from = 1, $number_of_items = 2, $column = 2, $direction = 1);
- 		$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	*/
-	public function testGetNumberOfUsersTrackingOverview() {
-		//ob_start();
-		$res = MySpace::get_number_of_users_tracking_overview();
- 		$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testGetUserDataTrackingOverview() {
-		//ob_start();
-		$res = MySpace::get_user_data_tracking_overview($from = 1, $number_of_items = 1, $column = 1, $direction = 1);
- 		$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-*/
-	public function testGetUserOverviewExportExtraFields() {
-		//ob_start();
-		$res = MySpace::get_user_overview_export_extra_fields($user_id = 1);
- 		$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testMakeUsername() {
-		//ob_start();
-		$res = MySpace::make_username($firstname = 'Vargas', $lastname = 'Carlos', $username = 'cvargas', $language = null, $encoding = null);
- 		$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testCheckUserInArray() {
-		//ob_start();
-		$res = MySpace::check_user_in_array($usernames = array(), $user_array = array());
- 		$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testUserAvailableInSession() {
-		//ob_start();
-		$res = MySpace::user_available_in_session($username = 1, $course_list = array(), $id_session = 1);
- 		$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testCheckAllUsernames() {
-		//ob_start();
-		$res = MySpace::check_all_usernames($users = array(), $course_list = array(), $id_session = 1);
- 		$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testGetUserCreator() {
-		//ob_start();
-		$res = MySpace::get_user_creator($users = array());
- 		$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testValidate_data() {
-		//ob_start();
-		$res = MySpace::validate_data($users = array(), $id_session = null);
- 		$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testCompleteMissingData() {
-		//ob_start();
-		$res = MySpace::complete_missing_data($user = 1);
- 		$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}*//*
-
-	public function testSaveData() {
-		//ob_start();
-		$res = MySpace::save_data($users = array(), $course_list = array(), $id_session = 1);
- 		$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testParseCsvData() {
-		//ob_start();
-		$res = MySpace::parse_csv_data($file = '');
- 		$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	*/
-	public function testElementStart() {
-		//ob_start();
-		$res = MySpace::element_start($parser = 'Contact', $data = '');
- 		$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testElementEnd() {
-		//ob_start();
-		$res = MySpace::element_end($parser = 'Contact', $data = '');
- 		$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testCharacterData() {
-		//ob_start();
-		$res = MySpace::character_data($parser = 'Contact', $data = '');
- 		$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testParseXmlData() {
-		//ob_start();
-		$res = MySpace::parse_xml_data($file = '');
- 		$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//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 - 1400
tests/main/newscorm/learnpath.class.test.php

@@ -1,1400 +0,0 @@
-<?php
-require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpath.class.php';
-
-class TestLearnpath extends UnitTestCase {
-
-    const course = 'COURSETEST';
-
-    public function testAddItem() {
-        //ob_start();
-        $parent = 2;
-        $previous = 1;
-        $type = 'dir';
-        $id = 1;
-        $title = 'Title';
-        $description = 'Description';
-        $prerequisites = 0;
-        $max_time_allowed = 0;
-
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->add_item($parent, $previous, $type, $id, $title, $description, $prerequisites, $max_time_allowed);
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testAddLp() {
-        //ob_start();
-        $name = '';
-        $description = '';
-        $learnpath = 'guess';
-        $origin = 'zip';
-        $zipname = '';
-        $res = learnpath::add_lp(self::course, $name, $description, $learnpath, $origin, $zipname);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    /*
-    public function testAutocompleteParents() {
-        //ob_start();
-        $item = 1;
-
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-        $res = $obj->autocomplete_parents($item);
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        var_dump($res);
-    }
-    */
-    public function testAutosave() {
-        //ob_start();
-        $res = learnpath::autosave();
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testBuildActionMenu() {
-        ob_start();
-        $res = learnpath::build_action_menu();
-        $this->assertTrue(is_null($res));
-        ob_end_clean();
-        //var_dump($res);
-    }
-
-
-    public function testClose() {
-        //ob_start();
-        $res = learnpath::close();
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testCreateDocument() {
-        //ob_start();
-        $_course = '';
-        $res = learnpath::create_document($_course);
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-/*
-    public function testCreateJs() {
-        //ob_start();
-        $res = learnpath::create_js();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-    public function testCreatePath() {
-        //ob_start();
-        $path = '';
-        $res = learnpath::create_path($path);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testCreateTreeArray() {
-        //ob_start();
-        $array = '';
-        $parent = 0;
-        $depth = -1;
-        $tmp = array ();
-        $res = learnpath::create_tree_array($array, $parent, $depth, $tmp);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testDisplayDocument() {
-        //ob_start();
-        $id = 1;
-        $show_title = false;
-        $iframe = true;
-        $edit_link = false;
-        $res = learnpath::display_document($id, $show_title, $iframe, $edit_link);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-/*
-    public function testDisplayDocumentForm() {
-        //ob_start();
-        $action = 'add';
-        $id = 0;
-        $extra_info = 'new';
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->display_document_form($action, $id, $extra_info);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-    public function testDisplayEditItem() {
-        //ob_start();
-        $item_id = '';
-        $res = learnpath::display_edit_item($item_id);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    /*
-    public function testDisplayForumForm() {
-        //ob_start();
-        $action = 'add';
-        $id = 0;
-        $extra_info = '';
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->display_forum_form($action, $id, $extra_info);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testDisplayHotpotatoesForm() {
-        //ob_start();
-        $action = 'add';
-        $id = 0;
-        $extra_info = '';
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->display_hotpotatoes_form($action, $id, $extra_info);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-    public function testDisplayItem() {
-        //ob_start();
-        $item_id = '';
-        $iframe = true;
-        $msg = '';
-        $res = learnpath::display_item($item_id, $iframe, $msg);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-/*	public function testDisplayItemForm() {
-        //ob_start();
-        $item_type = '';
-        $title = '';
-        $action = 'add';
-        $id = 0;
-        $extra_info = 'new';
-        $course='COURSETEST';
-        $lp_id = 1;
-        $user_id = 1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-        $res = $obj->display_item_form($item_type, $title, $action, $id, $extra_info);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testDisplayItemPrerequisitesForm() {
-        //ob_start();
-        $item_id = '';
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->display_item_prerequisites_form($item_id);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-    public function testDisplayItemSmallForm() {
-        //ob_start();
-        $item_type = '';
-        $title = '';
-        $data = '';
-        $res = learnpath::display_item_small_form($item_type, $title, $data);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-/*
-    public function testDisplayLinkForm() {
-        //ob_start();
-        $action = 'add';
-        $id = 0;
-        $extra_info = '';
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->display_link_form($action, $id, $extra_info);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testDisplayManipulate() {
-        //ob_start();
-        $item_id = '';
-        $item_type = TOOL_DOCUMENT;
-        $res = learnpath::display_manipulate($item_id, $item_type);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-    public function testDisplayMoveItem() {
-        //ob_start();
-        $item_id = '';
-        $res = learnpath::display_move_item($item_id);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-/*
-    public function testDisplayQuizForm() {
-        //ob_start();
-        $action = 'add';
-        $id = 0;
-        $extra_info = '';
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->display_quiz_form($action, $id, $extra_info);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-/*	public function testDisplayResources() {
-        //ob_start();
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->display_resources();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testDisplayStudentPublicationForm() {
-        //ob_start();
-        $action = 'add';
-        $id = 0;
-        $extra_info = '';
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->display_student_publication_form($action, $id, $extra_info);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testDisplayThreadForm() {
-        //ob_start();
-        $action = 'add';
-        $id = 0;
-        $extra_info = '';
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->display_thread_form($action, $id, $extra_info);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-    public function testEditDocument() {
-        //ob_start();
-        $_course='';
-        $res = learnpath::edit_document($_course);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testEditItem() {
-        //ob_start();
-        $id = '';
-        $parent = '';
-        $previous = '';
-        $title = '';
-        $description = '';
-        $prerequisites = 0;
-        $audio = NULL;
-        $max_time_allowed = 0;
-        $res = learnpath::edit_item($id, $parent, $previous, $title, $description, $prerequisites, $audio, $max_time_allowed);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testEditItemPrereq() {
-        //ob_start();
-        $id = '';
-        $prerequisite_id = '';
-        $mastery_score = 0;
-        $max_score = 100;
-        $res = learnpath::edit_item_prereq($id, $prerequisite_id, $mastery_score, $max_score);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testExportLp() {
-        //ob_start();
-        $type = 'scorm';
-        $id = 1;
-        $zipname = 'FILE';
-        $res = learnpath::export_lp($type, self::course, $id, $zipname);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testFirst() {
-        //ob_start();
-        $res = learnpath::first();
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetAuthor() {
-        //ob_start();
-        $res = learnpath::get_author();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetBrotherChapters() {
-        //ob_start();
-        $id = '';
-        $res = learnpath::getSiblingDirectories($id);
-        $this->assertTrue(is_array($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetBrotherItems() {
-        //ob_start();
-        $id = '';
-        $res = learnpath::get_brother_items($id);
-        $this->assertTrue(is_array($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-/*
-    public function testGetCommonIndexTermsByPrefix() {
-        //ob_start();
-        $prefix = '';
-        $res = learnpath::get_common_index_terms_by_prefix($prefix);
-        $this->assertTrue(is_array($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetCompleteItemsCount() {
-        //ob_start();
-        $res = learnpath::get_complete_items_count();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-    public function testGetCurrentItemId() {
-        //ob_start();
-        $res = learnpath::get_current_item_id();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetDocuments() {
-        //ob_start();
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->get_documents();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetExercises() {
-        //ob_start();
-        $res = learnpath::get_exercises();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetExtension() {
-        //ob_start();
-        $filename = 'file';
-        $res = learnpath::get_extension($filename);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetFirstItemId() {
-        //ob_start();
-        $res = learnpath::get_first_item_id();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetFlatOrderedItemsList() {
-        //ob_start();
-        $lp = 1;
-        $parent = 0;
-        $res = learnpath::get_flat_ordered_items_list($lp, $parent);
-        $this->assertTrue(is_array($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-        /*
-    public function testGetForums() {
-        //ob_start();
-
-        //require_once api_get_path(WEB_PATH).('forum/forumpublic function.inc.php');
-        //require_once api_get_path(WEB_PATH).('forum/forumconfig.inc.php');
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->get_forums();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetHtmlToc() {
-        //ob_start();
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->get_html_toc();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-    public function testGetId() {
-        //ob_start();
-        $res = learnpath::get_id();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetInteractionsCountFromDb() {
-        //ob_start();
-        $lp_iv_id = 0;
-        $res = learnpath::get_interactions_count_from_db($lp_iv_id);
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-/*
-    public function testGetItemsDetailsAsJs() {
-        //ob_start();
-        $varname='olms.lms_item_types';
-        $res = learnpath::get_items_details_as_js($varname);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetItemsStatusList() {
-        //ob_start();
-        $res = learnpath::get_items_status_list();
-        $this->assertTrue(is_array($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetIvInteractionsArray() {
-        //ob_start();
-        $lp_iv_id = '';
-        $res = learnpath::get_iv_interactions_array($lp_iv_id);
-        $this->assertTrue(is_array($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-    public function testGetIvObjectivesArray() {
-        //ob_start();
-        $lp_iv_id = 0;
-        $res = learnpath::get_iv_objectives_array($lp_iv_id);
-        $this->assertTrue(is_array($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    /*
-    public function testGetJsInfo() {
-        //ob_start();
-        $item_id = '';
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->get_js_info($item_id);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }	*/
-
-    public function testGetJsLib() {
-        //ob_start();
-        $res = learnpath::get_js_lib();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetLast() {
-        //ob_start();
-        $res = learnpath::get_last();
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetLink() {
-        //ob_start();
-        $type = 'http';
-        $item_id = null;
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->get_link($type, $item_id);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetLinks() {
-        //ob_start();
-        $res = learnpath::get_links();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetLpSessionId() {
-        //ob_start();
-        $res = learnpath::get_lp_session_id();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetMaker() {
-        //ob_start();
-        $res = learnpath::get_maker();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetMediaplayer() {
-        //ob_start();
-        $autostart='true';
-        $res = learnpath::get_mediaplayer($autostart);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetName() {
-        //ob_start();
-        $res = learnpath::get_name();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetNavigationBar() {
-        //ob_start();
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->get_navigation_bar();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetNextIndex() {
-        //ob_start();
-        $res = learnpath::get_next_index();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetNextItemId() {
-        //ob_start();
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->get_next_item_id();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetObjectivesCountFromDb() {
-        //ob_start();
-        $lp_iv_id = 0;
-        $res = learnpath::get_objectives_count_from_db($lp_iv_id);
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    /*
-    public function testGetPackageType() {
-        //ob_start();
-        $file_path = '';
-        $file_name = '';
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->get_package_type($file_path, $file_name);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }*/
-
-    public function testGetPreviewImage() {
-        //ob_start();
-        $res = learnpath::get_preview_image();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetPreviousIndex() {
-        //ob_start();
-        $res = learnpath::get_previous_index();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetPreviousItemId() {
-        //ob_start();
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->get_previous_item_id();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetProgress() {
-        //ob_start();
-        $res = learnpath::get_progress();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetProgressBar() {
-        //ob_start();
-        $mode = '';
-        $percentage = -1;
-        $text_add = '';
-        $from_lp = false;
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->get_progress_bar($mode, $percentage, $text_add, $from_lp);
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetProgressBarMode() {
-        //ob_start();
-        $res = learnpath::get_progress_bar_mode();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetProgressBarText() {
-        //ob_start();
-        $mode = '';
-        $add = 0;
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->get_progress_bar_text($mode, $add);
-        $this->assertTrue(is_array($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetProximity() {
-        //ob_start();
-        $res = learnpath::get_proximity();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetScormPrereqString() {
-        //ob_start();
-        $item_id = 1;
-        $res = learnpath::get_scorm_prereq_string($item_id);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetScormXmlNode() {
-        //ob_start();
-        $children = 'children';
-        $id = 1;
-        $res = learnpath::get_scorm_xml_node($children, $id);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetStudentPublications() {
-        //ob_start();
-        $res = learnpath::get_student_publications();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetTheme() {
-        //ob_start();
-        $res = learnpath::get_theme();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    /*
-    public function testGetToc() {
-        //ob_start();
-        $res = learnpath::get_toc();
-        $this->assertTrue(is_array($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-    public function testGetTotalItemsCount() {
-        //ob_start();
-        $res = learnpath::get_total_items_count();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-/*
-    public function testGetTotalItemsCountWithoutChapters() {
-        //ob_start();
-        $res = learnpath::getTotalItemsCountWithoutDirs();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    */
-    public function testGetType() {
-        //ob_start();
-        $get_name = false;
-        $res=learnpath::get_type($get_name) ;
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetTypeStatic() {
-        //ob_start();
-        $lp_id = 0;
-        $res = learnpath::get_type_static($lp_id);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetUpdateQueue() {
-        //ob_start();
-        $res = learnpath::get_update_queue();
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testGetUserId() {
-        //ob_start();
-        $res = learnpath::get_user_id();
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-/*
-    public function testGetView() {
-        //ob_start();
-        $attempt_num = 0;
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->get_view($attempt_num);
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    */
-    public function testGetViewId() {
-        //ob_start();
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->get_view_id();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    /*
-    public function testHasAudio() {
-        //ob_start();
-        $res = learnpath::has_audio();
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }*/
-
-    public function testLearnpath() {
-        //ob_start();
-        $course = '';
-        $lp_id = '';
-        $user_id = '';
-        $res = learnpath::__construct($course, $lp_id, $user_id);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testLog() {
-        //ob_start();
-        $msg = '';
-        $res = learnpath::log($msg);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testMoveDown() {
-        //ob_start();
-        $lp_id = 0;
-        $res = learnpath::move_down($lp_id);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testMoveItem() {
-        //ob_start();
-        $id = 1;
-        $direction = '';
-        $res = learnpath::move_item($id, $direction);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testMoveUp() {
-        //ob_start();
-        $lp_id = 0;
-        $res = learnpath::move_up($lp_id);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    /*
-    public function testNext() {
-        //ob_start();
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->next();
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }	*/
-
-    public function testOpen() {
-        //ob_start();
-        $id = '';
-        $res = learnpath::open($id);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-/*
-    public function testOverview() {
-        //ob_start();
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->overview();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    */
-    public function testPrerequisitesMatch() {
-        //ob_start();
-        $item = null;
-        $res = learnpath::prerequisites_match($item);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-/*
-    public function testPrevious() {
-        //ob_start();
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->previous();
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-    /*public function testRestart() {
-        //ob_start();
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->restart();
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }*/
-
-    public function testSaveCurrent() {
-        //ob_start();
-        $res = learnpath::save_current();
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testSaveItem() {
-        //ob_start();
-        $item_id = null;
-        $from_outside = true;
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->save_item($item_id, $from_outside);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testSaveLast() {
-        //ob_start();
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->save_last();
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    /*
-    public function testScormExport() {
-        //ob_start();
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->scorm_export();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-    public function testSetAuthor() {
-        //ob_start();
-        $name = '';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->set_author($name);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testSetCurrentItem() {
-        //ob_start();
-        $item_id = null;
-        $res = learnpath::set_current_item($item_id);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testSetEncoding() {
-        //ob_start();
-        $enc = 'ISO-8859-15';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->set_encoding($enc);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testSetErrorMsg() {
-        //ob_start();
-        $error = '';
-        $res = learnpath::set_error_msg($error);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testSetJslib() {
-        //ob_start();
-        $lib = '';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->set_jslib($lib);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testSetMaker() {
-        //ob_start();
-        $name = '';
-        $res = learnpath::set_maker($name);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testSetName() {
-        //ob_start();
-        $name = '';
-        $res = learnpath::set_name($name);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testSetPreviewImage() {
-        //ob_start();
-        $name = '';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->set_preview_image($name);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testSetPreviousItem() {
-        //ob_start();
-        $id = '';
-        $res = learnpath::set_previous_item($id);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testSetProximity() {
-        //ob_start();
-        $name = '';
-        $res = learnpath::set_proximity($name);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testSetTermsByPrefix() {
-        //ob_start();
-        $terms_string = '';
-        $prefix = '';
-        $res = learnpath::set_terms_by_prefix($terms_string, $prefix);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testSetTheme() {
-        //ob_start();
-        $name = '';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->set_theme($name);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    /*
-    public function testSortTreeArray() {
-        //ob_start();
-        $array = '';
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->sort_tree_array($array);
-        $this->assertTrue(is_array($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    */
-    public function testStartCurrentItem() {
-        //ob_start();
-        $allow_new_attempt = false;
-        $res = learnpath::start_current_item($allow_new_attempt);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testStopPreviousItem() {
-        //ob_start();
-        $res = learnpath::stop_previous_item();
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-/*
-    public function testTogglePublish() {
-        //ob_start();
-        $lp_id = '';
-        $set_visibility = 'v';
-        $res = learnpath::toggle_publish($lp_id, $set_visibility);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    */
-    public function testToggleVisibility() {
-        //ob_start();
-        $lp_id = '';
-        $set_visibility = 1;
-        $res = learnpath::toggle_visibility($lp_id, $set_visibility);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-/*
-    public function testTreeArray() {
-        //ob_start();
-        $array = '';
-        $res = learnpath::tree_array($array);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-*/
-    public function testUpdateDefaultScormCommit() {
-        //ob_start();
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->update_default_scorm_commit();
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testUpdateDefaultViewMode() {
-        //ob_start();
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->update_default_view_mode();
-        $this->assertTrue(is_string($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testUpdateDisplayOrder() {
-        //ob_start();
-        $res = learnpath::update_display_order();
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testUpdateReinit() {
-        //ob_start();
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->update_reinit();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testUpdateScormDebug() {
-        //ob_start();
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->update_scorm_debug();
-        $this->assertTrue(is_numeric($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testUploadImage() {
-        //ob_start();
-        $image_array = '';
-        $res = learnpath::upload_image($image_array);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-/*
-    public function testWriteResourcesTree() {
-        //ob_start();
-        $resources_sorted = '';
-        $num = 0;
-        $res = learnpath::write_resources_tree($resources_sorted, $num);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-    public function testDelete() {
-        //ob_start();
-        $course = null;
-        $id = null;
-        $delete = 'keep';
-        $course='COURSETEST';
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath($course, $lp_id, $user_id);
-
-        $res = $obj->delete($course, $id, $delete);
-        $this->assertTrue(is_null($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }*/
-
-    public function testDeleteChildrenItems() {
-        //ob_start();
-        $id = '';
-        $res = learnpath::delete_children_items($id);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testDeleteItem() {
-        //ob_start();
-        $id = '';
-        $remove = 'keep';
-        $res = learnpath::delete_item($id, $remove);
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-    public function testDeleteLpImage() {
-        //ob_start();
-        $lp_id=1;
-        $user_id=1;
-        $obj = new learnpath(self::course, $lp_id, $user_id);
-
-        $res = $obj->delete_lp_image();
-        $this->assertTrue(is_bool($res));
-        //ob_end_clean();
-        //var_dump($res);
-    }
-
-
-}
-?>

+ 0 - 593
tests/main/newscorm/learnpathItem.class.test.php

@@ -1,593 +0,0 @@
-<?php
-require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathItem.class.php';
-require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpath.class.php';
-
-
-class TestLearnpathItem extends UnitTestCase {
-	
-	
-	public function TestScorm() {
-		$this->UnitTestCase('Test Scorm');
-	}
-	
-
-	public function __construct() {
-		// The constructor acts like a global setUp for the class			
-		require_once api_get_path(SYS_TEST_PATH).'setup.inc.php';
-	}
-	
-	
-	public function testAddLp() {
-		//ob_start();
-		$course = 'COURSETEST';
-		$name = 'Leccion';
-		$description = 'Leccion';
-		$learnpath = 'guess';
-		$origin = 'zip';
-		$zipname = '';
-		$res = learnpath::add_lp($course, $name, $description, $learnpath, $origin, $zipname);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	
-	public function testAddChild() {
-		//ob_start();
-		$res = learnpathItem::add_child($item = 1);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testAddInteraction() {
-		//ob_start();
-		$res = learnpathItem::add_interaction($index = 1,$params = array());
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-
-	public function testAddObjective() {
-		//ob_start();
-		$res = learnpathItem::add_objective($index = 1,$params = array());
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testClose() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->close();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testDelete() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->delete();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	*/
-	public function testDropChild() {
-		//ob_start();
-		$res = learnpathItem::drop_child($item = 1);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetAttemptId() {
-		//ob_start();
-		$res = learnpathItem::get_attempt_id();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetChildren() {
-		//ob_start();
-		$res = learnpathItem::get_children();
-	 	$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetCoreExit() {
-		//ob_start();
-		$res = learnpathItem::get_core_exit();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetCurrentStartTime() {
-		//ob_start();
-		$res = learnpathItem::get_current_start_time();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetDescription() {
-		//ob_start();
-		$res = learnpathItem::get_description();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetFilePath() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->get_file_path($path_to_scorm_dir='');
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetId() {
-		//ob_start();
-		$res = learnpathItem::get_id();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testLoadInteractions() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->load_interactions();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	*/
-	public function testGetInteractionsCount() {
-		//ob_start();
-		$res = learnpathItem::get_interactions_count($checkdb=false);
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetInteractionsJsArray() {
-		//ob_start();
-		$res = learnpathItem::get_interactions_js_array($checkdb=false);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetObjectivesCount() {
-		//ob_start();
-		$res = learnpathItem::get_objectives_count();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetLaunchData() {
-		//ob_start();
-		$res = learnpathItem::get_launch_data();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetLessonLocation() {
-		//ob_start();
-		$res = learnpathItem::get_lesson_location();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetLessonMode() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->get_lesson_mode();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetLevel() {
-		//ob_start();
-		$res = learnpathItem::get_level();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetMasteryScore() {
-		//ob_start();
-		$res = learnpathItem::get_mastery_score();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetMax() {
-		//ob_start();
-		$res = learnpathItem::get_max();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetMaxTimeAllowed() {
-		//ob_start();
-		$res = learnpathItem::get_max_time_allowed();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetMin() {
-		//ob_start();
-		$res = learnpathItem::get_min();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetParent() {
-		//ob_start();
-		$res = learnpathItem::get_parent();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetPath() {
-		//ob_start();
-		$res = learnpathItem::get_path();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetPrereqString() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->get_prereq_string;
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	///var_dump($res);
-	}
-	
-	public function testGetPreventReinit() {
-		//ob_start();
-		$res = learnpathItem::get_prevent_reinit();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetRef() {
-		//ob_start();
-		$res = learnpathItem::get_ref();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetResourcesFromSource() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->get_resources_from_source($type=null,$abs_path=null, $recursivity=1);
-	 	$this->assertTrue(is_array($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetScore() {
-		//ob_start();
-		$res = learnpathItem::get_score();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetStatus() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->get_status($check_db=true,$update_local=false);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetSuspendData() {
-		//ob_start();
-		$res = learnpathItem::get_suspend_data();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetScormTime() {
-		//ob_start();
-		$res = learnpathItem::get_scorm_time($origin='php',$given_time=null);
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetTerms() {
-		//ob_start();
-		$res = learnpathItem::get_terms();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetTitle() {
-		//ob_start();
-		$res = learnpathItem::get_title();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetTotalTime() {
-		//ob_start();
-		$res = learnpathItem::get_total_time();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetType() {
-		//ob_start();
-		$res = learnpathItem::get_type();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetViewCount() {
-		//ob_start();
-		$res = learnpathItem::get_view_count();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testIsDone() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->is_done();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testIsRestartAllowed() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->is_restart_allowed();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testOpen() {
-		//ob_start();
-		$res = learnpathItem::open($allow_new_attempt=false);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testOutput() {
-		//ob_start();
-		$res = learnpathItem::output();
-	 	$this->assertTrue(is_string($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testParsePrereq() {
-		//ob_start();
-		$res = learnpathItem::parse_prereq($prereqs_string = '', $items = array(), $refs_list = array(),$user_id = 1);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testRestart() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->restart();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSave() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->save($from_outside=true,$prereqs_complete=false);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	*/
-	public function testSetAttemptId() {
-		//ob_start();
-		$res = learnpathItem::set_attempt_id($num = 1);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSetCoreExit() {
-		//ob_start();
-		$res = learnpathItem::set_core_exit($value = 1);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSetDescription() {
-		//ob_start();
-		$res = learnpathItem::set_description($string = '');
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSetLessonLocation() {
-		//ob_start();
-		$res = learnpathItem::set_lesson_location($location = '');
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSetLevel() {
-		//ob_start();
-		$res = learnpathItem::set_level($int=0);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSetLpView() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->set_lp_view($lp_view_id = 1);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSetPath() {
-		//ob_start();
-		$res = learnpathItem::set_path($string='');
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSetPreventReinit() {
-		//ob_start();
-		$res = learnpathItem::set_prevent_reinit($prevent = 1);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSetScore() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1);
-		$res = $obj->set_score($score = 1.56);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSetMaxScore() {
-		//ob_start();
-		$res = learnpathItem::set_max_score($score = 1.56);
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testSetStatus() {
-		//ob_start();
-		$res = learnpathItem::set_status($status = '');
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	*/
-	public function testSetTerms() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->set_terms($terms = '');
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testGetSearchDid() {
-		//ob_start();
-		$res = learnpathItem::get_search_did();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSetTime() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->set_time($scorm_time = '',$format='scorm');
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSetTitle() {
-		//ob_start();
-		$res = learnpathItem::set_title($string='');
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSetType() {
-		//ob_start();
-		$res = learnpathItem::set_type($string='');
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testStatusIs() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->status_is($list=array());
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testUpdateTime() {
-		//ob_start();
-		$res = learnpathItem::update_time($total_sec=0);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testWriteObjectivesToDb() {
-		//ob_start();
-		$res = learnpathItem::write_objectives_to_db();
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	/*
-	public function testWriteToDb() {
-		//ob_start();
-		$obj = new learnpathItem($db_id = 1, $user_id = 1); 
-		$res = $obj->write_to_db();
-	 	$this->assertTrue(is_bool($res));
-		//ob_end_clean();
-	 	//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 - 8
tests/main/newscorm/openoffice_document.class.test.php

@@ -1,8 +0,0 @@
-<?php
-/*
- * Created on 18/02/2010
- *
- * To change the template for this generated file go to
- * Window - Preferences - PHPeclipse - PHP - Code Templates
- */
-?>

+ 0 - 38
tests/main/newscorm/openoffice_presentation.class.test.php

@@ -1,38 +0,0 @@
-<?php
-//require_once(api_get_path(SYS_CODE_PATH).'lp/openoffice_presentation.class.php');
-
-class TestOpenofficePresentation extends UnitTestCase {
-	/*
-	public function testAddItem() {
-		//ob_start();
-		$res = OpenofficePresentation::make_lp($files=array());
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testAddCommandParameters() {
-		//ob_start();
-		$res = OpenofficePresentation::add_command_parameters();
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}
-	
-	public function testSetSlideSize() {
-		//ob_start();
-		$res = OpenofficePresentation::set_slide_size($width = '400',$height = '500');
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}	
-	
-	public function testAddDocsToVisio() {
-		//ob_start();
-		$res = OpenofficePresentation::add_docs_to_visio($files=array());
-	 	$this->assertTrue(is_numeric($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}*/
-}
-?>

+ 0 - 50
tests/main/newscorm/openoffice_text.class.test.php

@@ -1,50 +0,0 @@
-<?php
-require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpath.class.php';
-require_once api_get_path(SYS_CODE_PATH) . 'lp/openoffice_text.class.php';
-require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php';
-
-class TestOpenOfficeTextClass extends UnitTestCase {
-
-	public function testOpenOfficeText() {
-		//ob_start();
-		$res = OpenofficeText::make_lp($files=array());
-		$this->assertTrue(is_bool($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}	
-/*
-	public function testDealPerChapter() {
-		//ob_start();
-		$obj = new OpenofficeText($split_steps=false, $course_code=null, $resource_id=null,$user_id=null); 
-		$res = $obj->dealPerChapter($header = 'Header', $content = 'Content');
-		$this->assertTrue(is_null($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-
-	public function testDalPerPage() {
-		//ob_start();
-		$obj = new OpenofficeText($split_steps=false, $course_code=null, $resource_id=null,$user_id=null); 
-		$res = $obj->dealPerPage($header = 'Header', $body= 'Body');
-		$this->assertTrue(is_null($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-*/
-	public function testAddCommandParameters() {
-		//ob_start();
-		$res = OpenofficeText::add_command_parameters();
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-
-	public function testFormatPageContent() {
-		//ob_start();
-		$res = OpenofficeText::format_page_content($header = 'Header', $content = 'Content');
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}	
-}
-?> 

+ 0 - 47
tests/main/newscorm/openoffice_text_document.class.test.php

@@ -1,47 +0,0 @@
-<?php
-//require_once(api_get_path(SYS_CODE_PATH).'lp/openoffice_text_document.class.php');
-
-class TestOpenOfficeTextDocument extends UnitTestCase {
-/*
-	public function testMakeLp() {
-		//ob_start();
-		$obj = new OpenofficeTextDocument($split_steps=false, $course_code=null, $resource_id=null,$user_id=null); 		
-		$res = $obj->make_lp($files=array());
-		$this->assertTrue(is_bool($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-
-	public function testDealPerChapter() {
-		//ob_start();
-		$res = OpenOfficeTextDocument::dealPerChapter($header = 'Header', $content = 'Content');
-		$this->assertTrue(is_null($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-
-	public function testDealPerPage() {
-		//ob_start();
-		$res = OpenOfficeTextDocument::dealPerPage($header = 'Header',$body = 'Content');
-		$this->assertTrue(is_null($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-
-	public function testAddCommandParameters() {
-		//ob_start();
-		$res = OpenOfficeTextDocument::add_command_parameters();
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-
-	public function testFormatPageContent() {
-		//ob_start();
-		$res = OpenOfficeTextDocument::format_page_content($header = 'Header', $content = 'Content');
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}	*/
-}
-?>

+ 0 - 184
tests/main/newscorm/scorm.class.test.php

@@ -1,184 +0,0 @@
-<?php
-require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpath.class.php';
-require_once api_get_path(SYS_CODE_PATH) . 'lp/scorm.class.php';
-
-class TestScormClass extends UnitTestCase {
-/*
-	public function testScorm() {
-		//ob_start();
-		$course_code = 'COURSETEST';
-		$resource_id = 1;
-		$user_id = 1;
-		$obj = new scorm($course_code, $resource_id, $user_id); 
-		$res = $obj->scorm($course_code=null,$resource_id=null,$user_id=null);
-	 	$this->assertTrue(is_null($res));
-		//ob_end_clean();
-	 	//var_dump($res);
-	}*/
-
-	public function testOpen() {
-		//ob_start();
-		$id = 1;
-		$res = scorm::open($id);
-		$this->assertTrue(is_null($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}		
-	
-	public function testParseManifest() {
-		//ob_start();
-		$course_code = 'COURSETEST';
-		$resource_id = 1;
-		$user_id = 1;
-		$obj = new scorm($course_code, $resource_id, $user_id); 
-		$res = $obj->parse_manifest($file='');
-		$this->assertTrue(is_null($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}	
-	
-	public function testImportManifest() {
-		//ob_start();
-		$course_code = 'COURSETEST';
-		$resource_id = 1;
-		$user_id = 1;
-		$obj = new scorm($course_code, $resource_id, $user_id); 
-		$res = $obj->import_manifest($course_code = 'COURSETEST');
-		$this->assertTrue(is_null($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	/*
-	public function testImportLocalPackage() {
-		//ob_start();
-		$course_code = 'COURSETEST';
-		$resource_id = 1;
-		$user_id = 1;
-		$obj = new scorm($course_code, $resource_id, $user_id); 
-		$res = $obj->import_local_package($file_path,$current_dir='');
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	
-	public function testImportPackage() {
-		//ob_start();
-		$course_code = 'COURSETEST';
-		$resource_id = 1;
-		$user_id = 1;
-		$obj = new scorm($course_code, $resource_id, $user_id); 
-		$res = $obj->import_package($zip_file_info,$current_dir = '');
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}*/
-	
-	public function testSetProximity() {
-		//ob_start();
-		$course_code = 'COURSETEST';
-		$resource_id = 1;
-		$user_id = 1;
-		$obj = new scorm($course_code, $resource_id, $user_id); 
-		$res = $obj->set_proximity($proxy='');
-		$this->assertTrue(is_bool($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	
-	public function testSetTheme() {
-		//ob_start();
-		$course_code = 'COURSETEST';
-		$resource_id = 1;
-		$user_id = 1;
-		$obj = new scorm($course_code, $resource_id, $user_id); 
-		$res = $obj->set_theme($theme='Chamilo');
-		$this->assertTrue(is_bool($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	
-	public function testSetPreviewImage() {
-		//ob_start();
-		$course_code = 'COURSETEST';
-		$resource_id = 1;
-		$user_id = 1;
-		$obj = new scorm($course_code, $resource_id, $user_id); 
-		$res = $obj->set_preview_image($preview_image='');
-		$this->assertTrue(is_bool($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	
-	public function testSetAuthor() {
-		//ob_start();
-		$course_code = 'COURSETEST';
-		$resource_id = 1;
-		$user_id = 1;
-		$obj = new scorm($course_code, $resource_id, $user_id); 
-		$res = $obj->set_author($author='');
-		$this->assertTrue(is_bool($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	
-	public function testSetMaker() {
-		//ob_start();
-		$course_code = 'COURSETEST';
-		$resource_id = 1;
-		$user_id = 1;
-		$obj = new scorm($course_code, $resource_id, $user_id); 
-		$res = $obj->set_maker($maker='');
-		$this->assertTrue(is_bool($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	
-	public function testExportZip() {
-		//ob_start();
-		$course_code = 'COURSETEST';
-		$resource_id = 1;
-		$user_id = 1;
-		$obj = new scorm($course_code, $resource_id, $user_id); 
-		$res = $obj->export_zip($lp_id=null);
-		$this->assertTrue(is_bool($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	
-	public function testGetResPath() {
-		//ob_start();
-		$res = scorm::get_res_path($id=1);
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	
-	public function testGetResType() {
-		//ob_start();
-		$res = scorm::get_res_type($id = 1);
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	
-	public function testGetTitle() {
-		//ob_start();
-		$res = scorm::get_title();
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	
-	public function testReimportManifest() {
-		ob_start();
-		$course_code = 'COURSETEST';
-		$resource_id = 1;
-		$user_id = 1;
-		$obj = new scorm($course_code, $resource_id, $user_id); 
-		$res = $obj->reimport_manifest($course  = 'COURSETEST',$lp_id=null,$imsmanifest_path='');
-		$this->assertTrue(is_bool($res)); 
-		ob_end_clean();
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 26
tests/main/newscorm/scormItem.class.test.php

@@ -1,26 +0,0 @@
-<?php
-
-require_once api_get_path(SYS_CODE_PATH) . 'lp/scormItem.class.php';
-require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathItem.class.php';
-
-class TestScormItem extends UnitTestCase {
-
-	public function testGetFlatList() {
-		//ob_start();
-		$obj = new scormItem($type='manifest',&$element); 
-		$res = $obj->get_flat_list(&$list,&$abs_order,$rel_order=1,$level=0);
-		$this->assertTrue(is_null($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-/*
-	public function testSave() {
-		//ob_start();
-		$obj = new scormItem($type='manifest',&$element); 
-		$res = $obj->save($from_outside=true,$prereqs_complete=false);
-		$this->assertTrue(is_null($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}*/
-}
-?>

+ 0 - 39
tests/main/newscorm/scormOrganization.class.test.php

@@ -1,39 +0,0 @@
-<?php
-require_once api_get_path(SYS_CODE_PATH) . 'lp/scormOrganization.class.php';
-
-class TestScormOrganization extends UnitTestCase {
-
-	public function testget_flat_items_list() {
-		//ob_start();
-		$obj = new scormOrganization($type='manifest', $element, $scorm_charset='UTF-8'); 
-		$res = $obj->get_flat_items_list();
-		$this->assertTrue(is_array($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	
-	public function testGetScormType() {
-		//ob_start();
-		$res = scormOrganization::get_name();
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-
-	public function testGetRef() {
-		//ob_start();
-		$res = scormOrganization::get_ref();
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-
-	public function testSetName() {
-		//ob_start();
-		$res = scormOrganization::set_name($title = 'Titulo');
-		$this->assertTrue(is_null($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 30
tests/main/newscorm/scormResource.class.test.php

@@ -1,30 +0,0 @@
-<?php
-require_once api_get_path(SYS_CODE_PATH) . 'lp/scormResource.class.php';
-
-class TestScormResource extends UnitTestCase {
-	/*
-	function testScormResource() {
-		//ob_start();
-		$res = scormResource::scormResource($type='manifest',&$element);
-		$this->assertTrue(is_bool($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}	
-	*/
-	public function testGetPath() {
-		//ob_start();
-		$res = scormResource::get_path();
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	
-	public function testGetScormType() {
-		//ob_start();
-		$res = scormResource::get_scorm_type();
-		$this->assertTrue(is_string($res)); 
-		//ob_end_clean();
-		//var_dump($res);
-	}
-}
-?>

+ 0 - 235
tests/main/permissions/permissions_functions.inc.test.php

@@ -1,235 +0,0 @@
-<?php
-require_once api_get_path(SYS_CODE_PATH).'permissions/permissions_functions.inc.php';
-//require_once dirname(__FILE__).'/../main/permissions/permissions_functions.inc.php';
-
-class TestPermissions extends UnitTestCase {
-
-    public function __construct() {
-        $this->UnitTestCase('Permissions library - main/permissions/permissions_functions.inc.test.php');
-    }
-    /**
-	* This function is called when we assign a role to a user or a group
-	* @param string
-	* @param string
-	* @param int
-	* @param int
-	* @return string
-	*/
-	function testAssignRole(){
-		$content='';
-		$action='';
-		$id=1;
-		$role_id=1;
-		$scope='course';
-		$res = assign_role($content, $action, $id, $role_id, $scope);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-
-	/**
-	This function displays a checked or unchecked checkbox. The checkbox will be checked if the
-	* user, group or role has the permission for the given tool, unchecked if the user, group or role
-	* does not have the right
-	* @param array
-	* @param string
-	* @param string
-	* @param array
-	* @return null
-	*/
-	function testDisplayCheckboxMatrix(){
-		ob_start();
-		$permission_array=array();
-		$tool='';
-		$permission=1;
-		$inherited_permissions=array();
-		$res = display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions);
-		$this->assertTrue(is_null($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-	/**
-	* This function displays a checked or unchecked image. The image will be checked if the
-	* user, group or role has the permission for the given tool, unchecked if the user, group or role
-	* does not have the right
-	* @param $permission_array the array that contains all the permissions of the user, group, role
-	* @param $tool the tool we want to check a permission for
-	* @param $permission the permission we want to check for
-	*/
-	function testDisplayImageMatrix(){
-		//ob_start();
-		$permission_array=array();
-		$tool=1;
-		$permission=1;
-		$inherited_permissions=array($tool => array());
-		$course_admin=false;
-		$editable=true;
-		$res = display_image_matrix($permission_array, $tool, $permission,$inherited_permissions, $course_admin, $editable);
-		$this->assertTrue(is_null($res));
-		//ob_end_clean();
-		//var_dump($res);
-	}
-	/**
-	* Slightly modified:  Toon Keppens
-	* This function displays a checked or unchecked image. The image will be checked if the
-	* user, group or role has the permission for the given tool, unchecked if the user, group or role
-	* does not have the right
-	* @param int
-	* @param string
-	* @param string
-	* @param array
-	* @param bool
-	*/
-	function testDisplayImageMatrixForBlogs(){
-		$permission_array=array();
-		$user_id=1;
-		$tool=1;
-		$permission=1;
-		$inherited_permissions=array();
-		$course_admin=false;
-		$editable=true;
-		$res = display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission,$inherited_permissions, $course_admin, $editable);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	/**
-	* This function displays a list off all the roles of the course (and those defined by the platform admin)
-	* @param
-	* @param
-	*/
-	function testDisplayRoleList(){
-		$current_course_roles='';
-		$current_platform_roles='';
-		$res = display_role_list($current_course_roles, $current_platform_roles);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-	/**
-	* This function gets all the current roles of the user or group
-	* @param string
-	* @return array that contains the name of the roles the user has
-	*/
-	function testGetAllRoles(){
-		$content='course';
-		$res = get_all_roles($content);
-		if (!is_null($res)){
-			$this->assertTrue(is_array($res));
-		}
-		//var_dump($res);
-	}
-	/**
-	* This function retrieves the existing permissions of a user, group or role.
-	* @param $content are we retrieving the rights of a user, a group or a role (the database depends on it)
-	* @param $id the id of the user, group or role
-	*/
-	function testGetPermissions(){
-		$content='user';
-		$id=1;
-		$res = get_permissions($content, $id);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-	/**
-	* This function gets all the current roles of the user or group
-	* @param $content are we finding the roles for a user or a group (the database depends on it)
-	* @param $id the id of the user or group
-	* @return array that contains the name of the roles the user has
-	*/
-	function testGetRoles(){
-		$content='user';
-		$id=1;
-		$scope='course';
-		$res = get_roles($content, $id, $scope);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-	/**
-	* This function gets all the roles that are defined
-	* @param $content are we finding the roles for a user or a group (the database depends on it)
-	* @param $id the id of the user or group
-	* @param string	Deprecated parameter allowing use of 'platform' scope - the corresponding tables don't exist anymore so the scope is always set to 'course'
-	* @return array that contains the name of the roles the user has
-	*/
-	function testGetRolesPermissions(){
-		$content='user';
-		$id=1;
-		$scope='course';
-		$res = get_roles_permissions($content, $id, $scope);
-		if (!is_null($res)){
-			$this->assertTrue(is_array($res));
-		}
-		//var_dump($res);
-	}
-	/**
-	* the array that contains the current permission a user, group or role has will now be changed depending on
-	* the Dokeos Config Setting for the permissions (limited [add, edit, delete] or full [view, add, edit, delete, move, visibility]
-	* @param $content are we retrieving the rights of a user, a group or a role (the database depends on it)
-	* @param $id the id of the user, group or role
-	* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
-	* @version 1.0
-	* @todo currently there is a setting user_permissions and group_permissions. We should merge this in one config setting.
-	*/
-	function testLimitedOrFull(){
-		$current_permissions=array();
-		$res = limited_or_full($current_permissions);
-		if (!is_null($res)){
-			$this->assertTrue(is_array($res));
-		}
-		//var_dump($res);
-	}
-
-	function testMyPrintR(){
-		ob_start();
-		$array='';
-		$res = my_print_r($array);
-		$this->assertTrue(is_null($res));
-		ob_end_clean();
-		//var_dump($res);
-	}
-
-	/**
-	* This function merges permission arrays. Each permission array has the following structure
-	* a permission array has a tool contanst as a key and an array as a value. This value array consists of all the permissions that are granted in that tool.
-	*/
-	function testPermissionArrayMerge(){
-		$array1=array();
-		$array2=array();
-		$res = permission_array_merge($array1, $array2);
-		$this->assertTrue(is_array($res));
-		//var_dump($res);
-	}
-	/**
-	* This function stores one permission in the correct table.
-	* @param $content are we storing rights for a user, a group or a role (the database depends on it)
-	* @param $action are we granting or revoking a permission?
-	* @param $id the id of the user, group or role
-	* @param $tool the tool
-	* @param $permission the permission the user, group or role has been granted or revoked
-	*/
-	function testStoreOnePermission(){
-		$res = store_one_permission('user', 'grant', 2, 'link','');
-		if(!$res === NULL){
-		$this->assertTrue(is_string($res));
-		} else {
-			$this->assertNull($res);
-		}
-		//var_dump($res);
-	}
-	/**
-	* This function stores the permissions in the correct table.
-	* Since Checkboxes are used we do not know which ones are unchecked.
-	* That's why we first delete them all (for the given user/group/role
-	* and afterwards we store the checked ones only.
-	* @param $content are we storing rights for a user, a group or a role (the database depends on it)
-	* @param $id the id of the user, group or role
-	* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
-	* @version 1.0
-	*/
-	function testStorePermissions(){
-		$content='user';
-		$id=1;
-		$res = store_permissions($content, $id);
-		$this->assertTrue(is_string($res));
-		//var_dump($res);
-	}
-}
-?>

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini