public function MaillogTestCase::testLongSubject in Maillog / Mail Developer 7
Confirm what happens with long subject lines.
File
- tests/
MaillogTestCase.test, line 118 - Unit-ish tests for the Maillog module.
Class
- MaillogTestCase
- All unit tests for the module.
Code
public function testLongSubject() {
// Send an email.
$this
->sendTestEmail('maillog_long_subject_test');
// Compare the maillog db entry with the sent mail.
$logged_email = $this
->getLatestMaillogEntry();
$this
->assertTrue(!empty($logged_email), 'The test email was captured.');
// The original subject line, as copied from maillog_tests_mail().
$subject = str_repeat(t('Test email subject') . ' ', 20);
// Duplicate the string trimming.
$subject_trimmed = drupal_substr($subject, 0, 255);
$this
->assertEqual($subject_trimmed, $logged_email['subject'], 'Email subject was trimmed correctly.');
$this
->assertNotEqual($subject, $logged_email['subject'], 'Email subject is not untrimmed.');
}