skala
cvargas 15 years ago
commit 29454c61e9
  1. 516
      main/forum/forumfunction.inc.php
  2. 1285
      tests/main/forum/forumfunction.inc.test.php
  3. 102
      tests/test_suite.php

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -8,7 +8,7 @@ $maindir = dirname(__FILE__).'/../main/';
$incdir = dirname(__FILE__).'/../main/inc/';
$libdir = dirname(__FILE__).'/../main/inc/lib/';
//Need the ob start and clean else will show the objects
//Need the ob start and clean else will show the objects
require_once $incdir.'global.inc.php';
//List of files than need the tests
@ -28,7 +28,7 @@ require_once $libdir.'xmd.lib.php';
require_once $libdir.'formvalidator/FormValidator.class.php';
//Need the ob start and clean else will show the objects
//Need the ob start and clean else will show the objects
ob_start();
require_once $libdir.'main_api.lib.php';
require_once $libdir.'course_document.lib.php';
@ -45,7 +45,6 @@ require_once $maindir.'admin/statistics/statistics.lib.php';
require_once $maindir.'dropbox/dropbox_class.inc.php';
require_once $maindir.'dropbox/dropbox_functions.inc.php';
require_once $maindir.'survey/survey.lib.php';
require_once $maindir.'install/install.lib.php';
require_once $maindir.'exercice/export/scorm/scorm_classes.php';
require_once $maindir.'exercice/export/qti2/qti2_classes.php';
require_once $maindir.'exercice/export/exercise_import.inc.php';
@ -53,26 +52,30 @@ require_once $maindir.'exercice/exercise_result.class.php';
require_once $libdir.'exercise_show_functions.lib.php';
require_once $maindir.'exercice/answer.class.php';
require_once $maindir.'exercice/exercise.class.php';
//require_once $maindir.'exercice/exercise.lib.php';
require_once $maindir.'exercice/fill_blanks.class.php';
require_once $maindir.'exercice/freeanswer.class.php';
require_once $maindir.'forum/forumfunction.inc.php';
require_once $libdir.'fileManage.lib.php';
/**Problem with this file to test objects*/
//require_once $maindir.'exercice/exercise.lib.php';
class TestsSuite extends TestSuite {
function setUp() {
global $_configuration, $_user, $_course, $cidReq;
$cidReq = 'COURSETEST';
// check if course exists
// check if course exists
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$sql = "SELECT code FROM $table_course WHERE code = '$cidReq' ";
$rs = Database::query($sql, __FILE__, __LINE__);
$row = Database::fetch_row($rs);
if (empty($row[0])) {
// create a course
$course_datos = array(
'wanted_code'=> $cidReq,
@ -89,7 +92,7 @@ class TestsSuite extends TestSuite {
$course_datos['course_language'],$course_datos['course_admin_id'],
$course_datos['db_prefix'], $course_datos['firstExpirationDelay']);
}
$course_table = Database::get_main_table(TABLE_MAIN_COURSE);
$course_cat_table = Database::get_main_table(TABLE_MAIN_CATEGORY);
$sql = "SELECT course.*, course_category.code faCode, course_category.name faName
@ -98,9 +101,9 @@ class TestsSuite extends TestSuite {
ON course.category_code = course_category.code
WHERE course.code = '$cidReq'";
$result = Database::query($sql,__FILE__,__LINE__);
//create the session
if (Database::num_rows($result)>0) {
$cData = Database::fetch_array($result);
$_cid = $cData['code' ];
@ -121,22 +124,21 @@ class TestsSuite extends TestSuite {
$_course['visibility' ] = $cData['visibility'];
$_course['subscribe_allowed'] = $cData['subscribe'];
$_course['unubscribe_allowed'] = $cData['unsubscribe'];
api_session_register('_cid');
api_session_register('_course');
}
$_SESSION['_user']['user_id'] = 1;
$_SESSION['_user']['user_id'] = 1;
$_user['user_id'] = $_SESSION['_user']['user_id'];
$_SESSION['is_courseAdmin'] = 1;
$_SESSION['show'] = showall;
}
function TestsSuite() {
$this->setUp();
$this->TestSuite('All tests suite');
/*$this->addTestFile(dirname(__FILE__).'/main/install/install_upgrade.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/database.lib.test.php');
/* $this->addTestFile(dirname(__FILE__).'/main/inc/lib/database.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/add_course.lib.inc.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/course.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/banner.lib.test.php');
@ -147,13 +149,13 @@ class TestsSuite extends TestSuite {
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/classmanager.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/export.lib.inc.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/legal.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/mail.lib.inc.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/mail.lib.inc.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/message.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/online.inc.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/online.inc.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/security.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/specific_fields_manager.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/specific_fields_manager.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/social.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/sortabletable.class.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/sortabletable.class.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/statsUtils.lib.inc.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/tablesort.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/text.lib.test.php');
@ -182,15 +184,15 @@ class TestsSuite extends TestSuite {
$this->addTestFile(dirname(__FILE__).'/main/auth/openid/xrds.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/chat/chat_functions.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/conference/get_translation.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/exercice/hotpotatoes.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/exercice/hotpotatoes.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/newscorm/scorm.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/survey/survey.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/user/userInfoLib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/webservices/user_import/import.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/user/userInfoLib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/webservices/user_import/import.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/work/work.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/glossary.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/notebook.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/permissions/permissions_functions.inc.test.php');
$this->addTestFile(dirname(__FILE__).'/main/permissions/permissions_functions.inc.test.php');
$this->addTestFile(dirname(__FILE__).'/main/resourcelinker/resourcelinker.inc.test.php');
$this->addTestFile(dirname(__FILE__).'/main/survey/survey.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/dropbox/dropbox_class.inc.test.php');
@ -198,43 +200,53 @@ class TestsSuite extends TestSuite {
$this->addTestFile(dirname(__FILE__).'/main/search/search_suggestions.test.php');
$this->addTestFile(dirname(__FILE__).'/main/exercice/export/qti2/qti2_classes.test.php');
$this->addTestFile(dirname(__FILE__).'/main/exercice/export/scorm/scorm_classes.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/usermanager.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/groupmanager.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/image.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/usermanager.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/groupmanager.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/image.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/import.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/internationalization.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/internationalization.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/system_announcements.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/fileUpload.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/main_api.lib.test.php');//this file delete the course
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/main_api.lib.test.php');//this file delete the course
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/debug.lib.inc.test.php');//this file need be to the finish of the tests
*/
//This files has metadata, are deprecated, are not implemented and is not available for the test.
*/
/**This file was removed, now the functions was moved to install.lib*/
//require_once $maindir.'install/install_upgrade.lib.php';
//$this->addTestFile(dirname(__FILE__).'/main/install/install_upgrade.lib.test.php');
/**This files has metadata*/
//$this->addTestFile(dirname(__FILE__).'/main/inc/lib/xht.lib.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/inc/lib/xmd.lib.test.php');
/**This files are not used and is not finished implement*/
//$this->addTestFile(dirname(__FILE__).'/main/exercice/export/qti/qti_classes.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/exercice/export/qti2/qti2_export.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/exercice/export/exercise_import.inc.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/exercice/export/scorm/scorm_export.test.php');
/**EJERCICIOS**/
/**EXERCISES**/
//$this->addTestFile(dirname(__FILE__).'/main/exercice/answer.class.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/exercice/exercise_result.class.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/inc/lib/exercise_show_functions.lib.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/exercice/exercise.class.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/exercice/exercise.lib.test.php');falta
//$this->addTestFile(dirname(__FILE__).'/main/exercice/fill_blanks.class.test.php');falta
//$this->addTestFile(dirname(__FILE__).'/main/exercice/freeanswer.class.test.php');falta
/**This files have problem with class and call objects*/
//$this->addTestFile(dirname(__FILE__).'/main/exercice/exercise.lib.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/exercice/fill_blanks.class.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/exercice/freeanswer.class.test.php');
/**FORUM*/
$this->addTestFile(dirname(__FILE__).'/main/forum/forumfunction.inc.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/main_api.lib.test.php');//this file delete the course,session and the use of api_allow
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/main_api.lib.test.php');//this file delete the course,session and the use of api_allow
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/debug.lib.inc.test.php');//this file need be to the finish of the tests
}
}
$test = &new TestsSuite();

Loading…
Cancel
Save