online.inc.test.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. $res=online_logout(null, true);
  24. $this->assertTrue(is_null($res));
  25. //var_dump($res);
  26. }
  27. function testwho_is_online_in_this_course() {
  28. $uid='';
  29. $valid='';
  30. $rarray = array();
  31. $barray = array();
  32. $login_user_id= '';
  33. $login_date= '';
  34. array_push($rarray,$barray);
  35. array_push($barray,$login_user_id);
  36. array_push($barray,$login_date);
  37. $res=who_is_online_in_this_course($uid, $valid, $coursecode=null);
  38. if(!empty($barray)){
  39. $this->assertTrue(is_array($barray));
  40. //var_dump($str);
  41. } else {
  42. $this->assertTrue(is_bool($barray));
  43. //var_dump($rarray);
  44. }
  45. //var_dump($rarray);
  46. }
  47. function testwho_is_online() {
  48. $valid='';
  49. $res=who_is_online($valid);
  50. $this->assertTrue(is_array($res));
  51. //var_dump($res);
  52. }
  53. }
  54. ?>