From f2ad5407adb636ef762b15eb63ccabb6db72c558 Mon Sep 17 00:00:00 2001
From: Nadir Sunar <dernadir@gmail.com>
Date: Tue, 7 Jun 2016 18:15:11 +0200
Subject: [PATCH] [TASK] replaced @expectedException in sysext:extensionmanager
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Resolves: #76504
Releases: master
Change-Id: Id57369db6eb398db0b391ea23f325ee219d76424
Reviewed-on: https://review.typo3.org/48487
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Gordon Brüggemann <gordon.brueggemann@gmx.de>
Tested-by: Gordon Brüggemann <gordon.brueggemann@gmx.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
---
 .../Tests/Unit/Domain/Model/DownloadQueueTest.php        | 9 +++++----
 .../Tests/Unit/Utility/FileHandlingUtilityTest.php       | 7 +++++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/typo3/sysext/extensionmanager/Tests/Unit/Domain/Model/DownloadQueueTest.php b/typo3/sysext/extensionmanager/Tests/Unit/Domain/Model/DownloadQueueTest.php
index dc67b9452479..2a515909dc1a 100644
--- a/typo3/sysext/extensionmanager/Tests/Unit/Domain/Model/DownloadQueueTest.php
+++ b/typo3/sysext/extensionmanager/Tests/Unit/Domain/Model/DownloadQueueTest.php
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Domain\Model;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException;
 
 /**
  * Download queue test
@@ -67,19 +68,17 @@ class DownloadQueueTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException
-     * @expectedExceptionCode 1342432103
      */
     public function addExtensionToQueueThrowsExceptionIfUnknownStackIsGiven()
     {
+        $this->expectException(ExtensionManagerException::class);
+        $this->expectExceptionCode(1342432103);
         $this->downloadQueueMock->addExtensionToQueue($this->extensionMock, 'unknownStack');
     }
 
     /**
      * @test
      * @return void
-     * @expectedException \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException
-     * @expectedExceptionCode 1342432101
      */
     public function addExtensionToQueueThrowsExceptionIfExtensionWithSameKeyAndDifferentValuesAlreadyExists()
     {
@@ -88,6 +87,8 @@ class DownloadQueueTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $extensionMock2->setExtensionKey('foobar');
         $extensionMock2->setVersion('1.0.3');
 
+        $this->expectException(ExtensionManagerException::class);
+        $this->expectExceptionCode(1342432101);
         $this->downloadQueueMock->addExtensionToQueue($extensionMock2);
         $this->downloadQueueMock->addExtensionToQueue($this->extensionMock);
     }
diff --git a/typo3/sysext/extensionmanager/Tests/Unit/Utility/FileHandlingUtilityTest.php b/typo3/sysext/extensionmanager/Tests/Unit/Utility/FileHandlingUtilityTest.php
index b4c33bb10947..303f52414e46 100644
--- a/typo3/sysext/extensionmanager/Tests/Unit/Utility/FileHandlingUtilityTest.php
+++ b/typo3/sysext/extensionmanager/Tests/Unit/Utility/FileHandlingUtilityTest.php
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Utility;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException;
 
 /**
  * Testcase
@@ -83,10 +84,11 @@ class FileHandlingUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      * @param string $invalidRelativePath
      * @test
      * @dataProvider invalidRelativePathDataProvider
-     * @expectedException \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException
      */
     public function getAbsolutePathThrowsExceptionForInvalidRelativePaths($invalidRelativePath)
     {
+        $this->expectException(ExtensionManagerException::class);
+        $this->expectExceptionCode(1350742864);
         $fileHandlerMock = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility::class, array('dummy'), array());
         $fileHandlerMock->_call('getAbsolutePath', $invalidRelativePath);
     }
@@ -133,11 +135,12 @@ class FileHandlingUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException
      * @return void
      */
     public function makeAndClearExtensionDirThrowsExceptionOnInvalidPath()
     {
+        $this->expectException(ExtensionManagerException::class);
+        $this->expectExceptionCode(1337280417);
         $fileHandlerMock = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility::class, array('removeDirectory', 'addDirectory'));
         $languageServiceMock = $this->getMock(\TYPO3\CMS\Lang\LanguageService::class);
         $fileHandlerMock->_set('languageService', $languageServiceMock);
-- 
GitLab