Linux vmi284606.contaboserver.net 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Apache/2.4.57 (Ubuntu)
: 167.86.127.34 | : 216.73.217.51
Cant Read [ /etc/named.conf ]
7.2.24-0ubuntu0.18.04.17
root
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
var /
www /
html /
moodle.backup.39 /
mod /
assign /
tests /
[ HOME SHELL ]
Name
Size
Permission
Action
behat
[ DIR ]
drwxrwxr-x
fixtures
[ DIR ]
drwxrwxr-x
generator
[ DIR ]
drwxrwxr-x
base_test.php
9.41
KB
-rw-rw-r--
events_test.php
51.15
KB
-rw-rw-r--
externallib_test.php
115.57
KB
-rw-rw-r--
generator.php
4.82
KB
-rw-rw-r--
lib_test.php
57.92
KB
-rw-rw-r--
locallib_participants_test.php
5.56
KB
-rw-rw-r--
locallib_test.php
169.37
KB
-rw-rw-r--
markerallocation_test.php
5.72
KB
-rw-rw-r--
portfolio_caller_test.php
10.08
KB
-rw-rw-r--
privacy_feedback_legacy_polyfi...
9.5
KB
-rw-rw-r--
privacy_submission_legacy_poly...
9.73
KB
-rw-rw-r--
privacy_test.php
24.8
KB
-rw-rw-r--
restore_date_test.php
3.66
KB
-rw-rw-r--
search_test.php
4.22
KB
-rw-rw-r--
upgradelib_test.php
4.91
KB
-rw-rw-r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : locallib_participants_test.php
<?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Unit tests for (some of) mod/assign/locallib.php. * * @package mod_assign * @category phpunit * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); global $CFG; require_once(__DIR__ . '/../locallib.php'); class mod_assign_locallib_participants extends advanced_testcase { public function test_list_participants_blind_marking() { global $DB; $this->resetAfterTest(true); $course = $this->getDataGenerator()->create_course(); $roles = $DB->get_records('role', null, '', 'shortname, id'); $teacher = $this->getDataGenerator()->create_user(); $this->getDataGenerator()->enrol_user($teacher->id, $course->id, $roles['teacher']->id); $this->setUser($teacher); // Enrol two students. $students = []; for ($i = 0; $i < 2; $i++) { $student = $this->getDataGenerator()->create_user(); $this->getDataGenerator()->enrol_user($student->id, $course->id, $roles['student']->id); $students[$student->id] = $student; } $generator = $this->getDataGenerator()->get_plugin_generator('mod_assign'); $instance = $generator->create_instance(['course' => $course->id, 'blindmarking' => 1]); $cm = get_coursemodule_from_instance('assign', $instance->id); $context = context_module::instance($cm->id); $assign = new assign($context, $cm, $course); // Allocate IDs now. // We're testing whether the IDs are correct after allocation. assign::allocate_unique_ids($assign->get_instance()->id); $participants = $assign->list_participants(null, false); // There should be exactly two participants and they should be the students. $this->assertCount(2, $participants); foreach ($participants as $participant) { $this->assertArrayHasKey($participant->id, $students); } $keys = array_keys($participants); // Create a grading table, and query the DB This should have the same order. $table = new assign_grading_table($assign, 10, '', 0, false); $table->setup(); $table->query_db(10); $this->assertEquals($keys, array_keys($table->rawdata)); // Submit a file for the second student. $data = new stdClass(); $data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(), 'text'=>'Submission text', 'format'=>FORMAT_MOODLE); static::helper_add_submission($assign, $participants[$keys[1]], $data, 'onlinetext'); // Assign has a private cache. The easiest way to clear this is to create a new instance. $assign = new assign($context, $cm, $course); $newparticipants = $assign->list_participants(null, false); // There should be exactly two participants and they should be the students. $this->assertCount(2, $newparticipants); foreach ($newparticipants as $participant) { $this->assertArrayHasKey($participant->id, $students); } $newkeys = array_keys($newparticipants); // The user who submitted first should now be listed first. $this->assertEquals($participants[$keys[1]]->id, $newparticipants[$newkeys[0]]->id); $this->assertEquals($participants[$keys[0]]->id, $newparticipants[$newkeys[1]]->id); // Submit for the other student. static::helper_add_submission($assign, $participants[$keys[0]], $data, 'onlinetext'); $assign = new assign($context, $cm, $course); $newparticipants = $assign->list_participants(null, false); // The users should still be listed in order of the first submission $this->assertEquals($participants[$keys[1]]->id, $newparticipants[$newkeys[0]]->id); $this->assertEquals($participants[$keys[0]]->id, $newparticipants[$newkeys[1]]->id); // The updated grading table should have the same order as the updated participant list. $table->query_db(10); $this->assertEquals($newkeys, array_keys($table->rawdata)); } public function helper_add_submission($assign, $user, $data, $type) { global $USER; $previoususer = $USER; $this->setUser($user); $submission = $assign->get_user_submission($user->id, true); $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED; $rc = new ReflectionClass('assign'); $rcm = $rc->getMethod('update_submission'); $rcm->setAccessible(true); $rcm->invokeArgs($assign, [$submission, $user->id, true, false]); $plugin = $assign->get_submission_plugin_by_type($type); $plugin->save($submission, $data); $this->setUser($previoususer); } }
Close