From 05b386ab139fd9281afdbc66558616cd36314574 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 2 Oct 2023 21:44:13 -0700 Subject: [PATCH] hook_civicrm_links - Add exception for financialItem.batch.row --- tests/events/hook_civicrm_links.evch.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/events/hook_civicrm_links.evch.php b/tests/events/hook_civicrm_links.evch.php index cd1329fee0..0c62b8d6bf 100644 --- a/tests/events/hook_civicrm_links.evch.php +++ b/tests/events/hook_civicrm_links.evch.php @@ -30,6 +30,7 @@ return new class() extends EventCheck implements HookInterface { protected $grandfatheredNoUrl = [ 'basic.CRM_Core_BAO_LocationType.page::CRM_Core_BAO_LocationType', 'case.tab.row::Activity', + 'financialItem.batch.row::FinancialItem', 'group.selector.row::Group', 'job.manage.action::Job', 'membershipType.manage.action::MembershipType', @@ -37,6 +38,16 @@ return new class() extends EventCheck implements HookInterface { 'basic.CRM_Core_BAO_MessageTemplate.page::CRM_Core_BAO_MessageTemplate', ]; + /** + * These are deviant values with appear as `$link['bit']` fields. They are documented + * (and generally practiced) as integers. + * + * @var \string[][] + */ + protected $grandfatheredInvalidBits = [ + 'financialItem.batch.row' => ['view', 'assign'], + ]; + /** * These variants have anomalous keys that are not documented and do not * appear in most flavors of "hook_civicrm_links". @@ -110,7 +121,12 @@ return new class() extends EventCheck implements HookInterface { $this->assertType('string', $link['extra'], "$msg: extra should be a string"); } if (isset($link['bit'])) { - $this->assertType('integer', $link['bit'], "$msg: bit should be an int"); + if (in_array($link['bit'], $this->grandfatheredInvalidBits[$op] ?? [])) { + // Exception + } + else { + $this->assertType('integer', $link['bit'], "$msg: bit should be an int" . $link['bit']); + } } if (isset($link['ref'])) { $this->assertType('string', $link['ref'], "$msg: ref should be an string"); -- 2.25.1