From ebb4e06b332007ae68931e762903575875de1840 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 29 Sep 2021 20:40:42 +1300 Subject: [PATCH] Basic IDE cleanup on test class --- .../hook_civicrm_alterMailParams.evch.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/events/hook_civicrm_alterMailParams.evch.php b/tests/events/hook_civicrm_alterMailParams.evch.php index fa5f13e8481e..a5b69122f3c1 100644 --- a/tests/events/hook_civicrm_alterMailParams.evch.php +++ b/tests/events/hook_civicrm_alterMailParams.evch.php @@ -1,5 +1,9 @@ ['type' => 'bool|int', 'for' => 'messageTemplate'], ]; - public function isSupported($test) { + public function isSupported($test): bool { // MailTest does intentionally breaky things to provoke+ensure decent error-handling. //So we will not enforce generic rules on it. return !($test instanceof CRM_Utils_MailTest); @@ -96,8 +100,8 @@ public function isSupported($test) { * * @see \CRM_Utils_Hook::alterMailParams() */ - public function hook_civicrm_alterMailParams(&$params, $context = NULL) { - $msg = "Non-conformant hook_civicrm_alterMailParams(..., $context)"; + public function hook_civicrm_alterMailParams(&$params, $context = NULL): void { + $msg = 'Non-conforming hook_civicrm_alterMailParams(..., $context)'; $dump = print_r($params, 1); $this->assertRegExp('/^(messageTemplate|civimail|singleEmail|flexmailer)$/', @@ -129,7 +133,7 @@ public function hook_civicrm_alterMailParams(&$params, $context = NULL) { } if ($context === 'messageTemplate') { - $this->assertTrue(!empty($params['workflow']), "$msg: Message templates must always specify a symbolic name of the step/task\n$dump"); + $this->assertNotEmpty($params['workflow'], "$msg: Message templates must always specify a symbolic name of the step/task\n$dump"); if (isset($params['valueName'])) { // This doesn't require that valueName be supplied - but if it is supplied, it must match the workflow name. $this->assertEquals($params['workflow'], $params['valueName'], "$msg: If given, workflow and valueName must match\n$dump"); @@ -145,8 +149,8 @@ public function hook_civicrm_alterMailParams(&$params, $context = NULL) { } if (isset($params['groupName']) && $params['groupName'] === 'Scheduled Reminder Sender') { - $this->assertTrue(!empty($params['entity']), "$msg: Scheduled reminders should have entity\n$dump"); - $this->assertTrue(!empty($params['entity_id']), "$msg: Scheduled reminders should have entity_id\n$dump"); + $this->assertNotEmpty($params['entity'], "$msg: Scheduled reminders should have entity\n$dump"); + $this->assertNotEmpty($params['entity_id'], "$msg: Scheduled reminders should have entity_id\n$dump"); } }