silverstripe-contentreview/tests/ContentReviewNotificationTest.php

48 lines
1.7 KiB
PHP
Raw Normal View History

2014-02-24 01:38:16 +01:00
<?php
2015-11-02 00:27:42 +01:00
/**
* @mixin PHPUnit_Framework_TestCase
*/
class ContentReviewNotificationTest extends SapphireTest
{
/**
* @var string
*/
public static $fixture_file = "contentreview/tests/ContentReviewTest.yml";
/**
* @var array
*/
protected $requiredExtensions = array(
"SiteTree" => array("SiteTreeContentReview"),
"Group" => array("ContentReviewOwner"),
"Member" => array("ContentReviewOwner"),
"CMSPageEditController" => array("ContentReviewCMSExtension"),
"SiteConfig" => array("ContentReviewDefaultSettings"),
);
public function testContentReviewEmails()
{
SS_Datetime::set_mock_now("2010-02-24 12:00:00");
/** @var Page|SiteTreeContentReview $childParentPage */
$childParentPage = $this->objFromFixture("Page", "contact");
$childParentPage->NextReviewDate = "2010-02-23";
$childParentPage->write();
$task = new ContentReviewEmails();
$task->run(new SS_HTTPRequest("GET", "/dev/tasks/ContentReviewEmails"));
$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"]);
SS_Datetime::clear_mock_now();
}
2014-02-24 01:38:16 +01:00
}