Modified the function test and added function testdeletecourse

skala
Ricardo Rodriguez 15 years ago
parent 060020152c
commit 1b6d5baf70
  1. 32
      tests/main/admin/calendar.lib.test.php
  2. 29
      tests/main/admin/sub_language.class.test.php

@ -4,6 +4,8 @@ require_once(api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php");
require_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
require_once(api_get_path(LIBRARY_PATH).'icalcreator/iCalcreator.class.php');
require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
class TestCalendar extends UnitTestCase {
function TestCalendar() {
@ -269,11 +271,9 @@ class TestCalendar extends UnitTestCase {
}
public function testGetRepeatedEventsDayView(){
$y=0;
$m=0;
$d=0;
$start = mktime(0,0,0,$m,$d,$y);
$end = mktime(23,59,59,$m,$d,$y);
global $_course;
$start = 0;
$end = 0;
$params = array();
$course_code = 'COURSEX';
$course_info = api_get_course_info($course_code);
@ -399,12 +399,22 @@ class TestCalendar extends UnitTestCase {
$res = delete_agenda_item($id);
$this->assertTrue(is_bool($res));
}
/* public function testDeleteCourse() {
global $cidReq;
$resu = CourseManager::delete_course($cidReq);
session_destroy();
/*
public function TestDeleteCourse(){
$code = 'COURSEX';
$res = CourseManager::delete_course($code);
$path = api_get_path(SYS_PATH).'archive';
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if (strpos($file,$code)!==false) {
if (is_dir($path.'/'.$file)) {
rmdirr($path.'/'.$file);
}
}
}
closedir($handle);
}
}
*/
*/
}
?>

@ -72,8 +72,10 @@ class TestSubLanguageManager extends UnitTestCase {
$dokeos_path_file = $dirname.'spanish.inc.php';
$res = SubLanguageManager::add_file_in_language_directory($dokeos_path_file);
unlink($dokeos_path_file);
$this->assertTrue($res);
}
$this->assertNull($res);
$this->assertTrue(is_null($res));
}
//var_dump($res);
}
public function testwrite_data_in_file(){
@ -88,8 +90,10 @@ class TestSubLanguageManager extends UnitTestCase {
$new_sub_language='spanishtest';
$variable_sub_language='test';
$res = SubLanguageManager::write_data_in_file($path_file,$new_sub_language,$variable_sub_language);
$this->assertTrue($res);
}
$this->assertTrue(is_null($res));
$this->assertNull($res);
}
//var_dump($res);
@ -220,5 +224,22 @@ class TestSubLanguageManager extends UnitTestCase {
$this->assertTrue(is_bool($res));
// var_dump($res);
}
/*
public function TestDeleteCourse(){
$code = 'COURSEX';
$res = CourseManager::delete_course($code);
$path = api_get_path(SYS_PATH).'archive';
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if (strpos($file,$code)!==false) {
if (is_dir($path.'/'.$file)) {
rmdirr($path.'/'.$file);
}
}
}
closedir($handle);
}
}
*/
}
?>

Loading…
Cancel
Save