123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <?php
- require_once(api_get_path(LIBRARY_PATH).'events.lib.inc.php');
- class TestEvents extends UnitTestCase {
- public function __construct(){
- $this->UnitTestCase('Events library - main/inc/events.lib.inc.test.php');
- }
- function testCreateEventExerciceEmptyExoId() {
- /*global $_user, $_cid, $_configuration;
- $exo_id='';
- $res=create_event_exercice($exo_id);
- $this->assertFalse($res);*/
- //var_dump($res);
- }
- function testCreateEventExerciceUnexistingExoId() {
- global $_user, $_cid, $_configuration;
- $exo_id=3589534; //unexisting exe ID
- $res=create_event_exercice($exo_id);
- $this->assertFalse($res);
- //var_dump($res);
- }
- function testEventAccessCourse() {
- global $_configuration;
- global $_user;
- global $_cid;
- global $TABLETRACK_ACCESS;
- global $TABLETRACK_LASTACCESS;
- $res=Event::accessCourse();
- $this->assertTrue(is_numeric($res));
- //var_dump($res);
- }
- function testEventAccessTool() {
- global $_configuration;
- global $_cid;
- global $TABLETRACK_ACCESS;
- global $_configuration;
- global $_course;
- global $TABLETRACK_LASTACCESS;
- $tool = '';
- $id_session = 0;
- $res=Event::event_access_tool($tool, $id_session);
- $this->assertTrue(is_numeric($res));
- //var_dump($res);
- }
- function testEventDownload() {
- global $_configuration;
- global $_user;
- global $_cid;
- global $TABLETRACK_DOWNLOADS;
- $doc_url= '';
- $res=Event::event_download($doc_url);
- $this->assertTrue(is_numeric($res));
- //var_dump($res);
- }
- function testEventLink() {
- global $_configuration;
- global $_user;
- global $_cid;
- global $TABLETRACK_LINKS;
- $link_id='';
- $res=Event::event_link($link_id);
- $this->assertTrue(is_numeric($res));
- //var_dump($res);
- }
- function testEventLogin() {
- global $_configuration;
- global $_user;
- global $TABLETRACK_LOGIN;
- $res=Event::event_login(1);
- $this->assertNull($res);
- //var_dump($res);
- }
- function testEventOpen() {
- global $_configuration;
- global $TABLETRACK_OPEN;
- $res=event_open();
- $this->assertTrue(is_numeric($res));
- //var_dump($res);
- }
- function testEventSystem() {
- global $_configuration;
- global $_user;
- global $TABLETRACK_DEFAULT;
- $event_type = 'bla';
- $event_value_type = 'blo';
- $event_value = 'bli';
- $res=Event::addEvent($event_type, $event_value_type, $event_value);
- $this->assertTrue(is_bool($res));
- //var_dump($res);
- }
- function testEventUpload() {
- global $_configuration;
- global $_user;
- global $_cid;
- global $TABLETRACK_UPLOADS;
- $doc_id='';
- $res=Event::event_upload($doc_id);
- $this->assertTrue(is_numeric($res));
- //var_dump($res);
- }
- function testExerciseAttempt() {
- $score = Database::escape_string($score);
- $answer = Database::escape_string($answer);
- $quesId = Database::escape_string($quesId);
- $exeId = Database::escape_string($exeId);
- $j = Database::escape_string($j);
- global $_configuration, $_user, $_cid;
- $res=Event::exercise_attempt($score,$answer,$quesId,$exeId,$j);
- $this->assertTrue(is_bool($res));
- //var_dump($res);
- }
- function testExerciseAttemptHotspot() {
- global $_configuration, $_user, $_cid;
- $exe_id='';
- $question_id='';
- $answer_id='';
- $correct='';
- $coords='';
- $res=Event::exercise_attempt_hotspot($exe_id, $question_id, $answer_id, $correct, $coords);
- $this->assertTrue(is_bool($res));
- //var_dump($res);
- }
- function testUpdateEventExercice() {
- $exeid='';
- $exo_id='';
- $score='';
- $weighting='';
- $session_id='';
- $duration='';
- $question_list = array();
- $res=Event::update_event_exercice($exeid,$exo_id, $score, $weighting,$session_id,$learnpath_id=0,$learnpath_item_id=0, $duration, $question_list);
- $this->assertTrue(is_bool($res));
- //var_dump($res);
- }
- }
|