learnpath.class.test.php 32 KB

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