From bc00543da855fe903daf89f005ec2c0feb330a73 Mon Sep 17 00:00:00 2001 From: Ryan Smith <3045513+ryansmith94@users.noreply.github.com> Date: Fri, 3 Aug 2018 14:56:19 +0100 Subject: [PATCH] fix: Fixes module URLs and activity types to close #186. (#221) --- .../events/all/course_module_viewed.php | 7 +- .../core/course_module_completion_updated.php | 7 +- .../events/mod_book/course_module_viewed.php | 61 ++++++++++++++ .../events/mod_chat/course_module_viewed.php | 61 ++++++++++++++ .../events/mod_facetoface/cancel_booking.php | 7 +- .../mod_facetoface/course_module_viewed.php | 61 ++++++++++++++ .../events/mod_facetoface/signup_success.php | 7 +- .../events/mod_facetoface/take_attendance.php | 7 +- .../mod_feedback/course_module_viewed.php | 3 +- .../mod_feedback/item_answered/handler.php | 2 +- .../item_answered/multichoice.php | 2 +- .../item_answered/multichoicerated.php | 2 +- .../{numeric.php => numerical.php} | 4 +- .../mod_feedback/item_answered/textarea.php | 2 +- .../mod_feedback/item_answered/textfield.php | 2 +- .../response_submitted/response_submitted.php | 2 +- .../events/mod_forum/course_module_viewed.php | 56 +++++++++++++ .../events/mod_forum/discussion_viewed.php | 3 +- .../mod_lesson/course_module_viewed.php | 61 ++++++++++++++ .../events/mod_page/course_module_viewed.php | 61 ++++++++++++++ .../events/mod_quiz/attempt_reviewed.php | 2 +- .../events/mod_quiz/attempt_started.php | 4 +- .../attempt_submitted/attempt_submitted.php | 2 +- .../events/mod_quiz/attempt_viewed.php | 57 +++++++++++++ .../events/mod_quiz/course_module_viewed.php | 56 +++++++++++++ .../mod_quiz/question_answered/essay.php | 2 +- .../mod_quiz/question_answered/gapselect.php | 2 +- .../mod_quiz/question_answered/match.php | 2 +- .../question_answered/multichoice.php | 2 +- .../mod_quiz/question_answered/numerical.php | 2 +- .../question_answered/randomsamatch.php | 2 +- .../question_answered/shortanswer.php | 2 +- .../mod_quiz/question_answered/truefalse.php | 2 +- .../mod_resource/course_module_viewed.php | 61 ++++++++++++++ .../events/mod_scorm/course_module_viewed.php | 61 ++++++++++++++ .../mod_survey/course_module_viewed.php | 61 ++++++++++++++ .../events/mod_url/course_module_viewed.php | 61 ++++++++++++++ src/transformer/get_event_function_map.php | 24 +++--- .../{discussion.php => course_discussion.php} | 10 +-- .../utils/get_activity/course_feedback.php | 19 ++--- .../{event_module.php => course_forum.php} | 13 +-- .../utils/get_activity/course_module.php | 41 ++++++++++ .../{module.php => course_quiz.php} | 17 ++-- .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module}/test.php | 2 +- .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_booking_cancelled/data.json | 14 ++++ .../existing_booking_cancelled/event.json | 1 + .../statements.json | 2 +- .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_signup_success/data.json | 14 ++++ .../existing_signup_success/event.json | 1 + .../existing_signup_success/statements.json | 2 +- .../existing_attendance_taken/data.json | 20 +++++ .../existing_attendance_taken/event.json | 1 + .../existing_attendance_taken/statements.json | 2 +- .../viewing_feedback/data.json | 6 ++ .../response_submitted/multichoice/data.json | 14 ++++ .../multichoicerated/data.json | 14 ++++ .../response_submitted/no_items/data.json | 14 ++++ .../{numeric => numerical}/data.json | 14 ++++ .../{numeric => numerical}/event.json | 0 .../{numeric => numerical}/statements.json | 0 .../response_submitted/numerical/test.php | 24 ++++++ .../response_submitted/textarea/data.json | 14 ++++ .../response_submitted/textfield/data.json | 14 ++++ .../response_submitted/unknown_typ/data.json | 14 ++++ .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_discussion_viewed/data.json | 22 ++++- .../existing_discussion_viewed/event.json | 1 + .../statements.json | 11 ++- .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_attempt_reviewed/data.json | 6 ++ .../existing_attempt_reviewed/statements.json | 2 +- .../existing_attempt_started/data.json | 6 ++ .../existing_attempt_started/statements.json | 2 +- .../attempt_submitted/essay/data.json | 6 ++ .../attempt_submitted/essay/statements.json | 4 +- .../attempt_submitted/gapselect/data.json | 6 ++ .../gapselect/statements.json | 4 +- .../attempt_submitted/match/data.json | 6 ++ .../attempt_submitted/match/statements.json | 4 +- .../attempt_submitted/multichoice/data.json | 6 ++ .../multichoice/statements.json | 4 +- .../attempt_submitted/no_questions/data.json | 6 ++ .../no_questions/statements.json | 2 +- .../attempt_submitted/numerical/data.json | 6 ++ .../numerical/statements.json | 4 +- .../attempt_submitted/randomsamatch/data.json | 6 ++ .../randomsamatch/statements.json | 4 +- .../attempt_submitted/shortanswer/data.json | 6 ++ .../shortanswer/statements.json | 4 +- .../attempt_submitted/truefalse/data.json | 6 ++ .../truefalse/statements.json | 4 +- .../attempt_submitted/unknown_qtype/data.json | 6 ++ .../unknown_qtype/statements.json | 2 +- .../attempt_viewed/existing_module/data.json | 36 +++++++++ .../attempt_viewed/existing_module/event.json | 9 +++ .../existing_module/statements.json | 81 +++++++++++++++++++ .../attempt_viewed/existing_module}/test.php | 2 +- .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_module}/data.json | 14 ++++ .../existing_module}/event.json | 3 +- .../existing_module}/statements.json | 4 +- .../existing_module/test.php | 24 ++++++ .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ .../existing_module/data.json | 36 +++++++++ .../existing_module/event.json | 8 ++ .../existing_module/statements.json | 72 +++++++++++++++++ .../existing_module/test.php | 24 ++++++ 170 files changed, 3821 insertions(+), 104 deletions(-) create mode 100644 src/transformer/events/mod_book/course_module_viewed.php create mode 100644 src/transformer/events/mod_chat/course_module_viewed.php create mode 100644 src/transformer/events/mod_facetoface/course_module_viewed.php rename src/transformer/events/mod_feedback/item_answered/{numeric.php => numerical.php} (94%) create mode 100644 src/transformer/events/mod_forum/course_module_viewed.php create mode 100644 src/transformer/events/mod_lesson/course_module_viewed.php create mode 100644 src/transformer/events/mod_page/course_module_viewed.php create mode 100644 src/transformer/events/mod_quiz/attempt_viewed.php create mode 100644 src/transformer/events/mod_quiz/course_module_viewed.php create mode 100644 src/transformer/events/mod_resource/course_module_viewed.php create mode 100644 src/transformer/events/mod_scorm/course_module_viewed.php create mode 100644 src/transformer/events/mod_survey/course_module_viewed.php create mode 100644 src/transformer/events/mod_url/course_module_viewed.php rename src/transformer/utils/get_activity/{discussion.php => course_discussion.php} (73%) rename src/transformer/utils/get_activity/{event_module.php => course_forum.php} (72%) create mode 100644 src/transformer/utils/get_activity/course_module.php rename src/transformer/utils/get_activity/{module.php => course_quiz.php} (66%) create mode 100644 tests/mod_book/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_book/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_book/course_module_viewed/existing_module/statements.json rename tests/{all/course_module_viewed/viewing_scorm_module => mod_book/course_module_viewed/existing_module}/test.php (93%) create mode 100644 tests/mod_chat/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_chat/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_chat/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_chat/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_choice/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_choice/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_choice/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_choice/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_data/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_data/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_data/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_data/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_facetoface/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_facetoface/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_facetoface/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_facetoface/course_module_viewed/existing_module/test.php rename tests/mod_feedback/response_submitted/{numeric => numerical}/data.json (76%) rename tests/mod_feedback/response_submitted/{numeric => numerical}/event.json (100%) rename tests/mod_feedback/response_submitted/{numeric => numerical}/statements.json (100%) create mode 100644 tests/mod_feedback/response_submitted/numerical/test.php create mode 100644 tests/mod_folder/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_folder/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_folder/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_folder/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_forum/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_forum/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_forum/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_forum/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_glossary/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_glossary/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_glossary/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_glossary/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_imscp/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_imscp/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_imscp/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_imscp/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_lesson/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_lesson/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_lesson/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_lesson/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_lti/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_lti/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_lti/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_lti/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_page/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_page/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_page/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_page/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_quiz/attempt_viewed/existing_module/data.json create mode 100644 tests/mod_quiz/attempt_viewed/existing_module/event.json create mode 100644 tests/mod_quiz/attempt_viewed/existing_module/statements.json rename tests/{mod_feedback/response_submitted/numeric => mod_quiz/attempt_viewed/existing_module}/test.php (93%) create mode 100644 tests/mod_quiz/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_quiz/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_quiz/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_quiz/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_resource/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_resource/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_resource/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_resource/course_module_viewed/existing_module/test.php rename tests/{all/course_module_viewed/viewing_scorm_module => mod_scorm/course_module_viewed/existing_module}/data.json (60%) rename tests/{all/course_module_viewed/viewing_scorm_module => mod_scorm/course_module_viewed/existing_module}/event.json (75%) rename tests/{all/course_module_viewed/viewing_scorm_module => mod_scorm/course_module_viewed/existing_module}/statements.json (97%) create mode 100644 tests/mod_scorm/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_survey/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_survey/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_survey/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_survey/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_url/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_url/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_url/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_url/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_wiki/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_wiki/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_wiki/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_wiki/course_module_viewed/existing_module/test.php create mode 100644 tests/mod_workshop/course_module_viewed/existing_module/data.json create mode 100644 tests/mod_workshop/course_module_viewed/existing_module/event.json create mode 100644 tests/mod_workshop/course_module_viewed/existing_module/statements.json create mode 100644 tests/mod_workshop/course_module_viewed/existing_module/test.php diff --git a/src/transformer/events/all/course_module_viewed.php b/src/transformer/events/all/course_module_viewed.php index c80dc0119..edb802fcb 100644 --- a/src/transformer/events/all/course_module_viewed.php +++ b/src/transformer/events/all/course_module_viewed.php @@ -34,7 +34,12 @@ function course_module_viewed(array $config, \stdClass $event) { $lang => 'viewed' ], ], - 'object' => utils\get_activity\event_module($config, $event, $lang), + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'http://id.tincanapi.com/activitytype/lms/module' + ), 'timestamp' => utils\get_event_timestamp($event), 'context' => [ 'platform' => $config['source_name'], diff --git a/src/transformer/events/core/course_module_completion_updated.php b/src/transformer/events/core/course_module_completion_updated.php index d8da47a6d..3d18e2686 100644 --- a/src/transformer/events/core/course_module_completion_updated.php +++ b/src/transformer/events/core/course_module_completion_updated.php @@ -37,7 +37,12 @@ function course_module_completion_updated(array $config, \stdClass $event) { $lang => 'completed' ], ], - 'object' => utils\get_activity\module($config, $moduletype->name, $module, $lang), + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'http://id.tincanapi.com/activitytype/lms/module' + ), 'timestamp' => utils\get_event_timestamp($event), 'context' => [ 'platform' => $config['source_name'], diff --git a/src/transformer/events/mod_book/course_module_viewed.php b/src/transformer/events/mod_book/course_module_viewed.php new file mode 100644 index 000000000..9e419a82f --- /dev/null +++ b/src/transformer/events/mod_book/course_module_viewed.php @@ -0,0 +1,61 @@ +. + +namespace src\transformer\events\mod_book; + +defined('MOODLE_INTERNAL') || die(); + +use src\transformer\utils as utils; + +function course_module_viewed(array $config, \stdClass $event) { + $repo = $config['repo']; + $user = $repo->read_record_by_id('user', $event->userid); + $course = $repo->read_record_by_id('course', $event->courseid); + $lang = utils\get_course_lang($course); + + return [[ + 'actor' => utils\get_user($config, $user), + 'verb' => [ + 'id' => 'http://id.tincanapi.com/verb/viewed', + 'display' => [ + $lang => 'viewed' + ], + ], + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'http://id.tincanapi.com/activitytype/book' + ), + 'timestamp' => utils\get_event_timestamp($event), + 'context' => [ + 'platform' => $config['source_name'], + 'language' => $lang, + 'extensions' => [ + utils\INFO_EXTENSION => utils\get_info($config, $event), + ], + 'contextActivities' => [ + 'grouping' => [ + utils\get_activity\site($config), + utils\get_activity\course($config, $course), + ], + 'category' => [ + utils\get_activity\source($config), + ] + ], + ] + ]]; +} \ No newline at end of file diff --git a/src/transformer/events/mod_chat/course_module_viewed.php b/src/transformer/events/mod_chat/course_module_viewed.php new file mode 100644 index 000000000..304b762bc --- /dev/null +++ b/src/transformer/events/mod_chat/course_module_viewed.php @@ -0,0 +1,61 @@ +. + +namespace src\transformer\events\mod_chat; + +defined('MOODLE_INTERNAL') || die(); + +use src\transformer\utils as utils; + +function course_module_viewed(array $config, \stdClass $event) { + $repo = $config['repo']; + $user = $repo->read_record_by_id('user', $event->userid); + $course = $repo->read_record_by_id('course', $event->courseid); + $lang = utils\get_course_lang($course); + + return [[ + 'actor' => utils\get_user($config, $user), + 'verb' => [ + 'id' => 'http://id.tincanapi.com/verb/viewed', + 'display' => [ + $lang => 'viewed' + ], + ], + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'http://id.tincanapi.com/activitytype/chat-channel' + ), + 'timestamp' => utils\get_event_timestamp($event), + 'context' => [ + 'platform' => $config['source_name'], + 'language' => $lang, + 'extensions' => [ + utils\INFO_EXTENSION => utils\get_info($config, $event), + ], + 'contextActivities' => [ + 'grouping' => [ + utils\get_activity\site($config), + utils\get_activity\course($config, $course), + ], + 'category' => [ + utils\get_activity\source($config), + ] + ], + ] + ]]; +} \ No newline at end of file diff --git a/src/transformer/events/mod_facetoface/cancel_booking.php b/src/transformer/events/mod_facetoface/cancel_booking.php index af0f33bd9..c9861614b 100644 --- a/src/transformer/events/mod_facetoface/cancel_booking.php +++ b/src/transformer/events/mod_facetoface/cancel_booking.php @@ -34,7 +34,12 @@ function cancel_booking(array $config, \stdClass $event) { $lang => 'unregistered from' ], ], - 'object' => utils\get_activity\event_module($config, $event, $lang), + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'https://w3id.org/xapi/acrossx/activities/face-to-face-discussion' + ), 'timestamp' => utils\get_event_timestamp($event), 'context' => [ 'platform' => $config['source_name'], diff --git a/src/transformer/events/mod_facetoface/course_module_viewed.php b/src/transformer/events/mod_facetoface/course_module_viewed.php new file mode 100644 index 000000000..684020519 --- /dev/null +++ b/src/transformer/events/mod_facetoface/course_module_viewed.php @@ -0,0 +1,61 @@ +. + +namespace src\transformer\events\mod_facetoface; + +defined('MOODLE_INTERNAL') || die(); + +use src\transformer\utils as utils; + +function course_module_viewed(array $config, \stdClass $event) { + $repo = $config['repo']; + $user = $repo->read_record_by_id('user', $event->userid); + $course = $repo->read_record_by_id('course', $event->courseid); + $lang = utils\get_course_lang($course); + + return [[ + 'actor' => utils\get_user($config, $user), + 'verb' => [ + 'id' => 'http://id.tincanapi.com/verb/viewed', + 'display' => [ + $lang => 'viewed' + ], + ], + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'https://w3id.org/xapi/acrossx/activities/face-to-face-discussion' + ), + 'timestamp' => utils\get_event_timestamp($event), + 'context' => [ + 'platform' => $config['source_name'], + 'language' => $lang, + 'extensions' => [ + utils\INFO_EXTENSION => utils\get_info($config, $event), + ], + 'contextActivities' => [ + 'grouping' => [ + utils\get_activity\site($config), + utils\get_activity\course($config, $course), + ], + 'category' => [ + utils\get_activity\source($config), + ] + ], + ] + ]]; +} \ No newline at end of file diff --git a/src/transformer/events/mod_facetoface/signup_success.php b/src/transformer/events/mod_facetoface/signup_success.php index c5d7a2b3e..5c0d876d1 100644 --- a/src/transformer/events/mod_facetoface/signup_success.php +++ b/src/transformer/events/mod_facetoface/signup_success.php @@ -34,7 +34,12 @@ function signup_success(array $config, \stdClass $event) { $lang => 'registered to' ], ], - 'object' => utils\get_activity\event_module($config, $event, $lang), + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'https://w3id.org/xapi/acrossx/activities/face-to-face-discussion' + ), 'timestamp' => utils\get_event_timestamp($event), 'context' => [ 'platform' => $config['source_name'], diff --git a/src/transformer/events/mod_facetoface/take_attendance.php b/src/transformer/events/mod_facetoface/take_attendance.php index 18715afe0..dc3da221c 100644 --- a/src/transformer/events/mod_facetoface/take_attendance.php +++ b/src/transformer/events/mod_facetoface/take_attendance.php @@ -46,7 +46,12 @@ function take_attendance(array $config, \stdClass $event) { $lang => 'attended' ], ], - 'object' => utils\get_activity\event_module($config, $event, $lang), + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'https://w3id.org/xapi/acrossx/activities/face-to-face-discussion' + ), 'timestamp' => utils\get_event_timestamp($event), 'result' => [ 'duration' => "PT".(string) $sessionduration."S", diff --git a/src/transformer/events/mod_feedback/course_module_viewed.php b/src/transformer/events/mod_feedback/course_module_viewed.php index 4ed76ed56..7ba6b5cd9 100644 --- a/src/transformer/events/mod_feedback/course_module_viewed.php +++ b/src/transformer/events/mod_feedback/course_module_viewed.php @@ -24,7 +24,6 @@ function course_module_viewed(array $config, \stdClass $event) { $repo = $config['repo']; $user = $repo->read_record_by_id('user', $event->userid); $course = $repo->read_record_by_id('course', $event->courseid); - $feedback = $repo->read_record_by_id('feedback', $event->objectid); $lang = utils\get_course_lang($course); return [[ @@ -35,7 +34,7 @@ function course_module_viewed(array $config, \stdClass $event) { $lang => 'viewed' ], ], - 'object' => utils\get_activity\course_feedback($config, $event->contextinstanceid, $feedback, $lang), + 'object' => utils\get_activity\course_feedback($config, $course, $event->contextinstanceid), 'timestamp' => utils\get_event_timestamp($event), 'context' => [ 'platform' => $config['source_name'], diff --git a/src/transformer/events/mod_feedback/item_answered/handler.php b/src/transformer/events/mod_feedback/item_answered/handler.php index 710bd1e74..3d6170b80 100644 --- a/src/transformer/events/mod_feedback/item_answered/handler.php +++ b/src/transformer/events/mod_feedback/item_answered/handler.php @@ -30,7 +30,7 @@ function handler(array $config, \stdClass $event, \stdClass $feedbackvalue) { case 'multichoice': return multichoice($config, $event, $feedbackvalue, $feedbackitem); case 'numeric': - return numeric($config, $event, $feedbackvalue, $feedbackitem); + return numerical($config, $event, $feedbackvalue, $feedbackitem); case 'textarea': return textarea($config, $event, $feedbackvalue, $feedbackitem); case 'textfield': diff --git a/src/transformer/events/mod_feedback/item_answered/multichoice.php b/src/transformer/events/mod_feedback/item_answered/multichoice.php index 3531e30eb..bf8a1b889 100644 --- a/src/transformer/events/mod_feedback/item_answered/multichoice.php +++ b/src/transformer/events/mod_feedback/item_answered/multichoice.php @@ -65,7 +65,7 @@ function multichoice(array $config, \stdClass $event, \stdClass $feedbackvalue, 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\course_feedback($config, $event->contextinstanceid, $feedback, $lang), + utils\get_activity\course_feedback($config, $course, $event->contextinstanceid), ], 'category' => [ utils\get_activity\source($config), diff --git a/src/transformer/events/mod_feedback/item_answered/multichoicerated.php b/src/transformer/events/mod_feedback/item_answered/multichoicerated.php index 415e50161..e8703d81c 100644 --- a/src/transformer/events/mod_feedback/item_answered/multichoicerated.php +++ b/src/transformer/events/mod_feedback/item_answered/multichoicerated.php @@ -76,7 +76,7 @@ function multichoicerated(array $config, \stdClass $event, \stdClass $feedbackva 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\course_feedback($config, $event->contextinstanceid, $feedback, $lang), + utils\get_activity\course_feedback($config, $course, $event->contextinstanceid), ], 'category' => [ utils\get_activity\source($config), diff --git a/src/transformer/events/mod_feedback/item_answered/numeric.php b/src/transformer/events/mod_feedback/item_answered/numerical.php similarity index 94% rename from src/transformer/events/mod_feedback/item_answered/numeric.php rename to src/transformer/events/mod_feedback/item_answered/numerical.php index 7534b7951..19dc94d9e 100644 --- a/src/transformer/events/mod_feedback/item_answered/numeric.php +++ b/src/transformer/events/mod_feedback/item_answered/numerical.php @@ -20,7 +20,7 @@ use src\transformer\utils as utils; -function numeric(array $config, \stdClass $event, \stdClass $feedbackvalue, \stdClass $feedbackitem) { +function numerical(array $config, \stdClass $event, \stdClass $feedbackvalue, \stdClass $feedbackitem) { $repo = $config['repo']; $user = $repo->read_record_by_id('user', $event->userid); $course = $repo->read_record_by_id('course', $event->courseid); @@ -63,7 +63,7 @@ function numeric(array $config, \stdClass $event, \stdClass $feedbackvalue, \std 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\course_feedback($config, $event->contextinstanceid, $feedback, $lang), + utils\get_activity\course_feedback($config, $course, $event->contextinstanceid), ], 'category' => [ utils\get_activity\source($config), diff --git a/src/transformer/events/mod_feedback/item_answered/textarea.php b/src/transformer/events/mod_feedback/item_answered/textarea.php index 8172cded1..d92cc4897 100644 --- a/src/transformer/events/mod_feedback/item_answered/textarea.php +++ b/src/transformer/events/mod_feedback/item_answered/textarea.php @@ -60,7 +60,7 @@ function textarea(array $config, \stdClass $event, \stdClass $feedbackvalue, \st 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\course_feedback($config, $event->contextinstanceid, $feedback, $lang), + utils\get_activity\course_feedback($config, $course, $event->contextinstanceid), ], 'category' => [ utils\get_activity\source($config), diff --git a/src/transformer/events/mod_feedback/item_answered/textfield.php b/src/transformer/events/mod_feedback/item_answered/textfield.php index fc5b6bf63..451e19559 100644 --- a/src/transformer/events/mod_feedback/item_answered/textfield.php +++ b/src/transformer/events/mod_feedback/item_answered/textfield.php @@ -60,7 +60,7 @@ function textfield(array $config, \stdClass $event, \stdClass $feedbackvalue, \s 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\course_feedback($config, $event->contextinstanceid, $feedback, $lang), + utils\get_activity\course_feedback($config, $course, $event->contextinstanceid), ], 'category' => [ utils\get_activity\source($config), diff --git a/src/transformer/events/mod_feedback/response_submitted/response_submitted.php b/src/transformer/events/mod_feedback/response_submitted/response_submitted.php index b18327262..14c426626 100644 --- a/src/transformer/events/mod_feedback/response_submitted/response_submitted.php +++ b/src/transformer/events/mod_feedback/response_submitted/response_submitted.php @@ -36,7 +36,7 @@ function response_submitted(array $config, \stdClass $event) { $lang => 'submitted' ], ], - 'object' => utils\get_activity\course_feedback($config, $event->contextinstanceid, $feedback, $lang), + 'object' => utils\get_activity\course_feedback($config, $course, $event->contextinstanceid), 'timestamp' => utils\get_event_timestamp($event), 'context' => [ 'platform' => $config['source_name'], diff --git a/src/transformer/events/mod_forum/course_module_viewed.php b/src/transformer/events/mod_forum/course_module_viewed.php new file mode 100644 index 000000000..dd0cb85bb --- /dev/null +++ b/src/transformer/events/mod_forum/course_module_viewed.php @@ -0,0 +1,56 @@ +. + +namespace src\transformer\events\mod_forum; + +defined('MOODLE_INTERNAL') || die(); + +use src\transformer\utils as utils; + +function course_module_viewed(array $config, \stdClass $event) { + $repo = $config['repo']; + $user = $repo->read_record_by_id('user', $event->userid); + $course = $repo->read_record_by_id('course', $event->courseid); + $lang = utils\get_course_lang($course); + + return [[ + 'actor' => utils\get_user($config, $user), + 'verb' => [ + 'id' => 'http://id.tincanapi.com/verb/viewed', + 'display' => [ + $lang => 'viewed' + ], + ], + 'object' => utils\get_activity\course_forum($config, $course, $event->contextinstanceid), + 'timestamp' => utils\get_event_timestamp($event), + 'context' => [ + 'platform' => $config['source_name'], + 'language' => $lang, + 'extensions' => [ + utils\INFO_EXTENSION => utils\get_info($config, $event), + ], + 'contextActivities' => [ + 'grouping' => [ + utils\get_activity\site($config), + utils\get_activity\course($config, $course), + ], + 'category' => [ + utils\get_activity\source($config), + ] + ], + ] + ]]; +} \ No newline at end of file diff --git a/src/transformer/events/mod_forum/discussion_viewed.php b/src/transformer/events/mod_forum/discussion_viewed.php index cb6405a28..0530553e4 100644 --- a/src/transformer/events/mod_forum/discussion_viewed.php +++ b/src/transformer/events/mod_forum/discussion_viewed.php @@ -35,7 +35,7 @@ function discussion_viewed(array $config, \stdClass $event) { $lang => 'viewed' ], ], - 'object' => utils\get_activity\discussion($config, $discussion), + 'object' => utils\get_activity\course_discussion($config, $course, $discussion), 'timestamp' => utils\get_event_timestamp($event), 'context' => [ 'platform' => $config['source_name'], @@ -47,6 +47,7 @@ function discussion_viewed(array $config, \stdClass $event) { 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), + utils\get_activity\course_forum($config, $course, $event->contextinstanceid), ], 'category' => [ utils\get_activity\source($config), diff --git a/src/transformer/events/mod_lesson/course_module_viewed.php b/src/transformer/events/mod_lesson/course_module_viewed.php new file mode 100644 index 000000000..72163db2a --- /dev/null +++ b/src/transformer/events/mod_lesson/course_module_viewed.php @@ -0,0 +1,61 @@ +. + +namespace src\transformer\events\mod_lesson; + +defined('MOODLE_INTERNAL') || die(); + +use src\transformer\utils as utils; + +function course_module_viewed(array $config, \stdClass $event) { + $repo = $config['repo']; + $user = $repo->read_record_by_id('user', $event->userid); + $course = $repo->read_record_by_id('course', $event->courseid); + $lang = utils\get_course_lang($course); + + return [[ + 'actor' => utils\get_user($config, $user), + 'verb' => [ + 'id' => 'http://id.tincanapi.com/verb/viewed', + 'display' => [ + $lang => 'viewed' + ], + ], + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'http://adlnet.gov/expapi/activities/lesson' + ), + 'timestamp' => utils\get_event_timestamp($event), + 'context' => [ + 'platform' => $config['source_name'], + 'language' => $lang, + 'extensions' => [ + utils\INFO_EXTENSION => utils\get_info($config, $event), + ], + 'contextActivities' => [ + 'grouping' => [ + utils\get_activity\site($config), + utils\get_activity\course($config, $course), + ], + 'category' => [ + utils\get_activity\source($config), + ] + ], + ] + ]]; +} \ No newline at end of file diff --git a/src/transformer/events/mod_page/course_module_viewed.php b/src/transformer/events/mod_page/course_module_viewed.php new file mode 100644 index 000000000..2bf7540db --- /dev/null +++ b/src/transformer/events/mod_page/course_module_viewed.php @@ -0,0 +1,61 @@ +. + +namespace src\transformer\events\mod_page; + +defined('MOODLE_INTERNAL') || die(); + +use src\transformer\utils as utils; + +function course_module_viewed(array $config, \stdClass $event) { + $repo = $config['repo']; + $user = $repo->read_record_by_id('user', $event->userid); + $course = $repo->read_record_by_id('course', $event->courseid); + $lang = utils\get_course_lang($course); + + return [[ + 'actor' => utils\get_user($config, $user), + 'verb' => [ + 'id' => 'http://id.tincanapi.com/verb/viewed', + 'display' => [ + $lang => 'viewed' + ], + ], + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'https://w3id.org/xapi/acrossx/activities/page' + ), + 'timestamp' => utils\get_event_timestamp($event), + 'context' => [ + 'platform' => $config['source_name'], + 'language' => $lang, + 'extensions' => [ + utils\INFO_EXTENSION => utils\get_info($config, $event), + ], + 'contextActivities' => [ + 'grouping' => [ + utils\get_activity\site($config), + utils\get_activity\course($config, $course), + ], + 'category' => [ + utils\get_activity\source($config), + ] + ], + ] + ]]; +} \ No newline at end of file diff --git a/src/transformer/events/mod_quiz/attempt_reviewed.php b/src/transformer/events/mod_quiz/attempt_reviewed.php index a3a59a8ad..afa8dfe26 100644 --- a/src/transformer/events/mod_quiz/attempt_reviewed.php +++ b/src/transformer/events/mod_quiz/attempt_reviewed.php @@ -59,7 +59,7 @@ function attempt_reviewed(array $config, \stdClass $event) { 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\module($config, 'quiz', $quiz, $lang), + utils\get_activity\course_quiz($config, $course, $event->contextinstanceid), utils\get_activity\quiz_attempt($config, $attempt->id, $coursemodule->id), ], 'category' => [ diff --git a/src/transformer/events/mod_quiz/attempt_started.php b/src/transformer/events/mod_quiz/attempt_started.php index 90f70fc8a..30fa959f8 100644 --- a/src/transformer/events/mod_quiz/attempt_started.php +++ b/src/transformer/events/mod_quiz/attempt_started.php @@ -37,7 +37,7 @@ function attempt_started(array $config, \stdClass $event) { $lang => 'started' ], ], - 'object' => utils\get_activity\module($config, 'quiz', $quiz, $lang), + 'object' => utils\get_activity\course_quiz($config, $course, $event->contextinstanceid), 'timestamp' => utils\get_event_timestamp($event), 'context' => [ 'platform' => $config['source_name'], @@ -47,7 +47,7 @@ function attempt_started(array $config, \stdClass $event) { ], 'contextActivities' => [ 'other' => [ - utils\get_activity\quiz_attempt($config, $attempt->id, $coursemodule->id), + utils\get_activity\quiz_attempt($config, $attempt->id, $event->contextinstanceid), ], 'grouping' => [ utils\get_activity\site($config), diff --git a/src/transformer/events/mod_quiz/attempt_submitted/attempt_submitted.php b/src/transformer/events/mod_quiz/attempt_submitted/attempt_submitted.php index 3e9ac42d7..3e8c6d29e 100644 --- a/src/transformer/events/mod_quiz/attempt_submitted/attempt_submitted.php +++ b/src/transformer/events/mod_quiz/attempt_submitted/attempt_submitted.php @@ -41,7 +41,7 @@ function attempt_submitted(array $config, \stdClass $event) { $lang => 'completed' ], ], - 'object' => utils\get_activity\module($config, 'quiz', $quiz, $lang), + 'object' => utils\get_activity\course_quiz($config, $course, $event->contextinstanceid), 'timestamp' => utils\get_event_timestamp($event), 'result' => utils\get_attempt_result($config, $attempt, $gradeitem), 'context' => [ diff --git a/src/transformer/events/mod_quiz/attempt_viewed.php b/src/transformer/events/mod_quiz/attempt_viewed.php new file mode 100644 index 000000000..72733955b --- /dev/null +++ b/src/transformer/events/mod_quiz/attempt_viewed.php @@ -0,0 +1,57 @@ +. + +namespace src\transformer\events\mod_quiz; + +defined('MOODLE_INTERNAL') || die(); + +use src\transformer\utils as utils; + +function attempt_viewed(array $config, \stdClass $event) { + $repo = $config['repo']; + $user = $repo->read_record_by_id('user', $event->userid); + $course = $repo->read_record_by_id('course', $event->courseid); + $lang = utils\get_course_lang($course); + + return [[ + 'actor' => utils\get_user($config, $user), + 'verb' => [ + 'id' => 'http://id.tincanapi.com/verb/viewed', + 'display' => [ + $lang => 'viewed' + ], + ], + 'object' => utils\get_activity\quiz_attempt($config, $event->id, $event->contextinstanceid), + 'timestamp' => utils\get_event_timestamp($event), + 'context' => [ + 'platform' => $config['source_name'], + 'language' => $lang, + 'extensions' => [ + utils\INFO_EXTENSION => utils\get_info($config, $event), + ], + 'contextActivities' => [ + 'grouping' => [ + utils\get_activity\site($config), + utils\get_activity\course($config, $course), + utils\get_activity\course_quiz($config, $course, $event->contextinstanceid), + ], + 'category' => [ + utils\get_activity\source($config), + ] + ], + ] + ]]; +} \ No newline at end of file diff --git a/src/transformer/events/mod_quiz/course_module_viewed.php b/src/transformer/events/mod_quiz/course_module_viewed.php new file mode 100644 index 000000000..abd6e1e26 --- /dev/null +++ b/src/transformer/events/mod_quiz/course_module_viewed.php @@ -0,0 +1,56 @@ +. + +namespace src\transformer\events\mod_quiz; + +defined('MOODLE_INTERNAL') || die(); + +use src\transformer\utils as utils; + +function course_module_viewed(array $config, \stdClass $event) { + $repo = $config['repo']; + $user = $repo->read_record_by_id('user', $event->userid); + $course = $repo->read_record_by_id('course', $event->courseid); + $lang = utils\get_course_lang($course); + + return [[ + 'actor' => utils\get_user($config, $user), + 'verb' => [ + 'id' => 'http://id.tincanapi.com/verb/viewed', + 'display' => [ + $lang => 'viewed' + ], + ], + 'object' => utils\get_activity\course_quiz($config, $course, $event->contextinstanceid), + 'timestamp' => utils\get_event_timestamp($event), + 'context' => [ + 'platform' => $config['source_name'], + 'language' => $lang, + 'extensions' => [ + utils\INFO_EXTENSION => utils\get_info($config, $event), + ], + 'contextActivities' => [ + 'grouping' => [ + utils\get_activity\site($config), + utils\get_activity\course($config, $course), + ], + 'category' => [ + utils\get_activity\source($config), + ] + ], + ] + ]]; +} \ No newline at end of file diff --git a/src/transformer/events/mod_quiz/question_answered/essay.php b/src/transformer/events/mod_quiz/question_answered/essay.php index 62bb5f4f7..9f3fdbaf9 100644 --- a/src/transformer/events/mod_quiz/question_answered/essay.php +++ b/src/transformer/events/mod_quiz/question_answered/essay.php @@ -62,7 +62,7 @@ function essay(array $config, \stdClass $event, \stdClass $questionattempt, \std 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\module($config, 'quiz', $quiz, $lang), + utils\get_activity\course_quiz($config, $course, $event->contextinstanceid), utils\get_activity\quiz_attempt($config, $attempt->id, $coursemodule->id), ], 'category' => [ diff --git a/src/transformer/events/mod_quiz/question_answered/gapselect.php b/src/transformer/events/mod_quiz/question_answered/gapselect.php index 083fed3a1..fa562ac1f 100644 --- a/src/transformer/events/mod_quiz/question_answered/gapselect.php +++ b/src/transformer/events/mod_quiz/question_answered/gapselect.php @@ -67,7 +67,7 @@ function gapselect(array $config, \stdClass $event, \stdClass $questionattempt, 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\module($config, 'quiz', $quiz, $lang), + utils\get_activity\course_quiz($config, $course, $event->contextinstanceid), utils\get_activity\quiz_attempt($config, $attempt->id, $coursemodule->id), ], 'category' => [ diff --git a/src/transformer/events/mod_quiz/question_answered/match.php b/src/transformer/events/mod_quiz/question_answered/match.php index dfcc7d97f..ccb676d8f 100644 --- a/src/transformer/events/mod_quiz/question_answered/match.php +++ b/src/transformer/events/mod_quiz/question_answered/match.php @@ -77,7 +77,7 @@ function ($reduction, $selection) { 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\module($config, 'quiz', $quiz, $lang), + utils\get_activity\course_quiz($config, $course, $event->contextinstanceid), utils\get_activity\quiz_attempt($config, $attempt->id, $coursemodule->id), ], 'category' => [ diff --git a/src/transformer/events/mod_quiz/question_answered/multichoice.php b/src/transformer/events/mod_quiz/question_answered/multichoice.php index 793170b2a..ad19781a5 100644 --- a/src/transformer/events/mod_quiz/question_answered/multichoice.php +++ b/src/transformer/events/mod_quiz/question_answered/multichoice.php @@ -65,7 +65,7 @@ function multichoice(array $config, \stdClass $event, \stdClass $questionattempt 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\module($config, 'quiz', $quiz, $lang), + utils\get_activity\course_quiz($config, $course, $event->contextinstanceid), utils\get_activity\quiz_attempt($config, $attempt->id, $coursemodule->id), ], 'category' => [ diff --git a/src/transformer/events/mod_quiz/question_answered/numerical.php b/src/transformer/events/mod_quiz/question_answered/numerical.php index 4f86bc707..d03b3c8e5 100644 --- a/src/transformer/events/mod_quiz/question_answered/numerical.php +++ b/src/transformer/events/mod_quiz/question_answered/numerical.php @@ -66,7 +66,7 @@ function numerical(array $config, \stdClass $event, \stdClass $questionattempt, 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\module($config, 'quiz', $quiz, $lang), + utils\get_activity\course_quiz($config, $course, $event->contextinstanceid), utils\get_activity\quiz_attempt($config, $attempt->id, $coursemodule->id), ], 'category' => [ diff --git a/src/transformer/events/mod_quiz/question_answered/randomsamatch.php b/src/transformer/events/mod_quiz/question_answered/randomsamatch.php index 0d427a7b5..d9cce826d 100644 --- a/src/transformer/events/mod_quiz/question_answered/randomsamatch.php +++ b/src/transformer/events/mod_quiz/question_answered/randomsamatch.php @@ -77,7 +77,7 @@ function ($reduction, $selection) { 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\module($config, 'quiz', $quiz, $lang), + utils\get_activity\course_quiz($config, $course, $event->contextinstanceid), utils\get_activity\quiz_attempt($config, $attempt->id, $coursemodule->id), ], 'category' => [ diff --git a/src/transformer/events/mod_quiz/question_answered/shortanswer.php b/src/transformer/events/mod_quiz/question_answered/shortanswer.php index fab3245f0..32f525d71 100644 --- a/src/transformer/events/mod_quiz/question_answered/shortanswer.php +++ b/src/transformer/events/mod_quiz/question_answered/shortanswer.php @@ -62,7 +62,7 @@ function shortanswer(array $config, \stdClass $event, \stdClass $questionattempt 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\module($config, 'quiz', $quiz, $lang), + utils\get_activity\course_quiz($config, $course, $event->contextinstanceid), utils\get_activity\quiz_attempt($config, $attempt->id, $coursemodule->id), ], 'category' => [ diff --git a/src/transformer/events/mod_quiz/question_answered/truefalse.php b/src/transformer/events/mod_quiz/question_answered/truefalse.php index affc24d62..0d68b7812 100644 --- a/src/transformer/events/mod_quiz/question_answered/truefalse.php +++ b/src/transformer/events/mod_quiz/question_answered/truefalse.php @@ -66,7 +66,7 @@ function truefalse(array $config, \stdClass $event, \stdClass $questionattempt, 'grouping' => [ utils\get_activity\site($config), utils\get_activity\course($config, $course), - utils\get_activity\module($config, 'quiz', $quiz, $lang), + utils\get_activity\course_quiz($config, $course, $event->contextinstanceid), utils\get_activity\quiz_attempt($config, $attempt->id, $coursemodule->id), ], 'category' => [ diff --git a/src/transformer/events/mod_resource/course_module_viewed.php b/src/transformer/events/mod_resource/course_module_viewed.php new file mode 100644 index 000000000..68f2473c2 --- /dev/null +++ b/src/transformer/events/mod_resource/course_module_viewed.php @@ -0,0 +1,61 @@ +. + +namespace src\transformer\events\mod_resource; + +defined('MOODLE_INTERNAL') || die(); + +use src\transformer\utils as utils; + +function course_module_viewed(array $config, \stdClass $event) { + $repo = $config['repo']; + $user = $repo->read_record_by_id('user', $event->userid); + $course = $repo->read_record_by_id('course', $event->courseid); + $lang = utils\get_course_lang($course); + + return [[ + 'actor' => utils\get_user($config, $user), + 'verb' => [ + 'id' => 'http://id.tincanapi.com/verb/viewed', + 'display' => [ + $lang => 'viewed' + ], + ], + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'http://id.tincanapi.com/activitytype/resource' + ), + 'timestamp' => utils\get_event_timestamp($event), + 'context' => [ + 'platform' => $config['source_name'], + 'language' => $lang, + 'extensions' => [ + utils\INFO_EXTENSION => utils\get_info($config, $event), + ], + 'contextActivities' => [ + 'grouping' => [ + utils\get_activity\site($config), + utils\get_activity\course($config, $course), + ], + 'category' => [ + utils\get_activity\source($config), + ] + ], + ] + ]]; +} \ No newline at end of file diff --git a/src/transformer/events/mod_scorm/course_module_viewed.php b/src/transformer/events/mod_scorm/course_module_viewed.php new file mode 100644 index 000000000..d352f600f --- /dev/null +++ b/src/transformer/events/mod_scorm/course_module_viewed.php @@ -0,0 +1,61 @@ +. + +namespace src\transformer\events\mod_scorm; + +defined('MOODLE_INTERNAL') || die(); + +use src\transformer\utils as utils; + +function course_module_viewed(array $config, \stdClass $event) { + $repo = $config['repo']; + $user = $repo->read_record_by_id('user', $event->userid); + $course = $repo->read_record_by_id('course', $event->courseid); + $lang = utils\get_course_lang($course); + + return [[ + 'actor' => utils\get_user($config, $user), + 'verb' => [ + 'id' => 'http://id.tincanapi.com/verb/viewed', + 'display' => [ + $lang => 'viewed' + ], + ], + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'http://id.tincanapi.com/activitytype/legacy-learning-standard' + ), + 'timestamp' => utils\get_event_timestamp($event), + 'context' => [ + 'platform' => $config['source_name'], + 'language' => $lang, + 'extensions' => [ + utils\INFO_EXTENSION => utils\get_info($config, $event), + ], + 'contextActivities' => [ + 'grouping' => [ + utils\get_activity\site($config), + utils\get_activity\course($config, $course), + ], + 'category' => [ + utils\get_activity\source($config), + ] + ], + ] + ]]; +} \ No newline at end of file diff --git a/src/transformer/events/mod_survey/course_module_viewed.php b/src/transformer/events/mod_survey/course_module_viewed.php new file mode 100644 index 000000000..9623a0e06 --- /dev/null +++ b/src/transformer/events/mod_survey/course_module_viewed.php @@ -0,0 +1,61 @@ +. + +namespace src\transformer\events\mod_survey; + +defined('MOODLE_INTERNAL') || die(); + +use src\transformer\utils as utils; + +function course_module_viewed(array $config, \stdClass $event) { + $repo = $config['repo']; + $user = $repo->read_record_by_id('user', $event->userid); + $course = $repo->read_record_by_id('course', $event->courseid); + $lang = utils\get_course_lang($course); + + return [[ + 'actor' => utils\get_user($config, $user), + 'verb' => [ + 'id' => 'http://id.tincanapi.com/verb/viewed', + 'display' => [ + $lang => 'viewed' + ], + ], + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'http://id.tincanapi.com/activitytype/survey' + ), + 'timestamp' => utils\get_event_timestamp($event), + 'context' => [ + 'platform' => $config['source_name'], + 'language' => $lang, + 'extensions' => [ + utils\INFO_EXTENSION => utils\get_info($config, $event), + ], + 'contextActivities' => [ + 'grouping' => [ + utils\get_activity\site($config), + utils\get_activity\course($config, $course), + ], + 'category' => [ + utils\get_activity\source($config), + ] + ], + ] + ]]; +} \ No newline at end of file diff --git a/src/transformer/events/mod_url/course_module_viewed.php b/src/transformer/events/mod_url/course_module_viewed.php new file mode 100644 index 000000000..293f8596e --- /dev/null +++ b/src/transformer/events/mod_url/course_module_viewed.php @@ -0,0 +1,61 @@ +. + +namespace src\transformer\events\mod_url; + +defined('MOODLE_INTERNAL') || die(); + +use src\transformer\utils as utils; + +function course_module_viewed(array $config, \stdClass $event) { + $repo = $config['repo']; + $user = $repo->read_record_by_id('user', $event->userid); + $course = $repo->read_record_by_id('course', $event->courseid); + $lang = utils\get_course_lang($course); + + return [[ + 'actor' => utils\get_user($config, $user), + 'verb' => [ + 'id' => 'http://id.tincanapi.com/verb/viewed', + 'display' => [ + $lang => 'viewed' + ], + ], + 'object' => utils\get_activity\course_module( + $config, + $course, + $event->contextinstanceid, + 'http://adlnet.gov/expapi/activities/link' + ), + 'timestamp' => utils\get_event_timestamp($event), + 'context' => [ + 'platform' => $config['source_name'], + 'language' => $lang, + 'extensions' => [ + utils\INFO_EXTENSION => utils\get_info($config, $event), + ], + 'contextActivities' => [ + 'grouping' => [ + utils\get_activity\site($config), + utils\get_activity\course($config, $course), + ], + 'category' => [ + utils\get_activity\source($config), + ] + ], + ] + ]]; +} \ No newline at end of file diff --git a/src/transformer/get_event_function_map.php b/src/transformer/get_event_function_map.php index 8425249e6..a8857e8be 100644 --- a/src/transformer/get_event_function_map.php +++ b/src/transformer/get_event_function_map.php @@ -28,38 +28,38 @@ function get_event_function_map() { '\core\event\course_module_completion_updated' => 'core\course_module_completion_updated', '\mod_assign\event\assessable_submitted' => 'mod_assign\assignment_submitted', '\mod_assign\event\submission_graded' => 'mod_assign\assignment_graded', - '\mod_book\event\course_module_viewed' => 'all\course_module_viewed', - '\mod_chat\event\course_module_viewed' => 'all\course_module_viewed', + '\mod_book\event\course_module_viewed' => 'mod_book\course_module_viewed', + '\mod_chat\event\course_module_viewed' => 'mod_chat\course_module_viewed', '\mod_choice\event\course_module_viewed' => 'all\course_module_viewed', '\mod_data\event\course_module_viewed' => 'all\course_module_viewed', '\mod_facetoface\event\cancel_booking' => 'mod_facetoface\cancel_booking', - '\mod_facetoface\event\course_module_viewed' => 'all\course_module_viewed', + '\mod_facetoface\event\course_module_viewed' => 'mod_facetoface\course_module_viewed', '\mod_facetoface\event\signup_success' => 'mod_facetoface\signup_success', '\mod_facetoface\event\take_attendance' => 'mod_facetoface\take_attendance', '\mod_feedback\event\course_module_viewed' => 'mod_feedback\course_module_viewed', '\mod_feedback\event\response_submitted' => 'mod_feedback\response_submitted\handler', '\mod_folder\event\course_module_viewed' => 'all\course_module_viewed', - '\mod_forum\event\course_module_viewed' => 'all\course_module_viewed', + '\mod_forum\event\course_module_viewed' => 'mod_forum\course_module_viewed', '\mod_forum\event\discussion_viewed' => 'mod_forum\discussion_viewed', '\mod_forum\event\user_report_viewed' => 'mod_forum\user_report_viewed', '\mod_glossary\event\course_module_viewed' => 'all\course_module_viewed', '\mod_imscp\event\course_module_viewed' => 'all\course_module_viewed', - '\mod_lesson\event\course_module_viewed' => 'all\course_module_viewed', + '\mod_lesson\event\course_module_viewed' => 'mod_lesson\course_module_viewed', '\mod_lti\event\course_module_viewed' => 'all\course_module_viewed', - '\mod_page\event\course_module_viewed' => 'all\course_module_viewed', - '\mod_quiz\event\course_module_viewed' => 'all\course_module_viewed', + '\mod_page\event\course_module_viewed' => 'mod_page\course_module_viewed', + '\mod_quiz\event\course_module_viewed' => 'mod_quiz\course_module_viewed', '\mod_quiz\event\attempt_abandoned' => 'mod_quiz\attempt_submitted\handler', '\mod_quiz\event\attempt_started' => 'mod_quiz\attempt_started', '\mod_quiz\event\attempt_reviewed' => 'mod_quiz\attempt_reviewed', '\mod_quiz\event\attempt_submitted' => 'mod_quiz\attempt_submitted\handler', - '\mod_quiz\event\attempt_viewed' => 'all\course_module_viewed', - '\mod_resource\event\course_module_viewed' => 'all\course_module_viewed', - '\mod_scorm\event\course_module_viewed' => 'all\course_module_viewed', + '\mod_quiz\event\attempt_viewed' => 'mod_quiz\attempt_viewed', + '\mod_resource\event\course_module_viewed' => 'mod_resource\course_module_viewed', + '\mod_scorm\event\course_module_viewed' => 'mod_scorm\course_module_viewed', '\mod_scorm\event\sco_launched' => 'mod_scorm\sco_launched', '\mod_scorm\event\scoreraw_submitted' => 'mod_scorm\scoreraw_submitted', '\mod_scorm\event\status_submitted' => 'mod_scorm\status_submitted', - '\mod_survey\event\course_module_viewed' => 'all\course_module_viewed', - '\mod_url\event\course_module_viewed' => 'all\course_module_viewed', + '\mod_survey\event\course_module_viewed' => 'mod_survey\course_module_viewed', + '\mod_url\event\course_module_viewed' => 'mod_url\course_module_viewed', '\mod_wiki\event\course_module_viewed' => 'all\course_module_viewed', '\mod_workshop\event\course_module_viewed' => 'all\course_module_viewed', ]; diff --git a/src/transformer/utils/get_activity/discussion.php b/src/transformer/utils/get_activity/course_discussion.php similarity index 73% rename from src/transformer/utils/get_activity/discussion.php rename to src/transformer/utils/get_activity/course_discussion.php index 5d90fbf5b..7c944d4c3 100644 --- a/src/transformer/utils/get_activity/discussion.php +++ b/src/transformer/utils/get_activity/course_discussion.php @@ -19,17 +19,17 @@ use src\transformer\utils as utils; -function discussion(array $config, \stdClass $discussion) { - $lang = $config['source_lang']; - $appurl = $config['app_url']; - $discussionurl = $appurl . '/mod/forum/discuss.php?d=' . $discussion->id; +function course_discussion(array $config, \stdClass $course, \stdClass $discussion) { + $courselang = utils\get_course_lang($course); + $discussionurl = $config['app_url'].'/mod/forum/discuss.php?d='.$discussion->id; + $discussionname = property_exists($discussion, 'name') ? $discussion->name : 'Discussion'; return [ 'id' => $discussionurl, 'definition' => [ 'type' => 'http://id.tincanapi.com/activitytype/discussion', 'name' => [ - $lang => $discussion->name, + $courselang => $discussionname, ], ], ]; diff --git a/src/transformer/utils/get_activity/course_feedback.php b/src/transformer/utils/get_activity/course_feedback.php index 99ef6cd22..6636a8e02 100644 --- a/src/transformer/utils/get_activity/course_feedback.php +++ b/src/transformer/utils/get_activity/course_feedback.php @@ -19,16 +19,11 @@ use src\transformer\utils as utils; -function course_feedback(array $config, $cmid, $feedback, $lang) { - $name = $feedback->name ? $feedback->name : 'A Moodle feedback survey'; - - return [ - 'id' => $config['app_url'].'/mod/feedback/view.php?id='.$cmid, - 'definition' => [ - 'type' => 'http://id.tincanapi.com/activitytype/survey', - 'name' => [ - $lang => $name, - ], - ], - ]; +function course_feedback(array $config, \stdClass $course, $cmid) { + return utils\get_activity\course_module( + $config, + $course, + $cmid, + 'http://id.tincanapi.com/activitytype/survey' + ); } diff --git a/src/transformer/utils/get_activity/event_module.php b/src/transformer/utils/get_activity/course_forum.php similarity index 72% rename from src/transformer/utils/get_activity/event_module.php rename to src/transformer/utils/get_activity/course_forum.php index 0660dca8f..c47e49a0f 100644 --- a/src/transformer/utils/get_activity/event_module.php +++ b/src/transformer/utils/get_activity/course_forum.php @@ -19,10 +19,11 @@ use src\transformer\utils as utils; -function event_module(array $config, \stdClass $event, $lang) { - $repo = $config['repo']; - $moduletype = $event->objecttable; - $moduleid = $event->objectid; - $module = $repo->read_record_by_id($moduletype, $moduleid); - return utils\get_activity\module($config, $moduletype, $module, $lang); +function course_forum(array $config, \stdClass $course, $cmid) { + return utils\get_activity\course_module( + $config, + $course, + $cmid, + 'http://id.tincanapi.com/activitytype/forum-topic' + ); } diff --git a/src/transformer/utils/get_activity/course_module.php b/src/transformer/utils/get_activity/course_module.php new file mode 100644 index 000000000..e7d653d74 --- /dev/null +++ b/src/transformer/utils/get_activity/course_module.php @@ -0,0 +1,41 @@ +. + +namespace src\transformer\utils\get_activity; +defined('MOODLE_INTERNAL') || die(); + +use src\transformer\utils as utils; + +function course_module(array $config, $course, $cmid, $xapitype) { + $repo = $config['repo']; + $coursemodule = $repo->read_record_by_id('course_modules', $cmid); + $module = $repo->read_record_by_id('modules', $coursemodule->module); + $instance = $repo->read_record_by_id($module->name, $coursemodule->instance); + + $coursemoduleurl = $config['app_url'].'/mod/'.$module->name.'/view.php?id='.$cmid; + $courselang = utils\get_course_lang($course); + $instancename = property_exists($instance, 'name') ? $instance->name : $module->name; + + return [ + 'id' => $coursemoduleurl, + 'definition' => [ + 'type' => $xapitype, + 'name' => [ + $courselang => $instancename, + ], + ], + ]; +} diff --git a/src/transformer/utils/get_activity/module.php b/src/transformer/utils/get_activity/course_quiz.php similarity index 66% rename from src/transformer/utils/get_activity/module.php rename to src/transformer/utils/get_activity/course_quiz.php index 1ee67b128..369c89b70 100644 --- a/src/transformer/utils/get_activity/module.php +++ b/src/transformer/utils/get_activity/course_quiz.php @@ -19,14 +19,11 @@ use src\transformer\utils as utils; -function module(array $config, $moduletype, $module, $lang) { - return [ - 'id' => $config['app_url'].'/mod/'.$moduletype.'/view.php?id='.$module->id, - 'definition' => [ - 'type' => 'http://id.tincanapi.com/activitytype/lms/module', - 'name' => [ - $lang => property_exists($module, 'name') ? $module->name : $moduletype, - ], - ], - ]; +function course_quiz(array $config, \stdClass $course, $cmid) { + return utils\get_activity\course_module( + $config, + $course, + $cmid, + 'http://adlnet.gov/expapi/activities/assessment' + ); } diff --git a/tests/mod_book/course_module_viewed/existing_module/data.json b/tests/mod_book/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..fa2d5ca4e --- /dev/null +++ b/tests/mod_book/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "book" + } + ], + "book": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_book/course_module_viewed/existing_module/event.json b/tests/mod_book/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..d176bb4f4 --- /dev/null +++ b/tests/mod_book/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_book\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_book/course_module_viewed/existing_module/statements.json b/tests/mod_book/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..ec9cc32bb --- /dev/null +++ b/tests/mod_book/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/book\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/book", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_book\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\mod_book\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/all/course_module_viewed/viewing_scorm_module/test.php b/tests/mod_book/course_module_viewed/existing_module/test.php similarity index 93% rename from tests/all/course_module_viewed/viewing_scorm_module/test.php rename to tests/mod_book/course_module_viewed/existing_module/test.php index c300eab35..7c2a3365f 100644 --- a/tests/all/course_module_viewed/viewing_scorm_module/test.php +++ b/tests/mod_book/course_module_viewed/existing_module/test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace tests\all\course_module_viewed\viewing_scorm_module; +namespace tests\mod_book\course_module_viewed\existing_module; defined('MOODLE_INTERNAL') || die(); class test extends \tests\xapi_test_case { diff --git a/tests/mod_chat/course_module_viewed/existing_module/data.json b/tests/mod_chat/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..458d90120 --- /dev/null +++ b/tests/mod_chat/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "chat" + } + ], + "chat": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_chat/course_module_viewed/existing_module/event.json b/tests/mod_chat/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..568564aa9 --- /dev/null +++ b/tests/mod_chat/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_chat\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_chat/course_module_viewed/existing_module/statements.json b/tests/mod_chat/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..4171d5dae --- /dev/null +++ b/tests/mod_chat/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/chat\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/chat-channel", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_chat\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\mod_chat\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_chat/course_module_viewed/existing_module/test.php b/tests/mod_chat/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..6f8943f46 --- /dev/null +++ b/tests/mod_chat/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_chat\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_choice/course_module_viewed/existing_module/data.json b/tests/mod_choice/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..8b7c0fde1 --- /dev/null +++ b/tests/mod_choice/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "choice" + } + ], + "choice": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_choice/course_module_viewed/existing_module/event.json b/tests/mod_choice/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..a8912b486 --- /dev/null +++ b/tests/mod_choice/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_choice\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_choice/course_module_viewed/existing_module/statements.json b/tests/mod_choice/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..8fa1036dc --- /dev/null +++ b/tests/mod_choice/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/choice\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_choice\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\all\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_choice/course_module_viewed/existing_module/test.php b/tests/mod_choice/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..4fb7171c8 --- /dev/null +++ b/tests/mod_choice/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_choice\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_data/course_module_viewed/existing_module/data.json b/tests/mod_data/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..4ed8b064b --- /dev/null +++ b/tests/mod_data/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "data" + } + ], + "data": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_data/course_module_viewed/existing_module/event.json b/tests/mod_data/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..d9d17ff59 --- /dev/null +++ b/tests/mod_data/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_data\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_data/course_module_viewed/existing_module/statements.json b/tests/mod_data/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..8a9256ecf --- /dev/null +++ b/tests/mod_data/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/data\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_data\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\all\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_data/course_module_viewed/existing_module/test.php b/tests/mod_data/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..d273b6dc4 --- /dev/null +++ b/tests/mod_data/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_data\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_facetoface/cancel_booking/existing_booking_cancelled/data.json b/tests/mod_facetoface/cancel_booking/existing_booking_cancelled/data.json index fead1f207..308c050f2 100644 --- a/tests/mod_facetoface/cancel_booking/existing_booking_cancelled/data.json +++ b/tests/mod_facetoface/cancel_booking/existing_booking_cancelled/data.json @@ -13,6 +13,20 @@ "lang": "en" } ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "facetoface" + } + ], "facetoface": [ { "id": 1, diff --git a/tests/mod_facetoface/cancel_booking/existing_booking_cancelled/event.json b/tests/mod_facetoface/cancel_booking/existing_booking_cancelled/event.json index 08901c7f2..dd36687a7 100644 --- a/tests/mod_facetoface/cancel_booking/existing_booking_cancelled/event.json +++ b/tests/mod_facetoface/cancel_booking/existing_booking_cancelled/event.json @@ -5,5 +5,6 @@ "timecreated": 1433946701, "objecttable": "facetoface", "objectid": 1, + "contextinstanceid": 1, "eventname": "\\mod_facetoface\\event\\cancel_booking" } \ No newline at end of file diff --git a/tests/mod_facetoface/cancel_booking/existing_booking_cancelled/statements.json b/tests/mod_facetoface/cancel_booking/existing_booking_cancelled/statements.json index e88ee7b81..09e22befa 100644 --- a/tests/mod_facetoface/cancel_booking/existing_booking_cancelled/statements.json +++ b/tests/mod_facetoface/cancel_booking/existing_booking_cancelled/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/facetoface\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "https:\/\/w3id.org\/xapi\/acrossx\/activities\/face-to-face-discussion", "name": { "en": "test_facetoface_name" } diff --git a/tests/mod_facetoface/course_module_viewed/existing_module/data.json b/tests/mod_facetoface/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..d8ce6fe62 --- /dev/null +++ b/tests/mod_facetoface/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "facetoface" + } + ], + "facetoface": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_facetoface/course_module_viewed/existing_module/event.json b/tests/mod_facetoface/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..9793c6a1d --- /dev/null +++ b/tests/mod_facetoface/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_facetoface\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_facetoface/course_module_viewed/existing_module/statements.json b/tests/mod_facetoface/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..f73ae827b --- /dev/null +++ b/tests/mod_facetoface/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/facetoface\/view.php?id=1", + "definition": { + "type": "https:\/\/w3id.org\/xapi\/acrossx\/activities\/face-to-face-discussion", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_facetoface\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\mod_facetoface\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_facetoface/course_module_viewed/existing_module/test.php b/tests/mod_facetoface/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..e5a106f98 --- /dev/null +++ b/tests/mod_facetoface/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_facetoface\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_facetoface/signup_success/existing_signup_success/data.json b/tests/mod_facetoface/signup_success/existing_signup_success/data.json index fead1f207..308c050f2 100644 --- a/tests/mod_facetoface/signup_success/existing_signup_success/data.json +++ b/tests/mod_facetoface/signup_success/existing_signup_success/data.json @@ -13,6 +13,20 @@ "lang": "en" } ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "facetoface" + } + ], "facetoface": [ { "id": 1, diff --git a/tests/mod_facetoface/signup_success/existing_signup_success/event.json b/tests/mod_facetoface/signup_success/existing_signup_success/event.json index 8ac4e4e46..dbe4e774b 100644 --- a/tests/mod_facetoface/signup_success/existing_signup_success/event.json +++ b/tests/mod_facetoface/signup_success/existing_signup_success/event.json @@ -5,5 +5,6 @@ "timecreated": 1433946701, "objecttable": "facetoface", "objectid": 1, + "contextinstanceid": 1, "eventname": "\\mod_facetoface\\event\\signup_success" } \ No newline at end of file diff --git a/tests/mod_facetoface/signup_success/existing_signup_success/statements.json b/tests/mod_facetoface/signup_success/existing_signup_success/statements.json index ff16f45af..19e9ce2e9 100644 --- a/tests/mod_facetoface/signup_success/existing_signup_success/statements.json +++ b/tests/mod_facetoface/signup_success/existing_signup_success/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/facetoface\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "https:\/\/w3id.org\/xapi\/acrossx\/activities\/face-to-face-discussion", "name": { "en": "test_facetoface_name" } diff --git a/tests/mod_facetoface/take_attendance/existing_attendance_taken/data.json b/tests/mod_facetoface/take_attendance/existing_attendance_taken/data.json index 683ee125b..fc4cb9923 100644 --- a/tests/mod_facetoface/take_attendance/existing_attendance_taken/data.json +++ b/tests/mod_facetoface/take_attendance/existing_attendance_taken/data.json @@ -18,12 +18,32 @@ "lang": "en" } ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "facetoface" + } + ], "facetoface": [ { "id": 1, "name": "test_facetoface_name" } ], + "facetoface_sessions": [ + { + "id": 1, + "facetoface": 1 + } + ], "facetoface_signups": [ { "id": 1, diff --git a/tests/mod_facetoface/take_attendance/existing_attendance_taken/event.json b/tests/mod_facetoface/take_attendance/existing_attendance_taken/event.json index ff4e4d1ed..899b891ad 100644 --- a/tests/mod_facetoface/take_attendance/existing_attendance_taken/event.json +++ b/tests/mod_facetoface/take_attendance/existing_attendance_taken/event.json @@ -5,5 +5,6 @@ "timecreated": 1433946701, "objecttable": "facetoface", "objectid": 1, + "contextinstanceid": 1, "eventname": "\\mod_facetoface\\event\\take_attendance" } \ No newline at end of file diff --git a/tests/mod_facetoface/take_attendance/existing_attendance_taken/statements.json b/tests/mod_facetoface/take_attendance/existing_attendance_taken/statements.json index 9e36627c4..052d50ed1 100644 --- a/tests/mod_facetoface/take_attendance/existing_attendance_taken/statements.json +++ b/tests/mod_facetoface/take_attendance/existing_attendance_taken/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/facetoface\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "https:\/\/w3id.org\/xapi\/acrossx\/activities\/face-to-face-discussion", "name": { "en": "test_facetoface_name" } diff --git a/tests/mod_feedback/course_module_viewed/viewing_feedback/data.json b/tests/mod_feedback/course_module_viewed/viewing_feedback/data.json index 91d2e86b2..1d650a7e7 100644 --- a/tests/mod_feedback/course_module_viewed/viewing_feedback/data.json +++ b/tests/mod_feedback/course_module_viewed/viewing_feedback/data.json @@ -21,6 +21,12 @@ "instance": 1 } ], + "modules": [ + { + "id": 1, + "name": "feedback" + } + ], "feedback": [ { "id": 1, diff --git a/tests/mod_feedback/response_submitted/multichoice/data.json b/tests/mod_feedback/response_submitted/multichoice/data.json index 9eaf3e03d..ed32d2412 100644 --- a/tests/mod_feedback/response_submitted/multichoice/data.json +++ b/tests/mod_feedback/response_submitted/multichoice/data.json @@ -13,6 +13,20 @@ "lang": "en" } ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "feedback" + } + ], "feedback_completed": [ { "id": 1, diff --git a/tests/mod_feedback/response_submitted/multichoicerated/data.json b/tests/mod_feedback/response_submitted/multichoicerated/data.json index 75c3016ba..fbf122717 100644 --- a/tests/mod_feedback/response_submitted/multichoicerated/data.json +++ b/tests/mod_feedback/response_submitted/multichoicerated/data.json @@ -13,6 +13,20 @@ "lang": "en" } ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "feedback" + } + ], "feedback_completed": [ { "id": 1, diff --git a/tests/mod_feedback/response_submitted/no_items/data.json b/tests/mod_feedback/response_submitted/no_items/data.json index 54c2bcf1f..a7269a4ea 100644 --- a/tests/mod_feedback/response_submitted/no_items/data.json +++ b/tests/mod_feedback/response_submitted/no_items/data.json @@ -13,6 +13,20 @@ "lang": "en" } ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "feedback" + } + ], "feedback_completed": [ { "id": 1, diff --git a/tests/mod_feedback/response_submitted/numeric/data.json b/tests/mod_feedback/response_submitted/numerical/data.json similarity index 76% rename from tests/mod_feedback/response_submitted/numeric/data.json rename to tests/mod_feedback/response_submitted/numerical/data.json index 6e3fb1299..04dec96f2 100644 --- a/tests/mod_feedback/response_submitted/numeric/data.json +++ b/tests/mod_feedback/response_submitted/numerical/data.json @@ -13,6 +13,20 @@ "lang": "en" } ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "feedback" + } + ], "feedback_completed": [ { "id": 1, diff --git a/tests/mod_feedback/response_submitted/numeric/event.json b/tests/mod_feedback/response_submitted/numerical/event.json similarity index 100% rename from tests/mod_feedback/response_submitted/numeric/event.json rename to tests/mod_feedback/response_submitted/numerical/event.json diff --git a/tests/mod_feedback/response_submitted/numeric/statements.json b/tests/mod_feedback/response_submitted/numerical/statements.json similarity index 100% rename from tests/mod_feedback/response_submitted/numeric/statements.json rename to tests/mod_feedback/response_submitted/numerical/statements.json diff --git a/tests/mod_feedback/response_submitted/numerical/test.php b/tests/mod_feedback/response_submitted/numerical/test.php new file mode 100644 index 000000000..f809a8329 --- /dev/null +++ b/tests/mod_feedback/response_submitted/numerical/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_feedback\response_submitted\numerical; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_feedback/response_submitted/textarea/data.json b/tests/mod_feedback/response_submitted/textarea/data.json index ed22645eb..14505ed54 100644 --- a/tests/mod_feedback/response_submitted/textarea/data.json +++ b/tests/mod_feedback/response_submitted/textarea/data.json @@ -13,6 +13,20 @@ "lang": "en" } ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "feedback" + } + ], "feedback_completed": [ { "id": 1, diff --git a/tests/mod_feedback/response_submitted/textfield/data.json b/tests/mod_feedback/response_submitted/textfield/data.json index 8444abf55..dec1f8f83 100644 --- a/tests/mod_feedback/response_submitted/textfield/data.json +++ b/tests/mod_feedback/response_submitted/textfield/data.json @@ -13,6 +13,20 @@ "lang": "en" } ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "feedback" + } + ], "feedback_completed": [ { "id": 1, diff --git a/tests/mod_feedback/response_submitted/unknown_typ/data.json b/tests/mod_feedback/response_submitted/unknown_typ/data.json index ff223c5a1..0d9c07192 100644 --- a/tests/mod_feedback/response_submitted/unknown_typ/data.json +++ b/tests/mod_feedback/response_submitted/unknown_typ/data.json @@ -13,6 +13,20 @@ "lang": "en" } ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "feedback" + } + ], "feedback_completed": [ { "id": 1, diff --git a/tests/mod_folder/course_module_viewed/existing_module/data.json b/tests/mod_folder/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..4b49da023 --- /dev/null +++ b/tests/mod_folder/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "folder" + } + ], + "folder": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_folder/course_module_viewed/existing_module/event.json b/tests/mod_folder/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..dcd8bf9a0 --- /dev/null +++ b/tests/mod_folder/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_folder\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_folder/course_module_viewed/existing_module/statements.json b/tests/mod_folder/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..a989c27d1 --- /dev/null +++ b/tests/mod_folder/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/folder\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_folder\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\all\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_folder/course_module_viewed/existing_module/test.php b/tests/mod_folder/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..1730ab62d --- /dev/null +++ b/tests/mod_folder/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_folder\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_forum/course_module_viewed/existing_module/data.json b/tests/mod_forum/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..096b2fce5 --- /dev/null +++ b/tests/mod_forum/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "forum" + } + ], + "forum": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_forum/course_module_viewed/existing_module/event.json b/tests/mod_forum/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..5e3057900 --- /dev/null +++ b/tests/mod_forum/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_forum\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_forum/course_module_viewed/existing_module/statements.json b/tests/mod_forum/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..3727e3446 --- /dev/null +++ b/tests/mod_forum/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/forum\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/forum-topic", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_forum\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\mod_forum\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_forum/course_module_viewed/existing_module/test.php b/tests/mod_forum/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..5058c1a4e --- /dev/null +++ b/tests/mod_forum/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_forum\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_forum/discussion_viewed/existing_discussion_viewed/data.json b/tests/mod_forum/discussion_viewed/existing_discussion_viewed/data.json index 8708bfd50..b91a718c6 100644 --- a/tests/mod_forum/discussion_viewed/existing_discussion_viewed/data.json +++ b/tests/mod_forum/discussion_viewed/existing_discussion_viewed/data.json @@ -13,10 +13,30 @@ "lang": "en" } ], - "forum_discussions": [ + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "forum" + } + ], + "forum": [ { "id": 1, "name": "test_forum_name" } + ], + "forum_discussions": [ + { + "id": 1, + "name": "test_forum_discussion_name" + } ] } \ No newline at end of file diff --git a/tests/mod_forum/discussion_viewed/existing_discussion_viewed/event.json b/tests/mod_forum/discussion_viewed/existing_discussion_viewed/event.json index a7afc02ca..75b8fdab9 100644 --- a/tests/mod_forum/discussion_viewed/existing_discussion_viewed/event.json +++ b/tests/mod_forum/discussion_viewed/existing_discussion_viewed/event.json @@ -5,5 +5,6 @@ "timecreated": 1433946701, "objecttable": "forum", "objectid": 1, + "contextinstanceid": 1, "eventname": "\\mod_forum\\event\\discussion_viewed" } \ No newline at end of file diff --git a/tests/mod_forum/discussion_viewed/existing_discussion_viewed/statements.json b/tests/mod_forum/discussion_viewed/existing_discussion_viewed/statements.json index d65933479..8823704fe 100644 --- a/tests/mod_forum/discussion_viewed/existing_discussion_viewed/statements.json +++ b/tests/mod_forum/discussion_viewed/existing_discussion_viewed/statements.json @@ -18,7 +18,7 @@ "definition": { "type": "http:\/\/id.tincanapi.com\/activitytype\/discussion", "name": { - "en": "test_forum_name" + "en": "test_forum_discussion_name" } } }, @@ -53,6 +53,15 @@ "en": "test_name" } } + }, + { + "id": "http:\/\/www.example.org\/mod\/forum\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/forum-topic", + "name": { + "en": "test_forum_name" + } + } } ], "category": [ diff --git a/tests/mod_glossary/course_module_viewed/existing_module/data.json b/tests/mod_glossary/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..e2c513eb1 --- /dev/null +++ b/tests/mod_glossary/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "glossary" + } + ], + "glossary": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_glossary/course_module_viewed/existing_module/event.json b/tests/mod_glossary/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..3f1abadbe --- /dev/null +++ b/tests/mod_glossary/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_glossary\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_glossary/course_module_viewed/existing_module/statements.json b/tests/mod_glossary/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..d78fd3703 --- /dev/null +++ b/tests/mod_glossary/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/glossary\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_glossary\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\all\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_glossary/course_module_viewed/existing_module/test.php b/tests/mod_glossary/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..b941e556f --- /dev/null +++ b/tests/mod_glossary/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_glossary\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_imscp/course_module_viewed/existing_module/data.json b/tests/mod_imscp/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..4fa6863a6 --- /dev/null +++ b/tests/mod_imscp/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "imscp" + } + ], + "imscp": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_imscp/course_module_viewed/existing_module/event.json b/tests/mod_imscp/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..f619afd43 --- /dev/null +++ b/tests/mod_imscp/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_imscp\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_imscp/course_module_viewed/existing_module/statements.json b/tests/mod_imscp/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..470379285 --- /dev/null +++ b/tests/mod_imscp/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/imscp\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_imscp\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\all\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_imscp/course_module_viewed/existing_module/test.php b/tests/mod_imscp/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..0bc2abb74 --- /dev/null +++ b/tests/mod_imscp/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_imscp\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_lesson/course_module_viewed/existing_module/data.json b/tests/mod_lesson/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..56ecc88a0 --- /dev/null +++ b/tests/mod_lesson/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "lesson" + } + ], + "lesson": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_lesson/course_module_viewed/existing_module/event.json b/tests/mod_lesson/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..e595c1d9d --- /dev/null +++ b/tests/mod_lesson/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_lesson\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_lesson/course_module_viewed/existing_module/statements.json b/tests/mod_lesson/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..35d7e5fe6 --- /dev/null +++ b/tests/mod_lesson/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/lesson\/view.php?id=1", + "definition": { + "type": "http:\/\/adlnet.gov\/expapi\/activities\/lesson", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_lesson\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\mod_lesson\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_lesson/course_module_viewed/existing_module/test.php b/tests/mod_lesson/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..fc7c0c271 --- /dev/null +++ b/tests/mod_lesson/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_lesson\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_lti/course_module_viewed/existing_module/data.json b/tests/mod_lti/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..f919ad5f0 --- /dev/null +++ b/tests/mod_lti/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "lti" + } + ], + "lti": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_lti/course_module_viewed/existing_module/event.json b/tests/mod_lti/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..b5934d465 --- /dev/null +++ b/tests/mod_lti/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_lti\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_lti/course_module_viewed/existing_module/statements.json b/tests/mod_lti/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..116da8d00 --- /dev/null +++ b/tests/mod_lti/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/lti\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_lti\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\all\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_lti/course_module_viewed/existing_module/test.php b/tests/mod_lti/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..fb7105a71 --- /dev/null +++ b/tests/mod_lti/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_lti\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_page/course_module_viewed/existing_module/data.json b/tests/mod_page/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..8b60165fd --- /dev/null +++ b/tests/mod_page/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "page" + } + ], + "page": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_page/course_module_viewed/existing_module/event.json b/tests/mod_page/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..7c23841e7 --- /dev/null +++ b/tests/mod_page/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_page\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_page/course_module_viewed/existing_module/statements.json b/tests/mod_page/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..3ebae8189 --- /dev/null +++ b/tests/mod_page/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/page\/view.php?id=1", + "definition": { + "type": "https:\/\/w3id.org\/xapi\/acrossx\/activities\/page", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_page\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\mod_page\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_page/course_module_viewed/existing_module/test.php b/tests/mod_page/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..0555fdd93 --- /dev/null +++ b/tests/mod_page/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_page\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_quiz/attempt_reviewed/existing_attempt_reviewed/data.json b/tests/mod_quiz/attempt_reviewed/existing_attempt_reviewed/data.json index fd22dde19..544ff7246 100644 --- a/tests/mod_quiz/attempt_reviewed/existing_attempt_reviewed/data.json +++ b/tests/mod_quiz/attempt_reviewed/existing_attempt_reviewed/data.json @@ -26,6 +26,12 @@ "instance": 1 } ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], "quiz_attempts": [ { "id": 1, diff --git a/tests/mod_quiz/attempt_reviewed/existing_attempt_reviewed/statements.json b/tests/mod_quiz/attempt_reviewed/existing_attempt_reviewed/statements.json index 118aa2043..1cec2c41c 100644 --- a/tests/mod_quiz/attempt_reviewed/existing_attempt_reviewed/statements.json +++ b/tests/mod_quiz/attempt_reviewed/existing_attempt_reviewed/statements.json @@ -64,7 +64,7 @@ { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } diff --git a/tests/mod_quiz/attempt_started/existing_attempt_started/data.json b/tests/mod_quiz/attempt_started/existing_attempt_started/data.json index c24dcf02c..9f0dffdf0 100644 --- a/tests/mod_quiz/attempt_started/existing_attempt_started/data.json +++ b/tests/mod_quiz/attempt_started/existing_attempt_started/data.json @@ -21,6 +21,12 @@ "instance": 1 } ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], "quiz_attempts": [ { "id": 1, diff --git a/tests/mod_quiz/attempt_started/existing_attempt_started/statements.json b/tests/mod_quiz/attempt_started/existing_attempt_started/statements.json index beed83570..47419b415 100644 --- a/tests/mod_quiz/attempt_started/existing_attempt_started/statements.json +++ b/tests/mod_quiz/attempt_started/existing_attempt_started/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } diff --git a/tests/mod_quiz/attempt_submitted/essay/data.json b/tests/mod_quiz/attempt_submitted/essay/data.json index 6ff3e2639..4a55032d0 100644 --- a/tests/mod_quiz/attempt_submitted/essay/data.json +++ b/tests/mod_quiz/attempt_submitted/essay/data.json @@ -21,6 +21,12 @@ "instance": 1 } ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], "quiz_attempts": [ { "id": 1, diff --git a/tests/mod_quiz/attempt_submitted/essay/statements.json b/tests/mod_quiz/attempt_submitted/essay/statements.json index 614c56402..3edc0e227 100644 --- a/tests/mod_quiz/attempt_submitted/essay/statements.json +++ b/tests/mod_quiz/attempt_submitted/essay/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } @@ -154,7 +154,7 @@ { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } diff --git a/tests/mod_quiz/attempt_submitted/gapselect/data.json b/tests/mod_quiz/attempt_submitted/gapselect/data.json index d0563a5a9..3baccd5e6 100644 --- a/tests/mod_quiz/attempt_submitted/gapselect/data.json +++ b/tests/mod_quiz/attempt_submitted/gapselect/data.json @@ -21,6 +21,12 @@ "instance": 1 } ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], "quiz_attempts": [ { "id": 1, diff --git a/tests/mod_quiz/attempt_submitted/gapselect/statements.json b/tests/mod_quiz/attempt_submitted/gapselect/statements.json index d46635966..f9c2283ce 100644 --- a/tests/mod_quiz/attempt_submitted/gapselect/statements.json +++ b/tests/mod_quiz/attempt_submitted/gapselect/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } @@ -162,7 +162,7 @@ { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } diff --git a/tests/mod_quiz/attempt_submitted/match/data.json b/tests/mod_quiz/attempt_submitted/match/data.json index 32f8b7d72..e34c78399 100644 --- a/tests/mod_quiz/attempt_submitted/match/data.json +++ b/tests/mod_quiz/attempt_submitted/match/data.json @@ -21,6 +21,12 @@ "instance": 1 } ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], "quiz_attempts": [ { "id": 1, diff --git a/tests/mod_quiz/attempt_submitted/match/statements.json b/tests/mod_quiz/attempt_submitted/match/statements.json index 6fdeee5a1..a5dffd748 100644 --- a/tests/mod_quiz/attempt_submitted/match/statements.json +++ b/tests/mod_quiz/attempt_submitted/match/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } @@ -162,7 +162,7 @@ { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } diff --git a/tests/mod_quiz/attempt_submitted/multichoice/data.json b/tests/mod_quiz/attempt_submitted/multichoice/data.json index e9846f940..a4542e81c 100644 --- a/tests/mod_quiz/attempt_submitted/multichoice/data.json +++ b/tests/mod_quiz/attempt_submitted/multichoice/data.json @@ -21,6 +21,12 @@ "instance": 1 } ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], "quiz_attempts": [ { "id": 1, diff --git a/tests/mod_quiz/attempt_submitted/multichoice/statements.json b/tests/mod_quiz/attempt_submitted/multichoice/statements.json index 27c8e9429..aabc3d691 100644 --- a/tests/mod_quiz/attempt_submitted/multichoice/statements.json +++ b/tests/mod_quiz/attempt_submitted/multichoice/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } @@ -157,7 +157,7 @@ { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } diff --git a/tests/mod_quiz/attempt_submitted/no_questions/data.json b/tests/mod_quiz/attempt_submitted/no_questions/data.json index 310e35a85..c95482a09 100644 --- a/tests/mod_quiz/attempt_submitted/no_questions/data.json +++ b/tests/mod_quiz/attempt_submitted/no_questions/data.json @@ -21,6 +21,12 @@ "instance": 1 } ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], "quiz_attempts": [ { "id": 1, diff --git a/tests/mod_quiz/attempt_submitted/no_questions/statements.json b/tests/mod_quiz/attempt_submitted/no_questions/statements.json index a32284927..8dce662e9 100644 --- a/tests/mod_quiz/attempt_submitted/no_questions/statements.json +++ b/tests/mod_quiz/attempt_submitted/no_questions/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } diff --git a/tests/mod_quiz/attempt_submitted/numerical/data.json b/tests/mod_quiz/attempt_submitted/numerical/data.json index 060c62a3c..863137a09 100644 --- a/tests/mod_quiz/attempt_submitted/numerical/data.json +++ b/tests/mod_quiz/attempt_submitted/numerical/data.json @@ -21,6 +21,12 @@ "instance": 1 } ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], "quiz_attempts": [ { "id": 1, diff --git a/tests/mod_quiz/attempt_submitted/numerical/statements.json b/tests/mod_quiz/attempt_submitted/numerical/statements.json index dc0344ad0..6d892a43e 100644 --- a/tests/mod_quiz/attempt_submitted/numerical/statements.json +++ b/tests/mod_quiz/attempt_submitted/numerical/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } @@ -158,7 +158,7 @@ { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } diff --git a/tests/mod_quiz/attempt_submitted/randomsamatch/data.json b/tests/mod_quiz/attempt_submitted/randomsamatch/data.json index 54b1b517a..98e8fa697 100644 --- a/tests/mod_quiz/attempt_submitted/randomsamatch/data.json +++ b/tests/mod_quiz/attempt_submitted/randomsamatch/data.json @@ -21,6 +21,12 @@ "instance": 1 } ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], "quiz_attempts": [ { "id": 1, diff --git a/tests/mod_quiz/attempt_submitted/randomsamatch/statements.json b/tests/mod_quiz/attempt_submitted/randomsamatch/statements.json index c8a2cf5ac..78b07fce9 100644 --- a/tests/mod_quiz/attempt_submitted/randomsamatch/statements.json +++ b/tests/mod_quiz/attempt_submitted/randomsamatch/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } @@ -161,7 +161,7 @@ { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } diff --git a/tests/mod_quiz/attempt_submitted/shortanswer/data.json b/tests/mod_quiz/attempt_submitted/shortanswer/data.json index e0e9542fd..56ccba88d 100644 --- a/tests/mod_quiz/attempt_submitted/shortanswer/data.json +++ b/tests/mod_quiz/attempt_submitted/shortanswer/data.json @@ -21,6 +21,12 @@ "instance": 1 } ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], "quiz_attempts": [ { "id": 1, diff --git a/tests/mod_quiz/attempt_submitted/shortanswer/statements.json b/tests/mod_quiz/attempt_submitted/shortanswer/statements.json index 3b3b8ca0f..2e5097d54 100644 --- a/tests/mod_quiz/attempt_submitted/shortanswer/statements.json +++ b/tests/mod_quiz/attempt_submitted/shortanswer/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } @@ -154,7 +154,7 @@ { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } diff --git a/tests/mod_quiz/attempt_submitted/truefalse/data.json b/tests/mod_quiz/attempt_submitted/truefalse/data.json index 1bdfa629c..448114aff 100644 --- a/tests/mod_quiz/attempt_submitted/truefalse/data.json +++ b/tests/mod_quiz/attempt_submitted/truefalse/data.json @@ -21,6 +21,12 @@ "instance": 1 } ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], "quiz_attempts": [ { "id": 1, diff --git a/tests/mod_quiz/attempt_submitted/truefalse/statements.json b/tests/mod_quiz/attempt_submitted/truefalse/statements.json index f1ba5dca2..275aa0f85 100644 --- a/tests/mod_quiz/attempt_submitted/truefalse/statements.json +++ b/tests/mod_quiz/attempt_submitted/truefalse/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } @@ -158,7 +158,7 @@ { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } diff --git a/tests/mod_quiz/attempt_submitted/unknown_qtype/data.json b/tests/mod_quiz/attempt_submitted/unknown_qtype/data.json index 2a92a273e..c0c1e2dbf 100644 --- a/tests/mod_quiz/attempt_submitted/unknown_qtype/data.json +++ b/tests/mod_quiz/attempt_submitted/unknown_qtype/data.json @@ -21,6 +21,12 @@ "instance": 1 } ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], "quiz_attempts": [ { "id": 1, diff --git a/tests/mod_quiz/attempt_submitted/unknown_qtype/statements.json b/tests/mod_quiz/attempt_submitted/unknown_qtype/statements.json index a32284927..8dce662e9 100644 --- a/tests/mod_quiz/attempt_submitted/unknown_qtype/statements.json +++ b/tests/mod_quiz/attempt_submitted/unknown_qtype/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", "name": { "en": "test_quiz_name" } diff --git a/tests/mod_quiz/attempt_viewed/existing_module/data.json b/tests/mod_quiz/attempt_viewed/existing_module/data.json new file mode 100644 index 000000000..c8aaf7534 --- /dev/null +++ b/tests/mod_quiz/attempt_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], + "quiz": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_quiz/attempt_viewed/existing_module/event.json b/tests/mod_quiz/attempt_viewed/existing_module/event.json new file mode 100644 index 000000000..d3e99f853 --- /dev/null +++ b/tests/mod_quiz/attempt_viewed/existing_module/event.json @@ -0,0 +1,9 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "objectid": 1, + "contextinstanceid": 1, + "eventname": "\\mod_quiz\\event\\attempt_viewed" +} \ No newline at end of file diff --git a/tests/mod_quiz/attempt_viewed/existing_module/statements.json b/tests/mod_quiz/attempt_viewed/existing_module/statements.json new file mode 100644 index 000000000..9561a54d5 --- /dev/null +++ b/tests/mod_quiz/attempt_viewed/existing_module/statements.json @@ -0,0 +1,81 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/quiz\/attempt.php?attempt=1&cmid=1", + "definition": { + "type": "http:\/\/adlnet.gov\/expapi\/activities\/attempt", + "name": { + "en": "Attempt" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_quiz\\event\\attempt_viewed", + "event_function": "\\src\\transformer\\events\\mod_quiz\\attempt_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", + "definition": { + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_feedback/response_submitted/numeric/test.php b/tests/mod_quiz/attempt_viewed/existing_module/test.php similarity index 93% rename from tests/mod_feedback/response_submitted/numeric/test.php rename to tests/mod_quiz/attempt_viewed/existing_module/test.php index 60aae33e1..866d8d578 100644 --- a/tests/mod_feedback/response_submitted/numeric/test.php +++ b/tests/mod_quiz/attempt_viewed/existing_module/test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace tests\mod_feedback\response_submitted\numeric; +namespace tests\mod_quiz\attempt_viewed\existing_module; defined('MOODLE_INTERNAL') || die(); class test extends \tests\xapi_test_case { diff --git a/tests/mod_quiz/course_module_viewed/existing_module/data.json b/tests/mod_quiz/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..c8aaf7534 --- /dev/null +++ b/tests/mod_quiz/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "quiz" + } + ], + "quiz": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_quiz/course_module_viewed/existing_module/event.json b/tests/mod_quiz/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..a92087297 --- /dev/null +++ b/tests/mod_quiz/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_quiz\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_quiz/course_module_viewed/existing_module/statements.json b/tests/mod_quiz/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..b1e2d3552 --- /dev/null +++ b/tests/mod_quiz/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/quiz\/view.php?id=1", + "definition": { + "type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_quiz\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\mod_quiz\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_quiz/course_module_viewed/existing_module/test.php b/tests/mod_quiz/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..8bc6afe6f --- /dev/null +++ b/tests/mod_quiz/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_quiz\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_resource/course_module_viewed/existing_module/data.json b/tests/mod_resource/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..4bf391bb2 --- /dev/null +++ b/tests/mod_resource/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "resource" + } + ], + "resource": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_resource/course_module_viewed/existing_module/event.json b/tests/mod_resource/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..e0e147218 --- /dev/null +++ b/tests/mod_resource/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_resource\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_resource/course_module_viewed/existing_module/statements.json b/tests/mod_resource/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..00e92b0b1 --- /dev/null +++ b/tests/mod_resource/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/resource\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/resource", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_resource\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\mod_resource\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_resource/course_module_viewed/existing_module/test.php b/tests/mod_resource/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..218be088d --- /dev/null +++ b/tests/mod_resource/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_resource\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/all/course_module_viewed/viewing_scorm_module/data.json b/tests/mod_scorm/course_module_viewed/existing_module/data.json similarity index 60% rename from tests/all/course_module_viewed/viewing_scorm_module/data.json rename to tests/mod_scorm/course_module_viewed/existing_module/data.json index 84f46f5a3..90b7a2844 100644 --- a/tests/all/course_module_viewed/viewing_scorm_module/data.json +++ b/tests/mod_scorm/course_module_viewed/existing_module/data.json @@ -13,6 +13,20 @@ "lang": "en" } ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "scorm" + } + ], "scorm": [ { "id": 1, diff --git a/tests/all/course_module_viewed/viewing_scorm_module/event.json b/tests/mod_scorm/course_module_viewed/existing_module/event.json similarity index 75% rename from tests/all/course_module_viewed/viewing_scorm_module/event.json rename to tests/mod_scorm/course_module_viewed/existing_module/event.json index 34492ab88..5aa64fd83 100644 --- a/tests/all/course_module_viewed/viewing_scorm_module/event.json +++ b/tests/mod_scorm/course_module_viewed/existing_module/event.json @@ -3,7 +3,6 @@ "userid": 1, "courseid": 1, "timecreated": 1433946701, - "objecttable": "scorm", - "objectid": 1, + "contextinstanceid": 1, "eventname": "\\mod_scorm\\event\\course_module_viewed" } \ No newline at end of file diff --git a/tests/all/course_module_viewed/viewing_scorm_module/statements.json b/tests/mod_scorm/course_module_viewed/existing_module/statements.json similarity index 97% rename from tests/all/course_module_viewed/viewing_scorm_module/statements.json rename to tests/mod_scorm/course_module_viewed/existing_module/statements.json index 8f7c6c9af..9cbcbca41 100644 --- a/tests/all/course_module_viewed/viewing_scorm_module/statements.json +++ b/tests/mod_scorm/course_module_viewed/existing_module/statements.json @@ -16,7 +16,7 @@ "object": { "id": "http:\/\/www.example.org\/mod\/scorm\/view.php?id=1", "definition": { - "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "type": "http:\/\/id.tincanapi.com\/activitytype\/legacy-learning-standard", "name": { "en": "test_name" } @@ -31,7 +31,7 @@ "http:\/\/moodle.org": "1.0.0", "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", "event_name": "\\mod_scorm\\event\\course_module_viewed", - "event_function": "\\src\\transformer\\events\\all\\course_module_viewed" + "event_function": "\\src\\transformer\\events\\mod_scorm\\course_module_viewed" } }, "contextActivities": { diff --git a/tests/mod_scorm/course_module_viewed/existing_module/test.php b/tests/mod_scorm/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..b3e853659 --- /dev/null +++ b/tests/mod_scorm/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_scorm\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_survey/course_module_viewed/existing_module/data.json b/tests/mod_survey/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..e47f83a8b --- /dev/null +++ b/tests/mod_survey/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "survey" + } + ], + "survey": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_survey/course_module_viewed/existing_module/event.json b/tests/mod_survey/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..d1787ea13 --- /dev/null +++ b/tests/mod_survey/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_survey\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_survey/course_module_viewed/existing_module/statements.json b/tests/mod_survey/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..dc1bec69f --- /dev/null +++ b/tests/mod_survey/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/survey\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/survey", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_survey\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\mod_survey\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_survey/course_module_viewed/existing_module/test.php b/tests/mod_survey/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..4efa0aa1e --- /dev/null +++ b/tests/mod_survey/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_survey\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_url/course_module_viewed/existing_module/data.json b/tests/mod_url/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..a811b12af --- /dev/null +++ b/tests/mod_url/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "url" + } + ], + "url": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_url/course_module_viewed/existing_module/event.json b/tests/mod_url/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..f4c392039 --- /dev/null +++ b/tests/mod_url/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_url\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_url/course_module_viewed/existing_module/statements.json b/tests/mod_url/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..0a7d3391f --- /dev/null +++ b/tests/mod_url/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/url\/view.php?id=1", + "definition": { + "type": "http:\/\/adlnet.gov\/expapi\/activities\/link", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_url\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\mod_url\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_url/course_module_viewed/existing_module/test.php b/tests/mod_url/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..7d575e89f --- /dev/null +++ b/tests/mod_url/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_url\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_wiki/course_module_viewed/existing_module/data.json b/tests/mod_wiki/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..b362adcab --- /dev/null +++ b/tests/mod_wiki/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "wiki" + } + ], + "wiki": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_wiki/course_module_viewed/existing_module/event.json b/tests/mod_wiki/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..27d54924b --- /dev/null +++ b/tests/mod_wiki/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_wiki\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_wiki/course_module_viewed/existing_module/statements.json b/tests/mod_wiki/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..94b622425 --- /dev/null +++ b/tests/mod_wiki/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/wiki\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_wiki\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\all\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_wiki/course_module_viewed/existing_module/test.php b/tests/mod_wiki/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..e483f13c5 --- /dev/null +++ b/tests/mod_wiki/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_wiki\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file diff --git a/tests/mod_workshop/course_module_viewed/existing_module/data.json b/tests/mod_workshop/course_module_viewed/existing_module/data.json new file mode 100644 index 000000000..c6ddb60e0 --- /dev/null +++ b/tests/mod_workshop/course_module_viewed/existing_module/data.json @@ -0,0 +1,36 @@ +{ + "user": [ + { + "id": 1, + "firstname": "test_fullname", + "email": "test@test.com" + } + ], + "course": [ + { + "id": 1, + "fullname": "test_name", + "lang": "en" + } + ], + "course_modules": [ + { + "id": 1, + "course": 1, + "module": 1, + "instance": 1 + } + ], + "modules": [ + { + "id": 1, + "name": "workshop" + } + ], + "workshop": [ + { + "id": 1, + "name": "test_name" + } + ] +} \ No newline at end of file diff --git a/tests/mod_workshop/course_module_viewed/existing_module/event.json b/tests/mod_workshop/course_module_viewed/existing_module/event.json new file mode 100644 index 000000000..ff1533d97 --- /dev/null +++ b/tests/mod_workshop/course_module_viewed/existing_module/event.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "userid": 1, + "courseid": 1, + "timecreated": 1433946701, + "contextinstanceid": 1, + "eventname": "\\mod_workshop\\event\\course_module_viewed" +} \ No newline at end of file diff --git a/tests/mod_workshop/course_module_viewed/existing_module/statements.json b/tests/mod_workshop/course_module_viewed/existing_module/statements.json new file mode 100644 index 000000000..09846656a --- /dev/null +++ b/tests/mod_workshop/course_module_viewed/existing_module/statements.json @@ -0,0 +1,72 @@ +[ + { + "actor": { + "name": "test_fullname", + "account": { + "homePage": "http:\/\/www.example.org", + "name": "1" + } + }, + "verb": { + "id": "http:\/\/id.tincanapi.com\/verb\/viewed", + "display": { + "en": "viewed" + } + }, + "object": { + "id": "http:\/\/www.example.org\/mod\/workshop\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module", + "name": { + "en": "test_name" + } + } + }, + "timestamp": "2015-06-10T15:31:41+01:00", + "context": { + "platform": "Moodle", + "language": "en", + "extensions": { + "http:\/\/lrs.learninglocker.net\/define\/extensions\/info": { + "http:\/\/moodle.org": "1.0.0", + "https:\/\/github.com\/xAPI-vle\/moodle-logstore_xapi": "0.0.0-development", + "event_name": "\\mod_workshop\\event\\course_module_viewed", + "event_function": "\\src\\transformer\\events\\all\\course_module_viewed" + } + }, + "contextActivities": { + "grouping": [ + { + "id": "http:\/\/www.example.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms", + "name": { + "en": "test_name" + } + } + }, + { + "id": "http:\/\/www.example.org\/course\/view.php?id=1", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/course", + "name": { + "en": "test_name" + } + } + } + ], + "category": [ + { + "id": "http:\/\/moodle.org", + "definition": { + "type": "http:\/\/id.tincanapi.com\/activitytype\/source", + "name": { + "en": "Moodle" + } + } + } + ] + } + } + } +] \ No newline at end of file diff --git a/tests/mod_workshop/course_module_viewed/existing_module/test.php b/tests/mod_workshop/course_module_viewed/existing_module/test.php new file mode 100644 index 000000000..ad2373b7c --- /dev/null +++ b/tests/mod_workshop/course_module_viewed/existing_module/test.php @@ -0,0 +1,24 @@ +. + +namespace tests\mod_workshop\course_module_viewed\existing_module; +defined('MOODLE_INTERNAL') || die(); + +class test extends \tests\xapi_test_case { + protected function get_test_dir() { + return __DIR__; + } +} \ No newline at end of file