123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593 |
- <?php
- require_once(api_get_path(SYS_CODE_PATH).'newscorm/learnpathItem.class.php');
- require_once(api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php');
- class TestLearnpathItem extends UnitTestCase {
-
-
- public function TestScorm() {
- $this->UnitTestCase('Test Scorm');
- }
-
- public function __construct() {
- // The constructor acts like a global setUp for the class
- require_once api_get_path(SYS_TEST_PATH).'setup.inc.php';
- }
-
-
- public function testAddLp() {
- //ob_start();
- $course = 'COURSETEST';
- $name = 'Leccion';
- $description = 'Leccion';
- $learnpath = 'guess';
- $origin = 'zip';
- $zipname = '';
- $res = learnpath::add_lp($course, $name, $description, $learnpath, $origin, $zipname);
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
-
- public function testAddChild() {
- //ob_start();
- $res = learnpathItem::add_child($item = 1);
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
- public function testAddInteraction() {
- //ob_start();
- $res = learnpathItem::add_interaction($index = 1,$params = array());
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
- public function testAddObjective() {
- //ob_start();
- $res = learnpathItem::add_objective($index = 1,$params = array());
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
- /*
- public function testClose() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->close();
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testDelete() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->delete();
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
- */
- public function testDropChild() {
- //ob_start();
- $res = learnpathItem::drop_child($item = 1);
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetAttemptId() {
- //ob_start();
- $res = learnpathItem::get_attempt_id();
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetChildren() {
- //ob_start();
- $res = learnpathItem::get_children();
- $this->assertTrue(is_array($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetCoreExit() {
- //ob_start();
- $res = learnpathItem::get_core_exit();
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetCurrentStartTime() {
- //ob_start();
- $res = learnpathItem::get_current_start_time();
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetDescription() {
- //ob_start();
- $res = learnpathItem::get_description();
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetFilePath() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->get_file_path($path_to_scorm_dir='');
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetId() {
- //ob_start();
- $res = learnpathItem::get_id();
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
- /*
- public function testLoadInteractions() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->load_interactions();
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
- */
- public function testGetInteractionsCount() {
- //ob_start();
- $res = learnpathItem::get_interactions_count($checkdb=false);
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetInteractionsJsArray() {
- //ob_start();
- $res = learnpathItem::get_interactions_js_array($checkdb=false);
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetObjectivesCount() {
- //ob_start();
- $res = learnpathItem::get_objectives_count();
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetLaunchData() {
- //ob_start();
- $res = learnpathItem::get_launch_data();
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetLessonLocation() {
- //ob_start();
- $res = learnpathItem::get_lesson_location();
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetLessonMode() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->get_lesson_mode();
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetLevel() {
- //ob_start();
- $res = learnpathItem::get_level();
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetMasteryScore() {
- //ob_start();
- $res = learnpathItem::get_mastery_score();
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetMax() {
- //ob_start();
- $res = learnpathItem::get_max();
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetMaxTimeAllowed() {
- //ob_start();
- $res = learnpathItem::get_max_time_allowed();
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetMin() {
- //ob_start();
- $res = learnpathItem::get_min();
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetParent() {
- //ob_start();
- $res = learnpathItem::get_parent();
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetPath() {
- //ob_start();
- $res = learnpathItem::get_path();
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetPrereqString() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->get_prereq_string;
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- ///var_dump($res);
- }
-
- public function testGetPreventReinit() {
- //ob_start();
- $res = learnpathItem::get_prevent_reinit();
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetRef() {
- //ob_start();
- $res = learnpathItem::get_ref();
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetResourcesFromSource() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->get_resources_from_source($type=null,$abs_path=null, $recursivity=1);
- $this->assertTrue(is_array($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetScore() {
- //ob_start();
- $res = learnpathItem::get_score();
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetStatus() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->get_status($check_db=true,$update_local=false);
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetSuspendData() {
- //ob_start();
- $res = learnpathItem::get_suspend_data();
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetScormTime() {
- //ob_start();
- $res = learnpathItem::get_scorm_time($origin='php',$given_time=null);
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetTerms() {
- //ob_start();
- $res = learnpathItem::get_terms();
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetTitle() {
- //ob_start();
- $res = learnpathItem::get_title();
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetTotalTime() {
- //ob_start();
- $res = learnpathItem::get_total_time();
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetType() {
- //ob_start();
- $res = learnpathItem::get_type();
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetViewCount() {
- //ob_start();
- $res = learnpathItem::get_view_count();
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testIsDone() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->is_done();
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testIsRestartAllowed() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->is_restart_allowed();
- $this->assertTrue(is_numeric($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testOpen() {
- //ob_start();
- $res = learnpathItem::open($allow_new_attempt=false);
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testOutput() {
- //ob_start();
- $res = learnpathItem::output();
- $this->assertTrue(is_string($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testParsePrereq() {
- //ob_start();
- $res = learnpathItem::parse_prereq($prereqs_string = '', $items = array(), $refs_list = array(),$user_id = 1);
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
- /*
- public function testRestart() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->restart();
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testSave() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->save($from_outside=true,$prereqs_complete=false);
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
- */
- public function testSetAttemptId() {
- //ob_start();
- $res = learnpathItem::set_attempt_id($num = 1);
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testSetCoreExit() {
- //ob_start();
- $res = learnpathItem::set_core_exit($value = 1);
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testSetDescription() {
- //ob_start();
- $res = learnpathItem::set_description($string = '');
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testSetLessonLocation() {
- //ob_start();
- $res = learnpathItem::set_lesson_location($location = '');
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testSetLevel() {
- //ob_start();
- $res = learnpathItem::set_level($int=0);
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testSetLpView() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->set_lp_view($lp_view_id = 1);
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testSetPath() {
- //ob_start();
- $res = learnpathItem::set_path($string='');
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testSetPreventReinit() {
- //ob_start();
- $res = learnpathItem::set_prevent_reinit($prevent = 1);
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testSetScore() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->set_score($score = 1.56);
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testSetMaxScore() {
- //ob_start();
- $res = learnpathItem::set_max_score($score = 1.56);
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
- /*
- public function testSetStatus() {
- //ob_start();
- $res = learnpathItem::set_status($status = '');
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
- */
- public function testSetTerms() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->set_terms($terms = '');
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testGetSearchDid() {
- //ob_start();
- $res = learnpathItem::get_search_did();
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testSetTime() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->set_time($scorm_time = '',$format='scorm');
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testSetTitle() {
- //ob_start();
- $res = learnpathItem::set_title($string='');
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testSetType() {
- //ob_start();
- $res = learnpathItem::set_type($string='');
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testStatusIs() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->status_is($list=array());
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testUpdateTime() {
- //ob_start();
- $res = learnpathItem::update_time($total_sec=0);
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
-
- public function testWriteObjectivesToDb() {
- //ob_start();
- $res = learnpathItem::write_objectives_to_db();
- $this->assertTrue(is_null($res));
- //ob_end_clean();
- //var_dump($res);
- }
- /*
- public function testWriteToDb() {
- //ob_start();
- $obj = new learnpathItem($db_id = 1, $user_id = 1);
- $res = $obj->write_to_db();
- $this->assertTrue(is_bool($res));
- //ob_end_clean();
- //var_dump($res);
- }
- */
- public function __destruct() {
- // The destructor acts like a global tearDown for the class
- // require_once api_get_path(SYS_TEST_PATH).'teardown.inc.php';
- }
- }
|