From c97c124ea7b28f8cfe7385bca430988a6ec73822 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Tue, 20 Jul 2010 14:04:37 -0500 Subject: [PATCH] Minor - test lib description update --- tests/main/course_info/download.lib.test.php | 25 ++-- .../export/qti2/qti2_classes.test.php | 52 +++---- .../export/scorm/scorm_classes.test.php | 88 ++++++----- .../lib/be/attendancelink.class.test.php | 45 +++--- .../gradebook/lib/be/category.class.test.php | 137 +++++++++--------- .../lib/be/dropboxlink.class.test.php | 17 ++- .../lib/be/evaluation.class.test.php | 111 +++++++------- .../lib/be/exerciselink.class.test.php | 57 ++++---- .../lib/be/forumthreadlink.class.test.php | 21 +-- tests/main/inc/lib/debug.lib.inc.test.php | 3 + tests/main/newscorm/scorm.lib.test.php | 4 + .../permissions_functions.inc.test.php | 48 +++--- tests/main/search/search_suggestions.test.php | 10 +- tests/main/user/userInfoLib.test.php | 10 +- .../user_import/import.lib.test.php | 10 +- 15 files changed, 333 insertions(+), 305 deletions(-) mode change 100644 => 100755 tests/main/exercice/export/qti2/qti2_classes.test.php mode change 100644 => 100755 tests/main/exercice/export/scorm/scorm_classes.test.php mode change 100644 => 100755 tests/main/gradebook/lib/be/attendancelink.class.test.php mode change 100644 => 100755 tests/main/gradebook/lib/be/dropboxlink.class.test.php mode change 100644 => 100755 tests/main/gradebook/lib/be/evaluation.class.test.php mode change 100644 => 100755 tests/main/gradebook/lib/be/exerciselink.class.test.php mode change 100644 => 100755 tests/main/gradebook/lib/be/forumthreadlink.class.test.php mode change 100644 => 100755 tests/main/search/search_suggestions.test.php diff --git a/tests/main/course_info/download.lib.test.php b/tests/main/course_info/download.lib.test.php index 7b5fdfc8aa..c62b0e11c6 100755 --- a/tests/main/course_info/download.lib.test.php +++ b/tests/main/course_info/download.lib.test.php @@ -4,19 +4,20 @@ require_once api_get_path(SYS_CODE_PATH).'course_info/download.lib.php'; class TestCreateBackupIsAdmin extends UnitTestCase { + public function __construct() { + $this->UnitTestCase('Course download library - main/course_info/download.lib.test.php'); + } + public function Testcreate_backup_is_admin() + { + $_GET = array('archive' => 'index.html'); - public function Testcreate_backup_is_admin() - { - $_GET = array('archive' => 'index.html'); - - $resTrue = create_backup_is_admin(true); - $this->assertTrue(is_bool($resTrue)); - $resFalse = create_backup_is_admin(false); - $this->assertFalse($resFalse); - $this->assertEqual($resTrue , $resFalse); - //var_dump($resTrue, $resFalse); - - } + $resTrue = create_backup_is_admin(true); + $this->assertTrue(is_bool($resTrue)); + $resFalse = create_backup_is_admin(false); + $this->assertFalse($resFalse); + $this->assertEqual($resTrue , $resFalse); + //var_dump($resTrue, $resFalse); + } } ?> diff --git a/tests/main/exercice/export/qti2/qti2_classes.test.php b/tests/main/exercice/export/qti2/qti2_classes.test.php old mode 100644 new mode 100755 index c6beadac1b..631e86bed9 --- a/tests/main/exercice/export/qti2/qti2_classes.test.php +++ b/tests/main/exercice/export/qti2/qti2_classes.test.php @@ -20,28 +20,28 @@ define('FREE_ANSWER', 5); define('HOTSPOT', 6); class TestQti2 extends UnitTestCase { - + public $qIms2Question; public $qImsAnswerFillInBlanks; public $qImsAnswerFree; public $qImsAnswerHotspot; public $qImsAnswerMatching; public $qImsAnswerMultipleChoice; - - public function TestQti2() { - $this->UnitTestCase(''); + + public function __construct() { + $this->UnitTestCase('QTI2 library - main/exercice/export/qti2/qti2_classes.test.php'); } - - public function setUp() { - $this->qIms2Question = new Ims2Question(); + + public function setUp() { + $this->qIms2Question = new Ims2Question(); $this->qImsAnswerFillInBlanks = new ImsAnswerFillInBlanks(1); $this->qImsAnswerFree = new ImsAnswerFree(1); - $this->qImsAnswerHotspot = new ImsAnswerHotspot(1); + $this->qImsAnswerHotspot = new ImsAnswerHotspot(1); $this->qImsAnswerMatching = new ImsAnswerMatching(1); $this->qImsAnswerMultipleChoice = new ImsAnswerMultipleChoice(1); } - - public function tearDown() { + + public function tearDown() { $this-> qIms2Question = null; $this-> qImsAnswerFillInBlanks = null; $this-> qImsAnswerFree = null; @@ -49,12 +49,12 @@ class TestQti2 extends UnitTestCase { $this-> qImsAnswerMatching = null; $this-> qImsAnswerMultipleChoice = null; } - + //Class qIms2Question /** * Include the correct answer class and create answer */ - + function testsetAnswer() { $res=Ims2Question::setAnswer(); if(!is_null){ @@ -62,14 +62,14 @@ class TestQti2 extends UnitTestCase { } //var_dump($res); } - + function testcreateAnswersForm() { $form = array(1); $res=Ims2Question::createAnswersForm($form); $this->assertTrue(is_bool($res)); //var_dump($res); } - + function testprocessAnswersCreation() { $form = array(1); $res=Ims2Question::processAnswersCreation($form); @@ -94,7 +94,7 @@ class TestQti2 extends UnitTestCase { } //var_dump($res); } - + function testimsExportResponsesDeclaration() { $questionIdent = array(1); $res=$this->qImsAnswerFillInBlanks->imsExportResponsesDeclaration($questionIdent); @@ -110,7 +110,7 @@ class TestQti2 extends UnitTestCase { * TODO implement * Export the question part as a matrix-choice, with only one possible answer per line. */ - + function testImsExportResponsesqImsAnswerFree() { $questionIdent = array(''); $questionStatment = array(''); @@ -118,22 +118,22 @@ class TestQti2 extends UnitTestCase { $this->assertTrue(is_string($res)); //var_dump($res); } - + function testImsExportResponsesDeclarationqImsAnswerFree() { $questionIdent = array(1); $res=$this->qImsAnswerFree->imsExportResponsesDeclaration($questionIdent); $this->assertTrue(is_string($res)); //var_dump($res); } - - + + //Class qImsAnswerHotspot /** * TODO update this to match hotspots instead of copying matching * Export the question part as a matrix-choice, with only one possible answer per line. */ - + function testimsExportResponsesqImsAnswerHotspot() { $questionIdent = array(1); $questionStatment = array(1); @@ -141,7 +141,7 @@ class TestQti2 extends UnitTestCase { $this->assertTrue(is_string($res)); //var_dump($res); } - + function testimsExportResponsesDeclarationqImsAnswerHotspot() { $questionIdent = array(1); @@ -149,13 +149,13 @@ class TestQti2 extends UnitTestCase { $this->assertTrue(is_string($res)); //var_dump($res); } - + //Class qImsAnswerMatching /** * Export the question part as a matrix-choice, with only one possible answer per line. */ - + function testimsExportResponsesqImsAnswerMatching() { $questionIdent = array(1); $questionStatment = array(1); @@ -163,7 +163,7 @@ class TestQti2 extends UnitTestCase { $this->assertTrue(is_string($res)); //var_dump($res); } - + function testimsExportResponsesDeclarationqImsAnswerMatching() { $questionIdent = array(1); @@ -178,7 +178,7 @@ class TestQti2 extends UnitTestCase { * Return the XML flow for the possible answers. * */ - + function testimsExportResponsesqImsAnswerMultipleChoice() { $questionIdent = array(1); $questionStatment = array(1); @@ -186,7 +186,7 @@ class TestQti2 extends UnitTestCase { $this->assertTrue(is_string($res)); //var_dump($res); } - + function testimsExportResponsesDeclarationqImsAnswerMultipleChoice() { $questionIdent = array(1); diff --git a/tests/main/exercice/export/scorm/scorm_classes.test.php b/tests/main/exercice/export/scorm/scorm_classes.test.php old mode 100644 new mode 100755 index 0e4f0a75e0..c84b2adef3 --- a/tests/main/exercice/export/scorm/scorm_classes.test.php +++ b/tests/main/exercice/export/scorm/scorm_classes.test.php @@ -27,7 +27,7 @@ define('HOT_SPOT_DELINEATION', 8); define('MULTIPLE_ANSWER_COMBINATION', 9); class TestScormClasses extends UnitTestCase { - + public $sScormAnswerFillInBlanks; public $sScormAnswerFree; public $sScormAnswerHotspot; @@ -35,24 +35,22 @@ class TestScormClasses extends UnitTestCase { public $sScormAnswerMultipleChoice; public $sScormAnswerTrueFalse; public $sScormQuestion; - - - - public function TestScormClasses() { - $this->UnitTestCase(''); + + public function __construct() { + $this->UnitTestCase('SCORM exercises export library - main/exercice/export/scorm/scorm_classes.test.php'); } - - public function setUp() { - $this->sScormAnswerFillInBlanks = new ScormAnswerFillInBlanks(1); + + public function setUp() { + $this->sScormAnswerFillInBlanks = new ScormAnswerFillInBlanks(1); $this->sScormAnswerFree = new ScormAnswerFree(1); - $this->sScormAnswerHotspot = new ScormAnswerHotspot(1); + $this->sScormAnswerHotspot = new ScormAnswerHotspot(1); $this->sScormAnswerMatching = new ScormAnswerMatching(1); $this->sScormAnswerMultipleChoice = new ScormAnswerMultipleChoice(1); $this->sScormAnswerTrueFalse = new ScormAnswerTrueFalse(1); $this->sScormQuestion = new ScormQuestion(1); } - - public function tearDown() { + + public function tearDown() { $this-> sScormAnswerFillInBlanks = null; $this-> sScormAnswerFree = null; $this-> sScormAnswerHotspot = null; @@ -61,8 +59,8 @@ class TestScormClasses extends UnitTestCase { $this-> sScormAnswerTrueFalse = null; $this-> sScormQuestion = null; } - - + + //Class sScormAnswerFillInBlanks /** @@ -71,15 +69,15 @@ class TestScormClasses extends UnitTestCase { * As a side effect, it stores two lists in the class : * the missing words and their respective weightings. */ - - function testexport() { + + function testexport() { $res= $this->sScormAnswerFillInBlanks->export(); if(!is_null($res)){ $this->assertTrue(is_array($res)); } //var_dump($res); } - + //Class sScormAnswerFree /** @@ -89,85 +87,85 @@ class TestScormClasses extends UnitTestCase { * the missing words and their respective weightings. * */ - function testexportsScormAnswerFree() { + function testexportsScormAnswerFree() { $res= $this->sScormAnswerFree->export(); if(!is_null($res)){ $this->assertTrue(is_array($res)); } //var_dump($res); } - + //Class sScormAnswerHotspot /** * Returns the javascript code that goes with HotSpot exercises * @return string The JavaScript code */ - - function testexportsScormAnswerHotspot() { + + function testexportsScormAnswerHotspot() { $res= $this->sScormAnswerHotspot->export(); if(!is_null($res)){ $this->assertTrue(is_array($res)); } //var_dump($res); } - - function testgetjsheadersScormAnswerHotspot() { + + function testgetjsheadersScormAnswerHotspot() { $res= $this->sScormAnswerHotspot->get_js_header(); if(!is_null($res)){ $this->assertTrue(is_string($res)); } //var_dump($res); } - + //Class sScormAnswerMatching /** * Export the question part as a matrix-choice, with only one possible answer per line. * @author Amand Tihon */ - - function testexportsScormAnswerMatching() { + + function testexportsScormAnswerMatching() { $res= $this->sScormAnswerMatching->export(); if(!is_null($res)){ $this->assertTrue(is_array($res)); } //var_dump($res); } - + //Class sScormAnswerMultipleChoice /** * Return HTML code for possible answers */ - - function testexportsScormAnswerMultipleChoice() { + + function testexportsScormAnswerMultipleChoice() { $res= $this->sScormAnswerMultipleChoice->export(); if(!is_null($res)){ $this->assertTrue(is_array($res)); } //var_dump($res); } - + //Class sScormAnswerTrueFalse /** * Return the XML flow for the possible answers. * That's one , containing several */ - - function testexportsScormAnswerTrueFalse() { + + function testexportsScormAnswerTrueFalse() { $res= $this->sScormAnswerTrueFalse->export(); if(!is_null($res)){ $this->assertTrue(is_array($res)); } //var_dump($res); } - + //Class sScormQuestion - function testcreateAnswersFormsScormQuestion() { - $form = ''; + function testcreateAnswersFormsScormQuestion() { + $form = ''; $res= $this->sScormQuestion->createAnswersForm($form); if(!is_null($res)){ $this->assertTrue(is_bool($res)); @@ -179,52 +177,52 @@ class TestScormClasses extends UnitTestCase { * Return the XML flow for the possible answers. * That's one , containing several */ - - /*function testexportsScormQuestion() { + + /*function testexportsScormQuestion() { $res= $this->sScormQuestion->export(); if(!is_null($res)){ $this->assertTrue(is_array($res)); } //var_dump($res); }*/ - + /** * Returns an HTML-formatted question */ /* - function testgetQuestionHTMLsScormQuestion() { + function testgetQuestionHTMLsScormQuestion() { $res= $this->sScormQuestion->getQuestionHTML(); if(!is_null($res)){ $this->assertTrue(is_array($res)); } //var_dump($res); }*/ - + /** * Return the JavaScript code bound to the question */ /* - function testgetQuestionJSsScormQuestion() { + function testgetQuestionJSsScormQuestion() { $res= ScormQuestion::getQuestionJS(); if(!is_null($res)){ $this->assertTrue(is_array($res)); } //var_dump($res); }*/ - + function testprocessAnswersCreationJSsScormQuestion() { - $form = ''; + $form = ''; $res= $this->sScormQuestion->processAnswersCreation($form); if(!is_null($res)){ $this->assertTrue(is_bool($res)); } //var_dump($res); } - + /** * Include the correct answer class and create answer */ - + function testsetAnswersCreationJSsScormQuestion() { $res= $this->sScormQuestion->setAnswer(); if(!is_null($res)){ diff --git a/tests/main/gradebook/lib/be/attendancelink.class.test.php b/tests/main/gradebook/lib/be/attendancelink.class.test.php old mode 100644 new mode 100755 index d4ad9b345b..e1730f5989 --- a/tests/main/gradebook/lib/be/attendancelink.class.test.php +++ b/tests/main/gradebook/lib/be/attendancelink.class.test.php @@ -1,14 +1,15 @@ UnitTestCase('Test Attendance Link'); } public function __construct() { - // The constructor acts like a global setUp for the class - global $date; + $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'); @@ -22,18 +23,18 @@ class TestAttendanceLink extends UnitTestCase { $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(); @@ -45,81 +46,81 @@ class TestAttendanceLink extends UnitTestCase { $_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)); @@ -127,8 +128,8 @@ class TestAttendanceLink extends UnitTestCase { } public function __destruct() { - // The destructor acts like a global tearDown for the class - TestManager::delete_test_course('COURSEATTENDANCELINK'); + // 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 index 8cbd9be6c9..84de01e4f4 100755 --- a/tests/main/gradebook/lib/be/category.class.test.php +++ b/tests/main/gradebook/lib/be/category.class.test.php @@ -1,31 +1,32 @@ UnitTestCase('Test Category Class'); } public function __construct() { - // The constructor acts like a global setUp for the class + $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_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(); @@ -33,24 +34,24 @@ class TestCategoryClass extends UnitTestCase { $_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)); @@ -63,7 +64,7 @@ class TestCategoryClass extends UnitTestCase { * @param $parent parent category * @return bool */ - + public function testdoes_name_exist() { $name = 'test'; $parent=1; @@ -71,13 +72,13 @@ class TestCategoryClass extends UnitTestCase { $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(); @@ -85,61 +86,61 @@ class TestCategoryClass extends UnitTestCase { $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; @@ -147,13 +148,13 @@ class TestCategoryClass extends UnitTestCase { $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)); @@ -165,55 +166,55 @@ class TestCategoryClass extends UnitTestCase { $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) @@ -221,20 +222,20 @@ class TestCategoryClass extends UnitTestCase { * @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)) { @@ -243,83 +244,83 @@ class TestCategoryClass extends UnitTestCase { $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 @@ -330,13 +331,13 @@ class TestCategoryClass extends UnitTestCase { * @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, @@ -344,49 +345,49 @@ class TestCategoryClass extends UnitTestCase { * 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); @@ -397,17 +398,17 @@ class TestCategoryClass extends UnitTestCase { /** * 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)); @@ -415,8 +416,8 @@ class TestCategoryClass extends UnitTestCase { } public function __destruct() { - // The destructor acts like a global tearDown for the class - TestManager::delete_test_course('COURSECATEGORYCLASS'); + // 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 old mode 100644 new mode 100755 index 8906160f8a..7fdc4cfbfd --- a/tests/main/gradebook/lib/be/dropboxlink.class.test.php +++ b/tests/main/gradebook/lib/be/dropboxlink.class.test.php @@ -1,32 +1,33 @@ UnitTestCase('Test Drop Box Link'); - } + } public function __construct() { - // The constructor acts like a global setUp for the class + $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)); @@ -34,8 +35,8 @@ class TestDropBoxLink extends UnitTestCase { } public function __destruct() { - // The destructor acts like a global tearDown for the class - TestManager::delete_test_course('COURSEDROPBOXLINK'); + // 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 old mode 100644 new mode 100755 index 5ead1a63d9..c2abdabab8 --- a/tests/main/gradebook/lib/be/evaluation.class.test.php +++ b/tests/main/gradebook/lib/be/evaluation.class.test.php @@ -1,12 +1,13 @@ UnitTestCase('Test Evaluation'); } public function __construct() { - // The constructor acts like a global setUp for the class + $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(); @@ -21,24 +22,24 @@ class TestEvaluation extends UnitTestCase { $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) @@ -46,49 +47,49 @@ class TestEvaluation extends UnitTestCase { * 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; @@ -96,14 +97,14 @@ class TestEvaluation extends UnitTestCase { $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 + //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; @@ -117,128 +118,128 @@ class TestEvaluation extends UnitTestCase { $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 @@ -247,91 +248,91 @@ class TestEvaluation extends UnitTestCase { * @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)); @@ -339,8 +340,8 @@ class TestEvaluation extends UnitTestCase { } public function __destruct() { - // The destructor acts like a global tearDown for the class - TestManager::delete_test_course('COURSEEVALUATION'); + // 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 old mode 100644 new mode 100755 index a2164b8312..773fe039e2 --- a/tests/main/gradebook/lib/be/exerciselink.class.test.php +++ b/tests/main/gradebook/lib/be/exerciselink.class.test.php @@ -1,14 +1,15 @@ UnitTestCase('Test Exercise Link'); } public function __construct() { - global $date; + $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'); + TestManager::create_test_course('COURSEEXERCISELINK'); $this->exerciselink = new ExerciseLink(); $this->exerciselink-> set_id (1); $this->exerciselink-> set_name ('test'); @@ -21,18 +22,18 @@ class TestExerciseLink extends UnitTestCase { $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) @@ -40,52 +41,52 @@ class TestExerciseLink extends UnitTestCase { * 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(); @@ -93,51 +94,51 @@ class TestExerciseLink extends UnitTestCase { $_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)); @@ -145,8 +146,8 @@ class TestExerciseLink extends UnitTestCase { } public function __destruct() { - // The destructor acts like a global tearDown for the class - TestManager::delete_test_course('COURSEEXERCISELINK'); + // 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 old mode 100644 new mode 100755 index 493db7f7a8..d3e233be24 --- a/tests/main/gradebook/lib/be/forumthreadlink.class.test.php +++ b/tests/main/gradebook/lib/be/forumthreadlink.class.test.php @@ -1,12 +1,13 @@ UnitTestCase('Test Forum Thread Link'); } public function __construct() { - // The constructor acts like a global setUp for the class + $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); @@ -18,9 +19,9 @@ class TestForumThreadLink extends UnitTestCase { $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); @@ -29,13 +30,13 @@ class TestForumThreadLink extends UnitTestCase { $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'); + // 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/lib/debug.lib.inc.test.php b/tests/main/inc/lib/debug.lib.inc.test.php index 05aad14752..b0c969bd1a 100755 --- a/tests/main/inc/lib/debug.lib.inc.test.php +++ b/tests/main/inc/lib/debug.lib.inc.test.php @@ -4,6 +4,9 @@ require_once(api_get_path(LIBRARY_PATH).'debug.lib.inc.php'); class TestDebug extends UnitTestCase { + public function __construct() { + $this->UnitTestCase('Debug helper library - main/inc/lib/debug.lib.inc.test.php'); + } function testDebugFunction() { $variable='br'; ob_start(); diff --git a/tests/main/newscorm/scorm.lib.test.php b/tests/main/newscorm/scorm.lib.test.php index 00616ddc06..8d1c262f20 100755 --- a/tests/main/newscorm/scorm.lib.test.php +++ b/tests/main/newscorm/scorm.lib.test.php @@ -3,6 +3,10 @@ require_once(api_get_path(SYS_CODE_PATH).'newscorm/scorm.lib.php'); class TestScormLib extends UnitTestCase { + public function __construct() { + $this->UnitTestCase('SCORM library - main/newscorm/scorm.lib.test.php'); + } + /** * This public function gets a list of scorm paths located in a given directory * @param string Base directory path diff --git a/tests/main/permissions/permissions_functions.inc.test.php b/tests/main/permissions/permissions_functions.inc.test.php index 268d3d9650..cde0c28d9c 100755 --- a/tests/main/permissions/permissions_functions.inc.test.php +++ b/tests/main/permissions/permissions_functions.inc.test.php @@ -3,7 +3,11 @@ require_once api_get_path(SYS_CODE_PATH).'permissions/permissions_functions.inc. //require_once dirname(__FILE__).'/../main/permissions/permissions_functions.inc.php'; class TestPermissions extends UnitTestCase { - /** + + public function __construct() { + $this->UnitTestCase('Permissions library - main/permissions/permissions_functions.inc.test.php'); + } + /** * This function is called when we assign a role to a user or a group * @param string * @param string @@ -18,14 +22,14 @@ class TestPermissions extends UnitTestCase { $role_id=1; $scope='course'; $res = assign_role($content, $action, $id, $role_id, $scope); - $this->assertTrue(is_string($res)); + $this->assertTrue(is_string($res)); //var_dump($res); } - + /** This function displays a checked or unchecked checkbox. The checkbox will be checked if the * user, group or role has the permission for the given tool, unchecked if the user, group or role - * does not have the right + * does not have the right * @param array * @param string * @param string @@ -39,7 +43,7 @@ class TestPermissions extends UnitTestCase { $permission=1; $inherited_permissions=array(); $res = display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions); - $this->assertTrue(is_null($res)); + $this->assertTrue(is_null($res)); ob_end_clean(); //var_dump($res); } @@ -60,7 +64,7 @@ class TestPermissions extends UnitTestCase { $course_admin=false; $editable=true; $res = display_image_matrix($permission_array, $tool, $permission,$inherited_permissions, $course_admin, $editable); - $this->assertTrue(is_null($res)); + $this->assertTrue(is_null($res)); //ob_end_clean(); //var_dump($res); } @@ -74,7 +78,7 @@ class TestPermissions extends UnitTestCase { * @param string * @param array * @param bool - */ + */ function testDisplayImageMatrixForBlogs(){ $permission_array=array(); $user_id=1; @@ -84,13 +88,13 @@ class TestPermissions extends UnitTestCase { $course_admin=false; $editable=true; $res = display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission,$inherited_permissions, $course_admin, $editable); - $this->assertTrue(is_null($res)); + $this->assertTrue(is_null($res)); //var_dump($res); } /** * This function displays a list off all the roles of the course (and those defined by the platform admin) - * @param - * @param + * @param + * @param */ function testDisplayRoleList(){ $current_course_roles=''; @@ -109,8 +113,8 @@ class TestPermissions extends UnitTestCase { $res = get_all_roles($content); if (!is_null($res)){ $this->assertTrue(is_array($res)); - } - //var_dump($res); + } + //var_dump($res); } /** * This function retrieves the existing permissions of a user, group or role. @@ -122,7 +126,7 @@ class TestPermissions extends UnitTestCase { $id=1; $res = get_permissions($content, $id); $this->assertTrue(is_array($res)); - //var_dump($res); + //var_dump($res); } /** * This function gets all the current roles of the user or group @@ -136,7 +140,7 @@ class TestPermissions extends UnitTestCase { $scope='course'; $res = get_roles($content, $id, $scope); $this->assertTrue(is_array($res)); - //var_dump($res); + //var_dump($res); } /** * This function gets all the roles that are defined @@ -153,7 +157,7 @@ class TestPermissions extends UnitTestCase { if (!is_null($res)){ $this->assertTrue(is_array($res)); } - //var_dump($res); + //var_dump($res); } /** * the array that contains the current permission a user, group or role has will now be changed depending on @@ -170,18 +174,18 @@ class TestPermissions extends UnitTestCase { if (!is_null($res)){ $this->assertTrue(is_array($res)); } - //var_dump($res); + //var_dump($res); } - + function testMyPrintR(){ ob_start(); $array=''; $res = my_print_r($array); - $this->assertTrue(is_null($res)); + $this->assertTrue(is_null($res)); ob_end_clean(); //var_dump($res); } - + /** * This function merges permission arrays. Each permission array has the following structure * a permission array has a tool contanst as a key and an array as a value. This value array consists of all the permissions that are granted in that tool. @@ -191,7 +195,7 @@ class TestPermissions extends UnitTestCase { $array2=array(); $res = permission_array_merge($array1, $array2); $this->assertTrue(is_array($res)); - //var_dump($res); + //var_dump($res); } /** * This function stores one permission in the correct table. @@ -208,7 +212,7 @@ class TestPermissions extends UnitTestCase { } else { $this->assertNull($res); } - //var_dump($res); + //var_dump($res); } /** * This function stores the permissions in the correct table. @@ -225,7 +229,7 @@ class TestPermissions extends UnitTestCase { $id=1; $res = store_permissions($content, $id); $this->assertTrue(is_string($res)); - //var_dump($res); + //var_dump($res); } } ?> \ No newline at end of file diff --git a/tests/main/search/search_suggestions.test.php b/tests/main/search/search_suggestions.test.php old mode 100644 new mode 100755 index b520fa03b9..72b854ca8d --- a/tests/main/search/search_suggestions.test.php +++ b/tests/main/search/search_suggestions.test.php @@ -1,14 +1,18 @@ UnitTestCase('Search suggestions library - main/search/search_suggestions.test.php'); + } + function testGetSuggestionsFromSearchEngine() { //ob_start(); $q=1; $res = get_suggestions_from_search_engine($q); - $this->assertTrue(is_null($res)); + $this->assertTrue(is_null($res)); //ob_end_clean(); //var_dump($res); - } + } } ?> \ No newline at end of file diff --git a/tests/main/user/userInfoLib.test.php b/tests/main/user/userInfoLib.test.php index 42081a3005..ad511d7c2b 100755 --- a/tests/main/user/userInfoLib.test.php +++ b/tests/main/user/userInfoLib.test.php @@ -4,6 +4,10 @@ require_once(api_get_path(LIBRARY_PATH).'course.lib.php'); class TestUserInfoLib extends UnitTestCase { + public function __construct() { + $this->UnitTestCase('User info library - main/user/userInfoLib.test.php'); + } + /** * clean the content of a bloc for information category */ @@ -162,13 +166,13 @@ class TestUserInfoLib extends UnitTestCase { $this->assertTrue(is_bool($res)); //var_dump($res); } - + /** * This functon only is added to the end of the test and the end of the files in the all test. */ /*public function testDeleteCourse() { - global $cidReq; - $resu = CourseManager::delete_course($cidReq); + global $cidReq; + $resu = CourseManager::delete_course($cidReq); }*/ } ?> \ No newline at end of file diff --git a/tests/main/webservices/user_import/import.lib.test.php b/tests/main/webservices/user_import/import.lib.test.php index 7c53a3081b..ccbdb3b20f 100755 --- a/tests/main/webservices/user_import/import.lib.test.php +++ b/tests/main/webservices/user_import/import.lib.test.php @@ -8,6 +8,10 @@ require_once(api_get_path(LIBRARY_PATH).'course.lib.php'); class TestImpor extends UnitTestCase { + public function __construct() { + $this->UnitTestCase('User import WS library - main/webservices/user_import/import.lib.test.php'); + } + function testcomplete_missing_data(){ $user='admin'; $res=complete_missing_data($user); @@ -32,7 +36,7 @@ class TestImpor extends UnitTestCase { $this->assertTrue(is_array($res)); //var_dump($res); } - + function testparse_csv_data() { $file= '/tmp/'; $res=parse_csv_data($file); @@ -43,8 +47,8 @@ class TestImpor extends UnitTestCase { * This functon only is added to the end of the test and the end of the files in the all test. */ /*public function testDeleteCourse() { - global $cidReq; - $resu = CourseManager::delete_course($cidReq); + global $cidReq; + $resu = CourseManager::delete_course($cidReq); }*/ } ?>