Tests - Updated tests set to reflect debug library updates

skala
Yannick Warnier 15 years ago
parent 582f6a0c7b
commit b5a9ed5e13
  1. 22
      tests/main/inc/lib/add_course.lib.inc.test.php
  2. 20
      tests/main/inc/lib/debug.lib.inc.test.php
  3. 45
      tests/main/inc/lib/system_announcements.lib.test.php

@ -1,6 +1,5 @@
<?php <?php
require_once(api_get_path(LIBRARY_PATH).'add_course.lib.inc.php'); require_once(api_get_path(LIBRARY_PATH).'add_course.lib.inc.php');
require_once(api_get_path(LIBRARY_PATH).'debug.lib.inc.php');
require_once(api_get_path(LIBRARY_PATH).'course.lib.php'); require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
class TestAddCourse extends UnitTestCase { class TestAddCourse extends UnitTestCase {
@ -137,8 +136,6 @@ class TestAddCourse extends UnitTestCase {
$this->assertTrue($res === 0); $this->assertTrue($res === 0);
} }
function TestString2Binary(){ function TestString2Binary(){
$variable = true; $variable = true;
$res = string2binary($variable); $res = string2binary($variable);
@ -152,25 +149,6 @@ class TestAddCourse extends UnitTestCase {
$this->assertTrue($res === TRUE); $this->assertTrue($res === TRUE);
} }
/* // 1 excepcion de permisos
function TestReadPropertiesInArchive(){
ob_start();
$archive='/archive.ini';
$uid = api_get_user_id();
printVar(dirname($archive), "Zip : ");
$perm = '777';
$res = readPropertiesInArchive($archive, $isCompressed = TRUE);
if(is_array($res)){
$this->assertTrue(is_array($res));
}else{
$this->assertNull($res);
}
ob_end_clean();
//var_dump($res);
}
*/
public function TestDeleteCourse(){ public function TestDeleteCourse(){
$code = 'testcourse'; $code = 'testcourse';
$res = CourseManager::delete_course($code); $res = CourseManager::delete_course($code);

@ -7,10 +7,10 @@ class TestDebug extends UnitTestCase {
public function __construct() { public function __construct() {
$this->UnitTestCase('Debug helper library - main/inc/lib/debug.lib.inc.test.php'); $this->UnitTestCase('Debug helper library - main/inc/lib/debug.lib.inc.test.php');
} }
function testDebugFunction() { function test_printr_is_string() {
$variable='br'; $variable='br';
ob_start(); ob_start();
debug($variable); Debug::printr($variable);
$res=ob_get_contents(); $res=ob_get_contents();
ob_end_clean(); ob_end_clean();
//print_r($res); //print_r($res);
@ -18,10 +18,10 @@ class TestDebug extends UnitTestCase {
$this->assertTrue(is_scalar($res)); $this->assertTrue(is_scalar($res));
} }
function testDebugCourse() { function test_debug_course_is_string() {
global $_course; global $_course;
ob_start(); ob_start();
debug_course($_course); Debug::course($_course);
$res=ob_get_contents(); $res=ob_get_contents();
ob_end_clean(); ob_end_clean();
//print_r($res); //print_r($res);
@ -30,9 +30,9 @@ class TestDebug extends UnitTestCase {
} }
function testDebugPaths() { function test_debug_paths_is_string() {
ob_start(); ob_start();
debug_paths(); Debug::paths();
$res=ob_get_contents(); $res=ob_get_contents();
ob_end_clean(); ob_end_clean();
//print_r($res); //print_r($res);
@ -40,10 +40,10 @@ class TestDebug extends UnitTestCase {
$this->assertTrue(is_scalar($res)); $this->assertTrue(is_scalar($res));
} }
function testDebugUser() { function test_debug_user_is_array() {
global $_user; global $_user;
ob_start(); ob_start();
debug_user($_user); Debug::user($_user);
$res=ob_get_contents(); $res=ob_get_contents();
ob_end_clean(); ob_end_clean();
//print_r($res); //print_r($res);
@ -51,11 +51,11 @@ class TestDebug extends UnitTestCase {
//var_dump($res); //var_dump($res);
} }
function testPrintVar() { function test_print_var_is_string() {
$var=''; $var='';
GLOBAL $DEBUG; GLOBAL $DEBUG;
ob_start(); ob_start();
printVar($var, $varName = "@"); Debug::print_var($var, $varName = "@");
$res=ob_get_contents(); $res=ob_get_contents();
ob_end_clean(); ob_end_clean();
//print_r($res); //print_r($res);

@ -8,7 +8,7 @@ class TestSystemAnnouncementManager extends UnitTestCase {
public function __construct(){ public function __construct(){
$this->UnitTestCase('System announcements library - main/inc/lib/system_announcements.lib.test.php'); $this->UnitTestCase('System announcements library - main/inc/lib/system_announcements.lib.test.php');
} }
function testadd_announcement() { function test_add_announcement() {
$title='Anuncio'; $title='Anuncio';
$content='Contenido del anuncio'; $content='Contenido del anuncio';
$date_start='2010-01-02'; $date_start='2010-01-02';
@ -18,83 +18,68 @@ class TestSystemAnnouncementManager extends UnitTestCase {
$visible_guest = 0; $visible_guest = 0;
$lang = null; $lang = null;
$send_mail=0; $send_mail=0;
//ob_start();
$res=SystemAnnouncementManager::add_announcement($title, $content, $date_start, $date_end, $visible_teacher, $visible_student, $visible_guest, $lang, $send_mail); $res=SystemAnnouncementManager::add_announcement($title, $content, $date_start, $date_end, $visible_teacher, $visible_student, $visible_guest, $lang, $send_mail);
$this->assertTrue(is_bool($res)); $this->assertTrue(is_bool($res));
//ob_end_clean();
//var_dump($res);
} }
function testcount_nb_announcement() { function test_count_nb_announcement() {
$res=SystemAnnouncementManager::count_nb_announcement($start = 0,$user_id = ''); $res=SystemAnnouncementManager::count_nb_announcement($start = 0,$user_id = '');
$this->assertTrue(is_numeric($res)); $this->assertTrue(is_numeric($res));
//var_dump($res);
} }
function testdelete_announcement() { function test_delete_announcement() {
$id=''; $id='';
$res=SystemAnnouncementManager::delete_announcement($id); $res=SystemAnnouncementManager::delete_announcement($id);
$this->assertTrue(is_bool($res)); $this->assertTrue(is_bool($res));
//var_dump($res);
} }
function testdisplay_all_announcements() { function test_display_all_announcements() {
$visible=''; $visible='';
$res=SystemAnnouncementManager::display_all_announcements($visible, $id = -1,$start = 0,$user_id=''); $res=SystemAnnouncementManager::display_all_announcements($visible, $id = -1,$start = 0,$user_id='');
$this->assertTrue(is_null($res)); $this->assertTrue(is_null($res));
//var_dump($res);
} }
function testdisplay_announcements() { function test_display_announcements() {
$visible=''; $visible='';
$res=SystemAnnouncementManager::display_announcements($visible, $id = -1); $res=SystemAnnouncementManager::display_announcements($visible, $id = -1);
$this->assertTrue(is_null($res)); $this->assertNull($res);
//var_dump($res);
} }
function testdisplay_fleche() { function test_display_fleche() {
$user_id=''; $user_id='';
$res=SystemAnnouncementManager::display_fleche($user_id); $res=SystemAnnouncementManager::display_fleche($user_id);
$this->assertTrue(is_null($res)); $this->assertTrue(is_null($res));
//var_dump($res); //var_dump($res);
} }
function testget_all_announcements() { function test_get_all_announcements() {
$res=SystemAnnouncementManager::get_all_announcements(); $res=SystemAnnouncementManager::get_all_announcements();
$this->assertTrue(is_array($res)); $this->assertTrue(is_array($res));
//var_dump($res); //var_dump($res);
} }
function testget_announcement() { function test_get_announcement() {
$id=''; $id='';
$res=SystemAnnouncementManager::get_announcement($id); $res=SystemAnnouncementManager::get_announcement($id);
$this->assertTrue(is_bool($res)); $this->assertTrue(is_bool($res));
//var_dump($res); //var_dump($res);
} }
function testsend_system_announcement_by_email() { function test_send_system_announcement_by_email_is_null() {
global $_user; global $_user, $_setting, $charset;
global $_setting; $title = $content = $teacher = $student = '';
global $charset;
$title='';
$content='';
$teacher='';
$student='';
$res=SystemAnnouncementManager::send_system_announcement_by_email($title,$content,$teacher, $student); $res=SystemAnnouncementManager::send_system_announcement_by_email($title,$content,$teacher, $student);
$this->assertTrue(is_null($res)); $this->assertTrue(is_null($res));
//var_dump($res);
} }
function testset_visibility() { function test_set_visibility() {
$announcement_id=''; $announcement_id = $user = $visible='';
$user='';
$visible='';
$res=SystemAnnouncementManager::set_visibility($announcement_id, $user, $visible); $res=SystemAnnouncementManager::set_visibility($announcement_id, $user, $visible);
$this->assertTrue(is_bool($res)); $this->assertTrue(is_bool($res));
//var_dump($res); //var_dump($res);
} }
function testupdate_announcement() { function test_update_announcement() {
$id=1; $id=1;
$title='Anuncio'; $title='Anuncio';
$content='Contenido'; $content='Contenido';

Loading…
Cancel
Save