From: demeritcowboy Date: Thu, 7 Oct 2021 18:37:33 +0000 (-0400) Subject: add test X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=338bf9c28e610a1ffce33d60d4634ac6a7c9c8a3;p=civicrm-core.git add test --- diff --git a/tests/phpunit/CRM/Case/Form/EmailTest.php b/tests/phpunit/CRM/Case/Form/EmailTest.php new file mode 100644 index 0000000000..20fdbf50ce --- /dev/null +++ b/tests/phpunit/CRM/Case/Form/EmailTest.php @@ -0,0 +1,45 @@ +createLoggedInUser(); + $clientId = $this->individualCreate(); + $caseObj = $this->createCase($clientId, $loggedInUserId); + + $url = "civicrm/case/email/add?reset=1&action=add&atype=3&cid={$loggedInUserId}&caseid={$caseObj->id}"; + + $_SERVER['REQUEST_URI'] = $url; + $urlParts = explode('?', $url); + $_GET['q'] = $urlParts[0]; + + $parsed = []; + parse_str($urlParts[1], $parsed); + foreach ($parsed as $param => $value) { + $_REQUEST[$param] = $value; + } + + $item = CRM_Core_Invoke::getItem([$_GET['q']]); + ob_start(); + CRM_Core_Invoke::runItem($item); + $contents = ob_get_contents(); + ob_end_clean(); + + foreach ($parsed as $param => $dontcare) { + unset($_REQUEST[$param]); + } + + // Anything here could be subject to change. Just tried to pick a few that + // might be less likely to. Really just trying to see if it opens the + // right form and with no errors. + $this->assertStringContainsString('name="from_email_address"', $contents); + $this->assertStringContainsString('name="subject"', $contents); + $this->assertStringContainsString('name="_qf_Email_upload"', $contents); + $this->assertStringContainsString('anthony_anderson@civicrm.org', $contents); + $this->assertStringContainsString('CRM_Case_Form_Task_Email', $contents); + } + +}