I should add a test case or two. I'm not sure there's a good way to test outgoing functionality, but I should be able to create a test message (similar to the test_mbox files in the Mailhandler test cases) and make sure importing / mapping works.

Comments

danepowell’s picture

Status: Active » Postponed

Hrm... coming up with tests is actually going to be a pretty kettle of fish. Outgoing functionality is tough to test because (a) there are two different versions of notifications/messaging that need to be tested, and (b) there would need to be a way to intercept outgoing messages after the Mail Comment signature is added to the message body, but before the mail is actually sent.

Incoming functionality is tough to test because the nid of the test thread would need to be known a priori to embed in the test message signature. In my experience it's hard to guarantee this sort of thing in testing.

This is all assuming that we don't actually want to send/receive any emails. Now if there were a way to use an actual mailbox for testing, this might be simpler. One option would be to write a 'dummy mail' messaging sending method that writes outgoing emails to a local mbox file rather than actually sending them. But that's a lot of work for me to go through just to get simpletests working.

danepowell’s picture

Status: Postponed » Active

I think the way forward is to first create a Messaging plug-in that saves messages to an mbox. Basically, it would create an empty mbox file on install, and then save outgoing "messages" to it using imap_mail_compose and similar functions. The rest of the process should be pretty straightforward.

danepowell’s picture

Doubt this will ever happen with Notifications / Messaging, but I dropped an issue in the Message Notify queue: #2059011: Plugin to deliver mail locally for testing

danepowell’s picture

Ah, I've got a much better idea- write a patch for Reroute Mail: #2061781: Deliver mail to a local mbox

danepowell’s picture

Status: Active » Fixed

OMG. I can't believe I overlooked the assertMail* test functions. Maybe they weren't available in 6.x. Anyway, simpletests (for the sending side at least) are done...
http://drupalcode.org/project/mailcomment.git/commit/c82996b

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.