Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
a2c97c9b
Commit
a2c97c9b
authored
Oct 27, 2012
by
webchick
Browse files
Issue
#1824768
by vijaycs85: Convert drupal_test_email_collector() variable to CMI system.
parent
d029eeb5
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Mail/VariableLog.php
View file @
a2c97c9b
...
...
@@ -21,9 +21,9 @@ class VariableLog extends PhpMail implements MailInterface {
* Accepts an e-mail message and store it in a variable.
*/
public
function
mail
(
array
$message
)
{
$captured_emails
=
variable_get
(
'drupal_
test_email_collector'
,
array
()
)
;
$captured_emails
=
state
()
->
get
(
'system.
test_email_collector'
)
?:
array
();
$captured_emails
[]
=
$message
;
variable_set
(
'drupal_
test_email_collector'
,
$captured_emails
);
state
()
->
set
(
'system.
test_email_collector'
,
$captured_emails
);
return
TRUE
;
}
...
...
core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
View file @
a2c97c9b
...
...
@@ -963,8 +963,8 @@ protected function tearDown() {
// In case a fatal error occurred that was not in the test process read the
// log to pick up any fatal errors.
simpletest_log_read
(
$this
->
testId
,
$this
->
databasePrefix
,
get_class
(
$this
),
TRUE
);
$emailCount
=
count
(
variable_get
(
'drupal_test_email_collector'
,
array
())
);
$captured_emails
=
state
()
->
get
(
'system.test_email_collector'
)
?:
array
();
$emailCount
=
count
(
$captured_emails
);
if
(
$emailCount
)
{
$message
=
format_plural
(
$emailCount
,
'1 e-mail was sent during this test.'
,
'@count e-mails were sent during this test.'
);
$this
->
pass
(
$message
,
t
(
'E-mail'
));
...
...
core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
View file @
a2c97c9b
...
...
@@ -2000,7 +2000,7 @@ protected function drupalGetSettings() {
* An array containing e-mail messages captured during the current test.
*/
protected
function
drupalGetMails
(
$filter
=
array
())
{
$captured_emails
=
variable_get
(
'drupal_
test_email_collector'
,
array
()
)
;
$captured_emails
=
state
()
->
get
(
'system.
test_email_collector'
)
?:
array
();
$filtered_emails
=
array
();
foreach
(
$captured_emails
as
$message
)
{
...
...
@@ -2923,7 +2923,7 @@ protected function assertNoResponse($code, $message = '') {
* TRUE on pass, FALSE on fail.
*/
protected
function
assertMail
(
$name
,
$value
=
''
,
$message
=
''
)
{
$captured_emails
=
variable_get
(
'drupal_
test_email_collector'
,
array
()
)
;
$captured_emails
=
state
()
->
get
(
'system.
test_email_collector'
)
?:
array
();
$email
=
end
(
$captured_emails
);
return
$this
->
assertTrue
(
$email
&&
isset
(
$email
[
$name
])
&&
$email
[
$name
]
==
$value
,
$message
,
t
(
'E-mail'
));
}
...
...
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