protected function UbercartTestHelper::findMail in Ubercart 7.3
Same name and namespace in other branches
- 6.2 uc_store/uc_store.test \UbercartTestHelper::findMail()
Assert that an email was sent with a specific subject line.
Parameters
$pattern: A regular expression to match the subject against.
Return value
An array containing the most recently sent matching email, or FALSE if the subject line did not match anything.
2 calls to UbercartTestHelper::findMail()
- UbercartFileTestCase::testFilePurchaseCheckout in uc_file/
tests/ uc_file.test - UbercartRolesTestCase::testRolePurchaseCheckout in uc_roles/
tests/ uc_roles.test
File
- uc_store/
tests/ uc_store.test, line 182 - Test functionality provided by uc_store.
Class
- UbercartTestHelper
- Defines a base helper class for Ubercart tests.
Code
protected function findMail($pattern) {
foreach (array_reverse($this
->drupalGetMails()) as $mail) {
if (preg_match($pattern, $mail['subject'])) {
$this
->pass(t('E-mail found with subject matching %pattern.', array(
'%pattern' => $pattern,
)));
return $mail;
}
}
$this
->fail(t('E-mail not found with subject matching %pattern.', array(
'%pattern' => $pattern,
)));
return FALSE;
}