From c84786171e88bc684e307963adab8885bb1801fa Mon Sep 17 00:00:00 2001
From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org>
Date: Mon, 6 Jan 2014 12:39:20 +0000
Subject: [PATCH] Issue #1928440 by ar-jan: Rename incorrectly named
 MailInterface implementations.

---
 core/lib/Drupal/Core/Mail/MailFactory.php     |  6 ++--
 .../Drupal/Core/Mail/TestMailCollector.php    | 30 +++++++++++++++++++
 core/lib/Drupal/Core/Mail/VariableLog.php     | 30 -------------------
 .../lib/Drupal/simpletest/TestBase.php        |  2 +-
 .../lib/Drupal/simpletest/WebTestBase.php     |  6 ++--
 .../Installer/InstallerTranslationTest.php    |  2 +-
 .../lib/Drupal/system/Tests/InstallerTest.php |  2 +-
 7 files changed, 39 insertions(+), 39 deletions(-)
 create mode 100644 core/lib/Drupal/Core/Mail/TestMailCollector.php
 delete mode 100644 core/lib/Drupal/Core/Mail/VariableLog.php

diff --git a/core/lib/Drupal/Core/Mail/MailFactory.php b/core/lib/Drupal/Core/Mail/MailFactory.php
index d6bef9f717c6..dc1b70621f3d 100644
--- a/core/lib/Drupal/Core/Mail/MailFactory.php
+++ b/core/lib/Drupal/Core/Mail/MailFactory.php
@@ -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
    *
diff --git a/core/lib/Drupal/Core/Mail/TestMailCollector.php b/core/lib/Drupal/Core/Mail/TestMailCollector.php
new file mode 100644
index 000000000000..3b3e0566e64d
--- /dev/null
+++ b/core/lib/Drupal/Core/Mail/TestMailCollector.php
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Mail\TestMailCollector.
+ */
+
+namespace Drupal\Core\Mail;
+
+/**
+ * Defines a mail sending implementation that captures sent messages to the
+ * state system.
+ *
+ * This class is for running tests or for development.
+ */
+class TestMailCollector extends PhpMail implements MailInterface {
+
+  /**
+   * Overrides \Drupal\Core\Mail\PhpMail::mail().
+   *
+   * Accepts an e-mail message and stores it with the state system.
+   */
+  public function mail(array $message) {
+    $captured_emails = \Drupal::state()->get('system.test_mail_collector') ?: array();
+    $captured_emails[] = $message;
+    \Drupal::state()->set('system.test_mail_collector', $captured_emails);
+
+    return TRUE;
+  }
+}
diff --git a/core/lib/Drupal/Core/Mail/VariableLog.php b/core/lib/Drupal/Core/Mail/VariableLog.php
deleted file mode 100644
index c7b52013c5ca..000000000000
--- a/core/lib/Drupal/Core/Mail/VariableLog.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\Core\Mail\VariableLog.
- */
-
-namespace Drupal\Core\Mail;
-
-/**
- * Defines a mail sending implementation that captures sent messages to a
- * variable.
- *
- * This class is for running tests or for development.
- */
-class VariableLog extends PhpMail implements MailInterface {
-
-  /**
-   * Overrides Drupal\Core\Mail\PhpMail::mail().
-   *
-   * Accepts an e-mail message and store it in a variable.
-   */
-  public function mail(array $message) {
-    $captured_emails = \Drupal::state()->get('system.test_email_collector') ?: array();
-    $captured_emails[] = $message;
-    \Drupal::state()->set('system.test_email_collector', $captured_emails);
-
-    return TRUE;
-  }
-}
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
index 2f794b2efd62..9e7b6b2a26d4 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -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.');
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 7541fb26af33..265012e465ba 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -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);
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Installer/InstallerTranslationTest.php b/core/modules/system/lib/Drupal/system/Tests/Installer/InstallerTranslationTest.php
index addfc9e52d35..69b3352bc543 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Installer/InstallerTranslationTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Installer/InstallerTranslationTest.php
@@ -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
diff --git a/core/modules/system/lib/Drupal/system/Tests/InstallerTest.php b/core/modules/system/lib/Drupal/system/Tests/InstallerTest.php
index cda353781eaa..5bbaab865818 100644
--- a/core/modules/system/lib/Drupal/system/Tests/InstallerTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/InstallerTest.php
@@ -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
-- 
GitLab