function SimplenewsSubscribeTestCase::extractConfirmationLink in Simplenews 7.2
Extract a confirmation link from a mail body.
2 calls to SimplenewsSubscribeTestCase::extractConfirmationLink()
- SimplenewsSubscribeTestCase::testSubscribeAnonymous in tests/
simplenews.test - testSubscribeAnonymous
- SimplenewsSubscribeTestCase::testSubscribeMultiple in tests/
simplenews.test - Subscribe to multiple newsletters at the same time.
File
- tests/
simplenews.test, line 503 - Simplenews test functions.
Class
Code
function extractConfirmationLink($body) {
$pattern = '@newsletter/confirm/.+@';
preg_match($pattern, $body, $match);
$found = preg_match($pattern, $body, $match);
if (!$found) {
return FALSE;
}
$confirm_url = $match[0];
$this
->assertTrue($found, t('Confirmation URL found: @url', array(
'@url' => $confirm_url,
)));
return $confirm_url;
}