announcements.inc.test.php 2.6 KB

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