Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 311 and 401] [Versions 401 and 402] [Versions 401 and 403]

Quiz events tests.

Copyright: 2013 Adrian Greeve
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1349 lines (53 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: events_test  - X-Ref

Unit tests for quiz events.

prepare_quiz()   X-Ref
Setup a quiz.

return: quiz the generated quiz.

prepare_quiz_attempt($quizobj, $ispreview = false)   X-Ref
Setup a quiz attempt at the quiz created by {@link prepare_quiz()}.

param: quiz $quizobj the generated quiz.
param: bool $ispreview Make the attempt a preview attempt when true.
return: array with three elements, array($quizobj, $quba, $attempt)

prepare_quiz_data($ispreview = false)   X-Ref
Setup some convenience test data with a single attempt.

param: bool $ispreview Make the attempt a preview attempt when true.
return: array with three elements, array($quizobj, $quba, $attempt)

test_attempt_submitted()   X-Ref
No description

test_attempt_becameoverdue()   X-Ref
No description

test_attempt_abandoned()   X-Ref
No description

test_attempt_started()   X-Ref
No description

test_attempt_question_restarted()   X-Ref
Test the attempt question restarted event.

There is no external API for replacing a question, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_attempt_updated()   X-Ref
Test the attempt updated event.

There is no external API for updating an attempt, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_attempt_autosaved()   X-Ref
Test the attempt auto-saved event.

There is no external API for auto-saving an attempt, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_edit_page_viewed()   X-Ref
Test the edit page viewed event.

There is no external API for updating a quiz, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_attempt_deleted()   X-Ref
Test the attempt deleted event.


test_preview_attempt_deleted()   X-Ref
Test that preview attempt deletions are not logged.


test_report_viewed()   X-Ref
Test the report viewed event.

There is no external API for viewing reports, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_attempt_reviewed()   X-Ref
Test the attempt reviewed event.

There is no external API for reviewing attempts, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_attempt_summary_viewed()   X-Ref
Test the attempt summary viewed event.

There is no external API for viewing the attempt summary, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_user_override_created()   X-Ref
Test the user override created event.

There is no external API for creating a user override, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_group_override_created()   X-Ref
Test the group override created event.

There is no external API for creating a group override, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_user_override_updated()   X-Ref
Test the user override updated event.

There is no external API for updating a user override, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_group_override_updated()   X-Ref
Test the group override updated event.

There is no external API for updating a group override, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_user_override_deleted()   X-Ref
Test the user override deleted event.


test_group_override_deleted()   X-Ref
Test the group override deleted event.


test_attempt_viewed()   X-Ref
Test the attempt viewed event.

There is no external API for continuing an attempt, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_attempt_preview_started()   X-Ref
Test the attempt previewed event.


test_question_manually_graded()   X-Ref
Test the question manually graded event.

There is no external API for manually grading a question, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_attempt_regraded()   X-Ref
Test the attempt regraded event.

There is no external API for regrading attempts, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_attempt_manual_grading_completed()   X-Ref
Test the attempt notify manual graded event.
There is no external API for notification email when manual grading of user's attempt is completed,
so the unit test will simply create and trigger the event and ensure the event data is returned as expected.


test_page_break_created()   X-Ref
Test the page break created event.

There is no external API for creating page break, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_page_deleted_created()   X-Ref
Test the page break deleted event.

There is no external API for deleting page break, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_quiz_grade_updated()   X-Ref
Test the quiz grade updated event.

There is no external API for updating quiz grade, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_quiz_repaginated()   X-Ref
Test the quiz re-paginated event.

There is no external API for re-paginating quiz, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_section_break_created()   X-Ref
Test the section break created event.

There is no external API for creating section break, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_section_break_deleted()   X-Ref
Test the section break deleted event.

There is no external API for deleting section break, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_section_shuffle_updated()   X-Ref
Test the section shuffle updated event.

There is no external API for updating section shuffle, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_section_title_updated()   X-Ref
Test the section title updated event.

There is no external API for updating section title, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_slot_created()   X-Ref
Test the slot created event.

There is no external API for creating slot, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_slot_deleted()   X-Ref
Test the slot deleted event.

There is no external API for deleting slot, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_slot_mark_updated()   X-Ref
Test the slot mark updated event.

There is no external API for updating slot mark, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_slot_moved()   X-Ref
Test the slot moved event.

There is no external API for moving slot, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.

test_slot_requireprevious_updated()   X-Ref
Test the slot require previous updated event.

There is no external API for updating slot require previous option, so the unit test will simply
create and trigger the event and ensure the event data is returned as expected.