2017-06-09 00:38:49 +02:00
|
|
|
<?php
|
|
|
|
|
2017-08-22 02:15:22 +02:00
|
|
|
namespace SilverStripe\UserForms\Tests\Model\Recipient;
|
|
|
|
|
|
|
|
use SilverStripe\CMS\Model\SiteTree;
|
|
|
|
use SilverStripe\Dev\SapphireTest;
|
|
|
|
use SilverStripe\UserForms\Model\Recipient\EmailRecipient;
|
|
|
|
|
|
|
|
class EmailRecipientTest extends SapphireTest
|
2017-06-09 00:38:49 +02:00
|
|
|
{
|
2017-08-22 02:15:22 +02:00
|
|
|
protected static $fixture_file = 'EmailRecipientTest.yml';
|
2017-06-09 00:38:49 +02:00
|
|
|
|
|
|
|
public function testShortcodesAreRenderedInEmailPreviewContent()
|
|
|
|
{
|
2017-08-22 02:15:22 +02:00
|
|
|
$page = $this->objFromFixture(SiteTree::class, 'about_us');
|
2017-06-09 00:38:49 +02:00
|
|
|
|
2017-08-22 02:15:22 +02:00
|
|
|
$recipient = EmailRecipient::create();
|
2017-06-09 00:38:49 +02:00
|
|
|
$recipient->SendPlain = false;
|
|
|
|
$recipient->EmailBodyHtml = '<p>Some email content. About us: [sitetree_link,id=' . $page->ID . '].</p>';
|
|
|
|
|
|
|
|
$result = $recipient->getEmailBodyContent();
|
|
|
|
$this->assertContains('/about-us/', $result);
|
|
|
|
|
|
|
|
$recipient->SendPlain = true;
|
|
|
|
$recipient->EmailBody = 'Some email content. About us: [sitetree_link,id=' . $page->ID . '].';
|
|
|
|
|
|
|
|
$result = $recipient->getEmailBodyContent();
|
|
|
|
$this->assertContains('/about-us/', $result);
|
|
|
|
}
|
|
|
|
}
|