From c9846fdf8cf9c96b7f6492ec67ca6756db7f45ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sascha=20L=C3=B6ffler?= <lsascha@gmail.com>
Date: Sat, 17 Mar 2018 15:35:37 +0100
Subject: [PATCH] [TASK] Make DispatcherTest notice free

Resolves: #84437
Releases: master
Change-Id: I9ef4f6de180d1be9cdcc90347c747bbb06cfc9ad
Reviewed-on: https://review.typo3.org/56311
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../extbase/Classes/SignalSlot/Dispatcher.php |  2 +-
 .../Tests/Unit/SignalSlot/DispatcherTest.php  | 40 +++++++++----------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php b/typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php
index a5fc63678b93..1cb17e71db90 100644
--- a/typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php
+++ b/typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php
@@ -119,7 +119,7 @@ class Dispatcher implements \TYPO3\CMS\Core\SingletonInterface
                 $object = $slotInformation['object'];
             } else {
                 if (!isset($this->objectManager)) {
-                    throw new Exception\InvalidSlotException(sprintf('Cannot dispatch %s::%s to class %s. The object manager is not yet available in the Signal Slot Dispatcher and therefore it cannot dispatch classes.', $signalClassName, $signalName, $slotInformation['class']), 1298113624);
+                    throw new Exception\InvalidSlotException(sprintf('Cannot dispatch %s::%s to class %s. The object manager is not yet available in the Signal Slot Dispatcher and therefore it cannot dispatch classes.', $signalClassName, $signalName, $slotInformation['class'] ?? ''), 1298113624);
                 }
                 if (!$this->objectManager->isRegistered($slotInformation['class'])) {
                     throw new Exception\InvalidSlotException('The given class "' . $slotInformation['class'] . '" is not a registered object.', 1245673367);
diff --git a/typo3/sysext/extbase/Tests/Unit/SignalSlot/DispatcherTest.php b/typo3/sysext/extbase/Tests/Unit/SignalSlot/DispatcherTest.php
index a922a8974194..7f603507a4f6 100644
--- a/typo3/sysext/extbase/Tests/Unit/SignalSlot/DispatcherTest.php
+++ b/typo3/sysext/extbase/Tests/Unit/SignalSlot/DispatcherTest.php
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\Extbase\Tests\Unit\SignalSlot;
 
 /*
@@ -14,21 +15,20 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\SignalSlot;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
 use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException;
 use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotReturnException;
+use TYPO3\CMS\Extbase\Tests\Fixture\SlotFixture;
 use TYPO3\CMS\Extbase\Tests\Unit\SignalSlot\Fixtures\OnlyClassNameSpecifiedFixture;
 use TYPO3\CMS\Extbase\Tests\Unit\SignalSlot\Fixtures\SlotMethodDoesNotExistFixture;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class DispatcherTest extends UnitTestCase
 {
-    /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
     /**
      * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
      */
@@ -36,7 +36,7 @@ class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
     protected function setUp()
     {
-        $accessibleClassName = $this->getAccessibleMock(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class, ['dummy']);
+        $accessibleClassName = $this->getAccessibleMock(Dispatcher::class, ['dummy']);
         $this->signalSlotDispatcher = new $accessibleClassName();
     }
 
@@ -114,7 +114,7 @@ class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $slotClassName = OnlyClassNameSpecifiedFixture::class;
         $mockSlot = new OnlyClassNameSpecifiedFixture();
-        $mockObjectManager = $this->createMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
+        $mockObjectManager = $this->createMock(ObjectManagerInterface::class);
         $mockObjectManager->expects($this->once())->method('isRegistered')->with($slotClassName)->will($this->returnValue(true));
         $mockObjectManager->expects($this->once())->method('get')->with($slotClassName)->will($this->returnValue($mockSlot));
         $this->signalSlotDispatcher->_set('objectManager', $mockObjectManager);
@@ -131,7 +131,7 @@ class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $this->signalSlotDispatcher->_set('isInitialized', true);
 
-        $firstMockSlot = $this->createMock(\TYPO3\CMS\Extbase\Tests\Fixture\SlotFixture::class);
+        $firstMockSlot = $this->createMock(SlotFixture::class);
         $firstMockSlot->expects($this->once())
             ->method('slot')
             ->will($this->returnCallback(
@@ -140,7 +140,7 @@ class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                         }
                     ));
 
-        $secondMockSlot = $this->createMock(\TYPO3\CMS\Extbase\Tests\Fixture\SlotFixture::class);
+        $secondMockSlot = $this->createMock(SlotFixture::class);
         $secondMockSlot->expects($this->once())
             ->method('slot')
             ->with('modified_bar', 'modified_quux');
@@ -158,7 +158,7 @@ class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $this->signalSlotDispatcher->_set('isInitialized', true);
 
-        $firstMockSlot = $this->createMock(\TYPO3\CMS\Extbase\Tests\Fixture\SlotFixture::class);
+        $firstMockSlot = $this->createMock(SlotFixture::class);
         $firstMockSlot->expects($this->once())
             ->method('slot')
             ->will($this->returnCallback(
@@ -167,7 +167,7 @@ class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                         }
                     ));
 
