diff --git a/tests/setup.inc.php b/tests/setup.inc.php deleted file mode 100644 index c618ca4a71..0000000000 --- a/tests/setup.inc.php +++ /dev/null @@ -1,201 +0,0 @@ - $cidReq, - 'title'=>$cidReq, - 'tutor_name'=>'John Doe', - 'category_code'=>'LANG', - 'course_language'=>'spanish', - 'course_admin_id'=>'001', - 'db_prefix'=> $_configuration['db_prefix'], - 'firstExpirationDelay'=>'999' - ); - $res = create_course($course_datos['wanted_code'], $course_datos['title'], - $course_datos['tutor_name'], $course_datos['category_code'], - $course_datos['course_language'],$course_datos['course_admin_id'], - $course_datos['db_prefix'], $course_datos['firstExpirationDelay']); -} - - -$sql = "SELECT course.*, course_category.code faCode, course_category.name faName - FROM $course_table - LEFT JOIN $course_cat_table - ON course.category_code = course_category.code - WHERE course.code = '$cidReq'"; - -$result = Database::query($sql,__FILE__,__LINE__); - -/* ------------------------------------------------------------ - Create the session ------------------------------------------------------------ -*/ -if (Database::num_rows($result)>0) { - $cData = Database::fetch_array($result); - $_cid = $cData['code' ]; - $_course = array(); - $_course['id' ] = $cData['code' ]; //auto-assigned integer - $_course['name' ] = $cData['title' ]; - $_course['official_code'] = $cData['visual_code' ]; // use in echo - $_course['sysCode' ] = $cData['code' ]; // use as key in db - $_course['path' ] = $cData['directory' ]; // use as key in path - $_course['dbName' ] = $cData['db_name' ]; // use as key in db list - $_course['dbNameGlu' ] = $_configuration['table_prefix'] . $cData['db_name'] . $_configuration['db_glue']; // use in all queries - $_course['titular' ] = $cData['tutor_name' ]; - $_course['language' ] = $cData['course_language' ]; - $_course['extLink' ]['url' ] = $cData['department_url' ]; - $_course['extLink' ]['name'] = $cData['department_name' ]; - $_course['categoryCode'] = $cData['faCode' ]; - $_course['categoryName'] = $cData['faName' ]; - $_course['visibility' ] = $cData['visibility' ]; - $_course['subscribe_allowed'] = $cData['subscribe' ]; - $_course['unubscribe_allowed'] = $cData['unsubscribe' ]; - - api_session_register('_cid'); - api_session_register('_course'); -} - -/* ------------------------------------------------------------ - Load the session ------------------------------------------------------------ -*/ -$_SESSION['_user']['user_id'] = 1; -$_SESSION['is_courseAdmin'] = 1; -$_SESSION['show'] = showall; - -/* ------------------------------------------------------------ - Load the user ------------------------------------------------------------ -*/ -$_user['user_id'] = $_SESSION['_user']['user_id']; diff --git a/tests/teardown.inc.php b/tests/teardown.inc.php deleted file mode 100644 index c7c119adc5..0000000000 --- a/tests/teardown.inc.php +++ /dev/null @@ -1,167 +0,0 @@ -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); - } - */ \ No newline at end of file