forked from civicrm/civicrm-core
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CATL-1614: Add unit test to test is_contact_creation_disabled_if_no_m…
…atch option during Inbound Email Processing
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,4 +169,37 @@ public function setUpMailing() { | |
$this->eventQueue = $this->callAPISuccess('MailingEventQueue', 'get', ['api.MailingEventQueue.create' => ['hash' => 'aaaaaaaaaaaaaaaa']]); | ||
} | ||
|
||
/** | ||
* Set up mail account with 'Do not create new contacts when filing emails' | ||
* option enabled. | ||
*/ | ||
public function setUpDoNotCreateContact() { | ||
$this->callAPISuccess('MailSettings', 'get', [ | ||
'api.MailSettings.create' => [ | ||
'name' => 'mailbox', | ||
'protocol' => 'Localdir', | ||
'source' => __DIR__ . '/data/mail', | ||
'domain' => 'example.com', | ||
'is_default' => '0', | ||
'is_contact_creation_disabled_if_no_match' => TRUE, | ||
], | ||
]); | ||
} | ||
|
||
/** | ||
* Test case email processing when is_non_case_email_skipped is enabled. | ||
*/ | ||
public function testInboundProcessingDoNotCreateContact() { | ||
$this->setUpDoNotCreateContact(); | ||
$mail = 'test_non_cases_email.eml'; | ||
|
||
copy(__DIR__ . '/data/inbound/' . $mail, __DIR__ . '/data/mail/' . $mail); | ||
$this->callAPISuccess('job', 'fetch_activities', []); | ||
$result = civicrm_api3('Contact', 'get', [ | ||
'sequential' => 1, | ||
'email' => "[email protected]", | ||
]); | ||
$this->assertTrue(empty($result['values'])); | ||
} | ||
|
||
} |