online.inc.test.php 1.2 KB

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