|
|
@ -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'; |
|
|
|