Commit 85c64c59 authored by totten's avatar totten

(flexmailer#29) Mailing.preview API - Add unit-test for call without contact ID

parent f4377975
......@@ -276,6 +276,23 @@ class api_v3_MailingTest extends CiviUnitTestCase {
$this->assertContains("<p>This is $displayName.</p>", $previewResult['values']['body_html']);
}
public function testMailerPreviewUnknownContact() {
$params = $this->_params;
$params['api.Mailing.preview'] = array(
'id' => '$value.id',
);
$result = $this->callAPISuccess('mailing', 'create', $params);
// NOTE: It's highly debatable what's best to do with contact-tokens for an
// unknown-contact. However, changes should be purposeful, so we'll test
// for the current behavior (i.e. returning blanks).
$previewResult = $result['values'][$result['id']]['api.Mailing.preview'];
$this->assertEquals("Hello ", $previewResult['values']['subject']);
$this->assertContains("This is .", $previewResult['values']['body_text']);
$this->assertContains("<p>This is .</p>", $previewResult['values']['body_html']);
}
public function testMailerPreviewRecipients() {
// BEGIN SAMPLE DATA
$groupIDs['inc'] = $this->groupCreate(array('name' => 'Example include group', 'title' => 'Example include group'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment