MDL-62214 tool_messageinbound: False negative due to time() usage
authorFrédéric Massart <fred@branchup.tech>
Wed, 2 May 2018 04:41:58 +0000 (12:41 +0800)
committerFrédéric Massart <fred@branchup.tech>
Wed, 2 May 2018 04:44:42 +0000 (12:44 +0800)
PHP Unit is so fast that my test couldn't cope with it!

admin/tool/messageinbound/tests/manager_test.php

index 936d996..b88a742 100644 (file)
@@ -58,7 +58,7 @@ class tool_messageinbound_manager_testcase extends provider_testcase {
         global $DB;
 
         $now = time();
-        $stale = time() - DAYSECS;
+        $stale = $now - DAYSECS - 1;    // Make a second older because PHP Unit is too damn fast!!
 
         $this->create_messagelist(['timecreated' => $now]);
         $this->create_messagelist(['timecreated' => $now - HOURSECS]);