123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- <?php
- require_once api_get_path(LIBRARY_PATH).'surveymanager.lib.php';
- //This class is deprecated
- /*
- class TestSurveyManager extends UnitTestCase {
- public function TestSurveyManager(){
- $this->UnitTestCase('Surveys library - main/inc/lib/surveymanager.lib.test.php');
- }
- function testcreate_survey() {
- $surveycode='';
- $surveytitle='';
- $surveysubtitle='';
- $author='';
- $survey_language='';
- $availablefrom='';
- $availabletill='';
- $isshare='';
- $surveytemplate='';
- $surveyintroduction='';
- $surveythanks='';
- $table_survey='';
- $table_group='';
- $res=SurveyManager::create_survey($surveycode,$surveytitle, $surveysubtitle, $author, $survey_language, $availablefrom, $availabletill,$isshare, $surveytemplate, $surveyintroduction, $surveythanks, $table_survey, $table_group);
- $this->assertTrue(is_numeric($res));
- //var_dump($res);
- }
- function testcreate_survey_attach() {
- $surveycode='';
- $surveytitle='';
- $surveysubtitle='';
- $author='';
- $survey_language='';
- $availablefrom='';
- $availabletill='';
- $isshare='';
- $surveytemplate='';
- $surveyintroduction='';
- $surveythanks='';
- $table_survey='';
- $table_group='';
- $res=SurveyManager::create_survey_attach($surveycode,$surveytitle, $surveysubtitle, $author, $survey_language, $availablefrom, $availabletill,$isshare, $surveytemplate, $surveyintroduction, $surveythanks, $table_survey, $table_group);
- $this->assertTrue(is_numeric($res));
- //var_dump($res);
- }
- function testattach_survey() {
- $surveyid='';
- $newsurveyid='';
- $db_name='';
- $curr_dbname='';
- $res=SurveyManager::attach_survey($surveyid,$newsurveyid,$db_name,$curr_dbname);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testcreate_course_survey_rel() {
- $cidReq='';
- $survey_id='';
- $table_course='';
- $table_course_survey_rel='';
- $res=SurveyManager::create_course_survey_rel($cidReq,$survey_id,$table_course,$table_course_survey_rel);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testdisplay_imported_group() {
- $sid='';
- $table_group='';
- $table_question='';
- ob_start();
- $res=SurveyManager::display_imported_group($sid,$table_group,$table_question);
- $this->assertTrue(is_null($res));
- ob_end_clean();
- //var_dump($res);
- }
- function testget_all_datas() {
- global $_course;
- $id='';
- $res=SurveyManager::get_all_datas($id);
- $this->assertTrue(is_bool($res));
- //var_dump($res);
- }
- function testget_author() {
- $db_name='';
- $survey_id='';
- $res=SurveyManager::get_author($db_name,$survey_id);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testget_data() {
- $id='';
- $field='';
- $res=SurveyManager::get_data($id, $field);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testget_groupname() {
- $db_name='';
- $gid='0011';
- $res=SurveyManager::get_groupname($db_name,$gid);
- if(!is_null($res))$this->assertTrue(is_bool($res));
- //var_dump($res);
- }
- function testget_question_type() {
- $questionid='';
- $res=SurveyManager::get_question_type($questionid);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testget_status() {
- global $_user;
- $table_user = Database::get_main_table(TABLE_MAIN_USER);
- $sqlm = "SELECT status FROM $table_user WHERE user_id = '".Database::escape_string($_user['user_id'])."'";
- $resm = Database::query($sqlm);
- $objm=@Database::fetch_object($resm);
- $ss = $objm->status ;
- $res=SurveyManager::get_status();
- if(!$res = null ){
- $this->assertTrue(is_null($res));
- }else{
- $this->assertTrue(is_string($res));
- }
- //var_dump($res);
- }
- function testget_survey_author() {
- $user_table = Database :: get_main_table(TABLE_MAIN_USER);
- $authorid = Database::escape_string($authorid);
- $sql_query = "SELECT * FROM $user_table WHERE user_id='$authorid'";
- $res = Database::query($sql_query);
- $firstname=@Database::result($res,0,'firstname');
- $res=SurveyManager::get_survey_author($authorid);
- $this->assertTrue(is_null($firstname));
- $this->assertNull($res);
- //var_dump($firstname);
- }
- function testget_survey_code() {
- $table_survey='';
- $survey_code='';
- $res=SurveyManager::get_survey_code($table_survey,$survey_code);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testget_survey_list() {
- ob_start();
- $res=SurveyManager::get_survey_list();
- $this->assertTrue(is_null($res));
- ob_end_clean();
- //var_dump($res);
- }
- function testget_surveyid() {
- $db_name='';
- $group_id='';
- $res=SurveyManager::get_surveyid($db_name,$group_id);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testget_surveyname() {
- $db_name='';
- $sid='';
- $res=SurveyManager::get_surveyname($db_name,$sid);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testget_surveyname_display() {
- $sid='';
- $res=SurveyManager::get_surveyname_display($sid);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testimport_questions() {
- $import_type='';
- $ids='';
- $res=SurveyManager::import_questions($import_type, $ids);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testinsert_into_group() {
- $survey_id='';
- $group_title='';
- $introduction='';
- $tb='';
- $res=SurveyManager::insert_into_group($survey_id,$group_title,$introduction,$tb);
- $this->assertTrue(is_numeric($res));
- //var_dump($res);
- }
- function testno_of_question() {
- $db_name='';
- $gid='';
- $res=SurveyManager::no_of_question($db_name,$gid);
- $this->assertTrue(is_bool($res));
- //var_dump($res);
- }
- function testpick_author() {
- $survey_id='';
- $res=SurveyManager::pick_author($survey_id);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testpick_surveyname() {
- $sid='';
- $res=SurveyManager::pick_surveyname($sid);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testselect_group_list() {
- $survey_id='';
- $seleced_groupid='';
- $extra_script='';
- $res=SurveyManager::select_group_list($survey_id, $seleced_groupid='', $extra_script='');
- $this->assertTrue(is_bool($res));
- //var_dump($res);
- }
- function testupdate_group() {
- $groupid='';
- $surveyid='';
- $groupnamme='';
- $introduction='';
- $curr_dbname='';
- $res=SurveyManager::update_group($groupid,$surveyid,$groupnamme,$introduction,$curr_dbname);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testupdate_question() {
- $qid='';
- $qtype='';
- $caption='';
- $alignment='';
- $answers='';
- $open_ans='';
- $curr_dbname='';
- $res=SurveyManager::update_question($qid,$qtype,$caption,$alignment,$answers,$open_ans,$curr_dbname);
- $this->assertTrue(is_numeric($res));
- //var_dump($res);
- }
- function testupdate_survey() {
- $surveyid='';
- $surveycode='';
- $surveytitle='';
- $surveysubtitle='';
- $author='';
- $survey_language='';
- $availablefrom='';
- $availabletill='';
- $isshare='';
- $surveytemplate='';
- $surveyintroduction='';
- $surveythanks='';
- $cidReq='';
- $table_course='';
- $res=SurveyManager::update_survey($surveyid,$surveycode,$surveytitle, $surveysubtitle, $author, $survey_language, $availablefrom, $availabletill,$isshare, $surveytemplate, $surveyintroduction, $surveythanks, $cidReq,$table_course);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testdelete_group() {
- $group_id='';
- $res=SurveyManager::delete_group($group_id);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- function testdelete_survey() {
- $survey_id='';
- $res=SurveyManager::delete_survey($survey_id);
- $this->assertTrue(is_bool($res));
- //var_dump($res);
- }
- }
- */
- class TestSurveyTree extends UnitTestCase {
- var $surveylist;
- var $plainsurveylist;
- var $numbersurveys;
- public function TestSurveTree(){
- $this->UnitTestCase('Survey trees library - main/inc/lib/surveymanager.lib.test.php');
- }
- function testgetParentId() {
- $id='';
- $res=SurveyTree::getParentId($id);
- $this->assertTrue(is_numeric($res));
- //var_dump($res);
- }
- function testcreateList() {
- $list=array();
- $res=SurveyTree::createList($list);
- $this->assertTrue(is_array($res));
- //var_dump($res);
- }
- }
- ?>
|