[TASK] Make core/Tests/Unit/Mail/ notice free 51/56751/5
authorJan Helke <typo3@helke.de>
Fri, 20 Apr 2018 09:56:26 +0000 (11:56 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 9 Jun 2018 19:20:33 +0000 (21:20 +0200)
Releases: master
Resolves: #84808
Change-Id: Ia520395c0d4cb3a8efd6529a23a0f65d1fa9247a
Reviewed-on: https://review.typo3.org/56751
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/core/Classes/Mail/TransportFactory.php
typo3/sysext/core/Tests/Unit/Mail/TransportFactoryTest.php

index 636f946..dc6c646 100644 (file)
@@ -117,8 +117,9 @@ class TransportFactory implements SingletonInterface
     /**
      * Creates a spool from mail settings.
      *
-     * @param  array  $mailSettings
+     * @param array $mailSettings
      * @return \Swift_Spool
+     * @throws \RuntimeException
      */
     protected function createSpool(array $mailSettings): \Swift_Spool
     {
@@ -137,8 +138,11 @@ class TransportFactory implements SingletonInterface
             default:
                 $spool = GeneralUtility::makeInstance($mailSettings['transport_spool_type'], $mailSettings);
                 if (!$spool instanceof \Swift_Spool) {
-                    throw new \RuntimeException($mailSettings['spool'] . ' is not an implementation of \\Swift_Spool,
-                            but must implement that interface to be used as a mail spool.', 1466799482);
+                    throw new \RuntimeException(
+                        $mailSettings['transport_spool_type'] . ' is not an implementation of \\Swift_Spool,
+                            but must implement that interface to be used as a mail spool.',
+                        1466799482
+                    );
                 }
                 break;
         }
index 07d9c46..f069297 100644 (file)
@@ -18,6 +18,8 @@ namespace TYPO3\CMS\Core\Tests\Unit\Mail;
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Mail\MemorySpool;
 use TYPO3\CMS\Core\Mail\TransportFactory;
+use TYPO3\CMS\Core\Tests\Unit\Mail\Fixtures\FakeInvalidSpoolFixture;
+use TYPO3\CMS\Core\Tests\Unit\Mail\Fixtures\FakeValidSpoolFixture;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
@@ -27,11 +29,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 class TransportFactoryTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * * @var TransportFactory
      */
     protected $subject;
@@ -44,7 +41,7 @@ class TransportFactoryTest extends UnitTestCase
     /**
      * @test
      */
-    public function getReturnsSwiftSpoolTransportUsingSwiftFileSpool()
+    public function getReturnsSwiftSpoolTransportUsingSwiftFileSpool(): void
     {
         $mailSettings = [
             'transport' => 'mail',
@@ -78,7 +75,7 @@ class TransportFactoryTest extends UnitTestCase
     /**
      * @test
      */
-    public function getReturnsSwiftSpoolTransportUsingSwiftMemorySpool()
+    public function getReturnsSwiftSpoolTransportUsingSwiftMemorySpool(): void
     {
         $mailSettings = [
             'transport' => 'mail',
@@ -109,7 +106,7 @@ class TransportFactoryTest extends UnitTestCase
     /**
      * @test
      */
-    public function getReturnsSwiftSpoolTransportUsingCustomSpool()
+    public function getReturnsSwiftSpoolTransportUsingCustomSpool(): void
     {
         $mailSettings = [
             'transport' => 'mail',
@@ -121,7 +118,7 @@ class TransportFactoryTest extends UnitTestCase
             'transport_mbox_file' => '',
             'defaultMailFromAddress' => '',
             'defaultMailFromName' => '',
-            'transport_spool_type' => 'TYPO3\\CMS\\Core\\Tests\\Unit\\Mail\\Fixtures\\FakeValidSpoolFixture',
+            'transport_spool_type' => FakeValidSpoolFixture::class,
             'transport_spool_filepath' => Environment::getVarPath() . '/messages/',
         ];
 
@@ -139,7 +136,7 @@ class TransportFactoryTest extends UnitTestCase
     /**
      * @test
      */
-    public function getThrowsRuntimeExceptionForInvalidCustomSpool()
+    public function getThrowsRuntimeExceptionForInvalidCustomSpool(): void
     {
         $this->expectException(\RuntimeException::class);
         $this->expectExceptionCode(1466799482);
@@ -154,7 +151,7 @@ class TransportFactoryTest extends UnitTestCase
             'transport_mbox_file' => '',
             'defaultMailFromAddress' => '',
             'defaultMailFromName' => '',
-            'transport_spool_type' => 'TYPO3\\CMS\\Core\\Tests\\Unit\\Mail\\Fixtures\\FakeInvalidSpoolFixture',
+            'transport_spool_type' => FakeInvalidSpoolFixture::class,
             'transport_spool_filepath' => Environment::getVarPath() . '/messages/',
         ];
 
@@ -164,7 +161,7 @@ class TransportFactoryTest extends UnitTestCase
     /**
      * @test
      */
-    public function getReturnsSwiftMailTransport()
+    public function getReturnsSwiftMailTransport(): void
     {
         $mailSettings = [
             'transport' => 'mail',