From c0d687f23b22bf8c731363071273e76a8a3b37b1 Mon Sep 17 00:00:00 2001 From: Belisoful Date: Wed, 3 May 2023 16:37:27 -0700 Subject: [PATCH] #918 fixing spot DBCron test failure. The test itself wasn't quite right. it should sort by asc (false), not descending (true). and ordering by uid (aka entry order) as well. --- framework/Util/Cron/TDbCronModule.php | 4 ++-- tests/unit/Util/Cron/TDbCronModuleTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/Util/Cron/TDbCronModule.php b/framework/Util/Cron/TDbCronModule.php index 103cd40f9..2bf9275fe 100644 --- a/framework/Util/Cron/TDbCronModule.php +++ b/framework/Util/Cron/TDbCronModule.php @@ -815,8 +815,8 @@ public function getCronLog($name, $pageSize, $offset, $sortingDesc = null) $sortingDesc ??= true; } if ($sortingDesc !== null) { - $sortingDesc = TPropertyValue::ensureBoolean($sortingDesc) ? "DESC" : "ASC"; - $orderby = " ORDER BY lastExecTime $sortingDesc, processCount $sortingDesc"; + $sortingDesc = TPropertyValue::ensureBoolean($sortingDesc) ? 'DESC' : 'ASC'; + $orderby = " ORDER BY lastExecTime $sortingDesc, tabuid $sortingDesc, processCount $sortingDesc"; } $cmd = $db->createCommand( "SELECT * FROM {$this->_tableName} WHERE {$where}active IS NULL{$orderby}{$limit}" diff --git a/tests/unit/Util/Cron/TDbCronModuleTest.php b/tests/unit/Util/Cron/TDbCronModuleTest.php index 28cdebf35..fcf0db055 100644 --- a/tests/unit/Util/Cron/TDbCronModuleTest.php +++ b/tests/unit/Util/Cron/TDbCronModuleTest.php @@ -240,7 +240,7 @@ public function testLogCronTask() self::assertEquals(5, $this->obj->getCronLogCount()); - $log = $this->obj->getCronLog(null, false, false, true); + $log = $this->obj->getCronLog(null, false, false, false); self::assertEquals(5, count($log)); self::assertEquals('testTaskAA', $log[0]['name']);