Merge pull request #4384 from nextcloud/renderHtml-fix

Rename renderHTML to renderHtml
This commit is contained in:
Morris Jobke 2017-04-19 17:52:37 -05:00 committed by GitHub
commit 0556104cd3
11 changed files with 23 additions and 23 deletions

View File

@ -329,7 +329,7 @@ class ShareByMailProvider implements IShareProvider {
$message->setSubject($subject);
$message->setPlainBody($emailTemplate->renderText());
$message->setHtmlBody($emailTemplate->renderHTML());
$message->setHtmlBody($emailTemplate->renderHtml());
$this->mailer->send($message);
}
@ -368,7 +368,7 @@ class ShareByMailProvider implements IShareProvider {
$message->setTo([$shareWith]);
$message->setSubject($subject);
$message->setBody($emailTemplate->renderText(), 'text/plain');
$message->setHtmlBody($emailTemplate->renderHTML());
$message->setHtmlBody($emailTemplate->renderHtml());
$this->mailer->send($message);
}

View File

@ -824,7 +824,7 @@ class ShareByMailProviderTest extends TestCase {
->with('Text Render');
$template
->expects($this->once())
->method('renderHTML')
->method('renderHtml')
->willReturn('HTML Render');
$message
->expects($this->once())
@ -939,7 +939,7 @@ class ShareByMailProviderTest extends TestCase {
->with('Text Render');
$template
->expects($this->once())
->method('renderHTML')
->method('renderHtml')
->willReturn('HTML Render');
$message
->expects($this->once())

View File

@ -311,7 +311,7 @@ class LostController extends Controller {
$message->setTo([$email => $user->getUID()]);
$message->setSubject($this->l10n->t('%s password reset', [$this->defaults->getName()]));
$message->setPlainBody($emailTemplate->renderText());
$message->setHtmlBody($emailTemplate->renderHTML());
$message->setHtmlBody($emailTemplate->renderHtml());
$message->setFrom([$this->from => $this->defaults->getName()]);
$this->mailer->send($message);
} catch (\Exception $e) {

View File

@ -34,7 +34,7 @@ use OCP\Mail\IEMailTemplate;
* Class EMailTemplate
*
* addBodyText and addBodyButtonGroup automatically opens the body
* addFooter, renderHTML, renderText automatically closes the body and the HTML if opened
* addFooter, renderHtml, renderText automatically closes the body and the HTML if opened
*
* @package OC\Mail
*/
@ -484,7 +484,7 @@ EOF;
*
* @return string
*/
public function renderHTML() {
public function renderHtml() {
if (!$this->footerAdded) {
$this->footerAdded = true;
if ($this->bodyOpened) {

View File

@ -45,7 +45,7 @@ namespace OCP\Mail;
*
* $emailTemplate->addFooter('Optional footer text');
*
* $htmlContent = $emailTemplate->renderHTML();
* $htmlContent = $emailTemplate->renderHtml();
* $plainContent = $emailTemplate->renderText();
*
* @since 12.0.0
@ -122,7 +122,7 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
public function renderHTML();
public function renderHtml();
/**
* Returns the rendered plain text email as string

View File

@ -156,7 +156,7 @@ class MailSettingsController extends Controller {
$message = $this->mailer->createMessage();
$message->setTo([$email => $displayName]);
$message->setSubject($this->l10n->t('Email setting test'));
$message->setHtmlBody($template->renderHTML());
$message->setHtmlBody($template->renderHtml());
$message->setPlainBody($template->renderText());
$errors = $this->mailer->send($message);
if (!empty($errors)) {

View File

@ -104,7 +104,7 @@ class Hooks {
$message->setTo([$user->getEMailAddress() => $user->getDisplayName()]);
$message->setSubject($this->l->t('Password for %1$s changed on %2$s', [$user->getDisplayName(), $instanceUrl]));
$message->setBody($template->renderText(), 'text/plain');
$message->setHtmlBody($template->renderHTML());
$message->setHtmlBody($template->renderHtml());
$this->mailer->send($message);
}
@ -157,7 +157,7 @@ class Hooks {
$message->setTo([$oldMailAddress => $user->getDisplayName()]);
$message->setSubject($this->l->t('Email address for %1$s changed on %2$s', [$user->getDisplayName(), $instanceUrl]));
$message->setBody($template->renderText(), 'text/plain');
$message->setHtmlBody($template->renderHTML());
$message->setHtmlBody($template->renderHtml());
$this->mailer->send($message);
}

View File

@ -158,7 +158,7 @@ class NewUserMailHelper {
$message = $this->mailer->createMessage();
$message->setTo([$user->getEMailAddress() => $user->getDisplayName()]);
$message->setSubject($this->l10n->t('Your %s account was created', [$this->themingDefaults->getName()]));
$message->setHtmlBody($emailTemplate->renderHTML());
$message->setHtmlBody($emailTemplate->renderHtml());
$message->setPlainBody($emailTemplate->renderText());
$message->setFrom([$this->fromAddress => $this->themingDefaults->getName()]);
$this->mailer->send($message);

View File

@ -329,7 +329,7 @@ class LostControllerTest extends \Test\TestCase {
->with(['lostpassword-noreply@localhost' => null]);
$emailTemplate = $this->createMock(IEMailTemplate::class);
$emailTemplate->expects($this->any())
->method('renderHTML')
->method('renderHtml')
->willReturn('HTML body');
$emailTemplate->expects($this->any())
->method('renderText')
@ -416,7 +416,7 @@ class LostControllerTest extends \Test\TestCase {
->with(['lostpassword-noreply@localhost' => null]);
$emailTemplate = $this->createMock(IEMailTemplate::class);
$emailTemplate->expects($this->any())
->method('renderHTML')
->method('renderHtml')
->willReturn('HTML body');
$emailTemplate->expects($this->any())
->method('renderText')
@ -497,7 +497,7 @@ class LostControllerTest extends \Test\TestCase {
->with(['lostpassword-noreply@localhost' => null]);
$emailTemplate = $this->createMock(IEMailTemplate::class);
$emailTemplate->expects($this->any())
->method('renderHTML')
->method('renderHtml')
->willReturn('HTML body');
$emailTemplate->expects($this->any())
->method('renderText')

View File

@ -354,7 +354,7 @@ This is an automatically sent email, please do not reply.
EOF;
$result = $this->newUserMailHelper->generateTemplate($user, true);
$this->assertEquals($expectedHtmlBody, $result->renderHTML());
$this->assertEquals($expectedHtmlBody, $result->renderHtml());
$this->assertEquals($expectedTextBody, $result->renderText());
$this->assertSame('OC\Mail\EMailTemplate', get_class($result));
}
@ -587,7 +587,7 @@ This is an automatically sent email, please do not reply.
EOF;
$result = $this->newUserMailHelper->generateTemplate($user, false);
$this->assertEquals($expectedHtmlBody, $result->renderHTML());
$this->assertEquals($expectedHtmlBody, $result->renderHtml());
$this->assertEquals($expectedTextBody, $result->renderText());
$this->assertSame('OC\Mail\EMailTemplate', get_class($result));
}
@ -621,7 +621,7 @@ EOF;
$message
->expects($this->at(2))
->method('setHtmlBody')
->with($emailTemplate->renderHTML());
->with($emailTemplate->renderHtml());
$message
->expects($this->at(3))
->method('setPlainBody')

View File

@ -85,7 +85,7 @@ class EMailTemplateTest extends TestCase {
);
$expectedHTML = file_get_contents(\OC::$SERVERROOT . '/tests/data/emails/new-account-email.html');
$this->assertSame($expectedHTML, $this->emailTemplate->renderHTML());
$this->assertSame($expectedHTML, $this->emailTemplate->renderHtml());
$expectedTXT = file_get_contents(\OC::$SERVERROOT . '/tests/data/emails/new-account-email.txt');
$this->assertSame($expectedTXT, $this->emailTemplate->renderText());
}
@ -124,7 +124,7 @@ class EMailTemplateTest extends TestCase {
$this->emailTemplate->addFooter();
$expectedHTML = file_get_contents(\OC::$SERVERROOT . '/tests/data/emails/new-account-email-custom.html');
$this->assertSame($expectedHTML, $this->emailTemplate->renderHTML());
$this->assertSame($expectedHTML, $this->emailTemplate->renderHtml());
$expectedTXT = file_get_contents(\OC::$SERVERROOT . '/tests/data/emails/new-account-email-custom.txt');
$this->assertSame($expectedTXT, $this->emailTemplate->renderText());
}
@ -163,7 +163,7 @@ class EMailTemplateTest extends TestCase {
$this->emailTemplate->addFooter();
$expectedHTML = file_get_contents(\OC::$SERVERROOT . '/tests/data/emails/new-account-email-single-button.html');
$this->assertSame($expectedHTML, $this->emailTemplate->renderHTML());
$this->assertSame($expectedHTML, $this->emailTemplate->renderHtml());
$expectedTXT = file_get_contents(\OC::$SERVERROOT . '/tests/data/emails/new-account-email-single-button.txt');
$this->assertSame($expectedTXT, $this->emailTemplate->renderText());
}
@ -205,7 +205,7 @@ class EMailTemplateTest extends TestCase {
$this->emailTemplate->addFooter();
$expectedHTML = file_get_contents(\OC::$SERVERROOT . '/tests/data/emails/new-account-email-custom.html');
$this->assertSame($expectedHTML, $this->emailTemplate->renderHTML());
$this->assertSame($expectedHTML, $this->emailTemplate->renderHtml());
$expectedTXT = file_get_contents(\OC::$SERVERROOT . '/tests/data/emails/new-account-email-custom-text-alternative.txt');
$this->assertSame($expectedTXT, $this->emailTemplate->renderText());
}