CiviTestListener - Ensure that mocked times are always cleaned up
authorTim Otten <totten@civicrm.org>
Sat, 2 Jan 2021 09:25:21 +0000 (01:25 -0800)
committerTim Otten <totten@civicrm.org>
Fri, 8 Jan 2021 05:24:46 +0000 (21:24 -0800)
Civi/Test/CiviTestListener.php
Civi/Test/CiviTestListenerPHPUnit7.php
Civi/Test/Legacy/CiviTestListener.php

index 2851bda3d89c9d283186e3dd54beeee9f104b327..71c595a0b548723fc2602ad21fbf264e8099da8e 100644 (file)
@@ -85,6 +85,7 @@ else {
       if ($test instanceof HookInterface) {
         \CRM_Utils_Hook::singleton()->reset();
       }
+      \CRM_Utils_Time::resetTime();
       if ($this->isCiviTest($test)) {
         error_reporting(E_ALL & ~E_NOTICE);
         $this->errorScope = NULL;
index ee8173d2b8341e162b739521f6ca818bbbe818a7..8cd76f46ffdbddeb3545f78668ca654e8578411f 100644 (file)
@@ -78,6 +78,7 @@ class CiviTestListenerPHPUnit7 implements \PHPUnit\Framework\TestListener {
     if ($test instanceof HookInterface) {
       \CRM_Utils_Hook::singleton()->reset();
     }
+    \CRM_Utils_Time::resetTime();
     if ($this->isCiviTest($test)) {
       error_reporting(E_ALL & ~E_NOTICE);
       $this->errorScope = NULL;
index eb85e8906e0c147bc3344ea1a1eefe1e95f48ea8..6533c33a46a6f86bd08aedfa0d8f1339b4031872 100644 (file)
@@ -74,6 +74,7 @@ class CiviTestListener extends \PHPUnit_Framework_BaseTestListener {
     if ($test instanceof \Civi\Test\HookInterface) {
       \CRM_Utils_Hook::singleton()->reset();
     }
+    \CRM_Utils_Time::resetTime();
     if ($this->isCiviTest($test)) {
       error_reporting(E_ALL & ~E_NOTICE);
       $this->errorScope = NULL;