Removed the require_once not used CT#191

skala
Arthur Portugal 15 years ago
parent 9e50f8d241
commit fe5ada5207
  1. 12
      tests/setup.inc.php
  2. 66
      tests/teardown.inc.php

@ -8,9 +8,8 @@
*
* It load:
* - require_once
* - constructs
* - creation course
* - session
* - sessions
* - api_allow_edit
* - api_session
*
@ -25,6 +24,7 @@
* if these are really configuration then we can make require_once in each tests.
* @todo use this file to load the setup in each file test.
* @todo check for duplication of require with test_suite.php
* @author aportugal
*/
/*
==============================================================================
@ -95,9 +95,9 @@ ob_end_clean();
Table definitions
-----------------------------------------------------------
*/
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$course_table = Database::get_main_table(TABLE_MAIN_COURSE);
$course_cat_table = Database::get_main_table(TABLE_MAIN_CATEGORY);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$course_table = Database::get_main_table(TABLE_MAIN_COURSE);
$course_cat_table = Database::get_main_table(TABLE_MAIN_CATEGORY);
/*
==============================================================================
@ -193,5 +193,3 @@ $_SESSION['show'] = showall;
-----------------------------------------------------------
*/
$_user['user_id'] = $_SESSION['_user']['user_id'];

@ -17,6 +17,7 @@
*
* @todo rewrite code to separate display, logic, database code
* @package chamilo.main
* @author aportugal
==============================================================================
*/
@ -27,19 +28,19 @@
* @todo check for duplication of require with test_suite.php
*/
/*
-----------------------------------------------------------
Included libraries
-----------------------------------------------------------
*/
require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
/*
==============================================================================
MAIN CODE
==============================================================================
*/
$code = 'COURSETEST';
/*
-----------------------------------------------------------
Delete the course
-----------------------------------------------------------
*/
$res = CourseManager::delete_course($code);
$path = api_get_path(SYS_PATH).'archive';
if ($handle = opendir($path)) {
@ -52,24 +53,31 @@ if ($handle = opendir($path)) {
}
closedir($handle);
}
$dirname = api_get_path(SYS_LANG_PATH);
$perm_dir = substr(sprintf('%o', fileperms($dirname)), -4);
if ($perm_dir != '0777') {
$msg = "Error";
$this->assertTrue(is_string($msg));
} else {
$path = $dirname.'upload';
$filemode = '0777';
$res = api_chmod_R($path, $filemode);
unlink($path);
$this->assertTrue($res || IS_WINDOWS_OS); // We know, it does not work for Windows.
}
/*
/*
-----------------------------------------------------------
Check api session destroy
-----------------------------------------------------------
*/
if (!headers_sent()) {
$res=api_session_destroy();
}
/*
$dirname = api_get_path(SYS_LANG_PATH);
$perm_dir = substr(sprintf('%o', fileperms($dirname)), -4);
if ($perm_dir != '0777') {
$msg = "Error";
$this->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';
@ -147,13 +155,7 @@ if ($handle = opendir($path)) {
ob_end_clean();
}
function testApiSessionDestroy(){
if (!headers_sent()) {
$res=api_session_destroy();
}
$this->assertTrue(is_null($res));
//var_dump($res);
}
function testApiSessionStart(){
if (!headers_sent()) {

Loading…
Cancel
Save