CRM_Extension_System - Only handle `test.*` extensions on headless test sites
[civicrm-core.git] / CRM / Extension / System.php
index b3157ffd5722bb5ecb0263d35a686ed3877fd98f..f9665524d9b9128d9c4afb568b39d6ca39a67298 100644 (file)
@@ -155,6 +155,12 @@ class CRM_Extension_System {
         }
       }
 
+      if (!defined('CIVICRM_TEST')) {
+        foreach ($containers as $container) {
+          $container->addFilter([__CLASS__, 'isNotTestExtension']);
+        }
+      }
+
       $this->fullContainer = new CRM_Extension_Container_Collection($containers, $this->getCache(), 'full');
     }
     return $this->fullContainer;
@@ -302,6 +308,10 @@ class CRM_Extension_System {
     return Civi::$statics[__CLASS__]['compatibility'];
   }
 
+  public static function isNotTestExtension(CRM_Extension_Info $info) {
+    return (bool) !preg_match('/^test\./', $info->key);
+  }
+
   /**
    * Take an extension's raw XML info and add information about the
    * extension's status on the local system.