learnpath.class.test.php 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445
  1. <?php
  2. require_once(api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php');
  3. class TestLearnpath extends UnitTestCase {
  4. const course = 'COURSETEST';
  5. public function testAddItem() {
  6. //ob_start();
  7. $parent = 2;
  8. $previous = 1;
  9. $type = 'dokeos_chapter';
  10. $id = 1;
  11. $title = 'Titulo';
  12. $description = 'Descripcion';
  13. $prerequisites = 0;
  14. $max_time_allowed = 0;
  15. $lp_id=1;
  16. $user_id=1;
  17. $obj = new learnpath(self::course, $lp_id, $user_id);
  18. $res = $obj->add_item($parent, $previous, $type, $id, $title, $description, $prerequisites, $max_time_allowed);
  19. $this->assertTrue(is_numeric($res));
  20. //ob_end_clean();
  21. //var_dump($res);
  22. }
  23. public function testAddLp() {
  24. //ob_start();
  25. $name = '';
  26. $description = '';
  27. $learnpath = 'guess';
  28. $origin = 'zip';
  29. $zipname = '';
  30. $res = learnpath::add_lp(self::course, $name, $description, $learnpath, $origin, $zipname);
  31. $this->assertTrue(is_null($res));
  32. //ob_end_clean();
  33. //var_dump($res);
  34. }
  35. /*
  36. public function testAutocompleteParents() {
  37. //ob_start();
  38. $item = 1;
  39. $course='COURSETEST';
  40. $lp_id=1;
  41. $user_id=1;
  42. $obj = new learnpath($course, $lp_id, $user_id);
  43. $res = $obj->autocomplete_parents($item);
  44. $this->assertTrue(is_numeric($res));
  45. //ob_end_clean();
  46. var_dump($res);
  47. }
  48. */
  49. public function testAutosave() {
  50. //ob_start();
  51. $res = learnpath::autosave();
  52. $this->assertTrue(is_null($res));
  53. //ob_end_clean();
  54. //var_dump($res);
  55. }
  56. public function testBuildActionMenu() {
  57. ob_start();
  58. $res = learnpath::build_action_menu();
  59. $this->assertTrue(is_null($res));
  60. ob_end_clean();
  61. //var_dump($res);
  62. }
  63. public function testClose() {
  64. //ob_start();
  65. $res = learnpath::close();
  66. $this->assertTrue(is_bool($res));
  67. //ob_end_clean();
  68. //var_dump($res);
  69. }
  70. public function testCreateDocument() {
  71. //ob_start();
  72. $_course = '';
  73. $res = learnpath::create_document($_course);
  74. $this->assertTrue(is_numeric($res));
  75. //ob_end_clean();
  76. //var_dump($res);
  77. }
  78. /*
  79. public function testCreateJs() {
  80. //ob_start();
  81. $res = learnpath::create_js();
  82. $this->assertTrue(is_string($res));
  83. //ob_end_clean();
  84. //var_dump($res);
  85. }
  86. */
  87. public function testCreatePath() {
  88. //ob_start();
  89. $path = '';
  90. $res = learnpath::create_path($path);
  91. $this->assertTrue(is_null($res));
  92. //ob_end_clean();
  93. //var_dump($res);
  94. }
  95. public function testCreateTreeArray() {
  96. //ob_start();
  97. $array = '';
  98. $parent = 0;
  99. $depth = -1;
  100. $tmp = array ();
  101. $res = learnpath::create_tree_array($array, $parent, $depth, $tmp);
  102. $this->assertTrue(is_null($res));
  103. //ob_end_clean();
  104. //var_dump($res);
  105. }
  106. public function testDisplayDocument() {
  107. //ob_start();
  108. $id = 1;
  109. $show_title = false;
  110. $iframe = true;
  111. $edit_link = false;
  112. $res = learnpath::display_document($id, $show_title, $iframe, $edit_link);
  113. $this->assertTrue(is_string($res));
  114. //ob_end_clean();
  115. //var_dump($res);
  116. }
  117. /*
  118. public function testDisplayDocumentForm() {
  119. //ob_start();
  120. $action = 'add';
  121. $id = 0;
  122. $extra_info = 'new';
  123. $course='COURSETEST';
  124. $lp_id=1;
  125. $user_id=1;
  126. $obj = new learnpath($course, $lp_id, $user_id);
  127. $res = $obj->display_document_form($action, $id, $extra_info);
  128. $this->assertTrue(is_string($res));
  129. //ob_end_clean();
  130. //var_dump($res);
  131. }
  132. */
  133. public function testDisplayEditItem() {
  134. //ob_start();
  135. $item_id = '';
  136. $res = learnpath::display_edit_item($item_id);
  137. $this->assertTrue(is_string($res));
  138. //ob_end_clean();
  139. //var_dump($res);
  140. }
  141. /*
  142. public function testDisplayForumForm() {
  143. //ob_start();
  144. $action = 'add';
  145. $id = 0;
  146. $extra_info = '';
  147. $course='COURSETEST';
  148. $lp_id=1;
  149. $user_id=1;
  150. $obj = new learnpath($course, $lp_id, $user_id);
  151. $res = $obj->display_forum_form($action, $id, $extra_info);
  152. $this->assertTrue(is_string($res));
  153. //ob_end_clean();
  154. //var_dump($res);
  155. }
  156. public function testDisplayHotpotatoesForm() {
  157. //ob_start();
  158. $action = 'add';
  159. $id = 0;
  160. $extra_info = '';
  161. $course='COURSETEST';
  162. $lp_id=1;
  163. $user_id=1;
  164. $obj = new learnpath($course, $lp_id, $user_id);
  165. $res = $obj->display_hotpotatoes_form($action, $id, $extra_info);
  166. $this->assertTrue(is_string($res));
  167. //ob_end_clean();
  168. //var_dump($res);
  169. }
  170. */
  171. public function testDisplayItem() {
  172. //ob_start();
  173. $item_id = '';
  174. $iframe = true;
  175. $msg = '';
  176. $res = learnpath::display_item($item_id, $iframe, $msg);
  177. $this->assertTrue(is_string($res));
  178. //ob_end_clean();
  179. //var_dump($res);
  180. }
  181. /* public function testDisplayItemForm() {
  182. //ob_start();
  183. $item_type = '';
  184. $title = '';
  185. $action = 'add';
  186. $id = 0;
  187. $extra_info = 'new';
  188. $course='COURSETEST';
  189. $lp_id = 1;
  190. $user_id = 1;
  191. $obj = new learnpath($course, $lp_id, $user_id);
  192. $res = $obj->display_item_form($item_type, $title, $action, $id, $extra_info);
  193. $this->assertTrue(is_string($res));
  194. //ob_end_clean();
  195. //var_dump($res);
  196. }
  197. public function testDisplayItemPrerequisitesForm() {
  198. //ob_start();
  199. $item_id = '';
  200. $course='COURSETEST';
  201. $lp_id=1;
  202. $user_id=1;
  203. $obj = new learnpath($course, $lp_id, $user_id);
  204. $res = $obj->display_item_prerequisites_form($item_id);
  205. $this->assertTrue(is_string($res));
  206. //ob_end_clean();
  207. //var_dump($res);
  208. }
  209. */
  210. public function testDisplayItemSmallForm() {
  211. //ob_start();
  212. $item_type = '';
  213. $title = '';
  214. $data = '';
  215. $res = learnpath::display_item_small_form($item_type, $title, $data);
  216. $this->assertTrue(is_string($res));
  217. //ob_end_clean();
  218. //var_dump($res);
  219. }
  220. /*
  221. public function testDisplayLinkForm() {
  222. //ob_start();
  223. $action = 'add';
  224. $id = 0;
  225. $extra_info = '';
  226. $course='COURSETEST';
  227. $lp_id=1;
  228. $user_id=1;
  229. $obj = new learnpath($course, $lp_id, $user_id);
  230. $res = $obj->display_link_form($action, $id, $extra_info);
  231. $this->assertTrue(is_string($res));
  232. //ob_end_clean();
  233. //var_dump($res);
  234. }
  235. public function testDisplayManipulate() {
  236. //ob_start();
  237. $item_id = '';
  238. $item_type = TOOL_DOCUMENT;
  239. $res = learnpath::display_manipulate($item_id, $item_type);
  240. $this->assertTrue(is_string($res));
  241. //ob_end_clean();
  242. //var_dump($res);
  243. }
  244. */
  245. public function testDisplayMoveItem() {
  246. //ob_start();
  247. $item_id = '';
  248. $res = learnpath::display_move_item($item_id);
  249. $this->assertTrue(is_string($res));
  250. //ob_end_clean();
  251. //var_dump($res);
  252. }
  253. /*
  254. public function testDisplayQuizForm() {
  255. //ob_start();
  256. $action = 'add';
  257. $id = 0;
  258. $extra_info = '';
  259. $course='COURSETEST';
  260. $lp_id=1;
  261. $user_id=1;
  262. $obj = new learnpath($course, $lp_id, $user_id);
  263. $res = $obj->display_quiz_form($action, $id, $extra_info);
  264. $this->assertTrue(is_string($res));
  265. //ob_end_clean();
  266. //var_dump($res);
  267. }
  268. */
  269. /* public function testDisplayResources() {
  270. //ob_start();
  271. $course='COURSETEST';
  272. $lp_id=1;
  273. $user_id=1;
  274. $obj = new learnpath($course, $lp_id, $user_id);
  275. $res = $obj->display_resources();
  276. $this->assertTrue(is_string($res));
  277. //ob_end_clean();
  278. //var_dump($res);
  279. }
  280. public function testDisplayStudentPublicationForm() {
  281. //ob_start();
  282. $action = 'add';
  283. $id = 0;
  284. $extra_info = '';
  285. $course='COURSETEST';
  286. $lp_id=1;
  287. $user_id=1;
  288. $obj = new learnpath($course, $lp_id, $user_id);
  289. $res = $obj->display_student_publication_form($action, $id, $extra_info);
  290. $this->assertTrue(is_string($res));
  291. //ob_end_clean();
  292. //var_dump($res);
  293. }
  294. public function testDisplayThreadForm() {
  295. //ob_start();
  296. $action = 'add';
  297. $id = 0;
  298. $extra_info = '';
  299. $course='COURSETEST';
  300. $lp_id=1;
  301. $user_id=1;
  302. $obj = new learnpath($course, $lp_id, $user_id);
  303. $res = $obj->display_thread_form($action, $id, $extra_info);
  304. $this->assertTrue(is_string($res));
  305. //ob_end_clean();
  306. //var_dump($res);
  307. }
  308. */
  309. public function testEditDocument() {
  310. //ob_start();
  311. $_course='';
  312. $res = learnpath::edit_document($_course);
  313. $this->assertTrue(is_null($res));
  314. //ob_end_clean();
  315. //var_dump($res);
  316. }
  317. public function testEditItem() {
  318. //ob_start();
  319. $id = '';
  320. $parent = '';
  321. $previous = '';
  322. $title = '';
  323. $description = '';
  324. $prerequisites = 0;
  325. $audio = NULL;
  326. $max_time_allowed = 0;
  327. $res = learnpath::edit_item($id, $parent, $previous, $title, $description, $prerequisites, $audio, $max_time_allowed);
  328. $this->assertTrue(is_bool($res));
  329. //ob_end_clean();
  330. //var_dump($res);
  331. }
  332. public function testEditItemPrereq() {
  333. //ob_start();
  334. $id = '';
  335. $prerequisite_id = '';
  336. $mastery_score = 0;
  337. $max_score = 100;
  338. $res = learnpath::edit_item_prereq($id, $prerequisite_id, $mastery_score, $max_score);
  339. $this->assertTrue(is_bool($res));
  340. //ob_end_clean();
  341. //var_dump($res);
  342. }
  343. public function testExportLp() {
  344. //ob_start();
  345. $type = 'scorm';
  346. $id = 1;
  347. $zipname = 'FILE';
  348. $res = learnpath::export_lp($type, self::course, $id, $zipname);
  349. $this->assertTrue(is_string($res));
  350. //ob_end_clean();
  351. //var_dump($res);
  352. }
  353. public function testFirst() {
  354. //ob_start();
  355. $res = learnpath::first();
  356. $this->assertTrue(is_null($res));
  357. //ob_end_clean();
  358. //var_dump($res);
  359. }
  360. public function testGetAuthor() {
  361. //ob_start();
  362. $res = learnpath::get_author();
  363. $this->assertTrue(is_string($res));
  364. //ob_end_clean();
  365. //var_dump($res);
  366. }
  367. public function testGetBrotherChapters() {
  368. //ob_start();
  369. $id = '';
  370. $res = learnpath::get_brother_chapters($id);
  371. $this->assertTrue(is_array($res));
  372. //ob_end_clean();
  373. //var_dump($res);
  374. }
  375. public function testGetBrotherItems() {
  376. //ob_start();
  377. $id = '';
  378. $res = learnpath::get_brother_items($id);
  379. $this->assertTrue(is_array($res));
  380. //ob_end_clean();
  381. //var_dump($res);
  382. }
  383. /*
  384. public function testGetCommonIndexTermsByPrefix() {
  385. //ob_start();
  386. $prefix = '';
  387. $res = learnpath::get_common_index_terms_by_prefix($prefix);
  388. $this->assertTrue(is_array($res));
  389. //ob_end_clean();
  390. //var_dump($res);
  391. }
  392. public function testGetCompleteItemsCount() {
  393. //ob_start();
  394. $res = learnpath::get_complete_items_count();
  395. $this->assertTrue(is_numeric($res));
  396. //ob_end_clean();
  397. //var_dump($res);
  398. }
  399. */
  400. public function testGetCurrentItemId() {
  401. //ob_start();
  402. $res = learnpath::get_current_item_id();
  403. $this->assertTrue(is_numeric($res));
  404. //ob_end_clean();
  405. //var_dump($res);
  406. }
  407. public function testGetDocuments() {
  408. //ob_start();
  409. $lp_id=1;
  410. $user_id=1;
  411. $obj = new learnpath(self::course, $lp_id, $user_id);
  412. $res = $obj->get_documents();
  413. $this->assertTrue(is_string($res));
  414. //ob_end_clean();
  415. //var_dump($res);
  416. }
  417. public function testGetExercises() {
  418. //ob_start();
  419. $res = learnpath::get_exercises();
  420. $this->assertTrue(is_string($res));
  421. //ob_end_clean();
  422. //var_dump($res);
  423. }
  424. public function testGetExtension() {
  425. //ob_start();
  426. $filename = 'file';
  427. $res = learnpath::get_extension($filename);
  428. $this->assertTrue(is_string($res));
  429. //ob_end_clean();
  430. //var_dump($res);
  431. }
  432. public function testGetFirstItemId() {
  433. //ob_start();
  434. $res = learnpath::get_first_item_id();
  435. $this->assertTrue(is_numeric($res));
  436. //ob_end_clean();
  437. //var_dump($res);
  438. }
  439. public function testGetFlatOrderedItemsList() {
  440. //ob_start();
  441. $lp = 1;
  442. $parent = 0;
  443. $res = learnpath::get_flat_ordered_items_list($lp, $parent);
  444. $this->assertTrue(is_array($res));
  445. //ob_end_clean();
  446. //var_dump($res);
  447. }
  448. /*
  449. public function testGetForums() {
  450. //ob_start();
  451. //require_once api_get_path(WEB_PATH).('forum/forumpublic function.inc.php');
  452. //require_once api_get_path(WEB_PATH).('forum/forumconfig.inc.php');
  453. $course='COURSETEST';
  454. $lp_id=1;
  455. $user_id=1;
  456. $obj = new learnpath($course, $lp_id, $user_id);
  457. $res = $obj->get_forums();
  458. $this->assertTrue(is_string($res));
  459. //ob_end_clean();
  460. //var_dump($res);
  461. }
  462. public function testGetHtmlToc() {
  463. //ob_start();
  464. $course='COURSETEST';
  465. $lp_id=1;
  466. $user_id=1;
  467. $obj = new learnpath($course, $lp_id, $user_id);
  468. $res = $obj->get_html_toc();
  469. $this->assertTrue(is_string($res));
  470. //ob_end_clean();
  471. //var_dump($res);
  472. }
  473. */
  474. public function testGetId() {
  475. //ob_start();
  476. $res = learnpath::get_id();
  477. $this->assertTrue(is_numeric($res));
  478. //ob_end_clean();
  479. //var_dump($res);
  480. }
  481. public function testGetInteractionsCountFromDb() {
  482. //ob_start();
  483. $lp_iv_id = 0;
  484. $res = learnpath::get_interactions_count_from_db($lp_iv_id);
  485. $this->assertTrue(is_numeric($res));
  486. //ob_end_clean();
  487. //var_dump($res);
  488. }
  489. /*
  490. public function testGetItemsDetailsAsJs() {
  491. //ob_start();
  492. $varname='olms.lms_item_types';
  493. $res = learnpath::get_items_details_as_js($varname);
  494. $this->assertTrue(is_string($res));
  495. //ob_end_clean();
  496. //var_dump($res);
  497. }
  498. public function testGetItemsStatusList() {
  499. //ob_start();
  500. $res = learnpath::get_items_status_list();
  501. $this->assertTrue(is_array($res));
  502. //ob_end_clean();
  503. //var_dump($res);
  504. }
  505. public function testGetIvInteractionsArray() {
  506. //ob_start();
  507. $lp_iv_id = '';
  508. $res = learnpath::get_iv_interactions_array($lp_iv_id);
  509. $this->assertTrue(is_array($res));
  510. //ob_end_clean();
  511. //var_dump($res);
  512. }
  513. */
  514. public function testGetIvObjectivesArray() {
  515. //ob_start();
  516. $lp_iv_id = 0;
  517. $res = learnpath::get_iv_objectives_array($lp_iv_id);
  518. $this->assertTrue(is_array($res));
  519. //ob_end_clean();
  520. //var_dump($res);
  521. }
  522. /*
  523. public function testGetJsInfo() {
  524. //ob_start();
  525. $item_id = '';
  526. $course='COURSETEST';
  527. $lp_id=1;
  528. $user_id=1;
  529. $obj = new learnpath($course, $lp_id, $user_id);
  530. $res = $obj->get_js_info($item_id);
  531. $this->assertTrue(is_string($res));
  532. //ob_end_clean();
  533. //var_dump($res);
  534. } */
  535. public function testGetJsLib() {
  536. //ob_start();
  537. $res = learnpath::get_js_lib();
  538. $this->assertTrue(is_string($res));
  539. //ob_end_clean();
  540. //var_dump($res);
  541. }
  542. public function testGetLast() {
  543. //ob_start();
  544. $res = learnpath::get_last();
  545. $this->assertTrue(is_null($res));
  546. //ob_end_clean();
  547. //var_dump($res);
  548. }
  549. public function testGetLink() {
  550. //ob_start();
  551. $type = 'http';
  552. $item_id = null;
  553. $lp_id=1;
  554. $user_id=1;
  555. $obj = new learnpath(self::course, $lp_id, $user_id);
  556. $res = $obj->get_link($type, $item_id);
  557. $this->assertTrue(is_string($res));
  558. //ob_end_clean();
  559. //var_dump($res);
  560. }
  561. public function testGetLinks() {
  562. //ob_start();
  563. $res = learnpath::get_links();
  564. $this->assertTrue(is_string($res));
  565. //ob_end_clean();
  566. //var_dump($res);
  567. }
  568. public function testGetLpSessionId() {
  569. //ob_start();
  570. $res = learnpath::get_lp_session_id();
  571. $this->assertTrue(is_numeric($res));
  572. //ob_end_clean();
  573. //var_dump($res);
  574. }
  575. public function testGetMaker() {
  576. //ob_start();
  577. $res = learnpath::get_maker();
  578. $this->assertTrue(is_string($res));
  579. //ob_end_clean();
  580. //var_dump($res);
  581. }
  582. public function testGetMediaplayer() {
  583. //ob_start();
  584. $autostart='true';
  585. $res = learnpath::get_mediaplayer($autostart);
  586. $this->assertTrue(is_string($res));
  587. //ob_end_clean();
  588. //var_dump($res);
  589. }
  590. public function testGetName() {
  591. //ob_start();
  592. $res = learnpath::get_name();
  593. $this->assertTrue(is_string($res));
  594. //ob_end_clean();
  595. //var_dump($res);
  596. }
  597. public function testGetNavigationBar() {
  598. //ob_start();
  599. $lp_id=1;
  600. $user_id=1;
  601. $obj = new learnpath(self::course, $lp_id, $user_id);
  602. $res = $obj->get_navigation_bar();
  603. $this->assertTrue(is_string($res));
  604. //ob_end_clean();
  605. //var_dump($res);
  606. }
  607. public function testGetNextIndex() {
  608. //ob_start();
  609. $res = learnpath::get_next_index();
  610. $this->assertTrue(is_numeric($res));
  611. //ob_end_clean();
  612. //var_dump($res);
  613. }
  614. public function testGetNextItemId() {
  615. //ob_start();
  616. $lp_id=1;
  617. $user_id=1;
  618. $obj = new learnpath(self::course, $lp_id, $user_id);
  619. $res = $obj->get_next_item_id();
  620. $this->assertTrue(is_numeric($res));
  621. //ob_end_clean();
  622. //var_dump($res);
  623. }
  624. public function testGetObjectivesCountFromDb() {
  625. //ob_start();
  626. $lp_iv_id = 0;
  627. $res = learnpath::get_objectives_count_from_db($lp_iv_id);
  628. $this->assertTrue(is_numeric($res));
  629. //ob_end_clean();
  630. //var_dump($res);
  631. }
  632. /*
  633. public function testGetPackageType() {
  634. //ob_start();
  635. $file_path = '';
  636. $file_name = '';
  637. $course='COURSETEST';
  638. $lp_id=1;
  639. $user_id=1;
  640. $obj = new learnpath($course, $lp_id, $user_id);
  641. $res = $obj->get_package_type($file_path, $file_name);
  642. $this->assertTrue(is_string($res));
  643. //ob_end_clean();
  644. //var_dump($res);
  645. }*/
  646. public function testGetPreviewImage() {
  647. //ob_start();
  648. $res = learnpath::get_preview_image();
  649. $this->assertTrue(is_string($res));
  650. //ob_end_clean();
  651. //var_dump($res);
  652. }
  653. public function testGetPreviousIndex() {
  654. //ob_start();
  655. $res = learnpath::get_previous_index();
  656. $this->assertTrue(is_numeric($res));
  657. //ob_end_clean();
  658. //var_dump($res);
  659. }
  660. public function testGetPreviousItemId() {
  661. //ob_start();
  662. $lp_id=1;
  663. $user_id=1;
  664. $obj = new learnpath(self::course, $lp_id, $user_id);
  665. $res = $obj->get_previous_item_id();
  666. $this->assertTrue(is_numeric($res));
  667. //ob_end_clean();
  668. //var_dump($res);
  669. }
  670. public function testGetProgress() {
  671. //ob_start();
  672. $res = learnpath::get_progress();
  673. $this->assertTrue(is_numeric($res));
  674. //ob_end_clean();
  675. //var_dump($res);
  676. }
  677. public function testGetProgressBar() {
  678. //ob_start();
  679. $mode = '';
  680. $percentage = -1;
  681. $text_add = '';
  682. $from_lp = false;
  683. $lp_id=1;
  684. $user_id=1;
  685. $obj = new learnpath(self::course, $lp_id, $user_id);
  686. $res = $obj->get_progress_bar($mode, $percentage, $text_add, $from_lp);
  687. $this->assertTrue(is_string($res));
  688. //ob_end_clean();
  689. //var_dump($res);
  690. }
  691. public function testGetProgressBarMode() {
  692. //ob_start();
  693. $res = learnpath::get_progress_bar_mode();
  694. $this->assertTrue(is_string($res));
  695. //ob_end_clean();
  696. //var_dump($res);
  697. }
  698. public function testGetProgressBarText() {
  699. //ob_start();
  700. $mode = '';
  701. $add = 0;
  702. $lp_id=1;
  703. $user_id=1;
  704. $obj = new learnpath(self::course, $lp_id, $user_id);
  705. $res = $obj->get_progress_bar_text($mode, $add);
  706. $this->assertTrue(is_array($res));
  707. //ob_end_clean();
  708. //var_dump($res);
  709. }
  710. public function testGetProximity() {
  711. //ob_start();
  712. $res = learnpath::get_proximity();
  713. $this->assertTrue(is_string($res));
  714. //ob_end_clean();
  715. //var_dump($res);
  716. }
  717. public function testGetScormPrereqString() {
  718. //ob_start();
  719. $item_id = 1;
  720. $res = learnpath::get_scorm_prereq_string($item_id);
  721. $this->assertTrue(is_bool($res));
  722. //ob_end_clean();
  723. //var_dump($res);
  724. }
  725. public function testGetScormXmlNode() {
  726. //ob_start();
  727. $children = 'children';
  728. $id = 1;
  729. $res = learnpath::get_scorm_xml_node($children, $id);
  730. $this->assertTrue(is_bool($res));
  731. //ob_end_clean();
  732. //var_dump($res);
  733. }
  734. public function testGetStats() {
  735. //ob_start();
  736. $res = learnpath::get_stats();
  737. $this->assertTrue(is_null($res));
  738. //ob_end_clean();
  739. //var_dump($res);
  740. }
  741. public function testGetStatsCourse() {
  742. //ob_start();
  743. $course = '';
  744. $res = learnpath::get_stats_course($course);
  745. $this->assertTrue(is_null($res));
  746. //ob_end_clean();
  747. //var_dump($res);
  748. }
  749. public function testGetStatsLp() {
  750. //ob_start();
  751. $lp = 1;
  752. $res = learnpath::get_stats_lp(self::course, $lp);
  753. $this->assertTrue(is_null($res));
  754. //ob_end_clean();
  755. //var_dump($res);
  756. }
  757. public function testGetStatsLpUser() {
  758. //ob_start();
  759. $lp = 1;
  760. $user = 1;
  761. $res = learnpath::get_stats_lp_user(self::course, $lp, $user);
  762. $this->assertTrue(is_null($res));
  763. //ob_end_clean();
  764. //var_dump($res);
  765. }
  766. public function testGetStatsUser() {
  767. //ob_start();
  768. $user = 1;
  769. $res = learnpath::get_stats_user(self::course, $user);
  770. $this->assertTrue(is_null($res));
  771. //ob_end_clean();
  772. //var_dump($res);
  773. }
  774. public function testGetStudentPublications() {
  775. //ob_start();
  776. $res = learnpath::get_student_publications();
  777. $this->assertTrue(is_string($res));
  778. //ob_end_clean();
  779. //var_dump($res);
  780. }
  781. public function testGetTheme() {
  782. //ob_start();
  783. $res = learnpath::get_theme();
  784. $this->assertTrue(is_string($res));
  785. //ob_end_clean();
  786. //var_dump($res);
  787. }
  788. /*
  789. public function testGetToc() {
  790. //ob_start();
  791. $res = learnpath::get_toc();
  792. $this->assertTrue(is_array($res));
  793. //ob_end_clean();
  794. //var_dump($res);
  795. }
  796. */
  797. public function testGetTotalItemsCount() {
  798. //ob_start();
  799. $res = learnpath::get_total_items_count();
  800. $this->assertTrue(is_numeric($res));
  801. //ob_end_clean();
  802. //var_dump($res);
  803. }
  804. /*
  805. public function testGetTotalItemsCountWithoutChapters() {
  806. //ob_start();
  807. $res = learnpath::get_total_items_count_without_chapters();
  808. $this->assertTrue(is_numeric($res));
  809. //ob_end_clean();
  810. //var_dump($res);
  811. }
  812. */
  813. public function testGetType() {
  814. //ob_start();
  815. $get_name = false;
  816. $res=learnpath::get_type($get_name) ;
  817. $this->assertTrue(is_bool($res));
  818. //ob_end_clean();
  819. //var_dump($res);
  820. }
  821. public function testGetTypeStatic() {
  822. //ob_start();
  823. $lp_id = 0;
  824. $res = learnpath::get_type_static($lp_id);
  825. $this->assertTrue(is_null($res));
  826. //ob_end_clean();
  827. //var_dump($res);
  828. }
  829. public function testGetUpdateQueue() {
  830. //ob_start();
  831. $res = learnpath::get_update_queue();
  832. $this->assertTrue(is_null($res));
  833. //ob_end_clean();
  834. //var_dump($res);
  835. }
  836. public function testGetUserId() {
  837. //ob_start();
  838. $res = learnpath::get_user_id();
  839. $this->assertTrue(is_bool($res));
  840. //ob_end_clean();
  841. //var_dump($res);
  842. }
  843. /*
  844. public function testGetView() {
  845. //ob_start();
  846. $attempt_num = 0;
  847. $course='COURSETEST';
  848. $lp_id=1;
  849. $user_id=1;
  850. $obj = new learnpath($course, $lp_id, $user_id);
  851. $res = $obj->get_view($attempt_num);
  852. $this->assertTrue(is_numeric($res));
  853. //ob_end_clean();
  854. //var_dump($res);
  855. }
  856. */
  857. public function testGetViewId() {
  858. //ob_start();
  859. $lp_id=1;
  860. $user_id=1;
  861. $obj = new learnpath(self::course, $lp_id, $user_id);
  862. $res = $obj->get_view_id();
  863. $this->assertTrue(is_numeric($res));
  864. //ob_end_clean();
  865. //var_dump($res);
  866. }
  867. /*
  868. public function testHasAudio() {
  869. //ob_start();
  870. $res = learnpath::has_audio();
  871. $this->assertTrue(is_bool($res));
  872. //ob_end_clean();
  873. //var_dump($res);
  874. }*/
  875. public function testLearnpath() {
  876. //ob_start();
  877. $course = '';
  878. $lp_id = '';
  879. $user_id = '';
  880. $res = learnpath::__construct($course, $lp_id, $user_id);
  881. $this->assertTrue(is_bool($res));
  882. //ob_end_clean();
  883. //var_dump($res);
  884. }
  885. public function testLog() {
  886. //ob_start();
  887. $msg = '';
  888. $res = learnpath::log($msg);
  889. $this->assertTrue(is_bool($res));
  890. //ob_end_clean();
  891. //var_dump($res);
  892. }
  893. public function testMoveDown() {
  894. //ob_start();
  895. $lp_id = 0;
  896. $res = learnpath::move_down($lp_id);
  897. $this->assertTrue(is_null($res));
  898. //ob_end_clean();
  899. //var_dump($res);
  900. }
  901. public function testMoveItem() {
  902. //ob_start();
  903. $id = 1;
  904. $direction = '';
  905. $res = learnpath::move_item($id, $direction);
  906. $this->assertTrue(is_bool($res));
  907. //ob_end_clean();
  908. //var_dump($res);
  909. }
  910. public function testMoveUp() {
  911. //ob_start();
  912. $lp_id = 0;
  913. $res = learnpath::move_up($lp_id);
  914. $this->assertTrue(is_null($res));
  915. //ob_end_clean();
  916. //var_dump($res);
  917. }
  918. /*
  919. public function testNext() {
  920. //ob_start();
  921. $course='COURSETEST';
  922. $lp_id=1;
  923. $user_id=1;
  924. $obj = new learnpath($course, $lp_id, $user_id);
  925. $res = $obj->next();
  926. $this->assertTrue(is_null($res));
  927. //ob_end_clean();
  928. //var_dump($res);
  929. } */
  930. public function testOpen() {
  931. //ob_start();
  932. $id = '';
  933. $res = learnpath::open($id);
  934. $this->assertTrue(is_null($res));
  935. //ob_end_clean();
  936. //var_dump($res);
  937. }
  938. /*
  939. public function testOverview() {
  940. //ob_start();
  941. $course='COURSETEST';
  942. $lp_id=1;
  943. $user_id=1;
  944. $obj = new learnpath($course, $lp_id, $user_id);
  945. $res = $obj->overview();
  946. $this->assertTrue(is_string($res));
  947. //ob_end_clean();
  948. //var_dump($res);
  949. }
  950. */
  951. public function testPrerequisitesMatch() {
  952. //ob_start();
  953. $item = null;
  954. $res = learnpath::prerequisites_match($item);
  955. $this->assertTrue(is_bool($res));
  956. //ob_end_clean();
  957. //var_dump($res);
  958. }
  959. /*
  960. public function testPrevious() {
  961. //ob_start();
  962. $course='COURSETEST';
  963. $lp_id=1;
  964. $user_id=1;
  965. $obj = new learnpath($course, $lp_id, $user_id);
  966. $res = $obj->previous();
  967. $this->assertTrue(is_null($res));
  968. //ob_end_clean();
  969. //var_dump($res);
  970. }
  971. */
  972. /*public function testRestart() {
  973. //ob_start();
  974. $course='COURSETEST';
  975. $lp_id=1;
  976. $user_id=1;
  977. $obj = new learnpath($course, $lp_id, $user_id);
  978. $res = $obj->restart();
  979. $this->assertTrue(is_bool($res));
  980. //ob_end_clean();
  981. //var_dump($res);
  982. }*/
  983. public function testSaveCurrent() {
  984. //ob_start();
  985. $res = learnpath::save_current();
  986. $this->assertTrue(is_bool($res));
  987. //ob_end_clean();
  988. //var_dump($res);
  989. }
  990. public function testSaveItem() {
  991. //ob_start();
  992. $item_id = null;
  993. $from_outside = true;
  994. $lp_id=1;
  995. $user_id=1;
  996. $obj = new learnpath(self::course, $lp_id, $user_id);
  997. $res = $obj->save_item($item_id, $from_outside);
  998. $this->assertTrue(is_bool($res));
  999. //ob_end_clean();
  1000. //var_dump($res);
  1001. }
  1002. public function testSaveLast() {
  1003. //ob_start();
  1004. $lp_id=1;
  1005. $user_id=1;
  1006. $obj = new learnpath(self::course, $lp_id, $user_id);
  1007. $res = $obj->save_last();
  1008. $this->assertTrue(is_null($res));
  1009. //ob_end_clean();
  1010. //var_dump($res);
  1011. }
  1012. /*
  1013. public function testScormExport() {
  1014. //ob_start();
  1015. $course='COURSETEST';
  1016. $lp_id=1;
  1017. $user_id=1;
  1018. $obj = new learnpath($course, $lp_id, $user_id);
  1019. $res = $obj->scorm_export();
  1020. $this->assertTrue(is_string($res));
  1021. //ob_end_clean();
  1022. //var_dump($res);
  1023. }
  1024. */
  1025. public function testSetAuthor() {
  1026. //ob_start();
  1027. $name = '';
  1028. $lp_id=1;
  1029. $user_id=1;
  1030. $obj = new learnpath(self::course, $lp_id, $user_id);
  1031. $res = $obj->set_author($name);
  1032. $this->assertTrue(is_bool($res));
  1033. //ob_end_clean();
  1034. //var_dump($res);
  1035. }
  1036. public function testSetCurrentItem() {
  1037. //ob_start();
  1038. $item_id = null;
  1039. $res = learnpath::set_current_item($item_id);
  1040. $this->assertTrue(is_null($res));
  1041. //ob_end_clean();
  1042. //var_dump($res);
  1043. }
  1044. public function testSetEncoding() {
  1045. //ob_start();
  1046. $enc = 'ISO-8859-15';
  1047. $lp_id=1;
  1048. $user_id=1;
  1049. $obj = new learnpath(self::course, $lp_id, $user_id);
  1050. $res = $obj->set_encoding($enc);
  1051. $this->assertTrue(is_bool($res));
  1052. //ob_end_clean();
  1053. //var_dump($res);
  1054. }
  1055. public function testSetErrorMsg() {
  1056. //ob_start();
  1057. $error = '';
  1058. $res = learnpath::set_error_msg($error);
  1059. $this->assertTrue(is_null($res));
  1060. //ob_end_clean();
  1061. //var_dump($res);
  1062. }
  1063. public function testSetJslib() {
  1064. //ob_start();
  1065. $lib = '';
  1066. $lp_id=1;
  1067. $user_id=1;
  1068. $obj = new learnpath(self::course, $lp_id, $user_id);
  1069. $res = $obj->set_jslib($lib);
  1070. $this->assertTrue(is_bool($res));
  1071. //ob_end_clean();
  1072. //var_dump($res);
  1073. }
  1074. public function testSetMaker() {
  1075. //ob_start();
  1076. $name = '';
  1077. $res = learnpath::set_maker($name);
  1078. $this->assertTrue(is_bool($res));
  1079. //ob_end_clean();
  1080. //var_dump($res);
  1081. }
  1082. public function testSetName() {
  1083. //ob_start();
  1084. $name = '';
  1085. $res = learnpath::set_name($name);
  1086. $this->assertTrue(is_bool($res));
  1087. //ob_end_clean();
  1088. //var_dump($res);
  1089. }
  1090. public function testSetPreviewImage() {
  1091. //ob_start();
  1092. $name = '';
  1093. $lp_id=1;
  1094. $user_id=1;
  1095. $obj = new learnpath(self::course, $lp_id, $user_id);
  1096. $res = $obj->set_preview_image($name);
  1097. $this->assertTrue(is_bool($res));
  1098. //ob_end_clean();
  1099. //var_dump($res);
  1100. }
  1101. public function testSetPreviousItem() {
  1102. //ob_start();
  1103. $id = '';
  1104. $res = learnpath::set_previous_item($id);
  1105. $this->assertTrue(is_null($res));
  1106. //ob_end_clean();
  1107. //var_dump($res);
  1108. }
  1109. public function testSetProximity() {
  1110. //ob_start();
  1111. $name = '';
  1112. $res = learnpath::set_proximity($name);
  1113. $this->assertTrue(is_bool($res));
  1114. //ob_end_clean();
  1115. //var_dump($res);
  1116. }
  1117. public function testSetTermsByPrefix() {
  1118. //ob_start();
  1119. $terms_string = '';
  1120. $prefix = '';
  1121. $res = learnpath::set_terms_by_prefix($terms_string, $prefix);
  1122. $this->assertTrue(is_bool($res));
  1123. //ob_end_clean();
  1124. //var_dump($res);
  1125. }
  1126. public function testSetTheme() {
  1127. //ob_start();
  1128. $name = '';
  1129. $lp_id=1;
  1130. $user_id=1;
  1131. $obj = new learnpath(self::course, $lp_id, $user_id);
  1132. $res = $obj->set_theme($name);
  1133. $this->assertTrue(is_bool($res));
  1134. //ob_end_clean();
  1135. //var_dump($res);
  1136. }
  1137. /*
  1138. public function testSortTreeArray() {
  1139. //ob_start();
  1140. $array = '';
  1141. $course='COURSETEST';
  1142. $lp_id=1;
  1143. $user_id=1;
  1144. $obj = new learnpath($course, $lp_id, $user_id);
  1145. $res = $obj->sort_tree_array($array);
  1146. $this->assertTrue(is_array($res));
  1147. //ob_end_clean();
  1148. //var_dump($res);
  1149. }
  1150. */
  1151. public function testStartCurrentItem() {
  1152. //ob_start();
  1153. $allow_new_attempt = false;
  1154. $res = learnpath::start_current_item($allow_new_attempt);
  1155. $this->assertTrue(is_bool($res));
  1156. //ob_end_clean();
  1157. //var_dump($res);
  1158. }
  1159. public function testStopPreviousItem() {
  1160. //ob_start();
  1161. $res = learnpath::stop_previous_item();
  1162. $this->assertTrue(is_bool($res));
  1163. //ob_end_clean();
  1164. //var_dump($res);
  1165. }
  1166. /*
  1167. public function testTogglePublish() {
  1168. //ob_start();
  1169. $lp_id = '';
  1170. $set_visibility = 'v';
  1171. $res = learnpath::toggle_publish($lp_id, $set_visibility);
  1172. $this->assertTrue(is_null($res));
  1173. //ob_end_clean();
  1174. //var_dump($res);
  1175. }
  1176. */
  1177. public function testToggleVisibility() {
  1178. //ob_start();
  1179. $lp_id = '';
  1180. $set_visibility = 1;
  1181. $res = learnpath::toggle_visibility($lp_id, $set_visibility);
  1182. $this->assertTrue(is_bool($res));
  1183. //ob_end_clean();
  1184. //var_dump($res);
  1185. }
  1186. /*
  1187. public function testTreeArray() {
  1188. //ob_start();
  1189. $array = '';
  1190. $res = learnpath::tree_array($array);
  1191. $this->assertTrue(is_null($res));
  1192. //ob_end_clean();
  1193. //var_dump($res);
  1194. }
  1195. */
  1196. public function testUpdateDefaultScormCommit() {
  1197. //ob_start();
  1198. $lp_id=1;
  1199. $user_id=1;
  1200. $obj = new learnpath(self::course, $lp_id, $user_id);
  1201. $res = $obj->update_default_scorm_commit();
  1202. $this->assertTrue(is_bool($res));
  1203. //ob_end_clean();
  1204. //var_dump($res);
  1205. }
  1206. public function testUpdateDefaultViewMode() {
  1207. //ob_start();
  1208. $lp_id=1;
  1209. $user_id=1;
  1210. $obj = new learnpath(self::course, $lp_id, $user_id);
  1211. $res = $obj->update_default_view_mode();
  1212. $this->assertTrue(is_string($res));
  1213. //ob_end_clean();
  1214. //var_dump($res);
  1215. }
  1216. public function testUpdateDisplayOrder() {
  1217. //ob_start();
  1218. $res = learnpath::update_display_order();
  1219. $this->assertTrue(is_bool($res));
  1220. //ob_end_clean();
  1221. //var_dump($res);
  1222. }
  1223. public function testUpdateReinit() {
  1224. //ob_start();
  1225. $lp_id=1;
  1226. $user_id=1;
  1227. $obj = new learnpath(self::course, $lp_id, $user_id);
  1228. $res = $obj->update_reinit();
  1229. $this->assertTrue(is_numeric($res));
  1230. //ob_end_clean();
  1231. //var_dump($res);
  1232. }
  1233. public function testUpdateScormDebug() {
  1234. //ob_start();
  1235. $lp_id=1;
  1236. $user_id=1;
  1237. $obj = new learnpath(self::course, $lp_id, $user_id);
  1238. $res = $obj->update_scorm_debug();
  1239. $this->assertTrue(is_numeric($res));
  1240. //ob_end_clean();
  1241. //var_dump($res);
  1242. }
  1243. public function testUploadImage() {
  1244. //ob_start();
  1245. $image_array = '';
  1246. $res = learnpath::upload_image($image_array);
  1247. $this->assertTrue(is_bool($res));
  1248. //ob_end_clean();
  1249. //var_dump($res);
  1250. }
  1251. /*
  1252. public function testWriteResourcesTree() {
  1253. //ob_start();
  1254. $resources_sorted = '';
  1255. $num = 0;
  1256. $res = learnpath::write_resources_tree($resources_sorted, $num);
  1257. $this->assertTrue(is_null($res));
  1258. //ob_end_clean();
  1259. //var_dump($res);
  1260. }
  1261. public function testDelete() {
  1262. //ob_start();
  1263. $course = null;
  1264. $id = null;
  1265. $delete = 'keep';
  1266. $course='COURSETEST';
  1267. $lp_id=1;
  1268. $user_id=1;
  1269. $obj = new learnpath($course, $lp_id, $user_id);
  1270. $res = $obj->delete($course, $id, $delete);
  1271. $this->assertTrue(is_null($res));
  1272. //ob_end_clean();
  1273. //var_dump($res);
  1274. }*/
  1275. public function testDeleteChildrenItems() {
  1276. //ob_start();
  1277. $id = '';
  1278. $res = learnpath::delete_children_items($id);
  1279. $this->assertTrue(is_bool($res));
  1280. //ob_end_clean();
  1281. //var_dump($res);
  1282. }
  1283. public function testDeleteItem() {
  1284. //ob_start();
  1285. $id = '';
  1286. $remove = 'keep';
  1287. $res = learnpath::delete_item($id, $remove);
  1288. $this->assertTrue(is_bool($res));
  1289. //ob_end_clean();
  1290. //var_dump($res);
  1291. }
  1292. public function testDeleteLpImage() {
  1293. //ob_start();
  1294. $lp_id=1;
  1295. $user_id=1;
  1296. $obj = new learnpath(self::course, $lp_id, $user_id);
  1297. $res = $obj->delete_lp_image();
  1298. $this->assertTrue(is_bool($res));
  1299. //ob_end_clean();
  1300. //var_dump($res);
  1301. }
  1302. }
  1303. ?>