scorm.class.test.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <?php
  2. require_once(api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php');
  3. require_once(api_get_path(SYS_CODE_PATH).'newscorm/scorm.class.php');
  4. class TestScormClass extends UnitTestCase {
  5. /*
  6. public function testScorm() {
  7. //ob_start();
  8. $course_code = 'COURSETEST';
  9. $resource_id = 1;
  10. $user_id = 1;
  11. $obj = new scorm($course_code, $resource_id, $user_id);
  12. $res = $obj->scorm($course_code=null,$resource_id=null,$user_id=null);
  13. $this->assertTrue(is_null($res));
  14. //ob_end_clean();
  15. //var_dump($res);
  16. }*/
  17. public function testOpen() {
  18. //ob_start();
  19. $id = 1;
  20. $res = scorm::open($id);
  21. $this->assertTrue(is_null($res));
  22. //ob_end_clean();
  23. //var_dump($res);
  24. }
  25. public function testParseManifest() {
  26. //ob_start();
  27. $course_code = 'COURSETEST';
  28. $resource_id = 1;
  29. $user_id = 1;
  30. $obj = new scorm($course_code, $resource_id, $user_id);
  31. $res = $obj->parse_manifest($file='');
  32. $this->assertTrue(is_null($res));
  33. //ob_end_clean();
  34. //var_dump($res);
  35. }
  36. public function testImportManifest() {
  37. //ob_start();
  38. $course_code = 'COURSETEST';
  39. $resource_id = 1;
  40. $user_id = 1;
  41. $obj = new scorm($course_code, $resource_id, $user_id);
  42. $res = $obj->import_manifest($course_code = 'COURSETEST');
  43. $this->assertTrue(is_null($res));
  44. //ob_end_clean();
  45. //var_dump($res);
  46. }
  47. /*
  48. public function testImportLocalPackage() {
  49. //ob_start();
  50. $course_code = 'COURSETEST';
  51. $resource_id = 1;
  52. $user_id = 1;
  53. $obj = new scorm($course_code, $resource_id, $user_id);
  54. $res = $obj->import_local_package($file_path,$current_dir='');
  55. $this->assertTrue(is_string($res));
  56. //ob_end_clean();
  57. //var_dump($res);
  58. }
  59. public function testImportPackage() {
  60. //ob_start();
  61. $course_code = 'COURSETEST';
  62. $resource_id = 1;
  63. $user_id = 1;
  64. $obj = new scorm($course_code, $resource_id, $user_id);
  65. $res = $obj->import_package($zip_file_info,$current_dir = '');
  66. $this->assertTrue(is_string($res));
  67. //ob_end_clean();
  68. //var_dump($res);
  69. }*/
  70. public function testSetProximity() {
  71. //ob_start();
  72. $course_code = 'COURSETEST';
  73. $resource_id = 1;
  74. $user_id = 1;
  75. $obj = new scorm($course_code, $resource_id, $user_id);
  76. $res = $obj->set_proximity($proxy='');
  77. $this->assertTrue(is_bool($res));
  78. //ob_end_clean();
  79. //var_dump($res);
  80. }
  81. public function testSetTheme() {
  82. //ob_start();
  83. $course_code = 'COURSETEST';
  84. $resource_id = 1;
  85. $user_id = 1;
  86. $obj = new scorm($course_code, $resource_id, $user_id);
  87. $res = $obj->set_theme($theme='Chamilo');
  88. $this->assertTrue(is_bool($res));
  89. //ob_end_clean();
  90. //var_dump($res);
  91. }
  92. public function testSetPreviewImage() {
  93. //ob_start();
  94. $course_code = 'COURSETEST';
  95. $resource_id = 1;
  96. $user_id = 1;
  97. $obj = new scorm($course_code, $resource_id, $user_id);
  98. $res = $obj->set_preview_image($preview_image='');
  99. $this->assertTrue(is_bool($res));
  100. //ob_end_clean();
  101. //var_dump($res);
  102. }
  103. public function testSetAuthor() {
  104. //ob_start();
  105. $course_code = 'COURSETEST';
  106. $resource_id = 1;
  107. $user_id = 1;
  108. $obj = new scorm($course_code, $resource_id, $user_id);
  109. $res = $obj->set_author($author='');
  110. $this->assertTrue(is_bool($res));
  111. //ob_end_clean();
  112. //var_dump($res);
  113. }
  114. public function testSetMaker() {
  115. //ob_start();
  116. $course_code = 'COURSETEST';
  117. $resource_id = 1;
  118. $user_id = 1;
  119. $obj = new scorm($course_code, $resource_id, $user_id);
  120. $res = $obj->set_maker($maker='');
  121. $this->assertTrue(is_bool($res));
  122. //ob_end_clean();
  123. //var_dump($res);
  124. }
  125. public function testExportZip() {
  126. //ob_start();
  127. $course_code = 'COURSETEST';
  128. $resource_id = 1;
  129. $user_id = 1;
  130. $obj = new scorm($course_code, $resource_id, $user_id);
  131. $res = $obj->export_zip($lp_id=null);
  132. $this->assertTrue(is_bool($res));
  133. //ob_end_clean();
  134. //var_dump($res);
  135. }
  136. public function testGetResPath() {
  137. //ob_start();
  138. $res = scorm::get_res_path($id=1);
  139. $this->assertTrue(is_string($res));
  140. //ob_end_clean();
  141. //var_dump($res);
  142. }
  143. public function testGetResType() {
  144. //ob_start();
  145. $res = scorm::get_res_type($id = 1);
  146. $this->assertTrue(is_string($res));
  147. //ob_end_clean();
  148. //var_dump($res);
  149. }
  150. public function testGetTitle() {
  151. //ob_start();
  152. $res = scorm::get_title();
  153. $this->assertTrue(is_string($res));
  154. //ob_end_clean();
  155. //var_dump($res);
  156. }
  157. public function testReimportManifest() {
  158. ob_start();
  159. $course_code = 'COURSETEST';
  160. $resource_id = 1;
  161. $user_id = 1;
  162. $obj = new scorm($course_code, $resource_id, $user_id);
  163. $res = $obj->reimport_manifest($course = 'COURSETEST',$lp_id=null,$imsmanifest_path='');
  164. $this->assertTrue(is_bool($res));
  165. ob_end_clean();
  166. //var_dump($res);
  167. }
  168. }
  169. ?>