Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
104cfd7c
Commit
104cfd7c
authored
Nov 07, 2013
by
Paul Klimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'yii\mail\MessageInterface' methods renamed: 'text' to 'textBody', 'html' to 'htmlBody'
parent
1aafa73e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
34 deletions
+34
-34
Message.php
extensions/swiftmailer/yii/swiftmailer/Message.php
+2
-2
BaseMailer.php
framework/yii/mail/BaseMailer.php
+8
-8
MessageInterface.php
framework/yii/mail/MessageInterface.php
+2
-2
MessageTest.php
tests/unit/extensions/swiftmailer/MessageTest.php
+8
-8
BaseMailerTest.php
tests/unit/framework/mail/BaseMailerTest.php
+12
-12
BaseMessageTest.php
tests/unit/framework/mail/BaseMessageTest.php
+2
-2
No files found.
extensions/swiftmailer/yii/swiftmailer/Message.php
View file @
104cfd7c
...
@@ -97,7 +97,7 @@ class Message extends BaseMessage
...
@@ -97,7 +97,7 @@ class Message extends BaseMessage
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
public
function
text
(
$text
)
public
function
text
Body
(
$text
)
{
{
$this
->
setBody
(
$text
,
'text/plain'
);
$this
->
setBody
(
$text
,
'text/plain'
);
return
$this
;
return
$this
;
...
@@ -106,7 +106,7 @@ class Message extends BaseMessage
...
@@ -106,7 +106,7 @@ class Message extends BaseMessage
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
public
function
html
(
$html
)
public
function
html
Body
(
$html
)
{
{
$this
->
setBody
(
$html
,
'text/html'
);
$this
->
setBody
(
$html
,
'text/html'
);
return
$this
;
return
$this
;
...
...
framework/yii/mail/BaseMailer.php
View file @
104cfd7c
...
@@ -52,8 +52,8 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
...
@@ -52,8 +52,8 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
* - 'cc' argument for [[MessageInterface::cc()]]
* - 'cc' argument for [[MessageInterface::cc()]]
* - 'bcc' argument for [[MessageInterface::bcc()]]
* - 'bcc' argument for [[MessageInterface::bcc()]]
* - 'subject' argument for [[MessageInterface::subject()]]
* - 'subject' argument for [[MessageInterface::subject()]]
* - 'text
' argument for [[MessageInterface::text
()]]
* - 'text
Body' argument for [[MessageInterface::textBody
()]]
* - 'html
' argument for [[MessageInterface::html
()]]
* - 'html
Body' argument for [[MessageInterface::htmlBody
()]]
* For example:
* For example:
* ~~~
* ~~~
* array(
* array(
...
@@ -115,15 +115,15 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
...
@@ -115,15 +115,15 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
$params
[
'message'
]
=
$message
;
$params
[
'message'
]
=
$message
;
if
(
is_array
(
$view
))
{
if
(
is_array
(
$view
))
{
if
(
array_key_exists
(
'html'
,
$view
))
{
if
(
array_key_exists
(
'html'
,
$view
))
{
$message
->
html
(
$this
->
render
(
$view
[
'html'
],
$params
,
$this
->
htmlLayout
));
$message
->
html
Body
(
$this
->
render
(
$view
[
'html'
],
$params
,
$this
->
htmlLayout
));
}
}
if
(
array_key_exists
(
'text'
,
$view
))
{
if
(
array_key_exists
(
'text'
,
$view
))
{
$message
->
text
(
$this
->
render
(
$view
[
'text'
],
$params
,
$this
->
textLayout
));
$message
->
text
Body
(
$this
->
render
(
$view
[
'text'
],
$params
,
$this
->
textLayout
));
}
}
}
else
{
}
else
{
$html
=
$this
->
render
(
$view
,
$params
,
$this
->
htmlLayout
);
$html
=
$this
->
render
(
$view
,
$params
,
$this
->
htmlLayout
);
$message
->
html
(
$html
);
$message
->
html
Body
(
$html
);
$message
->
text
(
strip_tags
(
$html
));
$message
->
text
Body
(
strip_tags
(
$html
));
}
}
}
}
return
$message
;
return
$message
;
...
@@ -147,8 +147,8 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
...
@@ -147,8 +147,8 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
'cc'
,
'cc'
,
'bcc'
,
'bcc'
,
'subject'
,
'subject'
,
'text'
,
'text
Body
'
,
'html'
,
'html
Body
'
,
];
];
$directSetterConfig
=
[];
$directSetterConfig
=
[];
foreach
(
$config
as
$name
=>
$value
)
{
foreach
(
$config
as
$name
=>
$value
)
{
...
...
framework/yii/mail/MessageInterface.php
View file @
104cfd7c
...
@@ -87,14 +87,14 @@ interface MessageInterface
...
@@ -87,14 +87,14 @@ interface MessageInterface
* @param string $text message plain text content.
* @param string $text message plain text content.
* @return static self reference.
* @return static self reference.
*/
*/
public
function
text
(
$text
);
public
function
text
Body
(
$text
);
/**
/**
* Sets message HTML content.
* Sets message HTML content.
* @param string $html message HTML content.
* @param string $html message HTML content.
* @return static self reference.
* @return static self reference.
*/
*/
public
function
html
(
$html
);
public
function
html
Body
(
$html
);
/**
/**
* Attaches existing file to the email message.
* Attaches existing file to the email message.
...
...
tests/unit/extensions/swiftmailer/MessageTest.php
View file @
104cfd7c
...
@@ -160,7 +160,7 @@ class MessageTest extends VendorTestCase
...
@@ -160,7 +160,7 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
subject
(
'Yii Swift Test'
);
$message
->
subject
(
'Yii Swift Test'
);
$message
->
text
(
'Yii Swift Test body'
);
$message
->
text
Body
(
'Yii Swift Test body'
);
$this
->
assertTrue
(
$message
->
send
());
$this
->
assertTrue
(
$message
->
send
());
}
}
...
@@ -174,7 +174,7 @@ class MessageTest extends VendorTestCase
...
@@ -174,7 +174,7 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
subject
(
'Yii Swift Attach File Test'
);
$message
->
subject
(
'Yii Swift Attach File Test'
);
$message
->
text
(
'Yii Swift Attach File Test body'
);
$message
->
text
Body
(
'Yii Swift Attach File Test body'
);
$fileName
=
__FILE__
;
$fileName
=
__FILE__
;
$message
->
attach
(
$fileName
);
$message
->
attach
(
$fileName
);
...
@@ -195,7 +195,7 @@ class MessageTest extends VendorTestCase
...
@@ -195,7 +195,7 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
subject
(
'Yii Swift Create Attachment Test'
);
$message
->
subject
(
'Yii Swift Create Attachment Test'
);
$message
->
text
(
'Yii Swift Create Attachment Test body'
);
$message
->
text
Body
(
'Yii Swift Create Attachment Test body'
);
$fileName
=
'test.txt'
;
$fileName
=
'test.txt'
;
$fileContent
=
'Test attachment content'
;
$fileContent
=
'Test attachment content'
;
$message
->
attachContent
(
$fileContent
,
[
'fileName'
=>
$fileName
]);
$message
->
attachContent
(
$fileContent
,
[
'fileName'
=>
$fileName
]);
...
@@ -221,7 +221,7 @@ class MessageTest extends VendorTestCase
...
@@ -221,7 +221,7 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
subject
(
'Yii Swift Embed File Test'
);
$message
->
subject
(
'Yii Swift Embed File Test'
);
$message
->
html
(
'Embed image: <img src="'
.
$cid
.
'" alt="pic">'
);
$message
->
html
Body
(
'Embed image: <img src="'
.
$cid
.
'" alt="pic">'
);
$this
->
assertTrue
(
$message
->
send
());
$this
->
assertTrue
(
$message
->
send
());
...
@@ -247,7 +247,7 @@ class MessageTest extends VendorTestCase
...
@@ -247,7 +247,7 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
subject
(
'Yii Swift Embed File Test'
);
$message
->
subject
(
'Yii Swift Embed File Test'
);
$message
->
html
(
'Embed image: <img src="'
.
$cid
.
'" alt="pic">'
);
$message
->
html
Body
(
'Embed image: <img src="'
.
$cid
.
'" alt="pic">'
);
$this
->
assertTrue
(
$message
->
send
());
$this
->
assertTrue
(
$message
->
send
());
...
@@ -267,8 +267,8 @@ class MessageTest extends VendorTestCase
...
@@ -267,8 +267,8 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
subject
(
'Yii Swift Alternative Body Test'
);
$message
->
subject
(
'Yii Swift Alternative Body Test'
);
$message
->
html
(
'<b>Yii Swift</b> test HTML body'
);
$message
->
html
Body
(
'<b>Yii Swift</b> test HTML body'
);
$message
->
text
(
'Yii Swift test plain text body'
);
$message
->
text
Body
(
'Yii Swift test plain text body'
);
$this
->
assertTrue
(
$message
->
send
());
$this
->
assertTrue
(
$message
->
send
());
...
@@ -300,7 +300,7 @@ class MessageTest extends VendorTestCase
...
@@ -300,7 +300,7 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
subject
(
'Yii Swift Alternative Body Test'
);
$message
->
subject
(
'Yii Swift Alternative Body Test'
);
$message
->
text
(
'Yii Swift test plain text body'
);
$message
->
text
Body
(
'Yii Swift test plain text body'
);
$serializedMessage
=
serialize
(
$message
);
$serializedMessage
=
serialize
(
$message
);
$this
->
assertNotEmpty
(
$serializedMessage
,
'Unable to serialize message!'
);
$this
->
assertNotEmpty
(
$serializedMessage
,
'Unable to serialize message!'
);
...
...
tests/unit/framework/mail/BaseMailerTest.php
View file @
104cfd7c
...
@@ -115,8 +115,8 @@ class BaseMailerTest extends TestCase
...
@@ -115,8 +115,8 @@ class BaseMailerTest extends TestCase
'cc'
=>
'cc@domain.com'
,
'cc'
=>
'cc@domain.com'
,
'bcc'
=>
'bcc@domain.com'
,
'bcc'
=>
'bcc@domain.com'
,
'subject'
=>
'Test subject'
,
'subject'
=>
'Test subject'
,
'text'
=>
'Test text body'
,
'text
Body
'
=>
'Test text body'
,
'html'
=>
'Test HTML body'
,
'html
Body
'
=>
'Test HTML body'
,
];
];
$propertyConfig
=
[
$propertyConfig
=
[
'id'
=>
'test-id'
,
'id'
=>
'test-id'
,
...
@@ -201,12 +201,12 @@ class BaseMailerTest extends TestCase
...
@@ -201,12 +201,12 @@ class BaseMailerTest extends TestCase
'html'
=>
$htmlViewName
,
'html'
=>
$htmlViewName
,
'text'
=>
$textViewName
,
'text'
=>
$textViewName
,
]);
]);
$this
->
assertEquals
(
$htmlViewFileContent
,
$message
->
_html
,
'Unable to render html!'
);
$this
->
assertEquals
(
$htmlViewFileContent
,
$message
->
_html
Body
,
'Unable to render html!'
);
$this
->
assertEquals
(
$textViewFileContent
,
$message
->
_text
,
'Unable to render text!'
);
$this
->
assertEquals
(
$textViewFileContent
,
$message
->
_text
Body
,
'Unable to render text!'
);
$message
=
$mailer
->
compose
(
$htmlViewName
);
$message
=
$mailer
->
compose
(
$htmlViewName
);
$this
->
assertEquals
(
$htmlViewFileContent
,
$message
->
_html
,
'Unable to render html by direct view!'
);
$this
->
assertEquals
(
$htmlViewFileContent
,
$message
->
_html
Body
,
'Unable to render html by direct view!'
);
$this
->
assertEquals
(
strip_tags
(
$htmlViewFileContent
),
$message
->
_text
,
'Unable to render text by direct view!'
);
$this
->
assertEquals
(
strip_tags
(
$htmlViewFileContent
),
$message
->
_text
Body
,
'Unable to render text by direct view!'
);
}
}
}
}
...
@@ -237,8 +237,8 @@ class Message extends BaseMessage
...
@@ -237,8 +237,8 @@ class Message extends BaseMessage
public
$_cc
;
public
$_cc
;
public
$_bcc
;
public
$_bcc
;
public
$_subject
;
public
$_subject
;
public
$_text
;
public
$_text
Body
;
public
$_html
;
public
$_html
Body
;
public
function
charset
(
$charset
)
public
function
charset
(
$charset
)
{
{
...
@@ -276,15 +276,15 @@ class Message extends BaseMessage
...
@@ -276,15 +276,15 @@ class Message extends BaseMessage
return
$this
;
return
$this
;
}
}
public
function
text
(
$text
)
public
function
text
Body
(
$text
)
{
{
$this
->
_text
=
$text
;
$this
->
_text
Body
=
$text
;
return
$this
;
return
$this
;
}
}
public
function
html
(
$html
)
public
function
html
Body
(
$html
)
{
{
$this
->
_html
=
$html
;
$this
->
_html
Body
=
$html
;
return
$this
;
return
$this
;
}
}
...
...
tests/unit/framework/mail/BaseMessageTest.php
View file @
104cfd7c
...
@@ -97,11 +97,11 @@ class TestMessage extends BaseMessage
...
@@ -97,11 +97,11 @@ class TestMessage extends BaseMessage
public
function
subject
(
$subject
)
{}
public
function
subject
(
$subject
)
{}
public
function
text
(
$text
)
{
public
function
text
Body
(
$text
)
{
$this
->
text
=
$text
;
$this
->
text
=
$text
;
}
}
public
function
html
(
$html
)
{
public
function
html
Body
(
$html
)
{
$this
->
html
=
$html
;
$this
->
html
=
$html
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment