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.

Base class for unit tests for mod_assign.

Copyright: 2018 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 136 lines (5 kb)
Included or required:0 times
Referenced: 6 times
Includes or requires: 1 file
 mod/assign/tests/fixtures/testable_assign.php

Defines 4 functions


Functions that are not part of a class:

create_instance($course, $params = [], $options = [])   X-Ref
Convenience function to create a testable instance of an assignment.

param: array $params Array of parameters to pass to the generator
return: testable_assign Testable wrapper around the assign class.

add_submission($student, $assign, $onlinetext = null, $changeuser = true)   X-Ref
Add a user submission to the assignment.

param: \stdClass   $student The user to submit for
param: \assign     $assign The assignment to submit to
param: string      $onlinetext The text tobe submitted
param: bool        $changeuser Whether to switch user to the user being submitted as.

submit_for_grading($student, $assign, $data = [], $changeuser = true)   X-Ref
Submit the assignemnt for grading.

param: \stdClass   $student The user to submit for
param: \assign     $assign The assignment to submit to
param: array       $data Additional data to set
param: bool        $changeuser Whether to switch user to the user being submitted as.

mark_submission($teacher, $assign, $student, $grade = 50.0, $data = [], $attempt = 0)   X-Ref
Mark the submission.

param: \stdClass   $teacher The user to mark as
param: \assign     $assign The assignment to mark
param: \stdClass   $student The user to grade
param: array       $data Additional data to set
param: bool        $changeuser Whether to switch user to the user being submitted as.