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
Show 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
/**
* @inheritdoc
*/
public
function
text
(
$text
)
public
function
text
Body
(
$text
)
{
$this
->
setBody
(
$text
,
'text/plain'
);
return
$this
;
...
...
@@ -106,7 +106,7 @@ class Message extends BaseMessage
/**
* @inheritdoc
*/
public
function
html
(
$html
)
public
function
html
Body
(
$html
)
{
$this
->
setBody
(
$html
,
'text/html'
);
return
$this
;
...
...
framework/yii/mail/BaseMailer.php
View file @
104cfd7c
...
...
@@ -52,8 +52,8 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
* - 'cc' argument for [[MessageInterface::cc()]]
* - 'bcc' argument for [[MessageInterface::bcc()]]
* - 'subject' argument for [[MessageInterface::subject()]]
* - 'text
' argument for [[MessageInterface::text
()]]
* - 'html
' argument for [[MessageInterface::html
()]]
* - 'text
Body' argument for [[MessageInterface::textBody
()]]
* - 'html
Body' argument for [[MessageInterface::htmlBody
()]]
* For example:
* ~~~
* array(
...
...
@@ -115,15 +115,15 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
$params
[
'message'
]
=
$message
;
if
(
is_array
(
$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
))
{
$message
->
text
(
$this
->
render
(
$view
[
'text'
],
$params
,
$this
->
textLayout
));
$message
->
text
Body
(
$this
->
render
(
$view
[
'text'
],
$params
,
$this
->
textLayout
));
}
}
else
{
$html
=
$this
->
render
(
$view
,
$params
,
$this
->
htmlLayout
);
$message
->
html
(
$html
);
$message
->
text
(
strip_tags
(
$html
));
$message
->
html
Body
(
$html
);
$message
->
text
Body
(
strip_tags
(
$html
));
}
}
return
$message
;
...
...
@@ -147,8 +147,8 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
'cc'
,
'bcc'
,
'subject'
,
'text'
,
'html'
,
'text
Body
'
,
'html
Body
'
,
];
$directSetterConfig
=
[];
foreach
(
$config
as
$name
=>
$value
)
{
...
...
framework/yii/mail/MessageInterface.php
View file @
104cfd7c
...
...
@@ -87,14 +87,14 @@ interface MessageInterface
* @param string $text message plain text content.
* @return static self reference.
*/
public
function
text
(
$text
);
public
function
text
Body
(
$text
);
/**
* Sets message HTML content.
* @param string $html message HTML content.
* @return static self reference.
*/
public
function
html
(
$html
);
public
function
html
Body
(
$html
);
/**
* Attaches existing file to the email message.
...
...
tests/unit/extensions/swiftmailer/MessageTest.php
View file @
104cfd7c
...
...
@@ -160,7 +160,7 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
subject
(
'Yii Swift Test'
);
$message
->
text
(
'Yii Swift Test body'
);
$message
->
text
Body
(
'Yii Swift Test body'
);
$this
->
assertTrue
(
$message
->
send
());
}
...
...
@@ -174,7 +174,7 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$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__
;
$message
->
attach
(
$fileName
);
...
...
@@ -195,7 +195,7 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$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'
;
$fileContent
=
'Test attachment content'
;
$message
->
attachContent
(
$fileContent
,
[
'fileName'
=>
$fileName
]);
...
...
@@ -221,7 +221,7 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$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
());
...
...
@@ -247,7 +247,7 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$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
());
...
...
@@ -267,8 +267,8 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$message
->
subject
(
'Yii Swift Alternative Body Test'
);
$message
->
html
(
'<b>Yii Swift</b> test HTML body'
);
$message
->
text
(
'Yii Swift test plain text body'
);
$message
->
html
Body
(
'<b>Yii Swift</b> test HTML body'
);
$message
->
text
Body
(
'Yii Swift test plain text body'
);
$this
->
assertTrue
(
$message
->
send
());
...
...
@@ -300,7 +300,7 @@ class MessageTest extends VendorTestCase
$message
->
to
(
$this
->
testEmailReceiver
);
$message
->
from
(
'someuser@somedomain.com'
);
$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
);
$this
->
assertNotEmpty
(
$serializedMessage
,
'Unable to serialize message!'
);
...
...
tests/unit/framework/mail/BaseMailerTest.php
View file @
104cfd7c
...
...
@@ -115,8 +115,8 @@ class BaseMailerTest extends TestCase
'cc'
=>
'cc@domain.com'
,
'bcc'
=>
'bcc@domain.com'
,
'subject'
=>
'Test subject'
,
'text'
=>
'Test text body'
,
'html'
=>
'Test HTML body'
,
'text
Body
'
=>
'Test text body'
,
'html
Body
'
=>
'Test HTML body'
,
];
$propertyConfig
=
[
'id'
=>
'test-id'
,
...
...
@@ -201,12 +201,12 @@ class BaseMailerTest extends TestCase
'html'
=>
$htmlViewName
,
'text'
=>
$textViewName
,
]);
$this
->
assertEquals
(
$htmlViewFileContent
,
$message
->
_html
,
'Unable to render html!'
);
$this
->
assertEquals
(
$textViewFileContent
,
$message
->
_text
,
'Unable to render text!'
);
$this
->
assertEquals
(
$htmlViewFileContent
,
$message
->
_html
Body
,
'Unable to render html!'
);
$this
->
assertEquals
(
$textViewFileContent
,
$message
->
_text
Body
,
'Unable to render text!'
);
$message
=
$mailer
->
compose
(
$htmlViewName
);
$this
->
assertEquals
(
$htmlViewFileContent
,
$message
->
_html
,
'Unable to render html by direct view!'
);
$this
->
assertEquals
(
strip_tags
(
$htmlViewFileContent
),
$message
->
_text
,
'Unable to render text by direct view!'
);
$this
->
assertEquals
(
$htmlViewFileContent
,
$message
->
_html
Body
,
'Unable to render html 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
public
$_cc
;
public
$_bcc
;
public
$_subject
;
public
$_text
;
public
$_html
;
public
$_text
Body
;
public
$_html
Body
;
public
function
charset
(
$charset
)
{
...
...
@@ -276,15 +276,15 @@ class Message extends BaseMessage
return
$this
;
}
public
function
text
(
$text
)
public
function
text
Body
(
$text
)
{
$this
->
_text
=
$text
;
$this
->
_text
Body
=
$text
;
return
$this
;
}
public
function
html
(
$html
)
public
function
html
Body
(
$html
)
{
$this
->
_html
=
$html
;
$this
->
_html
Body
=
$html
;
return
$this
;
}
...
...
tests/unit/framework/mail/BaseMessageTest.php
View file @
104cfd7c
...
...
@@ -97,11 +97,11 @@ class TestMessage extends BaseMessage
public
function
subject
(
$subject
)
{}
public
function
text
(
$text
)
{
public
function
text
Body
(
$text
)
{
$this
->
text
=
$text
;
}
public
function
html
(
$html
)
{
public
function
html
Body
(
$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