-        $secondMockSlot = $this->createMock(\TYPO3\CMS\Extbase\Tests\Fixture\SlotFixture::class);
+        $secondMockSlot = $this->createMock(SlotFixture::class);
         $secondMockSlot->expects($this->once())
             ->method('slot')
             ->with('modified_bar', 'modified_quux');
@@ -185,7 +185,7 @@ class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $this->signalSlotDispatcher->_set('isInitialized', true);
 
-        $firstMockSlot = $this->createMock(\TYPO3\CMS\Extbase\Tests\Fixture\SlotFixture::class);
+        $firstMockSlot = $this->createMock(SlotFixture::class);
         $firstMockSlot->expects($this->once())
             ->method('slot')
             ->will($this->returnCallback(
@@ -194,11 +194,11 @@ class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                         }
                     ));
 
-        $secondMockSlot = $this->createMock(\TYPO3\CMS\Extbase\Tests\Fixture\SlotFixture::class);
+        $secondMockSlot = $this->createMock(SlotFixture::class);
         $secondMockSlot->expects($this->once())
             ->method('slot');
 
-        $thirdMockSlot = $this->createMock(\TYPO3\CMS\Extbase\Tests\Fixture\SlotFixture::class);
+        $thirdMockSlot = $this->createMock(SlotFixture::class);
         $thirdMockSlot->expects($this->once())
             ->method('slot')
             ->with('modified_bar', 'modified_quux');
@@ -219,7 +219,7 @@ class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $this->expectExceptionCode(1376683067);
         $this->signalSlotDispatcher->_set('isInitialized', true);
 
-        $mockSlot = $this->createMock(\TYPO3\CMS\Extbase\Tests\Fixture\SlotFixture::class);
+        $mockSlot = $this->createMock(SlotFixture::class);
         $mockSlot->expects($this->once())
             ->method('slot')
             ->will($this->returnCallback(
@@ -241,7 +241,7 @@ class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $this->expectExceptionCode(1376683066);
         $this->signalSlotDispatcher->_set('isInitialized', true);
 
-        $mockSlot = $this->createMock(\TYPO3\CMS\Extbase\Tests\Fixture\SlotFixture::class);
+        $mockSlot = $this->createMock(SlotFixture::class);
         $mockSlot->expects($this->once())
             ->method('slot')
             ->will($this->returnCallback(
@@ -261,7 +261,7 @@ class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $this->expectException(InvalidSlotException::class);
         $this->expectExceptionCode(1245673367);
-        $mockObjectManager = $this->createMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
+        $mockObjectManager = $this->createMock(ObjectManagerInterface::class);
         $mockObjectManager->expects($this->once())->method('isRegistered')->with('NonExistingClassName')->will($this->returnValue(false));
         $this->signalSlotDispatcher->_set('objectManager', $mockObjectManager);
         $this->signalSlotDispatcher->_set('isInitialized', true);
@@ -278,7 +278,7 @@ class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $this->expectExceptionCode(1245673368);
         $slotClassName = SlotMethodDoesNotExistFixture::class;
         $mockSlot = new SlotMethodDoesNotExistFixture();
-        $mockObjectManager = $this->createMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
+        $mockObjectManager = $this->createMock(ObjectManagerInterface::class);
         $mockObjectManager->expects($this->once())->method('isRegistered')->with($slotClassName)->will($this->returnValue(true));
         $mockObjectManager->expects($this->once())->method('get')->with($slotClassName)->will($this->returnValue($mockSlot));
         $this->signalSlotDispatcher->_set('objectManager', $mockObjectManager);
@@ -297,7 +297,7 @@ class DispatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $mockSlot = function () use (&$arguments) {
             $arguments = func_get_args();
         };
-        $mockObjectManager = $this->createMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
+        $mockObjectManager = $this->createMock(ObjectManagerInterface::class);
         $this->signalSlotDispatcher->connect('SignalClassName', 'methodName', $mockSlot, null, true);
         $this->signalSlotDispatcher->_set('objectManager', $mockObjectManager);
         $this->signalSlotDispatcher->_set('isInitialized', true);
-- 
GitLab