public function testNotificationEmailsRespectSiteBaseHrefSetting() { self::loadFixture(); $originalSettings = Settings::getSettings(); $settings = $originalSettings; $settings['site']['base_href'] = 'http://fake.domain/'; Settings::setFromArray($settings); $this->doLogin("*****@*****.**", "t3stp4ss"); TestEmailHandler::resetSentEmails(); $this->request->setMethod("POST")->setParams(array("approved" => "1"))->dispatch("/admin/posts/3/comments/edit/3"); $emails = TestEmailHandler::getSentEmails(); $this->assertTrue(strpos($emails[0]['body'], "http://fake.domain/2011/09/another-test-post") !== false); $this->assertTrue(strpos($emails[1]['body'], "http://fake.domain/2011/09/another-test-post") !== false); $this->assertTrue(strpos($emails[1]['body'], "http://fake.domain/comment-unsubscribe/") !== false); $this->assertTrue(strpos($emails[2]['body'], "http://fake.domain/2011/09/another-test-post") !== false); $this->assertTrue(strpos($emails[2]['body'], "http://fake.domain/comment-unsubscribe/") !== false); Settings::setFromArray($originalSettings); }
public function testCommentSubmissionOnDisabledPost() { TestEmailHandler::resetSentEmails(); $this->request->setMethod("POST")->setParams(array("name" => "Valid Comment", "email" => "*****@*****.**", "content" => "This is a valid message, but comments are disabled"))->dispatch("/articles/2011/03/test-post-for-comments/comment"); $emails = TestEmailHandler::getSentEmails(); $this->assertEquals(0, count($emails)); $this->assertRedirect(true); $this->assertRedirectUrl("/articles/2011/03/test-post-for-comments"); }