2014-02-24 01:38:16 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class ContentReviewNotificationTest extends SapphireTest {
|
|
|
|
|
2014-02-25 03:54:27 +01:00
|
|
|
public static $fixture_file = 'contentreview/tests/ContentReviewTest.yml';
|
|
|
|
|
2014-02-26 23:07:34 +01:00
|
|
|
protected $requiredExtensions = array(
|
|
|
|
"SiteTree" => array("SiteTreeContentReview"),
|
|
|
|
"Group" => array("ContentReviewOwner"),
|
|
|
|
"Member" => array("ContentReviewOwner"),
|
|
|
|
"CMSPageEditController" => array("ContentReviewCMSExtension"),
|
|
|
|
"SiteConfig" => array("ContentReviewDefaultSettings"),
|
|
|
|
);
|
|
|
|
|
2014-02-24 01:38:16 +01:00
|
|
|
public function testContentReviewEmails() {
|
2014-02-25 03:54:27 +01:00
|
|
|
SS_Datetime::set_mock_now('2010-02-24 12:00:00');
|
|
|
|
|
|
|
|
// This propagates the next review date to 'contact-child' page from the parent page
|
|
|
|
$childParentPage = $this->objFromFixture('Page', 'contact');
|
|
|
|
$childParentPage->NextReviewDate = '2010-02-23';
|
|
|
|
$childParentPage->write();
|
2014-02-24 01:38:16 +01:00
|
|
|
|
|
|
|
$task = new ContentReviewEmails();
|
|
|
|
$task->run(new SS_HTTPRequest('GET', '/dev/tasks/ContentReviewEmails'));
|
|
|
|
|
2014-02-25 03:54:27 +01:00
|
|
|
$expectedSubject = _t('ContentReviewEmails.SUBJECT', 'Page(s) are due for content review');
|
|
|
|
$email = $this->findEmail('author@example.com', null, $expectedSubject);
|
|
|
|
|
|
|
|
$this->assertNotNull($email, 'Email haven\'t been sent.');
|
|
|
|
|
|
|
|
$this->assertContains('There are 3 pages that are due for review today by you.', $email['htmlContent']);
|
|
|
|
$this->assertContains('Staff', $email['htmlContent']);
|
|
|
|
$this->assertContains('Contact Us', $email['htmlContent']);
|
|
|
|
$this->assertContains('Contact Us Child', $email['htmlContent']);
|
2014-02-24 01:38:16 +01:00
|
|
|
|
|
|
|
SS_Datetime::clear_mock_now();
|
|
|
|
}
|
|
|
|
}
|