Search moodle.org's
Developer Documentation

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
  • Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 37 and 311] [Versions 38 and 311] [Versions 39 and 311]

    Unit tests for (some of) mod/assign/locallib.php.

    Copyright: 1999 onwards Martin Dougiamas {@link http://moodle.com}
    License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
    File Size: 4375 lines (193 kb)
    Included or required:0 times
    Referenced: 0 times
    Includes or requires: 0 files

    Defines 1 class

    locallib_test:: (111 methods):
      test_return_links()
      test_get_feedback_plugins()
      test_get_submission_plugins()
      test_is_blind_marking()
      get_assign_perpage_provider()
      test_get_assign_perpage()
      test_gradingtable_filter_by_requiresgrading_no_grade()
      test_gradingtable_extension_due_date()
      test_gradingtable_extension_date_calculation_for_lateness()
      test_gradingtable_status_rendering()
      test_gradingtable_group_submissions_rendering()
      test_show_intro()
      test_has_submissions_or_grades()
      test_delete_grades()
      test_delete_instance()
      test_reset_userdata()
      test_plugin_settings()
      test_update_calendar()
      test_update_instance()
      test_cannot_submit_empty()
      test_cannot_submit_empty_no_submission()
      test_can_submit_with_submission()
      test_new_submission_empty()
      test_new_submission_empty_testcases()
      test_list_participants()
      test_list_participants_activeenrol()
      test_list_participants_with_group_restriction()
      test_get_participant_user_not_exist()
      test_get_participant_not_enrolled()
      test_get_participant_no_submission()
      test_get_participant_granted_extension()
      test_get_participant_with_ungraded_submission()
      test_get_participant_with_no_submission_no_capability()
      test_get_participant_with_submission_no_capability()
      test_get_participant_with_graded_submission()
      test_count_teams_no_active_non_group_allowed()
      test_count_teams_non_group_allowed()
      test_count_teams_no_active_group()
      test_count_teams_groups_only()
      test_submit_to_default_group()
      test_count_submissions_no_draft()
      test_count_submissions_draft()
      test_count_submissions_submitted()
      test_count_submissions_graded()
      test_count_submissions_graded_group()
      x_test_count_submissions_for_team()
      test_get_grading_userid_list_only_active()
      test_get_grading_userid_list_all()
      test_cron()
      test_cron_without_notifications()
      test_cron_regraded()
      test_markingworkflow_cron()
      test_cron_message_includes_courseid()
      test_is_graded()
      test_can_grade()
      test_can_view_submission()
      test_update_submission()
      test_update_submission_team()
      test_update_submission_suspended()
      test_update_submission_blind()
      test_group_submissions_submit_for_marking_requireallteammemberssubmit()
      test_group_submissions_submit_for_marking()
      test_submissions_open()
      test_get_graders()
      test_get_graders_separate_groups()
      test_get_notified_users()
      test_get_notified_users_in_grouping()
      test_group_members_only()
      test_get_uniqueid_for_user()
      test_show_student_summary()
      test_show_student_summary_with_feedback()
      test_attempt_reopen_method_manual()
      test_attempt_reopen_method_untilpass()
      test_attempt_reopen_method_untilpass_passing()
      test_attempt_reopen_method_untilpass_no_passing_requirement()
      test_markingworkflow()
      test_markerallocation()
      test_teacher_submit_for_student()
      test_teacher_submit_for_student_with_capability()
      test_disable_submit_after_cutoff_date()
      test_submission_comment_plugin_settings()
      submission_plugin_settings_provider()
      test_feedback_comment_commentinline()
      test_feedback_plugin_settings()
      feedback_plugin_settings_provider()
      test_is_gradebook_feedback_enabled()
      test_is_gradebook_feedback_disabled()
      test_can_edit_submission()
      test_can_edit_submission_with_editothersubmission()
      test_can_edit_submission_separategroups()
      test_can_edit_submission_separategroups_with_editothersubmission()
      test_can_view_blind_details()
      test_get_shared_group_members()
      test_get_shared_group_members_override()
      test_get_plugins_file_areas()
      test_override_exists()
      test_process_save_quick_grades()
      test_update_activity_completion_records_solitary_submission()
      test_update_activity_completion_records_team_submission()
      test_update_activity_completion_records_team_submission_new()
      fix_null_grades_provider()
      test_fix_null_grades()
      test_grade_submission_override()
      test_get_filters()
      test_assign_get_instance()
      assign_get_instance_provider()
      test_assign_get_default_instance()
      assign_get_default_instance_provider()
      view_group_override_provider()
      test_view_group_override()
      test_cron_use_task_api_to_get_lastruntime()


    Class: locallib_test  - X-Ref

    Unit tests for (some of) mod/assign/locallib.php.

    test_return_links()   X-Ref
    No description

    test_get_feedback_plugins()   X-Ref
    No description

    test_get_submission_plugins()   X-Ref
    No description

    test_is_blind_marking()   X-Ref
    No description

    get_assign_perpage_provider()   X-Ref
    Data provider for test_get_assign_perpage

    return: array Provider data

    test_get_assign_perpage($maxperpage, $userprefs)   X-Ref
    Test maxperpage

    param: integer $maxperpage site config value
    param: array $userprefs Array of user preferences and expected page sizes

    test_gradingtable_filter_by_requiresgrading_no_grade()   X-Ref
    Test filter by requires grading.

    This is specifically checking an assignment with no grade to make sure we do not
    get an exception thrown when rendering the grading table for this type of assignment.

    test_gradingtable_extension_due_date()   X-Ref
    Test submissions with extension date.


    test_gradingtable_extension_date_calculation_for_lateness()   X-Ref
    Test that late submissions with extension date calculate correctly.


    test_gradingtable_status_rendering()   X-Ref
    No description

    test_gradingtable_group_submissions_rendering()   X-Ref
    Check that group submission information is rendered correctly in the
    grading table.


    test_show_intro()   X-Ref
    No description

    test_has_submissions_or_grades()   X-Ref
    No description

    test_delete_grades()   X-Ref
    No description

    test_delete_instance()   X-Ref
    No description

    test_reset_userdata()   X-Ref
    No description

    test_plugin_settings()   X-Ref
    No description

    test_update_calendar()   X-Ref
    No description

    test_update_instance()   X-Ref
    No description

    test_cannot_submit_empty()   X-Ref
    No description

    test_cannot_submit_empty_no_submission()   X-Ref
    No description

    test_can_submit_with_submission()   X-Ref
    No description

    test_new_submission_empty($data, $expected)   X-Ref
    Test new_submission_empty

    We only test combinations of plugins here. Individual plugins are tested
    in their respective test files.

    param: string $data The file submission data
    param: bool $expected The expected return value

    test_new_submission_empty_testcases()   X-Ref
    Dataprovider for the test_new_submission_empty testcase

    return: array of testcases

    test_list_participants()   X-Ref
    No description

    test_list_participants_activeenrol()   X-Ref
    No description

    test_list_participants_with_group_restriction()   X-Ref
    No description

    test_get_participant_user_not_exist()   X-Ref
    No description

    test_get_participant_not_enrolled()   X-Ref
    No description

    test_get_participant_no_submission()   X-Ref
    No description

    test_get_participant_granted_extension()   X-Ref
    No description

    test_get_participant_with_ungraded_submission()   X-Ref
    No description

    test_get_participant_with_no_submission_no_capability()   X-Ref
    Tests that if a student with no submission who can no longer submit is not a participant.


    test_get_participant_with_submission_no_capability()   X-Ref
    Tests that if a student that has submitted but can no longer submit is a participant.


    test_get_participant_with_graded_submission()   X-Ref
    No description

    test_count_teams_no_active_non_group_allowed()   X-Ref
    No active group and non-group submissions disallowed => 2 groups.


    test_count_teams_non_group_allowed()   X-Ref
    No active group and non group submissions allowed => 2 groups + the default one.


    test_count_teams_no_active_group()   X-Ref
    Active group => just selected one.


    test_count_teams_groups_only()   X-Ref
    Active group => just selected one.


    test_submit_to_default_group()   X-Ref
    No description

    test_count_submissions_no_draft()   X-Ref
    No description

    test_count_submissions_draft()   X-Ref
    No description

    test_count_submissions_submitted()   X-Ref
    No description

    test_count_submissions_graded()   X-Ref
    No description

    test_count_submissions_graded_group()   X-Ref
    No description

    x_test_count_submissions_for_team()   X-Ref
    No description

    test_get_grading_userid_list_only_active()   X-Ref
    No description

    test_get_grading_userid_list_all()   X-Ref
    No description

    test_cron()   X-Ref
    No description

    test_cron_without_notifications()   X-Ref
    No description

    test_cron_regraded()   X-Ref
    No description

    test_markingworkflow_cron()   X-Ref
    Test delivery of grade notifications as controlled by marking workflow.


    test_cron_message_includes_courseid()   X-Ref
    No description

    test_is_graded()   X-Ref
    No description

    test_can_grade()   X-Ref
    No description

    test_can_view_submission()   X-Ref
    No description

    test_update_submission()   X-Ref
    No description

    test_update_submission_team()   X-Ref
    No description

    test_update_submission_suspended()   X-Ref
    No description

    test_update_submission_blind()   X-Ref
    No description

    test_group_submissions_submit_for_marking_requireallteammemberssubmit()   X-Ref
    No description

    test_group_submissions_submit_for_marking()   X-Ref
    No description

    test_submissions_open()   X-Ref
    No description

    test_get_graders()   X-Ref
    No description

    test_get_graders_separate_groups()   X-Ref
    No description

    test_get_notified_users()   X-Ref
    No description

    test_get_notified_users_in_grouping()   X-Ref
    No description

    test_group_members_only()   X-Ref
    No description

    test_get_uniqueid_for_user()   X-Ref
    No description

    test_show_student_summary()   X-Ref
    No description

    test_show_student_summary_with_feedback()   X-Ref
    No description

    test_attempt_reopen_method_manual()   X-Ref
    Test reopen behavior when in "Manual" mode.


    test_attempt_reopen_method_untilpass()   X-Ref
    Test reopen behavior when in "Reopen until pass" mode.


    test_attempt_reopen_method_untilpass_passing()   X-Ref
    No description

    test_attempt_reopen_method_untilpass_no_passing_requirement()   X-Ref
    No description

    test_markingworkflow()   X-Ref
    Test student visibility for each stage of the marking workflow.


    test_markerallocation()   X-Ref
    Test that a student allocated a specific marker is only shown to that marker.


    test_teacher_submit_for_student()   X-Ref
    Ensure that a teacher cannot submit for students as standard.


    test_teacher_submit_for_student_with_capability()   X-Ref
    Ensure that a teacher with the editothersubmission capability can submit on behalf of a student.


    test_disable_submit_after_cutoff_date()   X-Ref
    Ensure that disabling submit after the cutoff date works as expected.


    test_submission_comment_plugin_settings($globalenabled, $instanceconfig, $isenabled)   X-Ref
    Testing for submission comment plugin settings.

    param: bool    $globalenabled
    param: array   $instanceconfig
    param: bool    $isenabled

    submission_plugin_settings_provider()   X-Ref
    No description

    test_feedback_comment_commentinline()   X-Ref
    Testing for comment inline settings


    test_feedback_plugin_settings($instanceconfig, $isenabled)   X-Ref
    Testing for feedback comment plugin settings.

    param: array   $instanceconfig
    param: bool    $isenabled

    feedback_plugin_settings_provider()   X-Ref
    No description

    test_is_gradebook_feedback_enabled()   X-Ref
    Testing if gradebook feedback plugin is enabled.


    test_is_gradebook_feedback_disabled()   X-Ref
    Testing if gradebook feedback plugin is disabled.


    test_can_edit_submission()   X-Ref
    Testing can_edit_submission.


    test_can_edit_submission_with_editothersubmission()   X-Ref
    Testing can_edit_submission with the editothersubmission capability.


    test_can_edit_submission_separategroups()   X-Ref
    Testing can_edit_submission


    test_can_edit_submission_separategroups_with_editothersubmission()   X-Ref
    Testing can_edit_submission


    test_can_view_blind_details()   X-Ref
    Test if the view blind details capability works


    test_get_shared_group_members()   X-Ref
    Testing get_shared_group_members


    test_get_shared_group_members_override()   X-Ref
    Testing get_shared_group_members


    test_get_plugins_file_areas()   X-Ref
    Test get plugins file areas


    test_override_exists()   X-Ref
    Test override exists

    This function needs to obey the group override logic as per the assign grading table and
    the overview block.

    test_process_save_quick_grades()   X-Ref
    Test the quicksave grades processor


    test_update_activity_completion_records_solitary_submission()   X-Ref
    Test updating activity completion when submitting an assessment.


    test_update_activity_completion_records_team_submission()   X-Ref
    Test updating activity completion when submitting an assessment.


    test_update_activity_completion_records_team_submission_new()   X-Ref
    Test updating activity completion when submitting an assessment for MDL-67126.


    fix_null_grades_provider()   X-Ref
    Data provider for test_fix_null_grades

    return: array[] Test data for test_fix_null_grades. Each element should contain grade, expectedcount and gradebookvalue

    test_fix_null_grades($grade, $gradebookvalue)   X-Ref
    Test fix_null_grades

    param: number $grade The grade we should set in the assign grading table.
    param: number $expectedcount The finalgrade we expect in the gradebook after fixing the grades.

    test_grade_submission_override()   X-Ref
    Test grade override displays 'Graded' for students


    test_get_filters()   X-Ref
    Test the result of get_filters is consistent.


    test_assign_get_instance(array $courseconfig, array $assignconfig, array $enrolconfig,array $expectedproperties)   X-Ref
    Test assign->get_instance() for a number of cases, as defined in the data provider.

    param: array $courseconfig the config to use when creating the course.
    param: array $assignconfig the config to use when creating the assignment.
    param: array $enrolconfig the config to use when enrolling the user (this will be the active user).
    param: array $expectedproperties an map containing the expected names and values for the assign instance data.

    assign_get_instance_provider()   X-Ref
    The test_assign_get_instance data provider.


    test_assign_get_default_instance(array $courseconfig, array $assignconfig, array $enrolconfig,array $expectedproperties)   X-Ref
    Test assign->get_default_instance() for a number of cases, as defined in the date provider.

    param: array $courseconfig the config to use when creating the course.
    param: array $assignconfig the config to use when creating the assignment.
    param: array $enrolconfig the config to use when enrolling the user (this will be the active user).
    param: array $expectedproperties an map containing the expected names and values for the assign instance data.

    assign_get_default_instance_provider()   X-Ref
    The test_assign_get_default_instance data provider.


    view_group_override_provider()   X-Ref
    Data provider for test_view_group_override

    return: array Provider data

    test_view_group_override(string $role, array $groups, string $activegroup, string $expecteddate)   X-Ref
    Test showing group override duedate for admin

    param: string $role the role of the user (teacher, student, etc)
    param: string[] $groups the groups the user are member of
    param: string $activegroup The selected group
    param: string $expecteddate The expected due date

    test_cron_use_task_api_to_get_lastruntime()   X-Ref
    Test that cron task uses task API to get its last run time.