Browse Source

'MessageInterface::createAttachment()' renamed to 'MessageInterface::attachContentAsFile()'

tags/2.0.0-beta
Paul Klimov 11 years ago
parent
commit
4a9d546c79
  1. 2
      extensions/swiftmailer/yii/swiftmailer/Message.php
  2. 2
      framework/yii/mail/BaseMessage.php
  3. 4
      framework/yii/mail/MessageInterface.php
  4. 2
      tests/unit/extensions/swiftmailer/MessageTest.php
  5. 2
      tests/unit/framework/mail/BaseMailerTest.php

2
extensions/swiftmailer/yii/swiftmailer/Message.php

@ -115,7 +115,7 @@ class Message extends BaseMessage
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function createAttachment($content, $fileName, $contentType = 'application/octet-stream') public function attachContentAsFile($content, $fileName, $contentType = 'application/octet-stream')
{ {
if (empty($contentType)) { if (empty($contentType)) {
$contentType = 'application/octet-stream'; $contentType = 'application/octet-stream';

2
framework/yii/mail/BaseMessage.php

@ -75,7 +75,7 @@ abstract class BaseMessage extends Object implements MessageInterface
$attachFileName = basename($fileName); $attachFileName = basename($fileName);
} }
$content = file_get_contents($fileName); $content = file_get_contents($fileName);
$this->createAttachment($content, $attachFileName, $contentType); $this->attachContentAsFile($content, $attachFileName, $contentType);
} }
/** /**

4
framework/yii/mail/MessageInterface.php

@ -82,12 +82,12 @@ interface MessageInterface
public function addHtml($html); public function addHtml($html);
/** /**
* Create file attachment for the email message. * Attach specified content as file for the email message.
* @param string $content attachment file content. * @param string $content attachment file content.
* @param string $fileName attachment file name. * @param string $fileName attachment file name.
* @param string $contentType MIME type of the attachment file, by default 'application/octet-stream' will be used. * @param string $contentType MIME type of the attachment file, by default 'application/octet-stream' will be used.
*/ */
public function createAttachment($content, $fileName, $contentType = 'application/octet-stream'); public function attachContentAsFile($content, $fileName, $contentType = 'application/octet-stream');
/** /**
* Attaches existing file to the email message. * Attaches existing file to the email message.

2
tests/unit/extensions/swiftmailer/MessageTest.php

@ -82,7 +82,7 @@ class MessageTest extends VendorTestCase
$message->setFrom('someuser@somedomain.com'); $message->setFrom('someuser@somedomain.com');
$message->setSubject('Yii Swift Create Attachment Test'); $message->setSubject('Yii Swift Create Attachment Test');
$message->setText('Yii Swift Create Attachment Test body'); $message->setText('Yii Swift Create Attachment Test body');
$message->createAttachment('Test attachment content', 'test.txt'); $message->attachContentAsFile('Test attachment content', 'test.txt');
$this->assertTrue($message->send()); $this->assertTrue($message->send());
} }

2
tests/unit/framework/mail/BaseMailerTest.php

@ -187,5 +187,5 @@ class Message extends BaseMessage
public function addHtml($html) {} public function addHtml($html) {}
public function createAttachment($content, $fileName, $contentType = 'application/octet-stream') {} public function attachContentAsFile($content, $fileName, $contentType = 'application/octet-stream') {}
} }
Loading…
Cancel
Save