Closed (fixed)
Project:
Mail Comment
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Jan 2012 at 15:35 UTC
Updated:
25 Aug 2013 at 23:41 UTC
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
Comment #1
danepowell commentedHrm... 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.
Comment #2
danepowell commentedI 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.
Comment #3
danepowell commentedDoubt 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
Comment #4
danepowell commentedAh, I've got a much better idea- write a patch for Reroute Mail: #2061781: Deliver mail to a local mbox
Comment #5
danepowell commentedOMG. 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