From df99c6b71e66946eed08fcac5439afff3726dd76 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 14 Sep 2021 17:13:11 -0700 Subject: [PATCH] CaseActivity Examples - Only report example-data if the workflow is actually valid The `case_activity` workflow definition is weirdly/temporarily in `tests/phpunit`. This makes it loadable for headless testing, but it's not truly loadable in a web-env. Consequently, the examples should not be presented as valid example data when using web-env. --- .../Case/WorkflowMessage/CaseActivity/CaseAdhocExample.ex.php | 3 +++ .../Case/WorkflowMessage/CaseActivity/CaseModelExample.ex.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/tests/phpunit/CRM/Case/WorkflowMessage/CaseActivity/CaseAdhocExample.ex.php b/tests/phpunit/CRM/Case/WorkflowMessage/CaseActivity/CaseAdhocExample.ex.php index e05b2590cc..cfee7653c8 100644 --- a/tests/phpunit/CRM/Case/WorkflowMessage/CaseActivity/CaseAdhocExample.ex.php +++ b/tests/phpunit/CRM/Case/WorkflowMessage/CaseActivity/CaseAdhocExample.ex.php @@ -6,6 +6,9 @@ class CRM_Case_WorkflowMessage_CaseActivity_CaseAdhocExample extends \Civi\Workf * @inheritDoc */ public function getExamples(): iterable { + if (!class_exists($this->wfClass)) { + return []; /* CaseActivity WfMsg is temporarily in tests/phpunit, so it's not reliably loadable. Temp work-around. */ + } yield [ 'name' => "workflow/{$this->wfName}/{$this->exName}", 'title' => ts('Case Activity (Adhoc-style example)'), diff --git a/tests/phpunit/CRM/Case/WorkflowMessage/CaseActivity/CaseModelExample.ex.php b/tests/phpunit/CRM/Case/WorkflowMessage/CaseActivity/CaseModelExample.ex.php index b661afa077..d716e63982 100644 --- a/tests/phpunit/CRM/Case/WorkflowMessage/CaseActivity/CaseModelExample.ex.php +++ b/tests/phpunit/CRM/Case/WorkflowMessage/CaseActivity/CaseModelExample.ex.php @@ -5,6 +5,9 @@ class CRM_Case_WorkflowMessage_CaseActivity_CaseModelExample extends \Civi\Workf * @inheritDoc */ public function getExamples(): iterable { + if (!class_exists($this->wfClass)) { + return []; /* CaseActivity WfMsg is temporarily in tests/phpunit, so it's not reliably loadable. Temp work-around. */ + } yield [ 'name' => "workflow/{$this->wfName}/{$this->exName}", 'title' => ts('Case Activity (Class-style example)'), -- 2.25.1