From: Tim Otten Date: Sat, 1 Jun 2019 00:11:26 +0000 (-0700) Subject: CRM_Extension_System - Only handle `test.*` extensions on headless test sites X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=eee89c1be154b99d96fc7744d03dc63d1f66cec5;p=civicrm-core.git CRM_Extension_System - Only handle `test.*` extensions on headless test sites The headless test suite includes integration tests for correct handling of the extension installation/removal process. This involves some dummy extensions. Unfortunately, the dummy extensions are often picked up on live deployments -- where they're a bit distracting/annoying. Before ------ The `test.*` dummy extensions appear as available in all environments, including headless tests and live sites. After ----- The `test.*` dummy extensions are only available in the headless test environment. --- diff --git a/CRM/Extension/System.php b/CRM/Extension/System.php index b3157ffd57..f9665524d9 100644 --- a/CRM/Extension/System.php +++ b/CRM/Extension/System.php @@ -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.