Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Mail / MailManagerTest.php
index 9ba2fb52b70ce7877129a6fa2f6bab480b5324ed..de2e3d943faa6f13b6e9a21d3d42d6da070c5eff 100644 (file)
@@ -7,6 +7,7 @@
 
 namespace Drupal\Tests\Core\Mail;
 
+use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Render\RenderContext;
 use Drupal\Core\Render\RendererInterface;
 use Drupal\Tests\UnitTestCase;
@@ -103,6 +104,9 @@ class MailManagerTest extends UnitTestCase {
       'system.mail' => [
         'interface' => $interface,
       ],
+      'system.site' => [
+        'mail' => 'test@example.com',
+      ],
     ]);
     $logger_factory = $this->getMock('\Drupal\Core\Logger\LoggerChannelFactoryInterface');
     $string_translation = $this->getStringTranslationStub();
@@ -110,6 +114,11 @@ class MailManagerTest extends UnitTestCase {
     // Construct the manager object and override its discovery.
     $this->mailManager = new TestMailManager(new \ArrayObject(), $this->cache, $this->moduleHandler, $this->configFactory, $logger_factory, $string_translation, $this->renderer);
     $this->mailManager->setDiscovery($this->discovery);
+
+    // @see \Drupal\Core\Plugin\Factory\ContainerFactory::createInstance()
+    $container = new ContainerBuilder();
+    $container->set('config.factory', $this->configFactory);
+    \Drupal::setContainer($container);
   }
 
   /**
@@ -135,7 +144,6 @@ class MailManagerTest extends UnitTestCase {
     $this->assertInstanceOf('Drupal\Core\Mail\Plugin\Mail\TestMailCollector', $instance);
   }
 
-
   /**
    * Tests that mails are sent in a separate render context.
    *
@@ -163,6 +171,7 @@ class MailManagerTest extends UnitTestCase {
  * Provides a testing version of MailManager with an empty constructor.
  */
 class TestMailManager extends MailManager {
+
   /**
    * Sets the discovery for the manager.
    *