Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge branch 'MDL-59642-32' of git://github.com/andrewnicols/moodle i…
- Loading branch information
Showing
with
17 additions
and
3 deletions.
-
+17
−3
lib/tests/statslib_test.php
|
@@ -337,15 +337,29 @@ public function test_statslib_get_start_from() { |
|
|
|
|
|
$this->assertEquals($firstoldtime, stats_get_start_from('daily')); |
|
|
|
|
|
$time = time() - 5; |
|
|
\core_tests\event\create_executed::create(array('context' => context_system::instance()))->trigger(); |
|
|
$DB->set_field('logstore_standard_log', 'timecreated', $time++, [ |
|
|
'eventname' => '\\core_tests\\event\\create_executed', |
|
|
]); |
|
|
|
|
|
\core_tests\event\read_executed::create(array('context' => context_system::instance()))->trigger(); |
|
|
$DB->set_field('logstore_standard_log', 'timecreated', $time++, [ |
|
|
'eventname' => '\\core_tests\\event\\read_executed', |
|
|
]); |
|
|
|
|
|
\core_tests\event\update_executed::create(array('context' => context_system::instance()))->trigger(); |
|
|
$DB->set_field('logstore_standard_log', 'timecreated', $time++, [ |
|
|
'eventname' => '\\core_tests\\event\\update_executed', |
|
|
]); |
|
|
|
|
|
\core_tests\event\delete_executed::create(array('context' => context_system::instance()))->trigger(); |
|
|
$DB->set_field('logstore_standard_log', 'timecreated', $time++, [ |
|
|
'eventname' => '\\core_tests\\event\\delete_executed', |
|
|
]); |
|
|
|
|
|
// Fake the origin of events. |
|
|
$DB->set_field('logstore_standard_log', 'origin', 'web', array()); |
|
|
|
|
|
$logs = $DB->get_records('logstore_standard_log'); |
|
|
$logs = $DB->get_records('logstore_standard_log', null, 'timecreated ASC'); |
|
|
$this->assertCount(4, $logs); |
|
|
|
|
|
$firstnew = reset($logs); |
|
|