3

I see that SimpleTest has a few built in mail functions to check for send success etc, but how can I send a message, assert its content and then click a link within that content during a test?

What is the standard or most common way to test unsubscribe, or account verification links in emails with SimpleTest?

1 Answer 1

6

Simpletest automatically captures sent mails during a test and allows you to fetch them using $this->drupalGetMails() in the test class.

I did something like this recently in tests I wrote for the Simplenews project, to test subscription confirmation here.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.