diff --git a/classes/check/tasklatencycheck.php b/classes/check/tasklatencycheck.php index 77d2966..13aea5d 100644 --- a/classes/check/tasklatencycheck.php +++ b/classes/check/tasklatencycheck.php @@ -132,10 +132,10 @@ public function get_result(): result { $table = new \xmldb_table('task_log'); if ($dbman->table_exists($table)) { // We can use task logs! - $sql = "SELECT (timeend - timestart) AS duration + $sql = "SELECT (endtime - starttime) AS duration FROM {task_log} WHERE classname = ? - ORDER BY timeend DESC + ORDER BY endtime DESC LIMIT 1"; $record = $DB->get_record_sql($sql, [$taskclass]); diff --git a/tests/check/dirsizes_totara_test.php b/tests/check/dirsizes_totara_test.php index fdc29ce..063d510 100644 --- a/tests/check/dirsizes_totara_test.php +++ b/tests/check/dirsizes_totara_test.php @@ -14,8 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace tool_heartbeat\check; - use tool_heartbeat\check\dirsizes; /** @@ -28,7 +26,7 @@ * * @coversDefaultClass \tool_heartbeat\check\dirsizes */ -final class dirsizes_totara_test extends \externallib_advanced_testcase { +class dirsizes_totara_test extends \core_phpunit\testcase { protected function setUp(): void { parent::setUp(); $this->resetAfterTest(true); diff --git a/tests/check/tasklatencycheck_test.php b/tests/check/tasklatencycheck_test.php index 4910624..1908b3c 100644 --- a/tests/check/tasklatencycheck_test.php +++ b/tests/check/tasklatencycheck_test.php @@ -14,8 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace tool_heartbeat; - use core\check\result; /** @@ -26,7 +24,7 @@ * @copyright 2022, Catalyst IT * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class tasklatencycheck_test extends \externallib_advanced_testcase { +class tasklatencycheck_test extends \core_phpunit\testcase { /** * Test check for tasks start time delay. * @@ -171,8 +169,8 @@ public function test_task_run_duration() { // Test a good duration. // We need to set different field based on whether lockstats or logs for all these tests. if ($logs) { - $logrecord['timestart'] = time() - 15 * MINSECS; - $logrecord['timeend'] = time() - 12 * MINSECS; + $logrecord['starttime'] = time() - 15 * MINSECS; + $logrecord['endtime'] = time() - 12 * MINSECS; $DB->insert_record('task_log', $logrecord); } else { @@ -186,8 +184,8 @@ public function test_task_run_duration() { // Now test a negative duration. Can never happen, but the check shouldn't barf. if ($logs) { - $logrecord['timestart'] = time() - 12 * MINSECS; - $logrecord['timeend'] = time() - 15 * MINSECS; + $logrecord['starttime'] = time() - 12 * MINSECS; + $logrecord['endtime'] = time() - 15 * MINSECS; $DB->delete_records('task_log'); $DB->insert_record('task_log', $logrecord); @@ -203,8 +201,8 @@ public function test_task_run_duration() { // Now test a duration longer than the configured duration. if ($logs) { - $logrecord['timestart'] = time() - 15 * MINSECS; - $logrecord['timeend'] = time() - 5 * MINSECS; + $logrecord['starttime'] = time() - 15 * MINSECS; + $logrecord['endtime'] = time() - 5 * MINSECS; $DB->delete_records('task_log'); $DB->insert_record('task_log', $logrecord);