Container - Disable caching in as many unit-tests as we can
authorTim Otten <totten@civicrm.org>
Fri, 18 Sep 2020 02:11:19 +0000 (19:11 -0700)
committerTim Otten <totten@civicrm.org>
Fri, 18 Sep 2020 02:11:19 +0000 (19:11 -0700)
Civi/Core/Container.php

index acedf8a7802424c47927b047b6740be011c97f8c..28b210e2b07433c703873769782af907a181e898 100644 (file)
@@ -56,7 +56,7 @@ class Container {
     $cacheMode = defined('CIVICRM_CONTAINER_CACHE') ? CIVICRM_CONTAINER_CACHE : 'auto';
 
     // In pre-installation environments, don't bother with caching.
-    if (!defined('CIVICRM_DSN') || $cacheMode === 'never' || \CRM_Utils_System::isInUpgradeMode()) {
+    if (!defined('CIVICRM_DSN') || defined('CIVICRM_TEST') || CIVICRM_UF === 'UnitTests' || $cacheMode === 'never' || \CRM_Utils_System::isInUpgradeMode()) {
       $containerBuilder = $this->createContainer();
       $containerBuilder->compile();
       return $containerBuilder;