Commit c8478617 authored by catch's avatar catch

Issue #1928440 by ar-jan: Rename incorrectly named MailInterface implementations.

parent 2026f92d
......@@ -62,7 +62,7 @@ public function __construct(ConfigFactory $configFactory) {
* @code
* array(
* 'default' => 'Drupal\Core\Mail\PhpMail',
* 'user' => 'DevelMailLog',
* 'user' => 'Drupal\devel\DevelMailLog',
* );
* @endcode
*
......@@ -72,8 +72,8 @@ public function __construct(ConfigFactory $configFactory) {
* @code
* array(
* 'default' => 'Drupal\Core\Mail\PhpMail',
* 'user' => 'DevelMailLog',
* 'contact_page_autoreply' => 'DrupalDevNullMailSend',
* 'user' => 'Drupal\devel\DevelMailLog',
* 'contact_page_autoreply' => 'Drupal\example\NullMail',
* );
* @endcode
*
......
......@@ -2,28 +2,28 @@
/**
* @file
* Definition of Drupal\Core\Mail\VariableLog.
* Contains \Drupal\Core\Mail\TestMailCollector.
*/
namespace Drupal\Core\Mail;
/**
* Defines a mail sending implementation that captures sent messages to a
* variable.
* Defines a mail sending implementation that captures sent messages to the
* state system.
*
* This class is for running tests or for development.
*/
class VariableLog extends PhpMail implements MailInterface {
class TestMailCollector extends PhpMail implements MailInterface {
/**
* Overrides Drupal\Core\Mail\PhpMail::mail().
* Overrides \Drupal\Core\Mail\PhpMail::mail().
*
* Accepts an e-mail message and store it in a variable.
* Accepts an e-mail message and stores it with the state system.
*/
public function mail(array $message) {
$captured_emails = \Drupal::state()->get('system.test_email_collector') ?: array();
$captured_emails = \Drupal::state()->get('system.test_mail_collector') ?: array();
$captured_emails[] = $message;
\Drupal::state()->set('system.test_email_collector', $captured_emails);
\Drupal::state()->set('system.test_mail_collector', $captured_emails);
return TRUE;
}
......
......@@ -1075,7 +1075,7 @@ protected function tearDown() {
drupal_static_reset();
if ($this->container->has('state') && $state = $this->container->get('state')) {
$captured_emails = $state->get('system.test_email_collector') ?: array();
$captured_emails = $state->get('system.test_mail_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.');
......
......@@ -844,7 +844,7 @@ protected function setUp() {
}
// Use the test mail class instead of the default mail handler class.
\Drupal::config('system.mail')->set('interface.default', 'Drupal\Core\Mail\VariableLog')->save();
\Drupal::config('system.mail')->set('interface.default', 'Drupal\Core\Mail\TestMailCollector')->save();
drupal_set_time_limit($this->timeLimit);
// Temporary fix so that when running from run-tests.sh we don't get an
......@@ -2452,7 +2452,7 @@ protected function drupalGetSettings() {
* An array containing e-mail messages captured during the current test.
*/
protected function drupalGetMails($filter = array()) {
$captured_emails = \Drupal::state()->get('system.test_email_collector') ?: array();
$captured_emails = \Drupal::state()->get('system.test_mail_collector') ?: array();
$filtered_emails = array();
foreach ($captured_emails as $message) {
......@@ -3449,7 +3449,7 @@ protected function assertNoResponse($code, $message = '', $group = 'Browser') {
* TRUE on pass, FALSE on fail.
*/
protected function assertMail($name, $value = '', $message = '', $group = 'E-mail') {
$captured_emails = \Drupal::state()->get('system.test_email_collector') ?: array();
$captured_emails = \Drupal::state()->get('system.test_mail_collector') ?: array();
$email = end($captured_emails);
return $this->assertTrue($email && isset($email[$name]) && $email[$name] == $value, $message, $group);
}
......
......@@ -132,7 +132,7 @@ protected function setUp() {
), $submit_value);
// Use the test mail class instead of the default mail handler class.
\Drupal::config('system.mail')->set('interface.default', 'Drupal\Core\Mail\VariableLog')->save();
\Drupal::config('system.mail')->set('interface.default', 'Drupal\Core\Mail\TestMailCollector')->save();
drupal_set_time_limit($this->timeLimit);
// When running from run-tests.sh we don't get an empty current path which
......
......@@ -96,7 +96,7 @@ protected function setUp() {
}
// Use the test mail class instead of the default mail handler class.
\Drupal::config('system.mail')->set('interface.default', 'Drupal\Core\Mail\VariableLog')->save();
\Drupal::config('system.mail')->set('interface.default', 'Drupal\Core\Mail\TestMailCollector')->save();
drupal_set_time_limit($this->timeLimit);
// When running from run-tests.sh we don't get an empty current path which
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment