Hi all,

I've been writing some unit tests and have had some trouble with mail.

I send mail using my application and then check these emails in my unit
tests. All of this is handled by a local mail server (hMailServer).

If I use CURL to request pages from my local server that send mail, the SMTP
commands of the page all happen before the POP commands of my unit tests, so
the mail is sent, then checked.

If I load my bootstrap in my unit test the SMTP and POP commands are mixed
up, so that not all SMTP commands are finished before POP commands are sent.
This means the account can be checked before the mail has been sent, even
though in the code the sending commands are before the checking commands.

This happens whether I use PHP's mail() or Zend_Mail.

It appears as though the local server waits for the SMTP commands to finish
before it returns a result to CURL, whereas directly accessing my bootstrap
allows the SMTP commands to run in the background almost as a separate
thread.

Any ideas on why this is happening? How can I force the SMTP commands to
finish before code execution continues?

Cheers,
Steven


Reply via email to