Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/monara/public_html/test.athavaneng.com/themes.php on line 99
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
.
/**
* Base class for unit tests for mod_assign.
*
* @package mod_assign
* @category phpunit
* @copyright 2018 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/mod/assign/locallib.php');
require_once(__DIR__ . '/fixtures/testable_assign.php');
/**
* Generator helper trait.
*
* @copyright 2018 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
trait mod_assign_test_generator {
/**
* 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.
*/
protected function create_instance($course, $params = [], $options = []) {
$params['course'] = $course->id;
$generator = $this->getDataGenerator()->get_plugin_generator('mod_assign');
$instance = $generator->create_instance($params, $options);
$cm = get_coursemodule_from_instance('assign', $instance->id);
$context = context_module::instance($cm->id);
return new mod_assign_testable_assign($context, $cm, $course);
}
/**
* 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.
*/
protected function add_submission($student, $assign, $onlinetext = null, $changeuser = true) {
// Add a submission.
if ($changeuser) {
$this->setUser($student);
}
if ($onlinetext === null) {
$onlinetext = 'Submission text';
}
$data = (object) [
'userid' => $student->id,
'onlinetext_editor' => [
'itemid' => file_get_unused_draft_itemid(),
'text' => $onlinetext,
'format' => FORMAT_HTML,
]
];
$assign->save_submission($data, $notices);
}
/**
* 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.
*/
public function submit_for_grading($student, $assign, $data = [], $changeuser = true) {
if ($changeuser) {
$this->setUser($student);
}
$data = (object) array_merge($data, [
'userid' => $student->id,
]);
$sink = $this->redirectMessages();
$assign->submit_for_grading($data, []);
$sink->close();
return $data;
}
/**
* 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.
*/
protected function mark_submission($teacher, $assign, $student, $grade = 50.0, $data = [], $attempt = 0) {
global $DB;
// Mark the submission.
$this->setUser($teacher);
$data = (object) array_merge($data, [
'grade' => $grade,
]);
// Bump all timecreated and timemodified for this user back.
$DB->execute('UPDATE {assign_submission} SET timecreated = timecreated - 1, timemodified = timemodified - 1 WHERE userid = :userid',
['userid' => $student->id]);
$assign->testable_apply_grade_to_user($data, $student->id, $attempt);
}
}