[svn r22173] Minor - changed in the function test added new condition if(condition(function));

skala
Ricardo Rodriguez 16 years ago
parent 200f6cb407
commit 36221f558d
  1. 14
      tests/main/inc/lib/course.lib.test.php
  2. 15
      tests/main/inc/lib/database.lib.test.php
  3. 4
      tests/main/inc/lib/debug.lib.inc.test.php
  4. 8
      tests/main/inc/lib/fileUpload.lib.test.php
  5. 14
      tests/main/inc/lib/main_api.lib.test.php

@ -1,6 +1,6 @@
<?php
/*
* To can run this test you need comment this line or "die(mysql_error())" in 1374 course.lib.php
* To can run this test you need comment this line or "die(mysql_error())" in 1345 course.lib.php
*
*/
require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
@ -81,7 +81,7 @@ class TestCourse extends UnitTestCase{
*todo public function testCreateCourseExtrField()
*todo public function testUpdateCourseExtraFieldValue()
*/
/*
public function testGetCourseInformation(){
$res = $this->tcourse->get_course_information(1211);
$this->assertFalse($res);
@ -157,7 +157,7 @@ class TestCourse extends UnitTestCase{
/** Return a array() but now its empty, with this test is cheking is get the list course
* @author Arthur Portugal <arthur.portugal@dokeos.com>
*/
* /
public function testGetRealCourseList(){
$realgrouplist = new MockDatabase();
@ -326,7 +326,7 @@ class TestCourse extends UnitTestCase{
$this->assertFalse($res);
$this->assertTrue(is_array($res));
}
*/
public function testGetGroupListOfCourse(){
$grouplist = new MockDatabase();
$course_code = 'TEST';
@ -338,10 +338,10 @@ class TestCourse extends UnitTestCase{
$res=$this->courseManager->get_group_list_of_course($course_code);
$grouplist->expectOnce($group_list = array());
$this->assertTrue(is_object($this->courseManager));
//var_dump($res);
var_dump($res);
}
/*
public function testAttemptCreateVirtualCourse(){
$createvirtual = new MockDisplay();
$real_course_code = 'TEST';
@ -496,7 +496,7 @@ class TestCourse extends UnitTestCase{
$this->assertTrue(is_bool($res));
$this->assertFalse(is_null($res));
}
}*/
}
?>

@ -72,7 +72,10 @@ class TestDatabase extends UnitTestCase {
$course_info = api_get_course_info();
$database_name= $course_info[""];
$res=$this->dbase->fix_database_parameter($database_name);
$this->assertTrue(is_null($res));
if(!is_null($res)) :
$this->assertTrue(is_string($res));
endif;
//var_dump($res);
}
function testFixDatabaseParameterReturnString() {
@ -155,12 +158,18 @@ class TestDatabase extends UnitTestCase {
function testGetCurrentCourseDatabase() {
$res=$this->dbase->get_current_course_database();
$this->assertTrue(is_null($res));
if(!is_null($res)) :
$this->assertTrue(is_string($res));
endif;
//var_dump($res);
}
function testGetCurrentCourseGluedDatabase() {
$res=$this->dbase->get_current_course_glued_database();
$this->assertTrue(is_null($res));
if(!is_null($res)):
$this->assertTrue(is_string($res));
endif;
//var_dump($res);
}
function testGetDatabaseGlue()

@ -22,7 +22,9 @@ class TestDebug extends UnitTestCase {
$res=ob_get_contents();
ob_end_clean();
//print_r($res);
$this->assertTrue(is_numeric($_course));
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testDebugPaths() {

@ -34,8 +34,10 @@ class TestFileUpload extends UnitTestCase {
$filesize='';
$title='';
$res=add_document($_course,$path,$filetype,$filesize,$title);
if(!is_numeric($res)) :
$this->assertTrue(is_bool($res));
//var_dump($_course);
endif;
//var_dump($res);
}
function testAddExtOnMime() {
@ -160,8 +162,10 @@ class TestFileUpload extends UnitTestCase {
function testdocuments_total_space() {
$to_group_id='0';
$res= documents_total_space($to_group_id);
$res= documents_total_space($to_group_id);
if(!is_null($res)):
$this->assertTrue(is_numeric($res));
endif;
//var_dump($res);
}

@ -4,8 +4,8 @@ class TestMainApi extends UnitTestCase {
function TestMainApi() {
$this->UnitTestCase('Main API tests');
}
// todo function testApiProtectCourseScriptReturnsFalse()
// todo function testApiProtectAdminScriptReturnsFalse()
// todo function testApiBlockAnonymousUsers()
@ -165,13 +165,17 @@ class TestMainApi extends UnitTestCase {
}
function testApiGetUserCoursesReturnTrueWhenOutOfCoursesContext(){
$res = api_get_user_courses();
global $tbl_user;
$userid=1;
$fetch_session=true;
$res = api_get_user_courses($userid,$fetch_session);
$this->assertTrue(is_array($res));
//var_dump($res);
}
function testApiGetUserInfoReturnFalseWhenOutOfUserInfoContext(){
$res = api_get_user_info();
$user_id= 1;
$res = api_get_user_info($user_id);
$this->assertTrue(is_array($res));
//var_dump($res);
}
@ -189,7 +193,9 @@ class TestMainApi extends UnitTestCase {
function testApiGetCoursePathReturnFalseWhenOutOfCoursePathContext(){
$res = api_get_course_path();
$this->assertTrue(is_null($res));
if(!is_null($res)) :
$this->assertTrue(is_string($res));
endif;
//var_dump($res);
}

Loading…
Cancel
Save