mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-48595 logstore_standard: Fixing unit tests comparing performance
Adding also an extra userid checking as databases may include userid = 0 records.
This commit is contained in:
parent
ce1be0e738
commit
5803e36cc5
@ -261,13 +261,16 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
// Look for non-linear memory usage for the iterator version.
|
||||
$mem = memory_get_usage();
|
||||
$events = $store->get_events_select('', array(), '', 0, 0);
|
||||
$delta1 = memory_get_usage() - $mem;
|
||||
$events = $store->get_events_select_iterator('', array(), '', 0, 0);
|
||||
$delta2 = memory_get_usage() - $mem;
|
||||
$this->assertInstanceOf('\Traversable', $events);
|
||||
$events->close();
|
||||
$arraymemusage = memory_get_usage() - $mem;
|
||||
|
||||
$this->assertLessThan($delta1 / 10, $delta2);
|
||||
$mem = memory_get_usage();
|
||||
$eventsit = $store->get_events_select_iterator('', array(), '', 0, 0);
|
||||
$eventsit->close();
|
||||
$itmemusage = memory_get_usage() - $mem;
|
||||
|
||||
$this->assertInstanceOf('\Traversable', $eventsit);
|
||||
|
||||
$this->assertLessThan($arraymemusage / 10, $itmemusage);
|
||||
|
||||
set_config('enabled_stores', '', 'tool_log');
|
||||
get_log_manager(true);
|
||||
|
@ -127,6 +127,10 @@ class report_log_table_log extends table_sql {
|
||||
protected function get_user_fullname($userid) {
|
||||
global $DB;
|
||||
|
||||
if (empty($userid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($this->userfullnames[$userid])) {
|
||||
return $this->userfullnames[$userid];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user