|
|
|
@ -26,8 +26,7 @@ class TestAddCourse extends UnitTestCase { |
|
|
|
|
$course['category'],$course['title'],$course['course_language'], |
|
|
|
|
$course['uidCreator'],null,null); |
|
|
|
|
$this->assertPattern('/\d/',$res); |
|
|
|
|
$this->assertTrue($res); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function TestCreateCourse(){ |
|
|
|
@ -51,8 +50,7 @@ class TestAddCourse extends UnitTestCase { |
|
|
|
|
$course_datos['db_prefix'], $course_datos['firstExpirationDelay']); |
|
|
|
|
|
|
|
|
|
$this->assertPattern('/\d/', $res); |
|
|
|
|
$this->assertTrue($res); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function TestGenerateCourseCode(){ |
|
|
|
@ -60,8 +58,7 @@ class TestAddCourse extends UnitTestCase { |
|
|
|
|
$course_title = 'matemáticas'; |
|
|
|
|
$res = generate_course_code($course_title); |
|
|
|
|
$this->assertTrue($res); |
|
|
|
|
//$this->assertNotA($res); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function TestDefineCourseKeys(){ |
|
|
|
@ -71,7 +68,6 @@ class TestAddCourse extends UnitTestCase { |
|
|
|
|
$wantedCode = generate_course_code($wantedCode); |
|
|
|
|
$res = define_course_keys(generate_course_code($wantedCode), null, null, null,null, null); |
|
|
|
|
$this->assertTrue($res); |
|
|
|
|
//$this->assert |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -79,88 +75,98 @@ class TestAddCourse extends UnitTestCase { |
|
|
|
|
$courseRepository = ''; |
|
|
|
|
$courseId = ''; |
|
|
|
|
$res = prepare_course_repository($courseRepository, $courseId); |
|
|
|
|
$this->assertFalse($res); |
|
|
|
|
$this->assertTrue($res===0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Function not implemented with test, because the functionality |
|
|
|
|
* is very complex. |
|
|
|
|
*/ |
|
|
|
|
/* |
|
|
|
|
function TestUpdateDbCourse(){ |
|
|
|
|
$courseDbName = 'curso'; |
|
|
|
|
$res = update_Db_course($courseDbName); |
|
|
|
|
$this->assertPattern('/\d/',$res); |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
global $_configuration; |
|
|
|
|
$dbcourse = array('courseDbName'=> 'curso'); |
|
|
|
|
$res = update_Db_course($dbcourse['courseDbName']); |
|
|
|
|
$this->assertFalse($res===0); |
|
|
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
function TestBrowseFolders(){ |
|
|
|
|
$path=''; |
|
|
|
|
$files =''; |
|
|
|
|
$media=''; |
|
|
|
|
$res = browse_folders($path, $files, $media); |
|
|
|
|
$browse = array('path'=>'','file'=>'','media'=>''); |
|
|
|
|
$res = browse_folders($browse['path'], $browse['files'],$browse['media']); |
|
|
|
|
$this->assertFalse($res); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function TestSortPictures(){ |
|
|
|
|
$files =''; |
|
|
|
|
$type=''; |
|
|
|
|
$files ='121212'; |
|
|
|
|
$type='asasasasa'; |
|
|
|
|
$res = sort_pictures($files, $type); |
|
|
|
|
$this->assertFalse($res); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function TestFillCourseRepository(){ |
|
|
|
|
$courseRepository = ''; |
|
|
|
|
$courseRepository = '1212sder'; |
|
|
|
|
$res = fill_course_repository($courseRepository); |
|
|
|
|
$this->assertTrue($res); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function TestLang2db(){ |
|
|
|
|
$string = ''; |
|
|
|
|
$string = 'dsdzxcwqd'; |
|
|
|
|
$res = lang2db($string); |
|
|
|
|
$this->assertFalse($res); |
|
|
|
|
$this->assertTrue($res); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function TestFillDbCourse(){ |
|
|
|
|
global $_configuration, $clarolineRepositoryWeb, $_user; |
|
|
|
|
$courseDbName = $_configuration['table_prefix'].$courseDbName.$_configuration['db_glue']; |
|
|
|
|
$courseRepository = ''; |
|
|
|
|
$courseRepository = 'sdffsdf'; |
|
|
|
|
$language = 'english'; |
|
|
|
|
$default_document_array =''; |
|
|
|
|
$default_document_array ='1212121'; |
|
|
|
|
$res = fill_Db_course($courseDbName, $courseRepository, $language,$default_document_array); |
|
|
|
|
$this->assertFalse($res); |
|
|
|
|
$this->assertTrue($res === 0); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function TestString2Binary(){ |
|
|
|
|
$variable = true; |
|
|
|
|
$variable2 = false; |
|
|
|
|
$res = string2binary($variable); |
|
|
|
|
$res1=string2binary($variable2); |
|
|
|
|
$this->assertTrue($res); |
|
|
|
|
$this->assertFalse($res1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function TestCheckArchive(){ |
|
|
|
|
$pathToArchive =''; |
|
|
|
|
$res = checkArchive($pathToArchive); |
|
|
|
|
$this->assertTrue($res); |
|
|
|
|
$this->assertTrue($res === TRUE); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Fatal Error at the call to undefined function printVar() Line 2404 in the |
|
|
|
|
* add_course.lib.inc.php |
|
|
|
|
*/ |
|
|
|
|
/* |
|
|
|
|
/* |
|
|
|
|
function TestReadPropertiesInArchive(){ |
|
|
|
|
$archive=''; |
|
|
|
|
printVar(dirname($archive), "Zip : "); |
|
|
|
|
//readPropertiesInArchive($archive, $isCompressed = TRUE); |
|
|
|
|
ob_start(); |
|
|
|
|
$res = ob_get_contents(); |
|
|
|
|
$archive='archive'; |
|
|
|
|
$uid = api_get_user_id(); |
|
|
|
|
printVar(dirname($archive), "Zip : "); |
|
|
|
|
$res = readPropertiesInArchive($archive, $isCompressed = TRUE); |
|
|
|
|
$this->assertTrue($res); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ob_start(); |
|
|
|
|
//readPropertiesInArchive($archive, $isCompressed = TRUE); |
|
|
|
|
$res = ob_get_contents(readPropertiesInArchive); |
|
|
|
|
ob_end_clean(); |
|
|
|
|
$this->assertFalse($res); |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |