online.inc.test.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * To can test this file you need commet the line 125 in "online.inc.php"
  4. */
  5. require_once(api_get_path(LIBRARY_PATH).'online.inc.php');
  6. class TestOnline extends UnitTestCase {
  7. public function __construct() {
  8. $this->UnitTestCase('Online (chat) library - main/inc/lib/online.inc.test.php');
  9. }
  10. function testLoginCheck() {
  11. global $_course;
  12. $uid=1;
  13. $res=LoginCheck($uid);
  14. $this->assertTrue(is_null($res));
  15. }
  16. function testLoginDelete() {
  17. $user_id=1;
  18. $res=LoginDelete($user_id);
  19. $this->assertTrue(is_null($res));
  20. }
  21. function testonline_logout(){
  22. global $_configuration, $extAuthSource;
  23. global $logout_no_redirect;
  24. $logout_no_redirect = 'prueba';
  25. $res=online_logout();
  26. $this->assertTrue(is_null($res));
  27. //var_dump($res);
  28. }
  29. function testwho_is_online_in_this_course() {
  30. $uid='';
  31. $valid='';
  32. $rarray = array();
  33. $barray = array();
  34. $login_user_id= '';
  35. $login_date= '';
  36. array_push($rarray,$barray);
  37. array_push($barray,$login_user_id);
  38. array_push($barray,$login_date);
  39. $res=who_is_online_in_this_course($uid, $valid, $coursecode=null);
  40. if(!empty($barray)){
  41. $this->assertTrue(is_array($barray));
  42. //var_dump($str);
  43. } else {
  44. $this->assertTrue(is_bool($barray));
  45. //var_dump($rarray);
  46. }
  47. //var_dump($rarray);
  48. }
  49. function testwho_is_online() {
  50. $valid='';
  51. $res=who_is_online($valid);
  52. $this->assertTrue(is_array($res));
  53. //var_dump($res);
  54. }
  55. }
  56. ?>