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.165
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.aptans /
competency /
tests /
[ HOME SHELL ]
Name
Size
Permission
Action
event
[ DIR ]
drwxr-xr-x
external
[ DIR ]
drwxr-xr-x
generator
[ DIR ]
drwxr-xr-x
privacy
[ DIR ]
drwxr-xr-x
task
[ DIR ]
drwxr-xr-x
api_test.php
227.75
KB
-rw-rw-r--
competency_rule_test.php
14.83
KB
-rw-r--r--
competency_test.php
3.06
KB
-rw-r--r--
course_competency_settings_tes...
5.37
KB
-rw-r--r--
course_competency_test.php
6.11
KB
-rw-r--r--
course_module_competency_test....
2.71
KB
-rw-r--r--
generator_test.php
13.04
KB
-rw-r--r--
hooks_test.php
14.2
KB
-rw-r--r--
lib_test.php
15.08
KB
-rw-r--r--
performance_helper_test.php
6.75
KB
-rw-r--r--
plan_test.php
24.8
KB
-rw-r--r--
template_test.php
3.51
KB
-rw-r--r--
user_evidence_competency_test....
4.26
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : performance_helper_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/>. namespace core_competency; use core_competency\external\performance_helper; /** * Performance helper testcase. * * @package core_competency * @copyright 2016 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class performance_helper_test extends \advanced_testcase { public function test_get_context_from_competency() { global $DB; $this->resetAfterTest(true); $dg = $this->getDataGenerator(); $lpg = $dg->get_plugin_generator('core_competency'); $cat1 = $dg->create_category(); $framework = $lpg->create_framework(); $competency = $lpg->create_competency(['competencyframeworkid' => $framework->get('id')]); $competency2 = $lpg->create_competency(['competencyframeworkid' => $framework->get('id')]); $context = $competency->get_context(); $helper = new performance_helper(); $initdbqueries = $DB->perf_get_queries(); // Confirm that subsequent calls return a cached object. // Note that here we check that the framework is not loaded more than once. // The context objects are already cached in the context layer. $firstruncontext = $helper->get_context_from_competency($competency); $dbqueries = $DB->perf_get_queries(); $this->assertSame($context, $firstruncontext); $this->assertNotEquals($initdbqueries, $dbqueries); $secondruncontext = $helper->get_context_from_competency($competency); $this->assertSame($context, $secondruncontext); $this->assertSame($firstruncontext, $secondruncontext); $this->assertEquals($DB->perf_get_queries(), $dbqueries); $thirdruncontext = $helper->get_context_from_competency($competency2); $this->assertSame($context, $thirdruncontext); $this->assertSame($secondruncontext, $thirdruncontext); $this->assertEquals($DB->perf_get_queries(), $dbqueries); } public function test_get_framework_from_competency() { global $DB; $this->resetAfterTest(true); $dg = $this->getDataGenerator(); $lpg = $dg->get_plugin_generator('core_competency'); $cat1 = $dg->create_category(); $framework1 = $lpg->create_framework(); $comp1a = $lpg->create_competency(['competencyframeworkid' => $framework1->get('id')]); $comp1b = $lpg->create_competency(['competencyframeworkid' => $framework1->get('id')]); $framework2 = $lpg->create_framework(); $comp2a = $lpg->create_competency(['competencyframeworkid' => $framework2->get('id')]); $helper = new performance_helper(); $initdbqueries = $DB->perf_get_queries(); // Confirm that we get the right framework, and that subsequent calls // do not trigger DB queries, even for other competencies. $firstrunframework = $helper->get_framework_from_competency($comp1a); $firstrundbqueries = $DB->perf_get_queries(); $this->assertNotEquals($initdbqueries, $firstrundbqueries); $this->assertEquals($framework1, $firstrunframework); $this->assertNotSame($framework1, $firstrunframework); $secondrunframework = $helper->get_framework_from_competency($comp1b); $this->assertEquals($firstrundbqueries, $DB->perf_get_queries()); $this->assertEquals($framework1, $secondrunframework); $this->assertSame($firstrunframework, $secondrunframework); $thirdrunframework = $helper->get_framework_from_competency($comp1a); $this->assertEquals($firstrundbqueries, $DB->perf_get_queries()); $this->assertEquals($framework1, $thirdrunframework); $this->assertSame($firstrunframework, $thirdrunframework); // Fetch another framework. $fourthrunframework = $helper->get_framework_from_competency($comp2a); $fourthrundbqueries = $DB->perf_get_queries(); $this->assertNotEquals($firstrundbqueries, $fourthrundbqueries); $this->assertEquals($framework2, $fourthrunframework); $this->assertNotSame($framework2, $fourthrunframework); $fifthrunframework = $helper->get_framework_from_competency($comp2a); $this->assertEquals($fourthrundbqueries, $DB->perf_get_queries()); $this->assertEquals($framework2, $fifthrunframework); $this->assertSame($fourthrunframework, $fifthrunframework); } public function test_get_scale_from_competency() { global $DB; $this->resetAfterTest(true); $dg = $this->getDataGenerator(); $lpg = $dg->get_plugin_generator('core_competency'); $scale1 = $dg->create_scale(); $scale2 = $dg->create_scale(); $cat1 = $dg->create_category(); $framework1 = $lpg->create_framework(['scaleid' => $scale1->id]); $comp1 = $lpg->create_competency(['competencyframeworkid' => $framework1->get('id')]); $comp2 = $lpg->create_competency(['competencyframeworkid' => $framework1->get('id'), 'scaleid' => $scale2->id]); $comp3 = $lpg->create_competency(['competencyframeworkid' => $framework1->get('id')]); $helper = new performance_helper(); $initdbqueries = $DB->perf_get_queries(); // Get the first scale. $firstrunscale = $helper->get_scale_from_competency($comp1); $firstrundbqueries = $DB->perf_get_queries(); $this->assertNotEquals($initdbqueries, $firstrundbqueries); $this->assertEquals($scale1, $firstrunscale->get_record_data()); $secondrunscale = $helper->get_scale_from_competency($comp3); $this->assertEquals($firstrundbqueries, $DB->perf_get_queries()); $this->assertSame($firstrunscale, $secondrunscale); // Another scale, and its subsequent calls. $thirdrunscale = $helper->get_scale_from_competency($comp2); $thirddbqueries = $DB->perf_get_queries(); $this->assertNotEquals($firstrundbqueries, $thirddbqueries); $this->assertEquals($scale2, $thirdrunscale->get_record_data()); $this->assertSame($thirdrunscale, $helper->get_scale_from_competency($comp2)); $this->assertEquals($thirddbqueries, $DB->perf_get_queries()); } }
Close