diff --git a/tests/README.txt b/tests/README.txt deleted file mode 100755 index 6393ae107c..0000000000 --- a/tests/README.txt +++ /dev/null @@ -1,6 +0,0 @@ -/* For licensing terms, see /license.txt */ - -/* README */ - -This directory is used for automated testing through the use of the SimpleTest framework.. -Run test_suite.php diff --git a/tests/api/README.txt b/tests/api/README.txt deleted file mode 100755 index 694178c7fa..0000000000 --- a/tests/api/README.txt +++ /dev/null @@ -1 +0,0 @@ -This directory will contain the auto-generated PHPDoc files diff --git a/tests/behat.yml b/tests/behat.yml deleted file mode 100644 index 7da87a1d88..0000000000 --- a/tests/behat.yml +++ /dev/null @@ -1,9 +0,0 @@ -default: - extensions: - Behat\MinkExtension\Extension: - base_url: http://my.chamilo110.net - goutte: ~ - selenium2: ~ - paths: - features: features - bootstrap: %behat.paths.features%/bootstrap diff --git a/tests/build.phing.xml b/tests/build.phing.xml deleted file mode 100755 index fe16c98d2f..0000000000 --- a/tests/build.phing.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/build.xml b/tests/build.xml deleted file mode 100755 index d71096cef4..0000000000 --- a/tests/build.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/chamilotest.php b/tests/chamilotest.php deleted file mode 100755 index 7334954dec..0000000000 --- a/tests/chamilotest.php +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/tests/course_tests/index.html b/tests/course_tests/index.html deleted file mode 100755 index 8e464d8ce3..0000000000 --- a/tests/course_tests/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - -
- - \ No newline at end of file diff --git a/tests/datafiller/data_courses.php b/tests/datafiller/data_courses.php deleted file mode 100755 index 681f8ddf9d..0000000000 --- a/tests/datafiller/data_courses.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - */ - -$courses = array(); -$courses[] = array( - 'code' => 'ENGLISH101', - 'title' => 'English for beginners', - 'description' => 'English course', - 'category_code' => 'PROJ', - 'course_language' => 'english', - 'user_id' => 1, - 'expiration_date' => '2020-09-01 00:00:00', - 'exemplary_content' => true, -); -$courses[] = array( - 'code' => 'SPANISH101', - 'title' => 'Español para iniciantes', - 'description' => 'Curso de español', - 'category_code' => 'PROJ', - 'course_language' => 'spanish', - 'user_id' => 1, - 'expiration_date' => '2020-09-01 00:00:00', - 'exemplary_content' => true, -); -$courses[] = array( - 'code' => 'FRENCH101', - 'title' => 'Français pour débutants', - 'description' => 'Cours de français', - 'category_code' => 'PROJ', - 'course_language' => 'french', - 'user_id' => 1, - 'expiration_date' => '2020-09-01 00:00:00', - 'exemplary_content' => true, -); - diff --git a/tests/datafiller/data_users.php b/tests/datafiller/data_users.php deleted file mode 100755 index 7f326e37ac..0000000000 --- a/tests/datafiller/data_users.php +++ /dev/null @@ -1,226 +0,0 @@ - - * - */ -/** - * Initialisation section - */ -$users = array(); -$users[] = array( - 'username' => 'ywarnier', - 'pass' => 'ywarnier', - 'firstname' => 'Yannick', - 'lastname' => 'Warnier', - 'status' => 1, - 'auth_source' => 'platform', - 'email' => 'yannick.warnier@example.com', - 'creator_id' => 1, - 'active' => 1, -); -$users[] = array( - 'username' => 'mmosquera', - 'pass' => 'mmosquera', - 'firstname' => 'Michela', - 'lastname' => 'Mosquera Guardamino', - 'status' => 1, - 'auth_source' => 'platform', - 'email' => 'michela.mosquera@example.com', - 'creator_id' => 1, - 'active' => 1, -); -$users[] = array( - 'username' => 'mlanoix', - 'pass' => 'mlanoix', - 'firstname' => 'Michel', - 'lastname' => 'Lanoix', - 'status' => 5, - 'auth_source' => 'platform', - 'email' => 'michel.lanoix@example.com', - 'creator_id' => 1, - 'active' => 1 -); - -$users[] = array( - 'username' => 'jmontoya', - 'pass' => 'jmontoya', - 'firstname' => 'Julio', - 'lastname' => 'Montoya', - 'status' => 1, - 'auth_source' => 'platform', - 'email' => 'julio.montoya@example.com', - 'creator_id' => 1, - 'active' => 1 -); - -$users[] = array( - 'username' => 'agarcia', - 'pass' => 'agarcia', - 'firstname' => 'Alan', - 'lastname' => 'Garcia', - 'status' => 1, - 'auth_source' => 'platform', - 'email' => 'agarcia@example.com', - 'creator_id' => 1, - 'active' => 1 -); - -$users[] = array( - 'username' => 'pperez', - 'pass' => 'pperez', - 'firstname' => 'Pedro', - 'lastname' => 'Perez', - 'status' => 5, - 'auth_source' => 'platform', - 'email' => 'pperez@example.com', - 'creator_id' => 1, - 'active' => 1 -); - -$users[] = array( - 'username' => 'ggerard', - 'pass' => 'ggerard', - 'firstname' => 'Gabrielle', - 'lastname' => 'Gérard', - 'status' => 5, - 'auth_source' => 'platform', - 'email' => 'ggerard@example.com', - 'creator_id' => 1, - 'active' => 1 -); - -$users[] = array( - 'username' => 'norizales', - 'pass' => 'norizales', - 'firstname' => 'Noa', - 'lastname' => 'Orizales', - 'status' => 5, - 'auth_source' => 'platform', - 'email' => 'norizales@example.com', - 'creator_id' => 1, - 'active' => 1 -); - -$users[] = array( - 'username' => 'fbaggins', - 'pass' => 'fbaggins', - 'firstname' => 'Frodo', - 'lastname' => 'Baggins', - 'status' => 5, - 'auth_source' => 'platform', - 'email' => 'fbaggins@example.com', - 'creator_id' => 1, - 'active' => 1 -); - -$users[] = array( - 'username' => 'bbaggins', - 'pass' => 'bbagins', - 'firstname' => 'Bilbo', - 'lastname' => 'Baggins', - 'status' => 5, - 'auth_source' => 'platform', - 'email' => 'bbaggins@example.com', - 'creator_id' => 1, - 'active' => 1 -); - -$users[] = array( - 'username' => 'sgamgee', - 'pass' => 'sgamgee', - 'firstname' => 'Samwise', - 'lastname' => 'Gamgee', - 'status' => 5, - 'auth_source' => 'platform', - 'email' => 'sgamgee@example.com', - 'creator_id' => 1, - 'active' => 1 -); - -$users[] = array( - 'username' => 'jbrion', - 'pass' => 'jbrion', - 'firstname' => 'Jon', - 'lastname' => 'Brion', - 'status' => 5, - 'auth_source' => 'platform', - 'email' => 'jbrion@example.com', - 'creator_id' => 1, - 'active' => 1 -); -$users[] = array( - 'username' => 'fapple', - 'pass' => 'fapple', - 'firstname' => 'Fiona', - 'lastname' => 'Apple Maggart', - 'status' => 5, - 'auth_source' => 'platform', - 'email' => 'fapple@example.com', - 'creator_id' => 1, - 'active' => 1 -); - -$users[] = array( - 'username' => 'acalabaza', - 'pass' => 'acalabaza', - 'firstname' => 'Aldo', - 'lastname' => 'Calabaza', - 'status' => 5, - 'auth_source' => 'platform', - 'email' => 'acalabaza@example.com', - 'creator_id' => 1, - 'active' => 1 -); - -$users[] = array('username' => 'mbrandybuck', 'pass' => 'mbrandybuck', 'firstname' => 'Meriadoc', 'lastname' => 'Brandybuck', 'status' => 5, 'auth_source' => 'platform', 'email' => 'mbrandybuck@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'amaurichard', 'pass' => 'amaurichard', 'firstname' => 'Anabelle', 'lastname' => 'Maurichard', 'status' => 3, 'auth_source' => 'platform', 'email' => 'amaurichard@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'ptook', 'pass' => 'ptook', 'firstname' => 'Peregrin', 'lastname' => 'Took', 'status' => 4, 'auth_source' => 'platform', 'email' => 'ptook@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'abaggins', 'pass' => 'abaggins', 'firstname' => 'Angelica', 'lastname' => 'Baggins', 'status' => 17, 'auth_source' => 'platform', 'email' => 'abaggins@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'bproudfoot', 'pass' => 'bproudfoot', 'firstname' => 'Bodo', 'lastname' => 'Proudfoot', 'status' => 20, 'auth_source' => 'platform', 'email' => 'bproudfoot@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'csackville', 'pass' => 'csackville', 'firstname' => 'Camelia', 'lastname' => 'Sackville', 'status' => 5, 'auth_source' => 'platform', 'email' => 'csackville@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'dboffin', 'pass' => 'dboffin', 'firstname' => 'Donnamira', 'lastname' => 'Boffin', 'status' => 5, 'auth_source' => 'platform', 'email' => 'dboffin@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'efairbairn', 'pass' => 'efairbairn', 'firstname' => 'Elfstan', 'lastname' => 'Fairbairn', 'status' => 5, 'auth_source' => 'platform', 'email' => 'efairbairn@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'fgreenholm', 'pass'=> 'fgreenholm', 'firstname' => 'Fastred', 'lastname' => 'of Greenholm', 'status' => 5, 'auth_source' => 'platform', 'email' => 'fgreenholm@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'gboffin', 'pass'=> 'gboffin', 'firstname' => 'Griffo', 'lastname' => 'Boffin', 'status' => 5, 'auth_source' => 'platform', 'email' => 'gboffin@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'hbrandybuck', 'pass'=> 'hbrandybuck', 'firstname' => 'Hilda', 'lastname' => 'Brandybuck', 'status' => 5, 'auth_source' => 'platform', 'email' => 'hbrandybuck@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'itook', 'pass'=> 'itook', 'firstname' => 'Isengar', 'lastname' => 'Took', 'status' => 5, 'auth_source' => 'platform', 'email' => 'itook@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'mcotillard', 'pass'=> 'mcotillard', 'firstname' => 'Marion', 'lastname' => 'Cotillard', 'status' => 5, 'auth_source' => 'platform', 'email' => 'mcotillard@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'jcotton', 'pass'=> 'jcotton', 'firstname' => 'Jolly', 'lastname' => 'Cotton', 'status' => 5, 'auth_source' => 'platform', 'email' => 'jcotton@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'lcotton', 'pass'=> 'lcotton', 'firstname' => 'Lily', 'lastname' => 'Cotton', 'status' => 5, 'auth_source' => 'platform', 'email' => 'lcotton@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'mburrows', 'pass'=> 'mburrows', 'firstname' => 'Milo', 'lastname' => 'Burrows', 'status' => 5, 'auth_source' => 'platform', 'email' => 'mburrows@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'obolger', 'pass'=> 'obolger', 'firstname' => 'Odovacar', 'lastname' => 'Bolger', 'status' => 5, 'auth_source' => 'platform', 'email' => 'obolger@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'pbolger', 'pass'=> 'pbolger', 'firstname' => 'Prisca', 'lastname' => 'Bolger', 'status' => 5, 'auth_source' => 'platform', 'email' => 'pbolger@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'rgardner', 'pass'=> 'rgardner', 'firstname' => 'Ruby', 'lastname' => 'Gardner', 'status' => 5, 'auth_source' => 'platform', 'email' => 'rgardner@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'stook', 'pass'=> 'stook', 'firstname' => 'Sigismond', 'lastname' => 'Took', 'status' => 5, 'auth_source' => 'platform', 'email' => 'stook@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'sgollum', 'pass'=> 'sgollum', 'firstname' => 'Smeagol', 'lastname' => 'Gollum', 'status' => 5, 'auth_source' => 'platform', 'email' => 'sgollum@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'tsandyman', 'pass'=> 'tsandyman', 'firstname' => 'Ted', 'lastname' => 'Sandyman', 'status' => 5, 'auth_source' => 'platform', 'email' => 'tsandyman@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'wgamwich', 'pass'=> 'wgamwich', 'firstname' => 'Wiseman', 'lastname' => 'Gamwich', 'status' => 5, 'auth_source' => 'platform', 'email' => 'wgamwich@example.com', 'creator_id' => 1, 'active' => 1); - -$users[] = array('username' => 'mhalles','pass' => 'mhalles','firstname' => 'Maria','lastname' => 'Halles','status' => 5,'auth_source' => 'platform','email' => 'mhalles@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'adaniel','pass' => 'adaniel','firstname' => 'Anna','lastname' => 'Daniel','status' => 5,'auth_source' => 'platform','email' => 'adaniel@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'hstein','pass' => 'ppiedra','firstname' => 'Hansel','lastname' => 'Stein','status' => 5,'auth_source' => 'platform','email' => 'ppiedra@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'amartin','pass' => 'amartin','firstname' => 'Angel','lastname' => 'Martin','status' => 5,'auth_source' => 'platform','email' => 'amartin@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'mhiggins','pass' => 'mhingis','firstname' => 'Marc','lastname' => 'Higgins','status' => 5,'auth_source' => 'platform','email' => 'mhingis@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'jlennon','pass' => 'jlennon','firstname' => 'Johnny','lastname' => 'Lennon','status' => 5,'auth_source' => 'platform','email' => 'jlennon@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'pchavez','pass' => 'pchavez','firstname' => 'Parol','lastname' => 'Chavez','status' => 5,'auth_source' => 'platform','email' => 'pchavez@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'cvallejo','pass' => 'cvallejo','firstname' => 'César','lastname' => 'Vallejo','status' => 5,'auth_source' => 'platform','email' => 'cvallejo@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'ftruffaut','pass'=> 'ftruffaut','firstname' => 'François','lastname' => 'Truffaut','status' => 5,'auth_source' => 'platform','email' => 'ftruffaut@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'mjoy','pass'=> 'mjoy','firstname' => 'Mary','lastname' => 'Joy','status' => 5,'auth_source' => 'platform','email' => 'marion@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'dmassa','pass'=> 'dmassa','firstname' => 'Diego','lastname' => 'Massa','status' => 5,'auth_source' => 'platform','email' => 'dmassa@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'mjagger','pass'=> 'mjagger','firstname' => 'Mick','lastname' => 'Jagger','status' => 5,'auth_source' => 'platform','email' => 'mjagger@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'mcotilla','pass'=> 'mcotilla','firstname' => 'Marion','lastname' => 'Cotillard','status' => 5,'auth_source' => 'platform','email' => 'mcotilla@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'pepelepew','pass'=> 'pepelepew','firstname' => 'Pepe','lastname' => 'Le Pew','status' => 5,'auth_source' => 'platform','email' => 'pepelepew@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'nrubio','pass'=> 'nrubia','firstname' => 'Nathalie','lastname' => 'Rubio','status' => 5,'auth_source' => 'platform','email' => 'nrubia@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'psanchez','pass'=> 'psanchez','firstname' => 'Peri','lastname' => 'Sanchez','status' => 5,'auth_source' => 'platform','email' => 'psanchez@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'acostea','pass'=> 'acostea','firstname' => 'Andrea','lastname' => 'Costea','status' => 5,'auth_source' => 'platform','email' => 'acostea@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'telera','pass'=> 'telera','firstname' => 'Tania','lastname' => 'Helera','status' => 5,'auth_source' => 'platform','email' => 'telera@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'dstrauss','pass'=> 'dstrauss','firstname' => 'Domingo','lastname' => 'Strauss','status' => 5,'auth_source' => 'platform','email' => 'dstrauss@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'helena','pass'=> 'helena','firstname' => 'Helena','lastname' => 'Duarte','status' => 5,'auth_source' => 'platform','email' => 'helena@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'cgonzales','pass'=> 'cgonzales','firstname' => 'Cecilia','lastname' => 'Gonzales','status' => 5,'auth_source' => 'platform','email' => 'cgonzales@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'amann','pass'=> 'amann','firstname' => 'Aimee','lastname' => 'Mann','status' => 5,'auth_source' => 'platform','email' => 'amann@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'zzaouidi','pass'=> 'zazup','firstname' => 'Zatar','lastname' => 'Zaouidi','status' => 5,'auth_source' => 'platform','email' => 'zazup@example.com','creator_id' => 1,'active' => 1); - diff --git a/tests/datafiller/fill_all.php b/tests/datafiller/fill_all.php deleted file mode 100755 index 484a003574..0000000000 --- a/tests/datafiller/fill_all.php +++ /dev/null @@ -1,48 +0,0 @@ - - */ - -/** - * Initialisation section - */ -$incdir = dirname(__FILE__).'/../../main/inc/'; -require $incdir.'global.inc.php'; - -/** - * Code logic - */ -//Avoid execution if not from the command line -if (PHP_SAPI != 'cli') { die('This demo-data filling script can only be run from the command line. Please launch it from the command line using: php5 fill_all.php. To enable it from your browser (very highly dangerous), remove the first line of code from the "logic" section of this file.'); } -$eol = PHP_EOL; -$output = ''; -$files = scandir(dirname(__FILE__)); -foreach ($files as $file) { - if (substr($file,0,1) == '.' or substr($file,0,5) != 'fill_') { ; } //skip - else { - if ($file == basename(__FILE__)) { - //skip, this is the current file - } else { - $output .= $eol.'Reading file: '.$file.$eol; - require_once $file; - $function = basename($file,'.php'); - if (function_exists($function)) { - $output .= $eol.'Executing function '.$function.$eol; - $function(); - } else { - //function not found - } - } - } -} -/** - * Display - */ -echo $output.$eol; -echo "Done all$eol"; \ No newline at end of file diff --git a/tests/datafiller/fill_courses.php b/tests/datafiller/fill_courses.php deleted file mode 100755 index 38824b5bfb..0000000000 --- a/tests/datafiller/fill_courses.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - */ - -/** - * Loads the data and injects it into the Chamilo database, using the Chamilo - * internal functions. - * @return array List of user IDs for the users that have just been inserted - */ -function fill_courses() -{ - $eol = PHP_EOL; - $courses = array(); //declare only to avoid parsing notice - require_once 'data_courses.php'; //fill the $users array - $output = array(); - $output[] = array('title'=>'Courses Filling Report: '); - $i = 1; - foreach ($courses as $i => $course) { - //first check that the first item doesn't exist already - $output[$i]['line-init'] = $course['title']; - $res = CourseManager::create_course($course); - $output[$i]['line-info'] = $res ? get_lang('Added') : get_lang('NotInserted'); - $i++; - } - - return $output; -} diff --git a/tests/datafiller/fill_many_users.php b/tests/datafiller/fill_many_users.php deleted file mode 100755 index ba00185304..0000000000 --- a/tests/datafiller/fill_many_users.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - */ -/** - * Initialisation section - */ -require '../../main/inc/global.inc.php'; -/** - * Executing - */ -fill_many_users(100000); -/** - * Loads the data and injects it into the Chamilo database, using the Chamilo - * internal functions. - * @return array List of user IDs for the users that have just been inserted - */ -function fill_many_users($num) { - $eol = PHP_EOL; - $users = array(); //declare only to avoid parsing notice - require_once 'data_users.php'; //fill the $users array - $i = 1; - while ($i < $num) { - $output = array(); - $output[] = array('title'=>'Users Filling Report:'); - foreach ($users as $j => $user) { - //first check that the first item doesn't exist already - $output[$i]['line-init'] = $user['firstname']; - $res = UserManager::create_user($user['firstname'],$user['lastname'],$user['status'],$user['email'],$user['username'].$i,$user['pass'],null,null,null,null,$user['auth_source'],null,$user['active']); - $output[$i]['line-info'] = ($res ? get_lang('Inserted') : get_lang('NotInserted')).' '.$user['username'].$i; - $i++; - } - print_r($output); - } - //return $output; -} diff --git a/tests/datafiller/fill_users.php b/tests/datafiller/fill_users.php deleted file mode 100755 index 0b32fa97e1..0000000000 --- a/tests/datafiller/fill_users.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - */ -/** - * Initialisation section - */ - -/** - * Loads the data and injects it into the Chamilo database, using the Chamilo - * internal functions. - * @return array List of user IDs for the users that have just been inserted - */ -function fill_users() -{ - $users = array(); //declare only to avoid parsing notice - require_once 'data_users.php'; //fill the $users array - $output = array(); - $output[] = array('title'=>'Users Filling Report:'); - foreach ($users as $i => $user) { - //first check that the first item doesn't exist already - $output[$i]['line-init'] = $user['firstname']; - $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'] - ); - $output[$i]['line-info'] = $res ? get_lang('Inserted') : get_lang('NotInserted'); - } - - return $output; -} diff --git a/tests/datafiller/fill_whoisonline.php b/tests/datafiller/fill_whoisonline.php deleted file mode 100755 index 70aa0dc5e6..0000000000 --- a/tests/datafiller/fill_whoisonline.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - */ - -/** - * Loads the data and injects it into the Dokeos database, using the Dokeos - * internal functions. - * @return array List of user IDs for the users that have just been inserted - */ -function fill_whoisonline() -{ - $table_e_online = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); - $max = 100; - - //Cleaning the table - $sql = "TRUNCATE $table_e_online"; - $rs = Database::query($sql); - //filling the table - for ($i=1;$i <=$max;$i++) { - $date = api_get_utc_datetime(); - $sql = "INSERT INTO $table_e_online (login_id, login_user_id, login_date, user_ip, c_id, session_id, access_url_id) - VALUES ('$i', '$i', '$date', '127.0.0.1', '', '0','1')"; - $rs = Database::query($sql); - } -} diff --git a/tests/datafiller/index.html b/tests/datafiller/index.html deleted file mode 100755 index 8e464d8ce3..0000000000 --- a/tests/datafiller/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - -
- - \ No newline at end of file diff --git a/tests/features/accessCompanyReports.feature b/tests/features/accessCompanyReports.feature deleted file mode 100644 index df676fbfbb..0000000000 --- a/tests/features/accessCompanyReports.feature +++ /dev/null @@ -1,20 +0,0 @@ -@administration -Feature: Access to company reports as admin - In order to analyse reports of time spent on the platform - As an administrator - I need to be able to access the company reports - - Scenario: See the company reports link on the admin page - Given I am a platform administrator - And I am on "/main/admin/index.php" - Then I should see "Reports" - - Scenario: Access the company report - Given I am a platform administrator - And I am on "/main/mySpace/company_reports.php" - Then I should not see "not authorized" - - Scenario: Access the resumed version of the company report - Given I am a platform administrator - And I am on "/main/admin/company_reports_resumed.php" - Then I should not see "not authorized" diff --git a/tests/features/bootstrap/FeatureContext.php b/tests/features/bootstrap/FeatureContext.php deleted file mode 100644 index e9f4ad72ae..0000000000 --- a/tests/features/bootstrap/FeatureContext.php +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - diff --git a/tests/history/1.9.0/chamilito-3d.blend b/tests/history/1.9.0/chamilito-3d.blend deleted file mode 100755 index 424e969662..0000000000 Binary files a/tests/history/1.9.0/chamilito-3d.blend and /dev/null differ diff --git a/tests/history/1.9.0/chamilo-logo-transparent.png b/tests/history/1.9.0/chamilo-logo-transparent.png deleted file mode 100755 index 3f2baf7416..0000000000 Binary files a/tests/history/1.9.0/chamilo-logo-transparent.png and /dev/null differ diff --git a/tests/history/1.9.0/chamilo-logo.svg b/tests/history/1.9.0/chamilo-logo.svg deleted file mode 100755 index 6a8349dbbd..0000000000 --- a/tests/history/1.9.0/chamilo-logo.svg +++ /dev/null @@ -1,231 +0,0 @@ - - - -Chamilo | E-Learning & Collaboration Softwareimage/svg+xmlChamilo | E-Learning & Collaboration Software - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/img/bg-footer.gif b/tests/img/bg-footer.gif deleted file mode 100755 index bdd34cea9a..0000000000 Binary files a/tests/img/bg-footer.gif and /dev/null differ diff --git a/tests/img/bg-header4.png b/tests/img/bg-header4.png deleted file mode 100755 index 10f15a4a0a..0000000000 Binary files a/tests/img/bg-header4.png and /dev/null differ diff --git a/tests/img/header-logo.png b/tests/img/header-logo.png deleted file mode 100755 index 397e6f7cde..0000000000 Binary files a/tests/img/header-logo.png and /dev/null differ diff --git a/tests/index.html b/tests/index.html deleted file mode 100755 index 8e464d8ce3..0000000000 --- a/tests/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - -
- - \ No newline at end of file diff --git a/tests/internationalization.lib.test_standalone.php b/tests/internationalization.lib.test_standalone.php deleted file mode 100755 index 6d09a54fb0..0000000000 --- a/tests/internationalization.lib.test_standalone.php +++ /dev/null @@ -1,49 +0,0 @@ -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()); - -?> diff --git a/tests/logs/code-browser/README.txt b/tests/logs/code-browser/README.txt deleted file mode 100755 index d6699499b7..0000000000 --- a/tests/logs/code-browser/README.txt +++ /dev/null @@ -1 +0,0 @@ -Code browser report will be generated in this directory diff --git a/tests/logs/index.html b/tests/logs/index.html deleted file mode 100755 index 7879e1ce9f..0000000000 --- a/tests/logs/index.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/logs/jdepend.xml b/tests/logs/jdepend.xml deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/tests/logs/junit.xml b/tests/logs/junit.xml deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/tests/main/admin/calendar.lib.test.php b/tests/main/admin/calendar.lib.test.php deleted file mode 100755 index af282af155..0000000000 --- a/tests/main/admin/calendar.lib.test.php +++ /dev/null @@ -1,114 +0,0 @@ -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 testStoreNewAgendaItem(){ - global $_user; - $res_store = store_new_agenda_item(); - $this->assertTrue(is_numeric($res_store)); - - //delete the new agenda item in the database - if (is_numeric($res_store)) { - $res_delete = delete_agenda_item($res_store); - $this->assertTrue(is_numeric($res_store)); - } - } - - public function 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 - } -} diff --git a/tests/main/admin/statistics/statistics.lib.test.php b/tests/main/admin/statistics/statistics.lib.test.php deleted file mode 100755 index df6e22febd..0000000000 --- a/tests/main/admin/statistics/statistics.lib.test.php +++ /dev/null @@ -1,188 +0,0 @@ -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)); - } -} - -?> diff --git a/tests/main/admin/sub_language.class.test.php b/tests/main/admin/sub_language.class.test.php deleted file mode 100755 index 2f267c6331..0000000000 --- a/tests/main/admin/sub_language.class.test.php +++ /dev/null @@ -1,206 +0,0 @@ -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); - } -} -?> diff --git a/tests/main/announcements/announcements.inc.test.php b/tests/main/announcements/announcements.inc.test.php deleted file mode 100755 index 8b317bda1d..0000000000 --- a/tests/main/announcements/announcements.inc.test.php +++ /dev/null @@ -1,80 +0,0 @@ -UnitTestCase('Displays one specific announcement test'); - } - - public function Testconstruct_not_selected_select_form(){ - $courseSysCode= '123'; - $course_code = $courseSysCode; - ob_start(); - $to_already_selected=""; - $_SESSION['_cid'] = 'CURSO1'; - $user_list = array( 0=>array( - 0 => '1','user_id' => '1', - 1 =>'Doe','lastname' =>'Doe', - 2 =>'John','firstname' =>'John', - 3 => 'admin','username' =>'admin' - )); - - $res = construct_not_selected_select_form($group_list=null, $user_list,$to_already_selected); - ob_end_clean(); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - public function Testconstruct_selected_select_form(){ - $to_already_selected=""; - ob_start(); - $res = construct_selected_select_form($group_list=null, $user_list=null,$to_already_selected); - ob_end_clean(); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - public function Testshow_to_form_group(){ - ob_start(); - $group_id=1; - $group_users=GroupManager::get_subscribed_users($group_id); - $res = show_to_form_group($group_id); - ob_end_clean(); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - public function Testget_course_users(){ - $_SESSION['id_session'] = 'CURSO1'; - $user_list = CourseManager::get_real_and_linked_user_list(api_get_course_id(), true, $_SESSION['id_session']); - $res = get_course_users(); - if($res = array($res)){ - $this->assertTrue(is_array($res)); - } else { - $this->assertTrue(is_null($res)); - } - //var_dump($res); - } - - public function Testget_course_groups(){ - $_SESSION['id_session']='CURSO1'; - $new_group_list = CourseManager::get_group_list_of_course(api_get_course_id(), intval($_SESSION['id_session'])); - $res = get_course_groups(); - $this->assertFalse($res); - $this->assertTrue(is_array($res)); - var_dump($res); - } - - public function Testload_edit_users(){ - $_SESSION['id_session']='CURSO1'; - global $_course; - global $tbl_item_property; - $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); - $tool = ''; - $id = ''; - $res = load_edit_users($tool, $id); - $this->assertTrue(is_null($res)); - var_dump($res); - } -} diff --git a/tests/main/auth/openid/xrds.lib.test.php b/tests/main/auth/openid/xrds.lib.test.php deleted file mode 100755 index ad5ae85726..0000000000 --- a/tests/main/auth/openid/xrds.lib.test.php +++ /dev/null @@ -1,71 +0,0 @@ -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 = << - - Christian - Fasa Fasa - -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); - }*/ -} -?> diff --git a/tests/main/chat/chat_functions.lib.test.php b/tests/main/chat/chat_functions.lib.test.php deleted file mode 100755 index f4da104e12..0000000000 --- a/tests/main/chat/chat_functions.lib.test.php +++ /dev/null @@ -1,79 +0,0 @@ -UnitTestCase('Chat library - main/chat/chat_functions.lib.test.php'); - } - - public function setUp() { - $this->tcourse = new CourseManager(); - } - - public function tearDown() { - $this->tcourse = null; - } - - - - function testuser_connected_in_chat () { - $course_code = 'COURSETEST'; - $user_id = 1; - $res = user_connected_in_chat($user_id); - $this->assertTrue(is_bool($res)); - } - - - function testUsersListInChat () { - $course_code = 'COURSETEST'; - $course_info = api_get_course_info($course_code); - $database_name = $course_info['dbName']; - $res = users_list_in_chat($database_name); - $this->assertTrue(is_array($res)); - //var_dump($res); - } - - function CreateChatConnection($database_name) { - $session_id = 1; - $tbl_chat_connected = Database::get_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); - } - - - function testExitOfChat () { - $course_code = 'COURSETEST'; - $course_info = api_get_course_info($course_code); - $database_name = $course_info['dbName']; - $this->CreateChatConnection($database_name); - $user_id = 1; - $res = exit_of_chat($user_id); - //$resu = $this->tcourse->delete_course($course_code); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - - function testDisconnectUserOfChat() { - $_SESSION['is_courseAdmin'] = 1; - $course_code = 'COURSETEST'; - $course_info = api_get_course_info($course_code); - $database_name = $course_info['dbName']; - $this->CreateChatConnection($database_name); - $res = disconnect_user_of_chat($database_name); - $this->assertTrue(is_null($res)); - } -} -?> diff --git a/tests/main/conference/get_translation.lib.test.php b/tests/main/conference/get_translation.lib.test.php deleted file mode 100755 index 001bd3df98..0000000000 --- a/tests/main/conference/get_translation.lib.test.php +++ /dev/null @@ -1,16 +0,0 @@ -UnitTestCase('Conference translation getter library - main/conference/get_translation.lib.test.php'); - } - - function testget_language_file_as_xml(){ - ob_start(); - $res=get_language_file_as_xml($language='english'); - ob_end_clean(); - $this->assertTrue(is_string($res)); - } -} \ No newline at end of file diff --git a/tests/main/dropbox/dropbox_class.inc.test.php b/tests/main/dropbox/dropbox_class.inc.test.php deleted file mode 100755 index 96a2503840..0000000000 --- a/tests/main/dropbox/dropbox_class.inc.test.php +++ /dev/null @@ -1,319 +0,0 @@ -UnitTestCase(''); - } - - public function setUp() { - global $dropbox_cnf; - $dropbox_cnf['tbl_post'] = Database::get_course_table(TABLE_DROPBOX_POST); - $dropbox_cnf['tbl_file'] = Database::get_course_table(TABLE_DROPBOX_FILE); - $dropbox_cnf['tbl_person'] = Database::get_course_table(TABLE_DROPBOX_PERSON); - $dropbox_cnf['tbl_intro'] = Database::get_course_table(TABLE_TOOL_INTRO); - $dropbox_cnf['tbl_user'] = Database::get_main_table(TABLE_MAIN_USER); - $dropbox_cnf['tbl_course_user'] = Database::get_main_table(TABLE_MAIN_COURSE_USER); - $dropbox_cnf['tbl_category'] = Database::get_course_table(TABLE_DROPBOX_CATEGORY); - $dropbox_cnf['tbl_feedback'] = Database::get_course_table(TABLE_DROPBOX_FEEDBACK); - $this->ddropboxwork = new Dropbox_Work(1); - $this->ddropboxsentwork = new Dropbox_SentWork(1); - $this->dperson = new Dropbox_Person(1, 1, 1); - } - - public function tearDown() { - $this-> ddropboxwork = null; - $this-> ddropboxsentwork = null; - $this-> dperson = null; - } - -//Class Dropbox_Work - - /** - * Constructor calls private functions to create a new work or retreive an existing work from DB - * depending on the number of parameters - * - * @param unknown_type $arg1 - * @param unknown_type $arg2 - * @param unknown_type $arg3 - * @param unknown_type $arg4 - * @param unknown_type $arg5 - * @param unknown_type $arg6 - * @return Dropbox_Work - */ - - function testDropbox_Work() { - $arg1=1; - $resu= $this->ddropboxwork->Dropbox_Work($arg1, $arg2=null, $arg3=null, $arg4=null, $arg5=null, $arg6=null); - $this->assertTrue(is_null($resu)); - //var_dump($resu); - } - - /** - * private function creating a new work object - * - * @param unknown_type $uploader_id - * @param unknown_type $title - * @param unknown_type $description - * @param unknown_type $author - * @param unknown_type $filename - * @param unknown_type $filesize - * - * @todo $author was originally a field but this has now been replaced by the first and lastname of the uploader (to prevent anonymous uploads) - * As a consequence this parameter can be removed - */ - - function testCreateNewWork() { - global $dropbox_cnf; - $uploader_id=1; - $title='test'; - $description = 'testing'; - $author= 'test'; - $filename='test.txt'; - $filesize=125; - $resu= $this->ddropboxwork->_createNewWork($uploader_id, $title, $description, $author, $filename, $filesize); - $this->assertTrue(is_null($resu)); - //var_dump($resu); - } - - /** - * private function creating existing object by retreiving info from db - * - * @param unknown_type $id - */ - - function testCreateExistingWork() { - global $dropbox_cnf; - $dropbox_cnf['tbl_file'] = Database::get_course_table(TABLE_DROPBOX_FILE); - $dropbox_cnf['tbl_feedback'] = Database::get_course_table(TABLE_DROPBOX_FEEDBACK); - $id = 1; - $resu= $this->ddropboxwork->_createExistingWork($id); - $this->assertTrue(is_null($resu)); - //var_dump($resu); - } - -//Class Dropbox_SentWork - - /** - * Constructor calls private functions to create a new work or retreive an existing work from DB - * depending on the number of parameters - * - * @param unknown_type $arg1 - * @param unknown_type $arg2 - * @param unknown_type $arg3 - * @param unknown_type $arg4 - * @param unknown_type $arg5 - * @param unknown_type $arg6 - * @param unknown_type $arg7 - * @return Dropbox_SentWork - */ - - function testDropbox_SentWork() { - $arg1 = 1; - $resu= $this->ddropboxsentwork->Dropbox_SentWork($arg1, $arg2=null, $arg3=null, $arg4=null, $arg5=null, $arg6=null, $arg7=null); - $this->assertTrue(is_null($resu)); - } - - /** - * private function creating a new SentWork object - * - * @param unknown_type $uploader_id - * @param unknown_type $title - * @param unknown_type $description - * @param unknown_type $author - * @param unknown_type $filename - * @param unknown_type $filesize - * @param unknown_type $recipient_ids - */ - - function testCreateNewSentWork() { - $recipient_ids = array(1,2); - $uploader_id=1; - $title='test'; - $description = 'testing'; - $author= 'test'; - $filename='test.txt'; - $filesize=125; - $resu= $this->ddropboxsentwork->_createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids); - $this->assertTrue(is_null($resu)); - } - - /** - * private function creating existing object by retreiving info from db - * - * @param unknown_type $id - */ - - function testCreateExistingSentWork() { - $id = 1; - $resu= $this->ddropboxsentwork->_createExistingSentWork($id); - $this->assertTrue(is_null($resu)); - } - -//Class Dropbox_SentWork - - /** - * Constructor for recreating the Dropbox_Person object - * - * @param unknown_type $userId - * @param unknown_type $isCourseAdmin - * @param unknown_type $isCourseTutor - * @return Dropbox_Person - */ - - function testDropbox_Person() { - $userId = 1; - $isCourseAdmin = 1; - $isCourseTutor = 1; - $resu= $this->dperson->Dropbox_Person($userId, $isCourseAdmin, $isCourseTutor); - $this->assertTrue(is_null($resu)); - } - - /** - * This private method is used by the usort function in the - * orderSentWork and orderReceivedWork methods. - * It compares 2 work-objects by 1 of the properties of that object, dictated by the - * private property _orderBy - * - * @param unknown_type $a - * @param unknown_type $b - * @return -1, 0 or 1 dependent of the result of the comparison. - */ - - function testCmpWork() { - $a = 1; - $b = 1; - $resu= $this->dperson->_cmpWork($a, $b); - if(!is_numeric($resu)) { - $this->assertTrue(is_null($resu)); - } - } - - /** - * method that sorts the objects in the sentWork array, dependent on the $sort parameter. - * $sort can be lastDate, firstDate, title, size, ... - * - * @param unknown_type $sort - */ - - function testorderSentWork() { - $sort = 1; - $resu= $this->dperson->orderSentWork($sort); - if(!is_numeric($resu)) { - $this->assertTrue(is_null($resu)); - } - } - - /** - * method that sorts the objects in the receivedWork array, dependent on the $sort parameter. - * $sort can be lastDate, firstDate, title, size, ... - * @param unknown_type $sort - */ - - function testorderReceivedWork() { - $sort = 1; - $resu= $this->dperson->orderReceivedWork($sort); - if(!is_numeric($resu)) { - $this->assertTrue(is_null($resu)); - } - } - - /** - * Updates feedback for received work of this person with id=$id - * - * @param unknown_type $id - * @param unknown_type $text - */ - - function testupdateFeedback() { - $id = 1; - $text = 'test'; - $resu= $this->dperson->updateFeedback($id, $text); - if(!is_bool($resu)) { - $this->assertTrue(is_null($resu)); - } - } - - /** - * Filter the received work - * @param string $type - * @param string $value - */ - - function testfilter_received_work() { - $type = 1; - $value = 1; - $resu= $this->dperson->filter_received_work($type,$value); - if(!is_bool($resu)) { - $this->assertTrue(is_null($resu)); - } - } - - /** - * Deletes all the received work of this person - * - */ - - function testdeleteAllReceivedWork() { - $resu= $this->dperson->deleteAllReceivedWork(); - if(!is_numeric($resu)) { - $this->assertTrue(is_null($resu)); - } - } - - /** - * Deletes all the received categories and work of this person - */ - - function testdeleteReceivedWorkFolder() { - $id = 1; - $resu= $this->dperson->deleteReceivedWorkFolder($id); - if(!is_bool($resu)) { - $this->assertTrue(is_null($resu)); - } - } - - /** - * Deletes a received dropbox file of this person with id=$id - * - * @param integer $id - */ - - function testdeleteReceivedWork() { - $id = 1; - $resu= $this->dperson->deleteReceivedWork($id); - if(!is_bool($resu)) { - $this->assertTrue(is_null($resu)); - } - } - - /** - * Deletes all the sent dropbox files of this person - */ - - function testdeleteAllSentWork() { - $resu= $this->dperson->deleteAllSentWork(); - if(!is_bool($resu)) { - $this->assertTrue(is_null($resu)); - } - } - - /** - * Deletes a sent dropbox file of this person with id=$id - * - * @param unknown_type $id - */ - - function testdeleteSentWork() { - $id = 1; - $resu= $this->dperson->deleteSentWork($id); - if(!is_bool($resu)) { - $this->assertTrue(is_null($resu)); - } - } -} -?> diff --git a/tests/main/dropbox/dropbox_functions.inc.test.php b/tests/main/dropbox/dropbox_functions.inc.test.php deleted file mode 100755 index f367dab382..0000000000 --- a/tests/main/dropbox/dropbox_functions.inc.test.php +++ /dev/null @@ -1,505 +0,0 @@ -assertTrue(is_string($res)); - } - //var_dump($res); - } - - - /** - * Displays the form to move one individual file to a category - * @return html code of the form that appears in a dokeos message box. - */ - - function testdisplay_move_form() { - ob_start(); - $id= 1; - $part = 'test'; - $res= display_move_form($part, $id, $target=array()); - ob_end_clean(); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * This functions displays all teh possible actions that can be performed on multiple files. This is the dropdown list that - * appears below the sortable table of the sent / or received files. - * @return html value for the dropdown list - */ - - function testdisplay_action_options() { - ob_start(); - $categories= 1; - $part = 'test'; - $res= display_action_options($part, $categories, $current_category=0); - ob_end_clean(); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * this function returns the html code that displays the checkboxes next to the files so that - * multiple actions on one file are possible. - * @param $id the unique id of the file - * @param $part are we dealing with a sent or with a received file? - * @return html code - */ - - function testdisplay_file_checkbox() { - $id= 1; - $part = 'test'; - $res= display_file_checkbox($id, $part); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * This function displays the form to add a new category. - * - * @param $category_name this parameter is the name of the category (used when no section is selected) - * @param $id this is the id of the category we are editing. - * - * @author Patrick Cool , 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 , Ghent University - * @version march 2006 - */ - - function testDisplay_add_form() { - global $_user, $is_courseAdmin, $is_courseTutor, $course_info, $origin, $dropbox_unid; - ob_start(); - $res= display_add_form(); - ob_end_clean(); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * This function displays the firstname and lastname of the user as a link to the user tool. - * @see this is the same function as in the new forum, so this probably has to move to a user library. - * @todo move this function to the user library - */ - - function testdisplayuserlink() { - global $_otherusers; - $user_id = 1; - $res= display_user_link($user_id, $name=''); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * returns username or false if user isn't registered anymore - * @todo check if this function is still necessary. There might be a library function for this. - */ - - function testGetUserNameFromId() { - global $dropbox_cnf; - $id = 1; - $res= getUserNameFromId($id); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * returns loginname or false if user isn't registered anymore - * @todo check if this function is still necessary. There might be a library function for this. - */ - - function testGetLoginFromId() { - $id = 1; - $res= getLoginFromId($id); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - - /** - * @desc This function retrieves the number of feedback messages on every document. This function might become obsolete when - * the feedback becomes user individual. - */ - - function testget_total_number_feedback() { - global $dropbox_cnf; - $res= get_total_number_feedback($file_id=''); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * This function retrieves all the dropbox categories and returns them as an array - * @param $filter default '', when we need only the categories of the sent or the received part. - * @return array - */ - - function testGetdropbox_categories() { - $res= get_dropbox_categories($filter=''); - if(!is_null($res)){ - $this->assertTrue(is_array($res)); - } - //var_dump($res); - } - - /** - * Mailing zip-file is posted to (dest_user_id = ) mailing pseudo_id - * and is only visible to its uploader (user_id). - * Mailing content files have uploader_id == mailing pseudo_id, a normal recipient, - * and are visible initially to recipient and pseudo_id. - * @todo check if this function is still necessary. - */ - - function testgetUserOwningThisMailing() { - global $dropbox_cnf; - $mailingPseudoId = '1'; - $res= getUserOwningThisMailing($mailingPseudoId, $owner = 0, $or_die = ''); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * Get the last access to a given tool of a given user - * @param $tool string the tool constant - * @param $course_code the course_id - * @param $user_id the id of the user - * @return string last tool access date - * @todo consider moving this function to a more appropriate place. - */ - - function testget_last_tool_access() { - global $_course, $_user; - $tool = '1'; - $res= get_last_tool_access($tool, $course_code='', $user_id=''); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * This functions stores a new dropboxcategory - * @var it might not seem very elegant if you create a category in sent and in received with the same name that you get two entries in the - * dropbox_category table but it is the easiest solution. You get - * cat_name | received | sent | user_id - * test | 1 | 0 | 237 - * test | 0 | 1 | 237 - * more elegant would be - * test | 1 | 1 | 237 - */ - - function teststoreaddcategory() { - global $_user,$dropbox_cnf; - $res= store_addcategory(); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * This function moves a file to a different category - * @param $id the id of the file we are moving - * @param $target the id of the folder we are moving to - * @param $part are we moving a received file or a sent file? - * @return language string - */ - - function testStoremove() { - $id= 1; - $part = 'test'; - $target = array(); - $res= store_move($id, $target, $part); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - *@return selected string - */ - - function teststoreadddropbox() { - global $dropbox_cnf; - global $_user; - global $_course; - $res= store_add_dropbox(); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * @return boolean indicating if user with user_id=$user_id is a course member - * @todo eliminate global - * @todo check if this function is still necessary. There might be a library function for this. - */ - - function testIsCourseMember() { - $user_id = 1; - $res= isCourseMember($user_id); - if(!is_null($res)){ - $this->assertTrue(is_bool($res)); - } - //var_dump($res); - } - - /** - * this function transforms the array containing all the feedback into something visually attractive. - * @param an array containing all the feedback about the given message. - */ - - function testfeedback() { - $array = array(); - $res= feedback($array); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * This function returns the html code to display the feedback messages on a given dropbox file - * @param $feedback_array an array that contains all the feedback messages about the given document. - * @return html code - * @todo add the form for adding new comment (if the other party has not deleted it yet). - * @author Patrick Cool , 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); - } - */ - - /** - * Function that finds a given config setting - */ - - function testdropbox_cnf() { - $variable = 'test'; - $res= dropbox_cnf($variable); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * This is a callback function to decrypt the files in the zip file to their normal filename (as stored in the database) - * @param $p_event a variable of PCLZip - * @param $p_header a variable of PCLZip - */ - - function testmy_pre_add_callback() { - global $files; - $p_event = 'test'; - $res= my_pre_add_callback($p_event, &$p_header); - if(!is_null($res)){ - $this->assertTrue(is_numeric($res)); - } - //var_dump($res); - } - - /** - * @desc Cleans the temp zip files that were created when users download several files or a whole folder at once. - * T - * @return true - */ - - function testcleanup_temp_dropbox() { - global $_course; - $res= cleanup_temp_dropbox(); - if(!is_null($res)){ - $this->assertTrue(is_bool($res)); - } - //var_dump($res); - } - - /** - * This function deletes a dropbox category - * @todo give the user the possibility what needs to be done with the files in this category: move them to the root, download them as a zip, delete them - */ - - function testdelete_category() { - global $_user, $is_courseAdmin, $is_courseTutor,$dropbox_cnf; - $id= 1; - $action = 'test'; - $res= delete_category($action, $id); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - - /** - * Checks if there are files in the dropbox_file table that aren't used anymore in dropbox_person table. - * If there are, all entries concerning the file are deleted from the db + the file is deleted from the server - */ - - function testremoveUnusedFiles() { - $res= removeUnusedFiles(); - if(!is_null($res)){ - $this->assertTrue(is_array($res)); - } - //var_dump($res); - } - - /** - * @todo check if this function is still necessary. - */ - - function testremoveMoreIfMailing() { - $file_id = 1; - $res= removeMoreIfMailing($file_id); - if(!is_null($res)){ - $this->assertTrue(is_array($res)); - } - //var_dump($res); - } -} -?> \ No newline at end of file diff --git a/tests/main/exercice/answer.class.test.php b/tests/main/exercice/answer.class.test.php deleted file mode 100755 index c22e3ff5a6..0000000000 --- a/tests/main/exercice/answer.class.test.php +++ /dev/null @@ -1,389 +0,0 @@ -UnitTestCase(''); - } - - public function setUp() { - /* - //Create a new exercise - require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php'; - require_once api_get_path(SYS_CODE_PATH).'inc/lib/pear/HTML/QuickForm.php'; - $this->aAnswer = new Answer(2); - $this->aAnswer->read(); - $this->aAnswer = new Exercise(); - - $form = array( - 'exerciseTitle'=>'testtitle', - 'exerciseDescription'=>'testdescription', - 'exerciseAttempts'=>'0', - 'exerciseFeedbackType'=>'0', - 'exerciseType'=>'1', - 'randomQuestions'=>'0', - 'randomAnswers'=>'0', - 'results_disabled'=>'0', - 'enabletimercontroltotalminutes'=>'0'); - $res = Exercise::processCreation($form,$type='1'); - */ - $this->aAnswer = new Answer(2); - - - } - - public function tearDown() { - $this->aAnswer = null; - } - - /** - * constructor of the class - * - * @author Olivier Brouckaert - * @param integer Question ID that answers belong to - */ - - /* - function testAnswerConstructor() { - $questionId = 1; - $res = $this->aAnswer->Answer($questionId); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - */ - - - - /** - * creates a new answer - * - * @author Olivier Brouckaert - * @param string answer title - * @param integer 0 if bad answer, not 0 if good answer - * @param string answer comment - * @param integer answer weighting - * @param integer answer position - * @param coordinates Coordinates for hotspot exercises (optional) - * @param integer Type for hotspot exercises (optional) - */ - - function testcreateAnswer() { - $answer = 'test'; - $correct = 1; - $comment ='test'; - $weighting = 2; - $position = 1; - $res = $this->aAnswer->createAnswer($answer,$correct,$comment,$weighting,$position,$new_hotspot_coordinates = 1, $new_hotspot_type = 1,$destination=''); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - /** - * duplicates answers by copying them into another question - * @param - integer $newQuestionId - ID of the new question - */ - - function testduplicate() { - $newQuestionId = 1; - $res = $this->aAnswer->duplicate($newQuestionId); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - /** - * Returns a list of answers - * @return array List of answers where each answer is an array of (id, answer, comment, grade) and grade=weighting - */ - - function testgetAnswersList() { - $res = $this->aAnswer->getAnswersList(); - $this->assertTrue(is_array($res)); - //var_dump($res); - } - - /** - * Returns a list of grades - * @return array List of grades where grade=weighting (?) - */ - - function testgetGradesList() { - $res = $this->aAnswer->getGradesList(); - $this->assertTrue(is_array($res)); - //var_dump($res); - } - - /** - * Returns the question type - * @return integer The type of the question this answer is bound to - */ - - function testgetQuestionType() { - $res = $this->aAnswer->getQuestionType(); - if(!is_null($res)){ - $this->assertTrue(is_numeric($res)); - } - //var_dump($res); - } - - /** - * tells if answer is correct or not - * @param - integer $id - answer ID - * @return - integer - 0 if bad answer, not 0 if good answer - */ - - function testisCorrect() { - $id = 1; - $res = $this->aAnswer->isCorrect($id); - if(!is_null($res)){ - $this->assertTrue(is_numeric($res)); - } - //var_dump($res); - } - - /** - * reads answer informations from the data base - */ - - function testread() { - $res = $this->aAnswer->read(); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - /** - * reads answer informations from the data base ordered by parameter - * @param string Field we want to order by - * @param string DESC or ASC - */ - - function testreadOrderedBy() { - global $_course; - $field = 'position'; - $res = $this->aAnswer->readOrderedBy($field,$order=ASC); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - /** - * records answers into the data base - */ - - function testsave() { - $res = $this->aAnswer->save(); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - /** - * returns the answer title - * @param - integer $id - answer ID - * @return - string - answer title - */ - - function testselectAnswer() { - $id = 1; - $res = $this->aAnswer->selectAnswer($id); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * @param - integer $id - answer ID - * @return - bool - answer by id - */ - function testselectAnswerByAutoId() { - $auto_id = 1; - $res = $this->aAnswer->selectAnswerByAutoId($auto_id); - if(!is_null($res)){ - $this->assertTrue(is_array($res)); - } else { - $this->assertTrue(is_bool($res)); - } - //var_dump($res); - } - - /** - * returns the answer title from an answer's position - * @param - integer $id - answer ID - * @return - bool - answer title - */ - - function testselectAnswerIdByPosition() { - $pos = 1; - $res = $this->aAnswer->selectAnswerIdByPosition($pos); - if(!is_null($res)){ - $this->assertTrue(is_bool($res)); - } - //var_dump($res); - } - - /** - * returns the autoincrement id identificator - * @return - integer - answer num - */ - - function testselectAutoId() { - $id = 1; - $res = $this->aAnswer->selectAutoId($id); - if(!is_null($res)){ - $this->assertTrue(is_numeric($res)); - } - //var_dump($res); - } - - /** - * returns answer comment - * @param - integer $id - answer ID - * @return - string - answer comment - */ - - function testselectComment() { - $id = 1; - $res = $this->aAnswer->selectComment($id); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * returns the question ID of the destination question - * @return - integer - the question ID - */ - - function testselectDestination() { - $id = 1; - $res = $this->aAnswer->selectDestination($id); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - /** - * returns answer hotspot coordinates - * @param integer Answer ID - * @return integer Answer position - */ - - function testselectHotspotCoordinates() { - $id = 1; - $res = $this->aAnswer->selectHotspotCoordinates($id); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - } - - /** - * returns answer hotspot type - * - * @author Toon Keppens - * @param integer Answer ID - * @return integer Answer position - */ - - function testselectHotspotType() { - $id = 1; - $res = $this->aAnswer->selectHotspotType($id); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - } - - /** - * returns the number of answers in this question - * - * @author - Olivier Brouckaert - * @return - integer - number of answers - */ - - function testselectNbrAnswers() { - $res = $this->aAnswer->selectNbrAnswers(); - if(!is_null($res)){ - $this->assertTrue(is_numeric($res)); - } - } - - /** - * returns answer position - * - * @author - Olivier Brouckaert - * @param - integer $id - answer ID - * @return - integer - answer position - */ - - function testselectPosition() { - $id = 1; - $res = $this->aAnswer->selectPosition($id); - if(!is_null($res)){ - $this->assertTrue(is_numeric($res)); - } - } - - /** - * returns the question ID which the answers belong to - * - * @author - Olivier Brouckaert - * @return - integer - the question ID - */ - - function testselectQuestionId() { - $res = $this->aAnswer->selectQuestionId(); - if(!is_null($res)){ - $this->assertTrue(is_numeric($res)); - } - } - - /** - * returns answer weighting - * - * @author - Olivier Brouckaert - * @param - integer $id - answer ID - * @return - integer - answer weighting - */ - - function testselectWeighting() { - $id = 1; - $res = $this->aAnswer->selectWeighting($id); - if(!is_null($res)){ - $this->assertTrue(is_numeric($res)); - } - } - - /** - * updates an answer - * - * @author Toon Keppens - * @param string Answer title - * @param string Answer comment - * @param integer Answer weighting - * @param integer Answer position - */ - - function testupdateAnswers() { - $answer = ''; - $comment = ''; - $weighting=2; - $position=1; - $destination='0@@0@@0@@0'; - $res = $this->aAnswer->updateAnswers($answer,$comment,$weighting,$position,$destination); - if(!is_null($res)){ - $this->assertTrue(is_numeric($res)); - } - } - - /** - * clears $new_* arrays - */ - - function testcancel() { - $res = $this->aAnswer->cancel(); - $this->assertTrue(is_null($res)); - //var_dump($res); - } -} -?> diff --git a/tests/main/exercice/exercise.class.test.php b/tests/main/exercice/exercise.class.test.php deleted file mode 100755 index 83490531b3..0000000000 --- a/tests/main/exercice/exercise.class.test.php +++ /dev/null @@ -1,539 +0,0 @@ -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); - } -} -?> diff --git a/tests/main/exercice/exercise.lib.test.php b/tests/main/exercice/exercise.lib.test.php deleted file mode 100755 index 72291eba48..0000000000 --- a/tests/main/exercice/exercise.lib.test.php +++ /dev/null @@ -1,42 +0,0 @@ -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); - } - - - - -} -?> diff --git a/tests/main/exercice/exercise_result.class.test.php b/tests/main/exercice/exercise_result.class.test.php deleted file mode 100755 index 7ec2587c82..0000000000 --- a/tests/main/exercice/exercise_result.class.test.php +++ /dev/null @@ -1,83 +0,0 @@ -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); - } - - - - - - - - - - - -} -?> diff --git a/tests/main/exercice/export/exercise_import.inc.test.php b/tests/main/exercice/export/exercise_import.inc.test.php deleted file mode 100755 index fb2402337a..0000000000 --- a/tests/main/exercice/export/exercise_import.inc.test.php +++ /dev/null @@ -1,100 +0,0 @@ -assertFalse(is_array($res)); - if(!is_null){ - $this->assertTrue($res); - } - //var_dump($res); - } - - function testendElement() { - global $element_pile; - $element_pile = array(); - $parser= array(); - $data = array(); - $res = endElement($parser,$data); - $this->assertFalse(is_array($res)); - if(!is_null){ - $this->assertTrue($res); - } - //var_dump($res); - } - - /** - * possible deprecated - * @return the path of the temporary directory where the exercise was uploaded and unzipped - */ - - /*function testgetandunzipuploadedexercise() { - include_once (realpath(dirname(__FILE__) . '/../../inc/lib/pclzip/') . '/pclzip.lib.php'); - $res = get_and_unzip_uploaded_exercise(); - $this->assertFalse(is_array($res)); - if(!is_null){ - $this->assertTrue($res); - } - //var_dump($res); - } */ - - /** - * main function to import an exercise, - * Possible deprecated - * @return an array as a backlog of what was really imported, and error or debug messages to display - */ - - /*function testimport_exercise() { - $file = ''; - $res = import_exercise($file); - $this->assertFalse(is_array($res)); - if(!is_null){ - $this->assertTrue($res); - } - var_dump($res); - }*/ - - function testparse_file() { - $file = ''; - $exercisePath = ''; - $questionFile = ''; - $res = parse_file($exercisePath, $file, $questionFile); - $this->assertTrue(is_array($res)); - if(!is_null){ - $this->assertTrue($res); - } - //var_dump($res); - } - - function teststartElement() { - $parser = 'test'; - $name = 'test'; - $attributes = array(); - $res = startElement($parser, $name, $attributes); - $this->assertFalse(is_array($res)); - if(!is_null){ - $this->assertTrue($res); - } - //var_dump($res); - } - - function testtempdir() { - $dir = '/tmp'; - $res = tempdir($dir, $prefix='tmp', $mode=0777); - $this->assertFalse(is_array($res)); - if(!is_null){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } -} -?> diff --git a/tests/main/exercice/export/qti2/qti2_classes.test.php b/tests/main/exercice/export/qti2/qti2_classes.test.php deleted file mode 100755 index c09c736d3e..0000000000 --- a/tests/main/exercice/export/qti2/qti2_classes.test.php +++ /dev/null @@ -1,189 +0,0 @@ -UnitTestCase('QTI2 library - main/exercice/export/qti2/qti2_classes.test.php'); - } - - public function setUp() { - $this->qIms2Question = new Ims2Question(); - $this->qImsAnswerFillInBlanks = new ImsAnswerFillInBlanks(1); - $this->qImsAnswerFree = new ImsAnswerFree(1); - $this->qImsAnswerHotspot = new ImsAnswerHotspot(1); - $this->qImsAnswerMatching = new ImsAnswerMatching(1); - $this->qImsAnswerMultipleChoice = new ImsAnswerMultipleChoice(1); - } - - public function tearDown() { - $this-> qIms2Question = null; - $this-> qImsAnswerFillInBlanks = null; - $this-> qImsAnswerFree = null; - $this-> qImsAnswerHotspot = null; - $this-> qImsAnswerMatching = null; - $this-> qImsAnswerMultipleChoice = null; - } - -//Class qIms2Question - /** - * Include the correct answer class and create answer - */ - - function testsetAnswer() { - $res=Ims2Question::setAnswer(); - if(!is_null){ - $this->assertTrue(is_bool($res)); - } - //var_dump($res); - } - - function testcreateAnswersForm() { - $form = array(1); - $res=Ims2Question::createAnswersForm($form); - $this->assertTrue(is_bool($res)); - //var_dump($res); - } - - function testprocessAnswersCreation() { - $form = array(1); - $res=Ims2Question::processAnswersCreation($form); - $this->assertTrue(is_bool($res)); - //var_dump($res); - } - - -//Class qImsAnswerFillInBlanks - - /** - * Export the text with missing words. - * - * - */ - function testimsExportResponses() { - $questionIdent = array(1); - $questionStatment = array(1); - $res=$this->qImsAnswerFillInBlanks->imsExportResponses($questionIdent, $questionStatment); - if(!is_null){ - $this->assertTrue(is_bool($res)); - } - //var_dump($res); - } - - function testimsExportResponsesDeclaration() { - $questionIdent = array(1); - $res=$this->qImsAnswerFillInBlanks->imsExportResponsesDeclaration($questionIdent); - if(!is_null){ - $this->assertTrue(is_bool($res)); - } - //var_dump($res); - } - -//Class qImsAnswerFree - - /** - * TODO implement - * Export the question part as a matrix-choice, with only one possible answer per line. - */ - - function testImsExportResponsesqImsAnswerFree() { - $questionIdent = array(''); - $questionStatment = array(''); - $res=$this->qImsAnswerFree->imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia=''); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - function testImsExportResponsesDeclarationqImsAnswerFree() { - $questionIdent = array(1); - $res=$this->qImsAnswerFree->imsExportResponsesDeclaration($questionIdent); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - -//Class qImsAnswerHotspot - - /** - * TODO update this to match hotspots instead of copying matching - * Export the question part as a matrix-choice, with only one possible answer per line. - */ - - function testimsExportResponsesqImsAnswerHotspot() { - $questionIdent = array(1); - $questionStatment = array(1); - $res=$this->qImsAnswerHotspot->imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia=''); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - - function testimsExportResponsesDeclarationqImsAnswerHotspot() { - $questionIdent = array(1); - $res=$this->qImsAnswerHotspot->imsExportResponsesDeclaration($questionIdent); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - -//Class qImsAnswerMatching - - /** - * Export the question part as a matrix-choice, with only one possible answer per line. - */ - - function testimsExportResponsesqImsAnswerMatching() { - $questionIdent = array(1); - $questionStatment = array(1); - $res=$this->qImsAnswerMatching->imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia=''); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - - function testimsExportResponsesDeclarationqImsAnswerMatching() { - $questionIdent = array(1); - $res=$this->qImsAnswerMatching->imsExportResponsesDeclaration($questionIdent); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - -//Class qImsAnswerMultipleChoice - - /** - * Return the XML flow for the possible answers. - * - */ - - function testimsExportResponsesqImsAnswerMultipleChoice() { - $questionIdent = array(1); - $questionStatment = array(1); - $res=$this->qImsAnswerMultipleChoice->imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia=''); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - - function testimsExportResponsesDeclarationqImsAnswerMultipleChoice() { - $questionIdent = array(1); - $res=$this->qImsAnswerMultipleChoice->imsExportResponsesDeclaration($questionIdent); - $this->assertTrue(is_string($res)); - //var_dump($res); - } -} -?> diff --git a/tests/main/exercice/export/qti2/qti2_export.test.php b/tests/main/exercice/export/qti2/qti2_export.test.php deleted file mode 100755 index 9592ed8df9..0000000000 --- a/tests/main/exercice/export/qti2/qti2_export.test.php +++ /dev/null @@ -1,86 +0,0 @@ -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); - */ - } - - - - - - - - - - -} -?> diff --git a/tests/main/exercice/export/scorm/scorm_classes.test.php b/tests/main/exercice/export/scorm/scorm_classes.test.php deleted file mode 100755 index 41332356fb..0000000000 --- a/tests/main/exercice/export/scorm/scorm_classes.test.php +++ /dev/null @@ -1,219 +0,0 @@ -UnitTestCase('SCORM exercises export library - main/exercice/export/scorm/scorm_classes.test.php'); - } - - public function setUp() { - $this->sScormAnswerFillInBlanks = new ScormAnswerFillInBlanks(1); - $this->sScormAnswerFree = new ScormAnswerFree(1); - $this->sScormAnswerHotspot = new ScormAnswerHotspot(1); - $this->sScormAnswerMatching = new ScormAnswerMatching(1); - $this->sScormAnswerMultipleChoice = new ScormAnswerMultipleChoice(1); - $this->sScormAnswerTrueFalse = new ScormAnswerTrueFalse(1); - $this->sScormQuestion = new ScormQuestion(1); - } - - public function tearDown() { - $this-> sScormAnswerFillInBlanks = null; - $this-> sScormAnswerFree = null; - $this-> sScormAnswerHotspot = null; - $this-> sScormAnswerMatching = null; - $this-> sScormAnswerMultipleChoice = null; - $this-> sScormAnswerTrueFalse = null; - $this-> sScormQuestion = null; - } - - -//Class sScormAnswerFillInBlanks - - /** - * Export the text with missing words. - * - * As a side effect, it stores two lists in the class : - * the missing words and their respective weightings. - */ - - function testexport() { - $res= $this->sScormAnswerFillInBlanks->export(); - if(!is_null($res)){ - $this->assertTrue(is_array($res)); - } - //var_dump($res); - } - -//Class sScormAnswerFree - - /** - * Export the text with missing words. - * - * As a side effect, it stores two lists in the class : - * the missing words and their respective weightings. - * - */ - function testexportsScormAnswerFree() { - $res= $this->sScormAnswerFree->export(); - if(!is_null($res)){ - $this->assertTrue(is_array($res)); - } - //var_dump($res); - } - -//Class sScormAnswerHotspot - - /** - * Returns the javascript code that goes with HotSpot exercises - * @return string The JavaScript code - */ - - function testexportsScormAnswerHotspot() { - $res= $this->sScormAnswerHotspot->export(); - if(!is_null($res)){ - $this->assertTrue(is_array($res)); - } - //var_dump($res); - } - - function testgetjsheadersScormAnswerHotspot() { - $res= $this->sScormAnswerHotspot->get_js_header(); - if(!is_null($res)){ - $this->assertTrue(is_string($res)); - } - //var_dump($res); - } - - //Class sScormAnswerMatching - - /** - * Export the question part as a matrix-choice, with only one possible answer per line. - * @author Amand Tihon - */ - - 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 , containing several - */ - - 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 , containing several - */ - - /*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); - } -} -?> diff --git a/tests/main/exercice/fill_blanks.class.test.php b/tests/main/exercice/fill_blanks.class.test.php deleted file mode 100755 index 055e1072e5..0000000000 --- a/tests/main/exercice/fill_blanks.class.test.php +++ /dev/null @@ -1,45 +0,0 @@ -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); - }*/ - -} -?> diff --git a/tests/main/exercice/freeanswer.class.test.php b/tests/main/exercice/freeanswer.class.test.php deleted file mode 100755 index 8b94afc0e0..0000000000 --- a/tests/main/exercice/freeanswer.class.test.php +++ /dev/null @@ -1,29 +0,0 @@ -assertTrue(is_null($res)); - //var_dump($res); - } - - /** - * abstract function which creates the form to create / edit the answers of the question - * @param the formvalidator instance - */ - - function testprocessAnswersCreation () { - $form = new FormValidator('exercise_admin', 'post', api_get_self().'?exerciseId='.$_GET['exerciseId']); - $res =FreeAnswer::processAnswersCreation($form); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - -} -?> diff --git a/tests/main/exercice/hotpotatoes.lib.test.php b/tests/main/exercice/hotpotatoes.lib.test.php deleted file mode 100755 index 78e821c9b9..0000000000 --- a/tests/main/exercice/hotpotatoes.lib.test.php +++ /dev/null @@ -1,178 +0,0 @@ -UnitTestCase('Hotpotatoes exercises library - main/exercice/hotpotatoes.lib.test.php'); - } - - function testCheckImageName() { - $imgparams=array(); - $string=''; - $checked = myarraysearch($imgparams,$string); - $res=CheckImageName(&$imgparams,$string); - $this->assertTrue(is_bool($res)); - $this->assertTrue(is_bool($checked)); - //var_dump($res); - } - - function testCheckSubFolder() { - $path='Location: /main/exercice/'; - $res=CheckSubFolder($path); - $this->assertTrue(is_numeric($res)); - //var_dump($res); - } - - function testFillFolderName() { - $name='testnameofthefolder'; - $nsize=12; - $res=FillFolderName($name,$nsize); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - function testGenerateHiddenList() { - $imgparams=array('test'); - $res=GenerateHiddenList($imgparams); - $this->assertTrue(is_string($res)); - //var_dump($res); - - - } - - function testGenerateHpFolder() { - $folder='main/exercice/hotpotatoes.lib.php'; - $res=GenerateHpFolder($folder); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - function testGetComment() { - - $course_code = 'COURSETEST'; - $path = 'exercice_submit.php'; - $query ="select comment from $dbTable where path='$path'"; - $res=GetComment($path,$course_code); - $this->assertTrue(is_string($res)); - //var_dump($res); - - } - - /* Deprecated - function testGetFileName() { - $fname='main/exercice/hotpotatoes.lib.php'; - $res=GetFileName($fname); - $this->assertTrue(is_string($res)); - //var_dump($res); - }*/ - - function testGetFolderName() { - $fname='main/exercice/hotpotatoes.lib.php'; - $res=GetFolderName($fname); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - function testGetFolderPath() { - $fname='main/exercice/hotpotatoes.lib.php'; - $res=GetFolderPath($fname); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - function testGetImgName() { - $imgtag=''; - $res=GetImgName($imgtag); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - function testGetImgParams() { - $fname='/main/css/academica/images/bg.jpg'; - $fpath='main/css/academica/images/'; - $imgparams= array(); - $imgcount=''; - $res=GetImgParams($fname,$fpath,&$imgparams,&$imgcount); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - function testGetQuizName() { - $course_code = 'COURSETEST'; - $fname='exercice_submit.php'; - $fpath='main/exercice/exercice_submit.php'; - $res=GetQuizName($fname,$fpath); - - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - function testGetSrcName() { - $imgtag='src="test.jpg""'; - $res=GetSrcName($imgtag); - if(!is_string($res))$this->assertTrue(is_bool($res)); - //var_dump($res); - } - - function testhotpotatoes_init() { - $base = api_get_path(SYS_CODE_PATH); - $baseWorkDir=$base.'exercice/'; - $res=hotpotatoes_init($baseWorkDir); - $this->assertFalse($res); - //var_dump($res); - } - - function testHotPotGCt() { - $folder='/main/exercice'; - $flag=4; - $userID=1; - $res=HotPotGCt($folder,$flag,$userID); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - function testmyarraysearch() { - $array=array(); - $node=''; - $res=myarraysearch($array,$node); - if(!is_bool($res))$this->assertTrue(is_null($res)); - //var_dump($res); - } - - function testReadFileCont() { - $full_file_path=''; - $res=ReadFileCont($full_file_path); - if(!is_bool($res))$this->assertTrue(is_string($res)); - //var_dump($res); - } - - function testReplaceImgTag() { - $content='src="test2.jpg"'; - $res=ReplaceImgTag($content); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - function testSetComment() { - global $dbTable; - $path='/main/exercice'; - $comment='testing this function'; - $comment = Database::escape_string($comment); - $query = "UPDATE $dbTable set comment='$comment' where path='$path'"; - $result = Database::query($query); - $res=SetComment($path,$comment); - $this->assertTrue(is_string($res)); - //var_dump($resu); - } - - function testWriteFileCont() { - $course_code = 'COURSETEST'; - $full_file_path='/main/exercice/'; - $content='test test test'; - $res=WriteFileCont($full_file_path,$content); - $this->assertTrue(is_bool($res)); - //var_dump($res); - } -} -?> diff --git a/tests/main/forum/forumfunction.inc.test.php b/tests/main/forum/forumfunction.inc.test.php deleted file mode 100755 index 41d0614aea..0000000000 --- a/tests/main/forum/forumfunction.inc.test.php +++ /dev/null @@ -1,1311 +0,0 @@ -UnitTestCase('Test forum function'); - } - - public function __construct() { - // The constructor acts like a global setUp for the class - require_once api_get_path(SYS_TEST_PATH).'setup.inc.php'; - } - - /** - * This function add a attachment file into forum - * @param string a comment about file - * @param int last id from forum_post table - * @return void - */ - public function testadd_forum_attachment_file() { - global $_course; - $file_comment='testcoment'; - $last_id = 1; - $res = add_forum_attachment_file($file_comment,$last_id); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - /** - * This function approves a post = change - * - * @param $post_id the id of the post that will be deleted - * @param $action make the post visible or invisible - * @return string language variable - */ - - public function testapprove_post() { - $action= 'invisible'; - $post_id = 1; - $res = approve_post($post_id, $action); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - /** - * This function changes the lock status in the database - * - * @param $content what is it that we want to (un)lock: forum category, forum, thread, post - * @param $id the id of the content we want to (un)lock - * @param $action do we lock (=>locked value in db = 1) or unlock (=> locked value in db = 0) - * @return string, language variable - * @todo move to itemmanager - */ - - public function testchange_lock_status() { - $content = 'testcontent'; - $action= 'invisible'; - $id = 1; - $res = change_lock_status($content, $id, $action); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - /** - * This function changes the visibility in the database (item_property) - * - * @param $content what is it that we want to make (in)visible: forum category, forum, thread, post - * @param $id the id of the content we want to make invisible - * @param $target_visibility what is the current status of the visibility (0 = invisible, 1 = visible) - * @todo change the get parameter so that it matches the tool constants. - * @todo check if api_item_property_update returns true or false => returnmessage depends on it. - * @todo move to itemmanager - * @return string language variable - */ - - public function testchange_visibility() { - $content= 'testcontent'; - $target_visibility = 1; - $id = 1; - $res = change_visibility($content, $id, $target_visibility); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - /** - * This function gets the all information of the last (=most recent) post of the thread - * This can be done by sorting the posts that have the field thread_id=$thread_id and sort them by post_date - * @param $thread_id the id of the thread we want to know the last post of. - * @return an bool or array if there is a last post found, false if there is no post entry linked to that thread => thread will be deleted - */ - - public function testcheck_if_last_post_of_thread() { - $thread_id = 1; - $res = check_if_last_post_of_thread($thread_id); - if(!is_bool($res)) { - $this->assertTrue(is_array($res)); - } - //var_dump($res); - } - - /** - * This function returns a piece of html code that make the links grey (=invisible for the student) - * @param boolean 0/1: 0 = invisible, 1 = visible - * @return string language variable - */ - - public function testclass_visible_invisible() { - $current_visibility_status = 0; - $res = class_visible_invisible($current_visibility_status); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - /** - * This function counts the number of forums inside a given category - * @param $cat_id the id of the forum category - * @todo an additional parameter that takes the visibility into account. For instance $countinvisible=0 would return the number - * of visible forums, $countinvisible=1 would return the number of visible and invisible forums - * @return int the number of forums inside the given category - */ - - public function testcount_number_of_forums_in_category() { - $cat_id = 1; - $res = count_number_of_forums_in_category($cat_id); - $this->assertTrue(is_numeric($res)); - //var_dump($res); - } - - /** - * This function counts the number of post inside a thread user - * @param int Thread ID - * @param int User ID - * @return int the number of post inside a thread user - */ - - public function testcount_number_of_post_for_user_thread() { - $thread_id = 1; - $user_id = 1; - $res = count_number_of_post_for_user_thread($thread_id, $user_id); - $this->assertTrue(is_numeric($res)); - //var_dump($res); - } - - /** - * This function counts the number of post inside a thread - * @param int Thread ID - * @return int the number of post inside a thread - */ - - public function testcount_number_of_post_in_thread() { - $thread_id = 1; - $res = count_number_of_post_in_thread($thread_id); - $this->assertTrue(is_numeric($res)); - //var_dump($res); - } - - /** - * This function counts the number of user register in course - * @param int Course ID - * @return int the number of user register in course - */ - - public function testcount_number_of_user_in_course() { - global $cidReq; - $course_id = $cidReq; - $res = count_number_of_user_in_course($course_id); - $this->assertTrue(is_numeric($res)); - //var_dump($res); - } - - /** - * - * This function show current thread qualify . - * @param integer contains the information the current thread id - * @param integer contains the information the current session id - * @return array or null if is empty - */ - - public function testcurrent_qualify_of_thread() { - $thread_id = 1; - $session_id = 1; - $res = current_qualify_of_thread($thread_id,$session_id); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - /** - * Display the search results - * @return void HTML - display the results - */ - - public function testdisplay_forum_search_results() { - global $origin; - $search_term = 'testterm'; - ob_start(); - $res = display_forum_search_results($search_term); - ob_end_clean(); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - - /** - * This function 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 forum_id - * @param $forum_id integer that indicates the forum - * @return array returns - * @deprecated this functionality is now moved to get_forums($forum_id) - */ - /* - function testget_forum_information() { - $forum_id = 1; - $res = get_forum_information($forum_id); - $this->assertTrue(is_array($res)); - //var_dump($res); - }*/ - - /** - * This function retrieves all the information of a given forumcategory id - * @param $forum_id integer that indicates the forum - * @return array returns if there are category - * @return bool returns if there aren't category - */ - - public function testget_forumcategory_information() { - $cat_id = 1; - $res = get_forumcategory_information($cat_id); - if(!is_bool($res)){ - $this->assertTrue(is_array($res)); - } else { - $this->assertTrue(is_bool($res)); - } - //var_dump($res); - } - - /** - * Retrieve all the forums (regardless of their category) or of only one. The forums are sorted according to the forum_order. - * Since it does not take the forum category into account there probably will be two or more forums that have forum_order=1, ... - * @return an array containing all the information about the forums (regardless of their category) - * @todo check $sql4 because this one really looks fishy. - */ - - public function testget_forums() { - $res = get_forums($id=''); - if(!is_bool($res)){ - $this->assertTrue(is_array($res)); - } else { - $this->assertTrue(is_bool($res)); - } - //var_dump($res); - } - - /** - * This function retrieves all the fora in a given forum category - * @param integer $cat_id the id of the forum category - * @return an array containing all the information about the forums (regardless of their category) - */ - - public function testget_forums_in_category() { - $cat_id = 1; - $res = get_forums_in_category($cat_id); - if(!is_bool($res)){ - $this->assertTrue(is_array($res)); - } else { - $this->assertTrue(is_bool($res)); - } - //var_dump($res); - } - - /** - * This function gets all the forum information of the all the forum of the group - * @param integer $group_id the id of the group we need the fora of (see forum.forum_of_group) - * @return array - * @todo this is basically the same code as the get_forums function. Consider merging the two. - */ - - public function testget_forums_of_group() { - $group_id = 1; - $res = get_forums_of_group($group_id); - if(!is_null($res)){ - $this->assertTrue(is_array($res)); - } else { - $this->assertTrue(is_null($res)); - } - //var_dump($res); - } - - /** - * - * This function get qualify historical. - * @param integer contains the information the current user id - * @param integer contains the information the current thread id - * @param boolean contains the information of option to run - * @return array() - */ - - public function 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); - } - - /** - * With this function we find the number of posts and topics in a given forum. - * @param int - * @return array - * @todo consider to call this function only once and let it return an array where the key is the forum id and the value is an array with number_of_topics and number of post - * as key of this array and the value as a value. This could reduce the number of queries needed (especially when there are more forums) - * @todo consider merging both in one query. - * @deprecated the counting mechanism is now inside the function get_forums - */ - /* - function testget_post_topics_of_forum() { - $forum_id = 1; - $res = get_post_topics_of_forum($forum_id); - if(!is_null($res)){ - $this->assertTrue(is_array($res)); - } else { - $this->assertTrue(is_null($res)); - } - //var_dump($res); - }*/ - - /** - * Retrieve all posts of a given thread - * @param int $thread_id integer that indicates the forum - * @return an array containing all the information about the posts of a given thread - */ - - public function testget_posts() { - $thread_id = 1; - $res = 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); - } - - - /** - * This public function is called when the user is not allowed in this forum/thread/... - * @return bool display message of "not allowed" - */ - - public function testforum_not_allowed_here() { - ob_start(); - $res = forum_not_allowed_here(); - ob_end_clean(); - $this->assertTrue(is_bool($res)); - //var_dump($res); - } - - /** - * Delete the all the attachments from the DB and the file according to the post's id or attach id(optional) - * @param post id - * @param attach id (optional) - * @return void - */ - - public function testdelete_attachment() { - global $_course; - $post_id = 1; - $res = delete_attachment($post_id,$id_attach=0); - $this->assertTrue(is_null($res)); - //var_dump($res); - } - - /** - * This public function deletes a forum or a forum category - * This public function currently does not delete the forums inside the category, nor the threads and replies inside these forums. - * For the moment this is the easiest method and it has the advantage that it allows to recover fora that were acidently deleted - * when the forum category got deleted. - * - * @param $content = what we are deleting (a forum or a forum category) - * @param $id The id of the forum category that has to be deleted. - * @return void - * @todo write the code for the cascading deletion of the forums inside a forum category and also the threads and replies inside these forums - * @todo config setting for recovery or not (see also the documents tool: real delete or not). - */ - - public function 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'; - } -} -?> diff --git a/tests/main/gradebook/lib/be/attendancelink.class.test.php b/tests/main/gradebook/lib/be/attendancelink.class.test.php deleted file mode 100755 index e1730f5989..0000000000 --- a/tests/main/gradebook/lib/be/attendancelink.class.test.php +++ /dev/null @@ -1,135 +0,0 @@ -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'); - } -} -?> diff --git a/tests/main/gradebook/lib/be/category.class.test.php b/tests/main/gradebook/lib/be/category.class.test.php deleted file mode 100755 index 84de01e4f4..0000000000 --- a/tests/main/gradebook/lib/be/category.class.test.php +++ /dev/null @@ -1,423 +0,0 @@ -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'); - } -} -?> diff --git a/tests/main/gradebook/lib/be/dropboxlink.class.test.php b/tests/main/gradebook/lib/be/dropboxlink.class.test.php deleted file mode 100755 index 7fdc4cfbfd..0000000000 --- a/tests/main/gradebook/lib/be/dropboxlink.class.test.php +++ /dev/null @@ -1,42 +0,0 @@ -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'); - } -} -?> diff --git a/tests/main/gradebook/lib/be/evaluation.class.test.php b/tests/main/gradebook/lib/be/evaluation.class.test.php deleted file mode 100755 index c2abdabab8..0000000000 --- a/tests/main/gradebook/lib/be/evaluation.class.test.php +++ /dev/null @@ -1,347 +0,0 @@ -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'); - } -} -?> diff --git a/tests/main/gradebook/lib/be/exerciselink.class.test.php b/tests/main/gradebook/lib/be/exerciselink.class.test.php deleted file mode 100755 index 773fe039e2..0000000000 --- a/tests/main/gradebook/lib/be/exerciselink.class.test.php +++ /dev/null @@ -1,153 +0,0 @@ -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'); - } -} -?> diff --git a/tests/main/gradebook/lib/be/forumthreadlink.class.test.php b/tests/main/gradebook/lib/be/forumthreadlink.class.test.php deleted file mode 100755 index d3e233be24..0000000000 --- a/tests/main/gradebook/lib/be/forumthreadlink.class.test.php +++ /dev/null @@ -1,42 +0,0 @@ -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'); - } - -} -?> \ No newline at end of file diff --git a/tests/main/inc/banner.inc.test.php b/tests/main/inc/banner.inc.test.php deleted file mode 100755 index e14ddf8226..0000000000 --- a/tests/main/inc/banner.inc.test.php +++ /dev/null @@ -1,21 +0,0 @@ -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); - } -} diff --git a/tests/main/inc/course_document.lib.test.php b/tests/main/inc/course_document.lib.test.php deleted file mode 100755 index d91337584b..0000000000 --- a/tests/main/inc/course_document.lib.test.php +++ /dev/null @@ -1,35 +0,0 @@ -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); - } -} diff --git a/tests/main/inc/lib/access_url_edit_courses_to_url_functions.lib.test.php b/tests/main/inc/lib/access_url_edit_courses_to_url_functions.lib.test.php deleted file mode 100755 index 35a4357f6d..0000000000 --- a/tests/main/inc/lib/access_url_edit_courses_to_url_functions.lib.test.php +++ /dev/null @@ -1,35 +0,0 @@ -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); - } - - - -} - -?> diff --git a/tests/main/inc/lib/access_url_edit_sessions_to_url_functions.lib.test.php b/tests/main/inc/lib/access_url_edit_sessions_to_url_functions.lib.test.php deleted file mode 100755 index f2bb8cbec3..0000000000 --- a/tests/main/inc/lib/access_url_edit_sessions_to_url_functions.lib.test.php +++ /dev/null @@ -1,32 +0,0 @@ -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); - - } - -} -?> diff --git a/tests/main/inc/lib/access_url_edit_users_to_url_functions.lib.test.php b/tests/main/inc/lib/access_url_edit_users_to_url_functions.lib.test.php deleted file mode 100755 index 90d21f2f73..0000000000 --- a/tests/main/inc/lib/access_url_edit_users_to_url_functions.lib.test.php +++ /dev/null @@ -1,33 +0,0 @@ -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); - - } - -} - -?> diff --git a/tests/main/inc/lib/add_course.lib.inc.test.php b/tests/main/inc/lib/add_course.lib.inc.test.php deleted file mode 100755 index 79eea6f3fc..0000000000 --- a/tests/main/inc/lib/add_course.lib.inc.test.php +++ /dev/null @@ -1,137 +0,0 @@ -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 TestLang2db(){ - $string = 'test'; - $res = AddCourse::lang2db($string); - $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); - } - } -} diff --git a/tests/main/inc/lib/add_courses_to_sessions_functions.lib.test.php b/tests/main/inc/lib/add_courses_to_sessions_functions.lib.test.php deleted file mode 100755 index a8c125d93b..0000000000 --- a/tests/main/inc/lib/add_courses_to_sessions_functions.lib.test.php +++ /dev/null @@ -1,34 +0,0 @@ -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); - - } - -} - -?> diff --git a/tests/main/inc/lib/add_many_session_to_category_functions.lib.test.php b/tests/main/inc/lib/add_many_session_to_category_functions.lib.test.php deleted file mode 100755 index 8e81719059..0000000000 --- a/tests/main/inc/lib/add_many_session_to_category_functions.lib.test.php +++ /dev/null @@ -1,29 +0,0 @@ -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); - } -} -?> diff --git a/tests/main/inc/lib/blog.lib.test.php b/tests/main/inc/lib/blog.lib.test.php deleted file mode 100755 index 82b6d50a19..0000000000 --- a/tests/main/inc/lib/blog.lib.test.php +++ /dev/null @@ -1,598 +0,0 @@ -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); - } - - */ - - - - - -} -?> diff --git a/tests/main/inc/lib/classmanager.lib.test.php b/tests/main/inc/lib/classmanager.lib.test.php deleted file mode 100755 index 818841ef0a..0000000000 --- a/tests/main/inc/lib/classmanager.lib.test.php +++ /dev/null @@ -1,94 +0,0 @@ -UnitTestCase('Class (students) manager library - main/inc/lib/classmanager.lib.test.php'); - } - function testAddUser() { - $user_id='1'; - $class_id='1'; - $res=ClassManager::add_user($user_id, $class_id); - $this->assertNull($res); - $this->assertTrue(is_null($res)); - } - - function testclass_name_exists() { - $name='arthur'; - $res=ClassManager::class_name_exists($name); - $this->assertTrue(is_bool($res)); - } - - function testCreateClass() { - $name='new class'; - $res=ClassManager::create_class($name); - $this->assertTrue(is_bool($res)); - } - - function testDeleteClass() { - $class_id='new class'; - $res=ClassManager::delete_class($class_id); - $this->assertTrue(is_null($res)); - } - - function testGetClassId() { - $name='new class'; - $res=ClassManager::get_class_id($name); - $this->assertTrue(is_numeric($res)); - } - - function testGetClassInfo() { - $class_id='1'; - $res=ClassManager::get_class_info($class_id); - $this->assertTrue(is_array($res)); - } - - function testGetClassesInCourse() { - $course_code='FDI'; - $res=ClassManager::get_classes_in_course($course_code); - $this->assertTrue(is_array($res)); - } - - function testGetCourses() { - $class_id='1'; - $res=ClassManager::get_courses($class_id); - $this->assertTrue(is_array($res)); - } - - function testGetUsers() { - $class_id='1'; - $res=ClassManager::get_users($class_id); - $this->assertTrue(is_array($res)); - } - - function testSetName() { - $name='new class'; - $class_id='1'; - $res=ClassManager::set_name($name, $class_id); - $this->assertTrue(is_null($res)); - } - - function testSubscribeToCourse() { - $class_id='1'; - $course_code='FDI'; - $res=ClassManager::subscribe_to_course($class_id,$course_code); - $this->assertTrue(is_null($res)); - } - - function testUnsubscribeFromCourse() { - $class_id='1'; - $course_code='FDI'; - $res=ClassManager::unsubscribe_from_course($class_id, $course_code); - $this->assertTrue(is_null($res)); - } - - function testUnsubscribeUser() { - $user_id='1'; - $class_id='1'; - $res=ClassManager::unsubscribe_user($user_id, $class_id); - $this->assertTrue(is_null($res)); - } - -} -?> diff --git a/tests/main/inc/lib/database.lib.test.php b/tests/main/inc/lib/database.lib.test.php deleted file mode 100755 index 2a46801f62..0000000000 --- a/tests/main/inc/lib/database.lib.test.php +++ /dev/null @@ -1,173 +0,0 @@ -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)); - } -} -?> diff --git a/tests/main/inc/lib/debug.lib.inc.test.php b/tests/main/inc/lib/debug.lib.inc.test.php deleted file mode 100755 index 6632f87d30..0000000000 --- a/tests/main/inc/lib/debug.lib.inc.test.php +++ /dev/null @@ -1,65 +0,0 @@ -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)); - } -} -?> diff --git a/tests/main/inc/lib/display.lib.test.php b/tests/main/inc/lib/display.lib.test.php deleted file mode 100755 index 543c9e79f1..0000000000 --- a/tests/main/inc/lib/display.lib.test.php +++ /dev/null @@ -1,269 +0,0 @@ -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