From: Tim Otten Date: Fri, 14 Apr 2017 03:55:51 +0000 (-0700) Subject: CiviEventInspector - Include stub for hooks (when available) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e1d66df799edae6bc951d39a773344e7e28e9576;p=civicrm-core.git CiviEventInspector - Include stub for hooks (when available) --- diff --git a/Civi/Core/CiviEventInspector.php b/Civi/Core/CiviEventInspector.php index d5d3678607..8a4f14c3bc 100644 --- a/Civi/Core/CiviEventInspector.php +++ b/Civi/Core/CiviEventInspector.php @@ -192,6 +192,7 @@ class CiviEventInspector { 'description_html' => $method->getDocComment() ? \CRM_Admin_Page_APIExplorer::formatDocBlock($method->getDocComment()) : '', 'fields' => array(), 'class' => 'Civi\Core\Event\GenericHookEvent', + 'stub' => $method, ); foreach ($method->getParameters() as $parameter) { diff --git a/tests/phpunit/Civi/Core/CiviEventInspectorTest.php b/tests/phpunit/Civi/Core/CiviEventInspectorTest.php index 6997d9618c..144232d50f 100644 --- a/tests/phpunit/Civi/Core/CiviEventInspectorTest.php +++ b/tests/phpunit/Civi/Core/CiviEventInspectorTest.php @@ -18,6 +18,8 @@ class CiviEventInspectorTest extends \CiviUnitTestCase { $this->assertFalse($eventDef['fields']['domainID']['ref']); $this->assertEquals('&$settingsMetaData, $domainID, $profile', $eventDef['signature']); $this->assertTrue($inspector->validate($eventDef)); + $this->assertTrue($eventDef['stub'] instanceof \ReflectionMethod); + $this->assertTrue($eventDef['stub']->isStatic()); } public function testGetAll() { @@ -28,6 +30,10 @@ class CiviEventInspectorTest extends \CiviUnitTestCase { foreach ($all as $name => $eventDef) { $this->assertEquals($name, $eventDef['name']); $this->assertTrue($inspector->validate($eventDef)); + if (isset($eventDef['stub'])) { + $this->assertTrue($eventDef['stub'] instanceof \ReflectionMethod); + $this->assertTrue($eventDef['stub']->isStatic()); + } } }