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 @@
-
-
-
';
- $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