myspace.lib.test.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <?php
  2. class TestMySpaceLib extends UnitTestCase {
  3. public function TestMySpaceLib() {
  4. $this->UnitTestCase('Test My Space');
  5. }
  6. public function __construct() {
  7. // The constructor acts like a global setUp for the class
  8. require_once api_get_path(SYS_TEST_PATH).'setup.inc.php';
  9. }
  10. /*
  11. public function testExportCsv() {
  12. //ob_start();
  13. $res = MySpace::export_csv($header = array(1, 2 ,3), $data = array(1, 2 ,3), $file_name = 'export.csv');
  14. $this->assertTrue(is_null($res));
  15. //ob_end_clean();
  16. //var_dump($res);
  17. }
  18. */
  19. public function testGetConnectionsToCourse() {
  20. //ob_start();
  21. $res = MySpace::get_connections_to_course($user_id = 1, $course_code = 'COURSETEST');
  22. $this->assertTrue(is_array($res));
  23. //ob_end_clean();
  24. //var_dump($res);
  25. }
  26. public function testCourseInfoTrackingFilter() {
  27. //ob_start();
  28. $res = MySpace::course_info_tracking_filter($user_id = 1, $url_params = array(), $row = array());
  29. $this->assertTrue(is_string($res));
  30. //ob_end_clean();
  31. //var_dump($res);
  32. }
  33. public function testDisplayTrackingUserOverview() {
  34. ob_start();
  35. $res = MySpace::display_tracking_user_overview();
  36. $this->assertTrue(is_null($res));
  37. ob_end_clean();
  38. //var_dump($res);
  39. }
  40. public function testDisplayUserOverviewExportOptions() {
  41. //ob_start();
  42. $res = MySpace::display_user_overview_export_options();
  43. $this->assertTrue(is_null($res));
  44. //ob_end_clean();
  45. //var_dump($res);
  46. }
  47. public function testExercisesResults() {
  48. //ob_start();
  49. $res = MySpace::exercises_results($user_id = 1, $course_code = 'COURSETEST');
  50. $this->assertTrue(is_array($res));
  51. //ob_end_clean();
  52. //var_dump($res);
  53. }
  54. /*
  55. public function testExportTrackingUserOverview() {
  56. //ob_start();
  57. $res = MySpace::export_tracking_user_overview();
  58. $this->assertTrue(is_null($res));
  59. //ob_end_clean();
  60. //var_dump($res);
  61. }
  62. public function testGetCourseData() {
  63. //ob_start();
  64. $res = MySpace::get_course_data($from = 1, $number_of_items = 2, $column = 2, $direction = 1);
  65. $this->assertTrue(is_array($res));
  66. //ob_end_clean();
  67. //var_dump($res);
  68. }
  69. */
  70. public function testGetNumberOfUsersTrackingOverview() {
  71. //ob_start();
  72. $res = MySpace::get_number_of_users_tracking_overview();
  73. $this->assertTrue(is_numeric($res));
  74. //ob_end_clean();
  75. //var_dump($res);
  76. }
  77. /*
  78. public function testGetUserDataTrackingOverview() {
  79. //ob_start();
  80. $res = MySpace::get_user_data_tracking_overview($from = 1, $number_of_items = 1, $column = 1, $direction = 1);
  81. $this->assertTrue(is_array($res));
  82. //ob_end_clean();
  83. //var_dump($res);
  84. }
  85. */
  86. public function testGetUserOverviewExportExtraFields() {
  87. //ob_start();
  88. $res = MySpace::get_user_overview_export_extra_fields($user_id = 1);
  89. $this->assertTrue(is_array($res));
  90. //ob_end_clean();
  91. //var_dump($res);
  92. }
  93. public function testMakeUsername() {
  94. //ob_start();
  95. $res = MySpace::make_username($firstname = 'Vargas', $lastname = 'Carlos', $username = 'cvargas', $language = null, $encoding = null);
  96. $this->assertTrue(is_array($res));
  97. //ob_end_clean();
  98. //var_dump($res);
  99. }
  100. public function testCheckUserInArray() {
  101. //ob_start();
  102. $res = MySpace::check_user_in_array($usernames = array(), $user_array = array());
  103. $this->assertTrue(is_array($res));
  104. //ob_end_clean();
  105. //var_dump($res);
  106. }
  107. public function testUserAvailableInSession() {
  108. //ob_start();
  109. $res = MySpace::user_available_in_session($username = 1, $course_list = array(), $id_session = 1);
  110. $this->assertTrue(is_null($res));
  111. //ob_end_clean();
  112. //var_dump($res);
  113. }
  114. public function testCheckAllUsernames() {
  115. //ob_start();
  116. $res = MySpace::check_all_usernames($users = array(), $course_list = array(), $id_session = 1);
  117. $this->assertTrue(is_array($res));
  118. //ob_end_clean();
  119. //var_dump($res);
  120. }
  121. public function testGetUserCreator() {
  122. //ob_start();
  123. $res = MySpace::get_user_creator($users = array());
  124. $this->assertTrue(is_array($res));
  125. //ob_end_clean();
  126. //var_dump($res);
  127. }
  128. public function testValidate_data() {
  129. //ob_start();
  130. $res = MySpace::validate_data($users = array(), $id_session = null);
  131. $this->assertTrue(is_array($res));
  132. //ob_end_clean();
  133. //var_dump($res);
  134. }
  135. /*
  136. public function testCompleteMissingData() {
  137. //ob_start();
  138. $res = MySpace::complete_missing_data($user = 1);
  139. $this->assertTrue(is_numeric($res));
  140. //ob_end_clean();
  141. //var_dump($res);
  142. }*//*
  143. public function testSaveData() {
  144. //ob_start();
  145. $res = MySpace::save_data($users = array(), $course_list = array(), $id_session = 1);
  146. $this->assertTrue(is_array($res));
  147. //ob_end_clean();
  148. //var_dump($res);
  149. }
  150. public function testParseCsvData() {
  151. //ob_start();
  152. $res = MySpace::parse_csv_data($file = '');
  153. $this->assertTrue(is_array($res));
  154. //ob_end_clean();
  155. //var_dump($res);
  156. }
  157. */
  158. public function testElementStart() {
  159. //ob_start();
  160. $res = MySpace::element_start($parser = 'Contact', $data = '');
  161. $this->assertTrue(is_null($res));
  162. //ob_end_clean();
  163. //var_dump($res);
  164. }
  165. public function testElementEnd() {
  166. //ob_start();
  167. $res = MySpace::element_end($parser = 'Contact', $data = '');
  168. $this->assertTrue(is_null($res));
  169. //ob_end_clean();
  170. //var_dump($res);
  171. }
  172. public function testCharacterData() {
  173. //ob_start();
  174. $res = MySpace::character_data($parser = 'Contact', $data = '');
  175. $this->assertTrue(is_null($res));
  176. //ob_end_clean();
  177. //var_dump($res);
  178. }
  179. public function testParseXmlData() {
  180. //ob_start();
  181. $res = MySpace::parse_xml_data($file = '');
  182. $this->assertTrue(is_array($res));
  183. //ob_end_clean();
  184. //var_dump($res);
  185. }
  186. public function __destruct() {
  187. // The destructor acts like a global tearDown for the class
  188. //require_once api_get_path(SYS_TEST_PATH).'teardown.inc.php';
  189. }
  190. }