From d233cf4e92982b8d60266952ca7d95ea4332b1aa Mon Sep 17 00:00:00 2001 From: Carlos Vargas Date: Wed, 3 Feb 2010 16:52:51 -0500 Subject: [PATCH] fixed test suveymanagerlib and order stats.lib and fixed usermanager.lib see CT#191 --- main/inc/lib/stats.lib.inc.php | 269 ++++++------------ main/inc/lib/usermanager.lib.php | 4 +- tests/main/inc/lib/surveymanager.lib.test.php | 148 +++++----- 3 files changed, 162 insertions(+), 259 deletions(-) diff --git a/main/inc/lib/stats.lib.inc.php b/main/inc/lib/stats.lib.inc.php index f05c9f725f..3ddfccd55f 100755 --- a/main/inc/lib/stats.lib.inc.php +++ b/main/inc/lib/stats.lib.inc.php @@ -94,7 +94,6 @@ $TABLESTATS_REFERERS = $_configuration['statistics_database']."`.`track_c_ref */ function decodeOpenInfos() { global $TABLETRACK_OPEN; - // record initial value of ignore_user_abort $ignore = ignore_user_abort(); // prevent script from being stopped while executing, the following can be considered @@ -129,8 +128,7 @@ function decodeOpenInfos() { // load list of countries $list_countries = loadCountries(); - while ($row = Database::fetch_row ($query) ) - { + while ($row = Database::fetch_row ($query)) { $remote_host = $row[0]; /*****Provider*****/ //extract provider @@ -143,31 +141,25 @@ function decodeOpenInfos() { $country = extractCountry( $remote_host, $list_countries ); // increment country in the countries table $countries_array = addCountry( $country, $countries_array ); - } // update tables fillProvidersTable( $providers_array ); fillCountriesTable( $countries_array ); } - // provider and countries done - //--Browsers and OS---------------------------------------------------// - $sql = "SELECT open_agent FROM `$TABLETRACK_OPEN` WHERE open_remote_host != '' AND open_id <= '".$processBegin."' "; $query =Database::query( $sql ); - if(Database::num_rows($query) != 0){ + if(Database::num_rows($query) != 0) { // load lists // of browsers $list_browsers = loadBrowsers(); // of OS $list_os = loadOs(); - - while ($row = Database::fetch_row ($query)) - { + while ($row = Database::fetch_row ($query)) { $agent = $row[0]; /*****Browser and OS*****/ // extract browser and OS @@ -176,7 +168,6 @@ function decodeOpenInfos() { $browsers_array = addBrowser( $browser , $browsers_array ); $os_array = addOs( $os , $os_array ); } - fillBrowsersTable( $browsers_array ); fillOsTable( $os_array ); } @@ -191,29 +182,21 @@ function decodeOpenInfos() { $query = Database::query( $sql ); if(Database::num_rows($query) != 0) { - $i=0; - while ($row = Database::fetch_row ($query)) - { + while ($row = Database::fetch_row ($query)) { $ref = $row[0]; $referers_array = addReferer( $ref , $referers_array ); } fillReferersTable( $referers_array ); } // referers done - //-------------------------------------------------------------------// - // end of process // cleaning of $TABLETRACK_OPEN table cleanProcessedRecords($processBegin); - // reset to the initial value ignore_user_abort($ignore); } - - - /*************************************************************************** * * Utils @@ -236,15 +219,9 @@ function cleanProcessedRecords( $limit ) { open_agent = '', open_referer ='' WHERE open_id <= '".$limit."'"; - $query = Database::query( $sql ); - Database::query("OPTIMIZE TABLE $TABLETRACK_OPEN"); - } - - - /*************************************************************************** * * Provider @@ -260,10 +237,8 @@ function cleanProcessedRecords( $limit ) { table */ function extractProvider($remhost) { - if($remhost == "Unknown") return $remhost; - $explodedRemhost = explode(".", $remhost); $provider = $explodedRemhost[sizeof( $explodedRemhost )-2] ."." @@ -272,7 +247,6 @@ function extractProvider($remhost) { if($provider == "co.uk" || $provider == "co.jp") return $explodedRemhost[sizeof( $explodedRemhost )-3].$provider; else return $provider; - } @@ -287,13 +261,10 @@ function extractProvider($remhost) { - if the provider doesn't exist it will be added and set to 1 */ function addProvider($provider,$providers_array) { - if( isset( $providers_array[$provider] ) ) - { + if(isset($providers_array[$provider])) { // add one unity to this provider occurrences $providers_array[$provider] = $providers_array[$provider] + 1; - } - else - { + } else { // first occurrence of this provider $providers_array[$provider] = 1; } @@ -309,25 +280,20 @@ function addProvider($provider,$providers_array) { function fillProvidersTable($providers_array) { global $TABLESTATS_PROVIDERS; - if(is_array($providers_array)) - { - foreach ( $providers_array as $prov=>$number ) - { + if(is_array($providers_array)) { + foreach ( $providers_array as $prov=>$number ) { $sql = "SELECT counter FROM `".$TABLESTATS_PROVIDERS."` WHERE `provider` = '".$prov."'"; $res = Database::query($sql,__FILE__, __LINE__); // if this provider already exists in the DB - if( $row = Database::num_rows($res) ) - { + if($row = Database::num_rows($res)) { // update $sql2 = "UPDATE `".$TABLESTATS_PROVIDERS."` SET `counter` = counter + '$number' WHERE `provider` = '".$prov."'"; - } - else - { + } else { // insert $sql2 = "INSERT INTO `".$TABLESTATS_PROVIDERS."` (`provider`,`counter`) @@ -351,8 +317,7 @@ function fillProvidersTable($providers_array) { * @desc This function is used to build an array containing countries informations */ -function loadCountries() -{ +function loadCountries() { global $TABLESTATS_COUNTRIES; $sql = "SELECT code, country FROM `".$TABLESTATS_COUNTRIES."`"; @@ -368,8 +333,6 @@ function loadCountries() mysql_free_result($res); return $list_countries; } - - /** * @author Sebastien Piraux @@ -379,22 +342,17 @@ function loadCountries() * @desc this function will extract the country from a given remote host and increment the good value in the corresponding table */ -function extractCountry($remhost,$list_countries) -{ +function extractCountry($remhost,$list_countries) { if($remhost == "Unknown") return $remhost; // country code is the last value of remote host $explodedRemhost = explode(".",$remhost); $countryCode = $explodedRemhost[sizeof( $explodedRemhost )-1]; - - for($i = 0 ; $i < sizeof( $list_countries );$i++) - { + for($i = 0 ; $i < sizeof( $list_countries );$i++) { if($list_countries[$i][0] == $countryCode) return $list_countries[$i][1]; } } - - /** * @author Sebastien Piraux @@ -404,48 +362,34 @@ function extractCountry($remhost,$list_countries) * @desc this function will increment number of occurrence for $country in the countries' tables */ -function addCountry($country,$countries_array) -{ - if( isset( $countries_array[$country] ) ) - { +function addCountry($country,$countries_array) { + if(isset($countries_array[$country])) { // add one unity to this provider occurrences $countries_array[$country] = $countries_array[$country] + 1; - } - else - { + } else { // first occurrence of this provider $countries_array[$country] = 1; } return $countries_array; - } - - /** * @author Sebastien Piraux * @param countries_array : list of countries and their counter * @desc update the countries'table with new values */ -function fillCountriesTable($countries_array) -{ +function fillCountriesTable($countries_array) { global $TABLESTATS_COUNTRIES; - if(is_array($countries_array) ) - { - foreach ( $countries_array as $country=>$number ) - { - + if(is_array($countries_array)) { + foreach ( $countries_array as $country=>$number ) { // update $sql = "UPDATE `".$TABLESTATS_COUNTRIES."` SET `counter` = counter + '$number' WHERE `country` = '".$country."'"; - Database::query($sql,__FILE__, __LINE__); - } + } } } - - /*************************************************************************** * * Agent : Browser and OS @@ -458,8 +402,7 @@ function fillCountriesTable($countries_array) * @desc This function is used to build an array containing browser informations */ -function loadBrowsers() -{ +function loadBrowsers() { $buffer = split ("#","Gecko|Gecko#Mozilla/3|Mozilla 3.x#Mozilla/4.0|Mozilla 4.0x#Mozilla/4.5|Mozilla 4.5x#Mozilla/4.6|Mozilla 4.6x#Mozilla/4.7|Mozilla 4.7x#Mozilla/5.0|Mozilla 5.0x#MSIE 1.2|MSIE 1.2#MSIE 3.01|MSIE 3.x#MSIE 3.02|MSIE 3.x#MSIE 4.0|MSIE 4.x#MSIE 4.01|MSIE 4.x#MSIE 4.5|MSIE 4.5#MSIE 5.0b1|MSIE 5.0x#MSIE 5.0b2|MSIE 5.0x#MSIE 5.0|MSIE 5.0x#MSIE 5.01|MSIE 5.0x#MSIE 5.1|MSIE 5.1#MSIE 5.1b1|MSIE 5.1#MSIE 5.5|MSIE 5.5#MSIE 5.5b1|MSIE 5.5#MSIE 5.5b2|MSIE 5.5#MSIE 6.0|MSIE 6#MSIE 6.0b|MSIE 6#MSIE 6.5a|MSIE 6.5#Lynx/2.8.0|Lynx 2#Lynx/2.8.1|Lynx 2#Lynx/2.8.2|Lynx 2#Lynx/2.8.3|Lynx 2#Lynx/2.8.4|Lynx 2#Lynx/2.8.5|Lynx 2#HTTrack 3.0x|HTTrack#OmniWeb/4.0.1|OmniWeb#Opera 3.60|Opera 3.60#Opera 4.0|Opera 4#Opera 4.01|Opera 4#Opera 4.02|Opera 4#Opera 5|Opera 5#Opera/3.60|Opera 3.60#Opera/4|Opera 4#Opera/5|Opera 5#Opera/6|Opera 6#Opera 6|Opera 6#Netscape6|NS 6#Netscape/6|NS 6#Netscape7|NS 7#Netscape/7|NS 7#Konqueror/2.0|Konqueror 2#Konqueror/2.0.1|Konqueror 2#Konqueror/2.1|Konqueror 2#Konqueror/2.1.1|Konqueror 2#Konqueror/2.1.2|Konqueror 2#Konqueror/2.2|Konqueror 2#Teleport Pro|Teleport Pro#WebStripper|WebStripper#WebZIP|WebZIP#Netcraft Web|NetCraft#Googlebot|Googlebot#WebCrawler|WebCrawler#InternetSeer|InternetSeer#ia_archiver|ia archiver"); @@ -480,8 +423,7 @@ function loadBrowsers() * @desc This function is used to build an array containing OS informations */ -function loadOs() -{ +function loadOs() { $buffer = split ("#","Windows 95|Win 95#Windows_95|Win 95#Windows 98|Win 98#Windows NT|Win NT#Windows NT 5.0|Win 2000#Windows NT 5.1|Win XP#Windows 2000|Win 2000#Windows XP|Win XP#Windows ME|Win Me#Win95|Win 95#Win98|Win 98#WinNT|Win NT#linux-2.2|Linux 2#Linux|Linux#Linux 2|Linux 2#Macintosh|Mac#Mac_PPC|Mac#Mac_PowerPC|Mac#SunOS 5|SunOS 5#SunOS 6|SunOS 6#FreeBSD|FreeBSD#beOS|beOS#InternetSeer|InternetSeer#Googlebot|Googlebot#Teleport Pro|Teleport Pro"); $i=0; foreach( $buffer as $buffer1 ) { @@ -491,7 +433,6 @@ function loadOs() return $list_os; } /** - * @author Sebastien Piraux * @param remhost : must be $_SERVER['HTTP_USER_AGENT'] * @param list_browsers : browsers list :x @@ -501,29 +442,24 @@ function loadOs() * @desc this function will extract browser and OS from $_SERVER['HTTP_USER_AGENT'] */ -function extractAgent( $user_agent, $list_browsers, $list_os ) -{ +function extractAgent( $user_agent, $list_browsers, $list_os ) { // default values, if nothing corresponding found $viewable_browser = "Unknown"; $viewable_os = "Unknown"; // search for corresponding pattern in $_SERVER['HTTP_USER_AGENT'] // for browser - for($i = 0; $i < count( $list_browsers ); $i++) - { + for($i = 0; $i < count( $list_browsers ); $i++) { $pos = strpos( $user_agent, $list_browsers[$i][0] ); - if( $pos !== false ) - { + if( $pos !== false ) { $viewable_browser = $list_browsers[$i][1]; } } // for os - for($i = 0; $i < count($list_os); $i++) - { + for($i = 0; $i < count($list_os); $i++) { $pos = strpos( $user_agent, $list_os[$i][0] ); - if( $pos !== false ) - { + if( $pos !== false ) { $viewable_os = $list_os[$i][1]; } } @@ -541,20 +477,15 @@ function extractAgent( $user_agent, $list_browsers, $list_os ) the corresponding value - if the browser doesn't exist it will be added and set to 1 */ -function addBrowser($browser,$browsers_array) -{ - if( isset( $browsers_array[$browser] ) ) - { +function addBrowser($browser,$browsers_array) { + if(isset( $browsers_array[$browser])) { // add one unity to this provider occurrences $browsers_array[$browser] = $browsers_array[$browser] + 1; - } - else - { + } else { // first occurrence of this provider $browsers_array[$browser] = 1; } return $browsers_array; - } /** @@ -567,20 +498,15 @@ function addBrowser($browser,$browsers_array) the corresponding value - if the os doesn't exist it will be added and set to 1 */ -function addOs($os,$os_array) -{ - if( isset( $os_array[$os] ) ) - { +function addOs($os,$os_array) { + if(isset($os_array[$os])) { // add one unity to this provider occurrences $os_array[$os] = $os_array[$os] + 1; - } - else - { + } else { // first occurrence of this provider $os_array[$os] = 1; } return $os_array; - } /** @@ -589,35 +515,29 @@ function addOs($os,$os_array) * @param browsers_array : list of browsers and their counter * @desc update the browsers'table with new values */ -function fillBrowsersTable($browsers_array) -{ +function fillBrowsersTable($browsers_array) { global $TABLESTATS_BROWSERS; - if ( is_array($browsers_array ) ) - { - foreach ( $browsers_array as $browser=>$number ) - { - $sql = "SELECT counter - FROM `".$TABLESTATS_BROWSERS."` - WHERE `browser` = '".$browser."'"; - $res = Database::query($sql,__FILE__, __LINE__); - - // if this provider already exists in the DB - if( $row = Database::num_rows($res) ) - { - // update - $sql2 = "UPDATE `".$TABLESTATS_BROWSERS."` - SET `counter` = counter + '$number' - WHERE `browser` = '".$browser."'"; - } - else - { - // insert - $sql2 = "INSERT INTO `".$TABLESTATS_BROWSERS."` - (`browser`,`counter`) - VALUES ('".$browser."','".$number."')"; + if (is_array($browsers_array)) { + foreach ( $browsers_array as $browser=>$number ) { + $sql = "SELECT counter + FROM `".$TABLESTATS_BROWSERS."` + WHERE `browser` = '".$browser."'"; + $res = Database::query($sql,__FILE__, __LINE__); + + // if this provider already exists in the DB + if($row = Database::num_rows($res)) { + // update + $sql2 = "UPDATE `".$TABLESTATS_BROWSERS."` + SET `counter` = counter + '$number' + WHERE `browser` = '".$browser."'"; + } else { + // insert + $sql2 = "INSERT INTO `".$TABLESTATS_BROWSERS."` + (`browser`,`counter`) + VALUES ('".$browser."','".$number."')"; + } + Database::query($sql2,__FILE__, __LINE__); } - Database::query($sql2,__FILE__, __LINE__); - } } } @@ -627,35 +547,29 @@ function fillBrowsersTable($browsers_array) * @param os_array : list of os and their counter * @desc update the os'table with new values */ -function fillOsTable($os_array) -{ +function fillOsTable($os_array) { global $TABLESTATS_OS; - if ( is_array($os_array) ) - { - foreach ( $os_array as $os=>$number ) - { - $sql = "SELECT counter - FROM `".$TABLESTATS_OS."` - WHERE `os` = '".$os."'"; - $res = Database::query($sql,__FILE__, __LINE__); - - // if this provider already exists in the DB - if( $row = Database::num_rows($res) ) - { - // update - $sql2 = "UPDATE `".$TABLESTATS_OS."` - SET `counter` = counter + '$number' - WHERE `os` = '".$os."'"; - } - else - { - // insert - $sql2 = "INSERT INTO `".$TABLESTATS_OS."` - (`os`,`counter`) - VALUES ('".$os."','".$number."')"; + if (is_array($os_array)) { + foreach ($os_array as $os=>$number) { + $sql = "SELECT counter + FROM `".$TABLESTATS_OS."` + WHERE `os` = '".$os."'"; + $res = Database::query($sql,__FILE__, __LINE__); + + // if this provider already exists in the DB + if($row = Database::num_rows($res)) { + // update + $sql2 = "UPDATE `".$TABLESTATS_OS."` + SET `counter` = counter + '$number' + WHERE `os` = '".$os."'"; + } else { + // insert + $sql2 = "INSERT INTO `".$TABLESTATS_OS."` + (`os`,`counter`) + VALUES ('".$os."','".$number."')"; + } + Database::query($sql2,__FILE__, __LINE__); } - Database::query($sql2,__FILE__, __LINE__); - } } } @@ -664,8 +578,6 @@ function fillOsTable($os_array) * Referers * ***************************************************************************/ - - /** * @author Sebastien Piraux @@ -676,51 +588,38 @@ function fillOsTable($os_array) the corresponding value - if the referer doesn't exist it will be added and set to 1 */ -function addReferer($referer,$referers_array) -{ - if( isset( $referers_array[$referer] ) ) - { +function addReferer($referer,$referers_array) { + if(isset($referers_array[$referer])) { // add one unity to this provider occurrences $referers_array[$referer] = $referers_array[$referer] + 1; - } - else - { + } else { // first occurrence of this provider $referers_array[$referer] = 1; } return $referers_array; - } - - /** * @author Sebastien Piraux * @param referers_array : list of referers and their counter * @desc update the referers'table with new values */ -function fillReferersTable($referers_array) -{ +function fillReferersTable($referers_array) { global $TABLESTATS_REFERERS; - if (is_array($referers_array) ) - { - foreach ( $referers_array as $referer=>$number ) - { + if (is_array($referers_array)) { + foreach ( $referers_array as $referer=>$number ) { $sql = "SELECT counter FROM `".$TABLESTATS_REFERERS."` WHERE `referer` = '".$referer."'"; $res = Database::query($sql,__FILE__, __LINE__); // if this provider already exists in the DB - if( $row = Database::num_rows($res) ) - { + if($row = Database::num_rows($res)) { // update $sql2 = "UPDATE `".$TABLESTATS_REFERERS."` SET `counter` = counter + '$number' WHERE `referer` = '".$referer."'"; - } - else - { + } else { // insert $sql2 = "INSERT INTO `".$TABLESTATS_REFERERS."` (`referer`,`counter`) @@ -730,6 +629,4 @@ function fillReferersTable($referers_array) } } } - - ?> \ No newline at end of file diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index d466c4e5eb..bf88f9624d 100644 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -874,7 +874,9 @@ class UserManager */ public static function remove_user_production($user_id, $production) { $production_path = self::get_user_picture_path_by_id($user_id, 'system', true); - unlink($production_path['dir'].$production); + if (is_file($production_path['dir'].$production)) { + unlink($production_path['dir'].$production); + } } /** diff --git a/tests/main/inc/lib/surveymanager.lib.test.php b/tests/main/inc/lib/surveymanager.lib.test.php index b48cd843ee..b89289473b 100755 --- a/tests/main/inc/lib/surveymanager.lib.test.php +++ b/tests/main/inc/lib/surveymanager.lib.test.php @@ -3,6 +3,44 @@ require_once(api_get_path(LIBRARY_PATH).'surveymanager.lib.php'); class TestSurveyManager extends UnitTestCase { + 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=''; @@ -22,10 +60,11 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_null($res)); //var_dump($res); } - +/* + * Deprecated function testcreate_group() { $survey_id=''; - $group_title=' '; + $group_title=''; $introduction=''; $table_group=''; $res=SurveyManager::create_group($survey_id,$group_title,$introduction,$table_group); @@ -49,45 +88,9 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_numeric($res)); //var_dump($res); } +*/ - 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 testcreate_survey_in_another_language() { global $_course; $id=''; @@ -96,20 +99,7 @@ class TestSurveyManager extends UnitTestCase { $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); - } +*/ function testdisplay_imported_group() { $sid=''; @@ -153,7 +143,7 @@ class TestSurveyManager extends UnitTestCase { if(!is_null($res))$this->assertTrue(is_bool($res)); //var_dump($res); } - +/* function testget_question_data() { $qid=''; $curr_dbname=''; @@ -161,14 +151,14 @@ class TestSurveyManager extends UnitTestCase { $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_questions_move() { $curr_dbname=''; $row['caption'] = ''; @@ -177,7 +167,7 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_array($question1)); //var_dump($question1); } - +*/ function testget_status() { global $_user; $table_user = Database::get_main_table(TABLE_MAIN_USER); @@ -244,7 +234,7 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_null($res)); //var_dump($res); } - +/* function testgetUserAnswersDetails() { $id_userAnswers=''; $params=''; @@ -252,7 +242,7 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_array($res)); //var_dump($res); } - + function testimport_existing_question() { $surveyid=''; $qids=''; @@ -286,7 +276,7 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_null($res)); //var_dump($res); } - +*/ function testimport_questions() { $import_type=''; $ids=''; @@ -294,7 +284,7 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_null($res)); //var_dump($res); } - +/* function testinsert_existing_groups() { $sid=''; $gids=''; @@ -315,7 +305,7 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_null($res)); //var_dump($res); } - +*/ function testinsert_into_group() { $survey_id=''; $group_title=''; @@ -325,7 +315,7 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_numeric($res)); //var_dump($res); } - +/* function testinsert_old_groups() { $sid=''; $gids=''; @@ -388,7 +378,7 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_null($res)); //var_dump($res); } - +*/ function testno_of_question() { $db_name=''; $gid=''; @@ -410,7 +400,7 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_null($res)); //var_dump($res); } - +/* function testques_id_group_name() { $qid=''; $res=SurveyManager::ques_id_group_name($qid); @@ -427,7 +417,7 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_null($res)); //var_dump($res); } - +*/ function testselect_group_list() { $survey_id=''; $seleced_groupid=''; @@ -436,7 +426,7 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_bool($res)); //var_dump($res); } - +/* function testselect_survey_list() { $seleced_surveyid=''; $extra_script=''; @@ -444,7 +434,7 @@ class TestSurveyManager extends UnitTestCase { $this->assertTrue(is_bool($res)); //var_dump($res); } - +*/ function testupdate_group() { $groupid=''; $surveyid=''; @@ -505,7 +495,7 @@ class TestSurveyTree extends UnitTestCase { //var_dump($res); }*/ - +/* function testcreateList() { $list=''; $res=SurveyTree::createList($list); @@ -527,14 +517,14 @@ class TestSurveyTree extends UnitTestCase { $this->assertTrue(is_array($res)); //var_dump($res); } - +*/ function testgetParentId() { $id=''; $res=SurveyTree::getParentId($id); $this->assertTrue(is_numeric($res)); //var_dump($res); } - +/* function testlastSibling() { $id=''; $res=SurveyTree::lastSibling($id); @@ -547,6 +537,20 @@ class TestSurveyTree extends UnitTestCase { $res=SurveyTree::nextSibling($id); $this->assertTrue(is_array($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); + } } ?>