CRM_Utils_Hook_UnitTests - When running tests from an extension, the extension's...
authorTim Otten <totten@civicrm.org>
Wed, 24 Jul 2013 01:07:29 +0000 (18:07 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 24 Jul 2013 01:07:29 +0000 (18:07 -0700)
CRM/Utils/Hook/UnitTests.php

index 6004cff9192ec9058cf263ac97de624fbb7d05eb..9ed86c83810fdc9199549b1457124c4ead06d153 100644 (file)
@@ -37,6 +37,7 @@ class CRM_Utils_Hook_UnitTests extends CRM_Utils_Hook {
 
   protected $mockObject;
   protected $adhocHooks;
+  protected $civiModules = NULL;
 
   // Call this in CiviUnitTestCase::setUp()
   function reset() {
@@ -62,7 +63,15 @@ class CRM_Utils_Hook_UnitTests extends CRM_Utils_Hook {
   function invoke($numParams,
     &$arg1, &$arg2, &$arg3, &$arg4, &$arg5,
     $fnSuffix) {
+
     $params = array( &$arg1, &$arg2, &$arg3, &$arg4, &$arg5);
+
+    if ($this->civiModules === NULL) {
+      $this->civiModules = array();
+      $this->requireCiviModules($this->civiModules);
+    }
+    $this->runHooks($this->civiModules, $fnSuffix, $numParams, $arg1, $arg2, $arg3, $arg4, $arg5);
+
     if ($this->mockObject && is_callable(array($this->mockObject, $fnSuffix))) {
       call_user_func(array($this->mockObject, $fnSuffix), $arg1, $arg2, $arg3, $arg4, $arg5);
     }