assertTrue(is_string($msg)); } else { $path = $dirname.'upload'; $filemode = '0777'; $res = api_chmod_R($path, $filemode); unlink($path); } function testApiIsAllowed(){ global $_course, $_user; $tool= 'full'; $action = 'delete'; $res=api_is_allowed($tool, $action, $task_id=0); if(!is_bool($res)){ $this->assertTrue(is_null($res)); } $this->assertTrue($action); $this->assertTrue($_user['user_id']); } function testApiNotAllowed(){ ob_start(); //api_not_allowed($print_headers = false); $res = ob_get_contents(); $this->assertEqual($res,''); ob_end_clean(); } function testApiIsAllowedToCreateCourse() { $res=api_is_allowed_to_create_course(); if(!is_bool($res)){ $this->assertTrue(is_null($res)); } } function testApiIsCoach(){ global $_user; global $sessionIsCoach; $_user['user_id']=2; $sessionIsCoach=Database::store_result($result=false); $res=api_is_coach(); $this->assertTrue(is_bool($res)); //var_dump($res); $this->assertTrue($_user['user_id']); $this->assertTrue(is_array($sessionIsCoach)); //var_dump($sessionIsCoach); } function testApiIsSessionAdmin(){ global $_user; $_user['status']=true; $res=api_is_session_admin(); $this->assertTrue(is_bool($res)); $this->assertTrue(is_array($_user)); //var_dump($_user); } function testApiIsCourseCoach() { $res=api_is_course_coach(); if(!is_bool($res)){ $this->assertTrue(is_null($res)); } } function testApiIsSessionAdmin(){ global $_user; $_user['status']=true; $res=api_is_session_admin(); $this->assertTrue(is_bool($res)); $this->assertTrue(is_array($_user)); //var_dump($_user); } function testApiNotAllowed(){ ob_start(); //api_not_allowed($print_headers = false); $res = ob_get_contents(); $this->assertEqual($res,''); ob_end_clean(); } function testApiSessionStart(){ if (!headers_sent()) { $res = api_session_start($already_sintalled=true); } $this->assertTrue(is_null($res)); //var_dump($res); } */