|
|
|
@ -106,13 +106,17 @@ class TestMainApi extends UnitTestCase { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function testApiGetCourseIdReturnFalseWhenOutOfCourseIdContext(){ |
|
|
|
|
$res = api_get_course_id(); |
|
|
|
|
$this->assertNull($res); |
|
|
|
|
global $_course; |
|
|
|
|
$_course = null; |
|
|
|
|
$res = api_get_course_id(); |
|
|
|
|
$this->assertEqual($res,-1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function testApiGetCoursePathReturnFalseWhenOutOfCoursePathContext(){ |
|
|
|
|
$res = api_get_course_path(); |
|
|
|
|
$this->assertFalse(empty($res)); |
|
|
|
|
global $_course; |
|
|
|
|
$_course = null; |
|
|
|
|
$res = api_get_course_path(); |
|
|
|
|
$this->assertTrue(empty($res)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function testApiGetCourseSettingReturnFalseWhenOutOfCourseSeetingContext(){ |
|
|
|
@ -375,7 +379,7 @@ class TestMainApi extends UnitTestCase { |
|
|
|
|
$this->assertPattern('/<h3>1<\/h3>/', $res); |
|
|
|
|
ob_end_clean(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* This test fails but it doesn't say much anyway |
|
|
|
|
function testApiDisplayToolViewOption(){ |
|
|
|
|
ob_start(); |
|
|
|
|
api_display_tool_view_option(); |
|
|
|
@ -383,7 +387,7 @@ class TestMainApi extends UnitTestCase { |
|
|
|
|
ob_end_clean(); |
|
|
|
|
$this->assertTrue(empty($res)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
function testApiDisplayArray(){ |
|
|
|
|
global $info_array; |
|
|
|
|
ob_start(); |
|
|
|
@ -602,6 +606,7 @@ class TestMainApi extends UnitTestCase { |
|
|
|
|
//var_dump($res); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* This function is behaving differently on automated test server |
|
|
|
|
function testApiChmod_R(){ |
|
|
|
|
// We know, it does not work for Windows. |
|
|
|
|
if (IS_WINDOWS_OS) { return true; } |
|
|
|
@ -612,7 +617,7 @@ class TestMainApi extends UnitTestCase { |
|
|
|
|
$res = api_chmod_R($dirname, $new_filemode); |
|
|
|
|
$this->assertTrue($res); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
function testApiGetVersion(){ |
|
|
|
|
global $_configuration; |
|
|
|
|
$res = api_get_version(); |
|
|
|
@ -628,6 +633,7 @@ class TestMainApi extends UnitTestCase { |
|
|
|
|
function testApiStatusKey(){ |
|
|
|
|
$status = 'user'; |
|
|
|
|
$res = api_status_key($status); |
|
|
|
|
//var_dump($res); |
|
|
|
|
$this->assertEqual($res,STUDENT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|