Differential D19957 Diff 47700 src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php
Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | public function testThreadIDHeaders() { | ||||
$this->runThreadIDHeadersWithConfiguration(false, true); | $this->runThreadIDHeadersWithConfiguration(false, true); | ||||
$this->runThreadIDHeadersWithConfiguration(false, false); | $this->runThreadIDHeadersWithConfiguration(false, false); | ||||
} | } | ||||
private function runThreadIDHeadersWithConfiguration( | private function runThreadIDHeadersWithConfiguration( | ||||
$supports_message_id, | $supports_message_id, | ||||
$is_first_mail) { | $is_first_mail) { | ||||
$user = $this->generateNewTestUser(); | |||||
$phid = $user->getPHID(); | |||||
$mailer = new PhabricatorMailTestAdapter(); | $mailer = new PhabricatorMailTestAdapter(); | ||||
$mailer->prepareForSend( | $mailer->setSupportsMessageID($supports_message_id); | ||||
array( | |||||
'supportsMessageIDHeader' => $supports_message_id, | |||||
)); | |||||
$thread_id = '<somethread-12345@somedomain.tld>'; | $thread_id = 'somethread-12345'; | ||||
$mail = new PhabricatorMetaMTAMail(); | $mail = id(new PhabricatorMetaMTAMail()) | ||||
$mail->setThreadID($thread_id, $is_first_mail); | ->setThreadID($thread_id, $is_first_mail) | ||||
$mail->sendWithMailers(array($mailer)); | ->addTos(array($phid)) | ||||
->sendWithMailers(array($mailer)); | |||||
$guts = $mailer->getGuts(); | $guts = $mailer->getGuts(); | ||||
$dict = ipull($guts['headers'], 1, 0); | |||||
$headers = idx($guts, 'headers', array()); | |||||
$dict = array(); | |||||
foreach ($headers as $header) { | |||||
list($name, $value) = $header; | |||||
$dict[$name] = $value; | |||||
} | |||||
if ($is_first_mail && $supports_message_id) { | if ($is_first_mail && $supports_message_id) { | ||||
$expect_message_id = true; | $expect_message_id = true; | ||||
$expect_in_reply_to = false; | $expect_in_reply_to = false; | ||||
$expect_references = false; | $expect_references = false; | ||||
} else { | } else { | ||||
$expect_message_id = false; | $expect_message_id = false; | ||||
$expect_in_reply_to = true; | $expect_in_reply_to = true; | ||||
▲ Show 20 Lines • Show All 207 Lines • Show Last 20 Lines |