announcements.inc.test.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once api_get_path(SYS_CODE_PATH).'announcements/announcements.inc.php';
  4. require_once api_get_path(LIBRARY_PATH).'course.lib.php';
  5. require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
  6. require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
  7. class TestAnnouncements extends UnitTestCase {
  8. function TestAnnouncements(){
  9. $this->UnitTestCase('Displays one specific announcement test');
  10. }
  11. public function Testconstruct_not_selected_select_form(){
  12. $courseSysCode= '123';
  13. $course_code = $courseSysCode;
  14. ob_start();
  15. $to_already_selected="";
  16. $_SESSION['_cid'] = 'CURSO1';
  17. $user_list = array( 0=>array(
  18. 0 => '1','user_id' => '1',
  19. 1 =>'Doe','lastname' =>'Doe',
  20. 2 =>'John','firstname' =>'John',
  21. 3 => 'admin','username' =>'admin'
  22. ));
  23. $res = construct_not_selected_select_form($group_list=null, $user_list,$to_already_selected);
  24. ob_end_clean();
  25. $this->assertTrue(is_null($res));
  26. //var_dump($res);
  27. }
  28. public function Testconstruct_selected_select_form(){
  29. $to_already_selected="";
  30. ob_start();
  31. $res = construct_selected_select_form($group_list=null, $user_list=null,$to_already_selected);
  32. ob_end_clean();
  33. $this->assertTrue(is_null($res));
  34. //var_dump($res);
  35. }
  36. public function Testshow_to_form_group(){
  37. ob_start();
  38. $group_id=1;
  39. $group_users=GroupManager::get_subscribed_users($group_id);
  40. $res = show_to_form_group($group_id);
  41. ob_end_clean();
  42. $this->assertTrue(is_null($res));
  43. //var_dump($res);
  44. }
  45. public function Testget_course_users(){
  46. $_SESSION['id_session'] = 'CURSO1';
  47. $user_list = CourseManager::get_real_and_linked_user_list(api_get_course_id(), true, $_SESSION['id_session']);
  48. $res = get_course_users();
  49. if($res = array($res)){
  50. $this->assertTrue(is_array($res));
  51. } else {
  52. $this->assertTrue(is_null($res));
  53. }
  54. //var_dump($res);
  55. }
  56. public function Testget_course_groups(){
  57. $_SESSION['id_session']='CURSO1';
  58. $new_group_list = CourseManager::get_group_list_of_course(api_get_course_id(), intval($_SESSION['id_session']));
  59. $res = get_course_groups();
  60. $this->assertFalse($res);
  61. $this->assertTrue(is_array($res));
  62. var_dump($res);
  63. }
  64. public function Testload_edit_users(){
  65. $_SESSION['id_session']='CURSO1';
  66. global $_course;
  67. global $tbl_item_property;
  68. $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
  69. $tool = '';
  70. $id = '';
  71. $res = load_edit_users($tool, $id);
  72. $this->assertTrue(is_null($res));
  73. var_dump($res);
  74. }
  75. /*
  76. public function Testsent_to_form(){
  77. $group_names=get_course_groups();
  78. $sent_to_array='';
  79. $res = sent_to_form($sent_to_array);
  80. $this->assertTrue(is_null($res));
  81. var_dump($res);
  82. }*/
  83. }