idFromFixture(SiteConfig::class, 'mysiteconfig'); foreach (SiteConfig::get()->exclude('ID', $desiredID) as $config) { $config->delete(); } } /** * @var array */ protected static $required_extensions = [ SiteTree::class => [SiteTreeContentReview::class], Group::class => [ContentReviewOwner::class], Member::class => [ContentReviewOwner::class], CMSPageEditController::class => [ContentReviewCMSExtension::class], SiteConfig::class => [ContentReviewDefaultSettings::class], ]; public function testContentReviewEmails() { DBDatetime::set_mock_now('2010-02-24 12:00:00'); /** @var Page|SiteTreeContentReview $childParentPage */ $childParentPage = $this->objFromFixture(Page::class, 'contact'); $childParentPage->NextReviewDate = '2010-02-23'; $childParentPage->write(); $task = new ContentReviewEmails(); $task->run(new HTTPRequest('GET', '/dev/tasks/ContentReviewEmails')); // Set template variables (as per variable case) $ToEmail = 'author@example.com'; $Subject = 'Please log in to review some content!'; $PagesCount = 3; $ToFirstName = 'Test'; $email = $this->findEmail($ToEmail, null, $Subject); $this->assertNotNull($email, "Email haven't been sent."); $this->assertContains( "
There are $PagesCount pages that are due for review today by you, $ToFirstName.
This email was sent to $ToEmail
", $email['htmlContent'] ); $this->assertContains('Staff', $email['htmlContent']); $this->assertContains('Contact Us', $email['htmlContent']); $this->assertContains('Contact Us Child', $email['htmlContent']); DBDatetime::clear_mock_now(); } }