[TASK] Replace @expectedException annotation in sysext:extbase 10/48510/3
authorNadir Sunar <dernadir@gmail.com>
Wed, 8 Jun 2016 15:12:49 +0000 (17:12 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 8 Jun 2016 18:00:45 +0000 (20:00 +0200)
Use expectException() instead of @expectedException in unit tests
and add expectedExceptionCode() where possible.
This patch handles occurences in sysext:extbase.

Resolves: #76505
Releases: master

Change-Id: I7eba9066f64faed7ca14a0f0f221736750abab46
Reviewed-on: https://review.typo3.org/48510
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Tested-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
33 files changed:
typo3/sysext/extbase/Tests/Unit/Configuration/FrontendConfigurationManagerTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/CommandManagerTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/CommandTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/RequestBuilderTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/AbstractControllerTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/ActionControllerTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/ArgumentTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/ArgumentsTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/CommandControllerTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/MvcPropertyMappingConfigurationServiceTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/RequestTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Web/RequestBuilderTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Web/Routing/UriBuilderTest.php
typo3/sysext/extbase/Tests/Unit/Object/Container/ClassInfoFactoryTest.php
typo3/sysext/extbase/Tests/Unit/Object/Container/ContainerTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Mapper/DataMapFactoryTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Mapper/DataMapperTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Storage/Typo3DbQueryParserTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/RepositoryTest.php
typo3/sysext/extbase/Tests/Unit/Property/PropertyMapperTest.php
typo3/sysext/extbase/Tests/Unit/Property/TypeConverter/DateTimeConverterTest.php
typo3/sysext/extbase/Tests/Unit/Property/TypeConverter/PersistentObjectConverterTest.php
typo3/sysext/extbase/Tests/Unit/Reflection/ObjectAccessTest.php
typo3/sysext/extbase/Tests/Unit/Scheduler/TaskTest.php
typo3/sysext/extbase/Tests/Unit/Security/Cryptography/HashServiceTest.php
typo3/sysext/extbase/Tests/Unit/Service/ExtensionServiceTest.php
typo3/sysext/extbase/Tests/Unit/SignalSlot/DispatcherTest.php
typo3/sysext/extbase/Tests/Unit/Utility/ArrayUtilityTest.php
typo3/sysext/extbase/Tests/Unit/Utility/ExtensionUtilityTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/ConjunctionValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/StringLengthValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/ValidatorResolverTest.php

index f179794..7cfe795 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Configuration;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Extbase\Configuration\Exception\ParseErrorException;
 
 /**
  * Test case
@@ -293,10 +294,11 @@ class FrontendConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCas
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Configuration\Exception\ParseErrorException
      */
     public function overrideSwitchableControllerActionsThrowsExceptionIfFlexFormConfigurationIsInvalid()
     {
+        $this->expectException(ParseErrorException::class);
+        $this->expectExceptionCode(1257146403);
         $frameworkConfiguration = array(
             'pluginName' => 'Pi1',
             'extensionName' => 'SomeExtension',
index c01e066..38575bf 100644 (file)
@@ -20,6 +20,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+use TYPO3\CMS\Extbase\Mvc\Exception\AmbiguousCommandIdentifierException;
+use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchCommandException;
 
 /**
  * Test case
@@ -94,10 +96,11 @@ class CommandManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchCommandException
      */
     public function getCommandByIdentifierThrowsExceptionIfNoMatchingCommandWasFound()
     {
+        $this->expectException(NoSuchCommandException::class);
+        $this->expectExceptionCode(1310556663);
         $mockCommand = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, array(), array(), '', false);
         $mockCommand->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('extensionkey:controller:command'));
         $mockCommands = array($mockCommand);
@@ -107,10 +110,11 @@ class CommandManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\AmbiguousCommandIdentifierException
      */
     public function getCommandByIdentifierThrowsExceptionIfMoreThanOneMatchingCommandWasFound()
     {
+        $this->expectException(AmbiguousCommandIdentifierException::class);
+        $this->expectExceptionCode(1310557169);
         $mockCommand1 = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, array(), array(), '', false);
         $mockCommand1->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('extensionkey:controller:command'));
         $mockCommand2 = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, array(), array(), '', false);
index ccbc265..a5d0d83 100644 (file)
@@ -93,11 +93,12 @@ class CommandTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      * @dataProvider invalidCommandClassNames
-     * @expectedException \InvalidArgumentException
      * @param string $controllerClassName
      */
     public function constructThrowsExceptionIfCommandClassNameIsInvalid($controllerClassName)
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1438782187);
         new \TYPO3\CMS\Extbase\Mvc\Cli\Command($controllerClassName, 'foo');
     }
 
index 37a959c..401afb6 100644 (file)
@@ -20,6 +20,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+use TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentMixingException;
 
 /**
  * Test case
@@ -297,10 +298,11 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentMixingException
      */
     public function ifNamedArgumentsAreUsedAllRequiredArgumentsMustBeNamed()
     {
+        $this->expectException(InvalidArgumentMixingException::class);
+        $this->expectExceptionCode(1309971820);
         $methodParameters = array(
             'testArgument1' => array('optional' => false, 'type' => 'string'),
             'testArgument2' => array('optional' => false, 'type' => 'string')
@@ -311,10 +313,11 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentMixingException
      */
     public function ifUnnamedArgumentsAreUsedAllRequiredArgumentsMustBeUnnamed()
     {
+        $this->expectException(InvalidArgumentMixingException::class);
+        $this->expectExceptionCode(1309971821);
         $methodParameters = array(
             'requiredArgument1' => array('optional' => false, 'type' => 'string'),
             'requiredArgument2' => array('optional' => false, 'type' => 'string')
index 88b45f1..94a5d8e 100644 (file)
@@ -132,10 +132,11 @@ class AbstractControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function addFlashMessageThrowsExceptionOnInvalidMessageBody()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1243258395);
         $controller = $this->getMockForAbstractClass(\TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::class,
             array(),
             '',
index 225d894..8986367 100644 (file)
@@ -16,6 +16,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Controller;
 
 use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
+use TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentTypeException;
+use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchActionException;
 
 /**
  * Test case
@@ -172,10 +174,11 @@ class ActionControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchActionException
      */
     public function resolveActionMethodNameThrowsAnExceptionIfTheActionDefinedInTheRequestDoesNotExist()
     {
+        $this->expectException(NoSuchActionException::class);
+        $this->expectExceptionCode(1186669086);
         $mockRequest = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Request::class, array(), array(), '', false);
         $mockRequest->expects($this->once())->method('getControllerActionName')->will($this->returnValue('fooBar'));
         /** @var \TYPO3\CMS\Extbase\Mvc\Controller\ActionController|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
@@ -279,10 +282,11 @@ class ActionControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentTypeException
      */
     public function initializeActionMethodArgumentsThrowsExceptionIfDataTypeWasNotSpecified()
     {
+        $this->expectException(InvalidArgumentTypeException::class);
+        $this->expectExceptionCode(1253175643);
         $mockRequest = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Request::class, array(), array(), '', false);
         $mockArguments = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Controller\Arguments::class, array(), array(), '', false);
         $mockController = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Controller\ActionController::class, array('fooAction'), array(), '', false);
index 6325509..93f533f 100644 (file)
@@ -59,19 +59,21 @@ class ArgumentTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function constructingArgumentWithoutNameThrowsException()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1232551853);
         new \TYPO3\CMS\Extbase\Mvc\Controller\Argument('', 'Text');
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function constructingArgumentWithInvalidNameThrowsException()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1187951688);
         new \TYPO3\CMS\Extbase\Mvc\Controller\Argument(new \ArrayObject(), 'Text');
     }
 
@@ -108,11 +110,12 @@ class ArgumentTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      * @dataProvider invalidShortNames
-     * @expectedException \InvalidArgumentException
      * @param string $invalidShortName
      */
     public function shortNameShouldThrowExceptionIfInvalid($invalidShortName)
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1195824959);
         $this->simpleValueArgument->setShortName($invalidShortName);
     }
 
index 51e6efe..a699d88 100644 (file)
@@ -225,10 +225,11 @@ class ArgumentsTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \LogicException
      */
     public function callingInvalidMethodThrowsException()
     {
+        $this->expectException(\LogicException::class);
+        $this->expectExceptionCode(1210858451);
         $arguments = new \TYPO3\CMS\Extbase\Mvc\Controller\Arguments();
         $arguments->nonExistingMethod();
     }
index 93fdd24..4ec01c7 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Controller;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
 
 /**
  * Test case
@@ -56,10 +57,11 @@ class CommandControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
      */
     public function quitThrowsStopActionException()
     {
+        $this->expectException(StopActionException::class);
+        // @TODO expectExceptionCode is 0
         $mockResponse = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\Response::class);
         $this->commandController->_set('response', $mockResponse);
         $this->commandController->_call('quit');
@@ -67,10 +69,11 @@ class CommandControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
      */
     public function quitSetsResponseExitCode()
     {
+        $this->expectException(StopActionException::class);
+        // @TODO expectExceptionCode is 0
         $mockResponse = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\Response::class);
         $mockResponse->expects($this->once())->method('setExitCode')->with(123);
         $this->commandController->_set('response', $mockResponse);
index 6b8f52e..b52d12c 100644 (file)
@@ -20,6 +20,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Controller;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+use TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException;
 
 /**
  * Test case
@@ -96,18 +97,23 @@ class MvcPropertyMappingConfigurationServiceTest extends \TYPO3\CMS\Core\Tests\U
         return array(
             'Overriding form fields (string overridden by array) - 1' => array(
                 array('field1', 'field2', 'field2[bla]', 'field2[blubb]'),
+                1255072196
             ),
             'Overriding form fields (string overridden by array) - 2' => array(
                 array('field1', 'field2[bla]', 'field2[bla][blubb][blubb]'),
+                1255072196
             ),
             'Overriding form fields (array overridden by string) - 1' => array(
                 array('field1', 'field2[bla]', 'field2[blubb]', 'field2'),
+                1255072587
             ),
             'Overriding form fields (array overridden by string) - 2' => array(
                 array('field1', 'field2[bla][blubb][blubb]', 'field2[bla]'),
+                1255072587
             ),
             'Empty [] not as last argument' => array(
                 array('field1', 'field2[][bla]'),
+                1255072832
             )
 
         );
@@ -125,12 +131,15 @@ class MvcPropertyMappingConfigurationServiceTest extends \TYPO3\CMS\Core\Tests\U
     }
 
     /**
+     * @param $input
+     * @param $expectExceptionCode
      * @test
      * @dataProvider dataProviderForgenerateTrustedPropertiesTokenWithUnallowedValues
-     * @expectedException \TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException
      */
-    public function generateTrustedPropertiesTokenThrowsExceptionInWrongCases($input)
+    public function generateTrustedPropertiesTokenThrowsExceptionInWrongCases($input, $expectExceptionCode)
     {
+        $this->expectException(InvalidArgumentForHashGenerationException::class);
+        $this->expectExceptionCode($expectExceptionCode);
         $requestHashService = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService::class, array('serializeAndHashFormFieldArray'));
         $requestHashService->generateTrustedPropertiesToken($input);
     }
index 2334f79..94c6a99 100644 (file)
@@ -13,6 +13,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException;
+use TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentTypeException;
 
 /**
  * Test case
@@ -31,30 +33,33 @@ class RequestTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException
      */
     public function setArgumentThrowsExceptionIfTheGivenArgumentNameIsNoString()
     {
+        $this->expectException(InvalidArgumentNameException::class);
+        $this->expectExceptionCode(1210858767);
         $request = new \TYPO3\CMS\Extbase\Mvc\Request();
         $request->setArgument(123, 'theValue');
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException
      */
     public function setArgumentThrowsExceptionIfTheGivenArgumentNameIsAnEmptyString()
     {
+        $this->expectException(InvalidArgumentNameException::class);
+        $this->expectExceptionCode(1210858767);
         $request = new \TYPO3\CMS\Extbase\Mvc\Request();
         $request->setArgument('', 'theValue');
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentTypeException
      */
     public function setArgumentThrowsExceptionIfTheGivenArgumentValueIsAnObject()
     {
+        $this->expectException(InvalidArgumentTypeException::class);
+        $this->expectExceptionCode(1210858767);
         $this->markTestSkipped('Differing behavior from TYPO3.Flow because of backwards compatibility reasons.');
         $request = new \TYPO3\CMS\Extbase\Mvc\Request();
         $request->setArgument('theKey', new \stdClass());
index 02095e8..addb26e 100644 (file)
@@ -13,6 +13,10 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Web;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Error\Http\PageNotFoundException;
+use TYPO3\CMS\Extbase\Mvc\Exception;
+use TYPO3\CMS\Extbase\Mvc\Exception\InvalidActionNameException;
+use TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerNameException;
 
 /**
  * Test case
@@ -227,10 +231,11 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
      */
     public function buildThrowsExceptionIfExtensionNameIsNotConfigured()
     {
+        $this->expectException(Exception::class);
+        $this->expectExceptionCode(1289843275);
         unset($this->configuration['extensionName']);
         $mockConfigurationManager = $this->getMock(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::class);
         $mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
@@ -240,10 +245,11 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
      */
     public function buildThrowsExceptionIfPluginNameIsNotConfigured()
     {
+        $this->expectException(Exception::class);
+        $this->expectExceptionCode(1289843277);
         unset($this->configuration['pluginName']);
         $mockConfigurationManager = $this->getMock(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::class);
         $mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
@@ -254,10 +260,11 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
      */
     public function buildThrowsExceptionIfControllerConfigurationIsEmptyOrNotSet()
     {
+        $this->expectException(Exception::class);
+        $this->expectExceptionCode(1316104317);
         $this->configuration['controllerConfiguration'] = array();
         $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
         $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
@@ -267,10 +274,11 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
      */
     public function buildThrowsExceptionIfControllerConfigurationHasNoDefaultActionDefined()
     {
+        $this->expectException(Exception::class);
+        $this->expectExceptionCode(1295479651);
         $this->configuration['controllerConfiguration']['TheFirstController'] = array();
         $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
         $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
@@ -280,10 +288,11 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
      */
     public function buildThrowsExceptionIfNoDefaultControllerCanBeResolved()
     {
+        $this->expectException(Exception::class);
+        $this->expectExceptionCode(1316104317);
         $this->configuration['controllerConfiguration'] = array(
             '' => array(
                 'actions' => array('foo')
@@ -387,10 +396,11 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
      */
     public function buildThrowsExceptionIfDefaultControllerCantBeDetermined()
     {
+        $this->expectException(Exception::class);
+        $this->expectExceptionCode(1316104317);
         $this->configuration['controllerConfiguration'] = array();
         $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
         $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
@@ -431,10 +441,11 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerNameException
      */
     public function buildThrowsInvalidControllerNameExceptionIfSpecifiedControllerIsNotAllowed()
     {
+        $this->expectException(InvalidControllerNameException::class);
+        $this->expectExceptionCode(1313855173);
         $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
         $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
         $this->mockExtensionService->expects($this->any())->method('getPluginNamespace')->will($this->returnValue('tx_myextension_pi1'));
@@ -449,10 +460,11 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Error\Http\PageNotFoundException
      */
     public function buildThrowsPageNotFoundExceptionIfEnabledAndSpecifiedControllerIsNotAllowed()
     {
+        $this->expectException(PageNotFoundException::class);
+        $this->expectExceptionCode(1313857897);
         $this->configuration['mvc']['throwPageNotFoundExceptionIfActionCantBeResolved'] = 1;
         $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
         $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
@@ -485,10 +497,11 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
      */
     public function buildThrowsExceptionIfDefaultActionCantBeDetermined()
     {
+        $this->expectException(Exception::class);
+        $this->expectExceptionCode(1316104317);
         $this->configuration['controllerConfiguration'] = array();
         $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
         $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
@@ -545,10 +558,11 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\InvalidActionNameException
      */
     public function buildThrowsInvalidActionNameExceptionIfSpecifiedActionIsNotAllowed()
     {
+        $this->expectException(InvalidActionNameException::class);
+        $this->expectExceptionCode(1313855175);
         $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
         $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
         $this->mockExtensionService->expects($this->any())->method('getPluginNamespace')->will($this->returnValue('tx_myextension_pi1'));
@@ -563,10 +577,11 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Error\Http\PageNotFoundException
      */
     public function buildThrowsPageNotFoundExceptionIfEnabledAndSpecifiedActionIsNotAllowed()
     {
+        $this->expectException(PageNotFoundException::class);
+        $this->expectExceptionCode(1313857898);
         $this->configuration['mvc']['throwPageNotFoundExceptionIfActionCantBeResolved'] = 1;
         $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
         $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
index 25587c2..87dd07f 100644 (file)
@@ -19,6 +19,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
 use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
 use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
+use TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentValueException;
 use TYPO3\CMS\Extbase\Mvc\Web\Request;
 use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
 use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
@@ -812,10 +813,11 @@ class UriBuilderTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentValueException
      */
     public function conversionOfTansientObjectsThrowsExceptionForOtherThanValueObjects()
     {
+        $this->expectException(InvalidArgumentValueException::class);
+        $this->expectExceptionCode(1260881688);
         $mockEntity = new EntityFixture();
         $mockEntity->name = 'foo';
         /** @var UriBuilder|\PHPUnit_Framework_MockObject_MockObject|Object $mockUriBuilder */
index 1fbcb82..ddda0e3 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Object\Container;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Extbase\Object\Container\Exception\UnknownObjectException;
 
 /**
  * Test case
@@ -34,10 +35,11 @@ class ClassInfoFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Object\Container\Exception\UnknownObjectException
      */
     public function buildClassInfoFromClassNameThrowsExceptionIfGivenClassNameCantBeReflected()
     {
+        $this->expectException(UnknownObjectException::class);
+        $this->expectExceptionCode(1289386765);
         $this->classInfoFactory->buildClassInfoFromClassName('SomeNonExistingClass');
     }
 
index 5b5c49f..16f4432 100644 (file)
@@ -13,6 +13,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Object\Container;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Extbase\Object\Exception;
+use TYPO3\CMS\Extbase\Object\Exception\CannotBuildObjectException;
 
 /**
  * Test case
@@ -99,10 +101,11 @@ class ContainerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Object\Exception
      */
     public function getInstanceThrowsExceptionWhenTryingToInstanciateASingletonWithConstructorParameters()
     {
+        $this->expectException(Exception::class);
+        $this->expectExceptionCode(1292858051);
         $this->container->getInstance('t3lib_object_tests_amixed_array_singleton', array('somevalue'));
     }
 
@@ -150,28 +153,31 @@ class ContainerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Object\Exception\CannotBuildObjectException
      */
     public function getInstanceThrowsExceptionIfPrototypeObjectsWiredViaConstructorInjectionContainCyclicDependencies()
     {
+        $this->expectException(CannotBuildObjectException::class);
+        $this->expectExceptionCode(1295611406);
         $this->container->getInstance('t3lib_object_tests_cyclic1WithSetterDependency');
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Object\Exception\CannotBuildObjectException
      */
     public function getInstanceThrowsExceptionIfPrototypeObjectsWiredViaSetterInjectionContainCyclicDependencies()
     {
+        $this->expectException(CannotBuildObjectException::class);
+        $this->expectExceptionCode(1295611406);
         $this->container->getInstance('t3lib_object_tests_cyclic1');
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Object\Exception
      */
     public function getInstanceThrowsExceptionIfClassWasNotFound()
     {
+        $this->expectException(Exception::class);
+        $this->expectExceptionCode(1289386765);
         $this->container->getInstance('nonextistingclass_bla');
     }
 
index 1143a9a..1f50813 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Persistence\Generic\Mapper;
 use TYPO3\CMS\Core\DataHandling\TableColumnSubType;
 use TYPO3\CMS\Core\DataHandling\TableColumnType;
 use TYPO3\CMS\Core\Tests\AccessibleObjectInterface;
+use TYPO3\CMS\Extbase\Persistence\Generic\Exception\InvalidClassException;
 use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap;
 
 /**
@@ -362,10 +363,11 @@ class DataMapFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Persistence\Generic\Exception\InvalidClassException
      */
     public function buildDataMapThrowsExceptionIfClassNameIsNotKnown()
     {
+        $this->expectException(InvalidClassException::class);
+        // @TODO expectExceptionCode is 0
         $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, array('getControlSection'), array(), '', false);
         $cacheMock = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, array('get'), array(), '', false);
         $cacheMock->expects($this->any())->method('get')->will($this->returnValue(false));
index dce21e7..e79dd76 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Persistence\Generic\Mapper;
  */
 
 use TYPO3\CMS\Core\Tests\AccessibleObjectInterface;
+use TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnexpectedTypeException;
 use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap;
 use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper;
 
@@ -309,10 +310,11 @@ class DataMapperTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnexpectedTypeException
      */
     public function getPlainValueCallsGetRealInstanceOnInputIfInputIsInstanceOfLazyLoadingProxy()
     {
+        $this->expectException(UnexpectedTypeException::class);
+        $this->expectExceptionCode(1274799934);
         $dataMapper = new DataMapper();
         $input = $this->getMock(
             \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy::class,
index c8263f1..6fc7ab9 100644 (file)
@@ -82,37 +82,41 @@ class QueryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function setLimitAcceptsOnlyIntegers()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1245071870);
         $this->query->setLimit(1.5);
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function setLimitRejectsIntegersLessThanOne()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1245071870);
         $this->query->setLimit(0);
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function setOffsetAcceptsOnlyIntegers()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1245071872);
         $this->query->setOffset(1.5);
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function setOffsetRejectsIntegersLessThanZero()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1245071872);
         $this->query->setOffset(-1);
     }
 
index d92bb00..36a404d 100644 (file)
@@ -15,6 +15,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Persistence\Generic\Storage;
  */
 use Prophecy\Argument;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
+use TYPO3\CMS\Extbase\Persistence\Generic\Exception\InconsistentQuerySettingsException;
+use TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnsupportedOrderException;
 
 class Typo3DbQueryParserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 {
@@ -191,10 +193,11 @@ class Typo3DbQueryParserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnsupportedOrderException
      */
     public function orderStatementGenerationThrowsExceptionOnUnsupportedOrder()
     {
+        $this->expectException(UnsupportedOrderException::class);
+        $this->expectExceptionCode(1242816074);
         $mockSource = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\Selector::class, array('getNodeTypeName'), array(), '', false);
         $mockSource->expects($this->never())->method('getNodeTypeName');
         $mockDataMapper = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class, array('convertPropertyNameToColumnName', 'convertClassNameToTableName'), array(), '', false);
@@ -321,10 +324,11 @@ class Typo3DbQueryParserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Persistence\Generic\Exception\InconsistentQuerySettingsException
      */
     public function visibilityConstraintStatementGenerationThrowsExceptionIfTheQuerySettingsAreInconsistent()
     {
+        $this->expectException(InconsistentQuerySettingsException::class);
+        $this->expectExceptionCode(1460975922);
         $tableName = 'tx_foo_table';
         $GLOBALS['TCA'][$tableName]['ctrl'] = array(
             'enablecolumns' => array(
index 3a063c6..0b15bf4 100644 (file)
@@ -13,6 +13,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Persistence;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException;
+use TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnsupportedMethodException;
 
 /**
  * Test case
@@ -259,39 +261,44 @@ class RepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnsupportedMethodException
      */
     public function magicCallMethodTriggersAnErrorIfUnknownMethodsAreCalled()
     {
+        $this->expectException(UnsupportedMethodException::class);
+        $this->expectExceptionCode(1233180480);
         $repository = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Repository::class, array('createQuery'), array($this->mockObjectManager));
         $repository->__call('foo', array());
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
      */
     public function addChecksObjectType()
     {
+        $this->expectException(IllegalObjectTypeException::class);
+        $this->expectExceptionCode(1248363335);
         $this->repository->_set('objectType', 'ExpectedObjectType');
         $this->repository->add(new \stdClass());
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
      */
     public function removeChecksObjectType()
     {
+        $this->expectException(IllegalObjectTypeException::class);
+        $this->expectExceptionCode(1248363336);
         $this->repository->_set('objectType', 'ExpectedObjectType');
         $this->repository->remove(new \stdClass());
     }
+
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
      */
     public function updateChecksObjectType()
     {
+        $this->expectException(IllegalObjectTypeException::class);
+        $this->expectExceptionCode(1249479625);
         $repository = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Repository::class, array('dummy'), array($this->mockObjectManager));
         $repository->_set('objectType', 'ExpectedObjectType');
 
@@ -365,10 +372,11 @@ class RepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
      */
     public function updateRejectsObjectsOfWrongType()
     {
+        $this->expectException(IllegalObjectTypeException::class);
+        $this->expectExceptionCode(1249479625);
         $this->repository->_set('objectType', 'Foo');
         $this->repository->update(new \stdClass());
     }
index 04543a0..151cf82 100644 (file)
@@ -21,6 +21,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Property;
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
 
+use TYPO3\CMS\Extbase\Property\Exception\InvalidSourceException;
 use TYPO3\CMS\Extbase\Tests\Unit\Property\Fixtures\DataProviderOneInterface;
 use TYPO3\CMS\Extbase\Tests\Unit\Property\Fixtures\DataProviderThree;
 use TYPO3\CMS\Extbase\Tests\Unit\Property\Fixtures\DataProviderThreeInterface;
@@ -89,11 +90,12 @@ class PropertyMapperTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      * @dataProvider invalidSourceTypes
-     * @expectedException \TYPO3\CMS\Extbase\Property\Exception\InvalidSourceException
      * @param mixed $source
      */
     public function sourceWhichIsNoSimpleTypeThrowsException($source)
     {
+        $this->expectException(InvalidSourceException::class);
+        $this->expectExceptionCode(1297773150);
         /** @var \TYPO3\CMS\Extbase\Property\PropertyMapper|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
         $propertyMapper = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Property\PropertyMapper::class, array('dummy'));
         $propertyMapper->_call('determineSourceType', $source);
index af6bc5a..c700fbb 100644 (file)
@@ -21,6 +21,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Property\TypeConverter;
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
 
+use TYPO3\CMS\Extbase\Property\Exception\TypeConverterException;
 use TYPO3\CMS\Extbase\Tests\Unit\Property\TypeConverter\Fixtures\DateTimeSubFixture;
 
 /**
@@ -229,10 +230,11 @@ class DateTimeConverterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Property\Exception\TypeConverterException
      */
     public function convertFromThrowsExceptionIfGivenArrayDoesNotSpecifyTheDate()
     {
+        $this->expectException(TypeConverterException::class);
+        $this->expectExceptionCode(1308003914);
         $this->converter->convertFrom(array('hour' => '12', 'minute' => '30'), 'DateTime');
     }
 
@@ -265,11 +267,12 @@ class DateTimeConverterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Property\Exception\TypeConverterException
      * @dataProvider invalidDatePartKeyValuesDataProvider
      */
     public function convertFromThrowsExceptionIfDatePartKeysHaveInvalidValuesSpecified($source)
     {
+        $this->expectException(TypeConverterException::class);
+        $this->expectExceptionCode(1308003914);
         $this->converter->convertFrom($source, 'DateTime');
     }
 
@@ -330,10 +333,11 @@ class DateTimeConverterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Property\Exception\TypeConverterException
      */
     public function convertFromThrowsExceptionIfSpecifiedTimezoneIsInvalid()
     {
+        $this->expectException(TypeConverterException::class);
+        $this->expectExceptionCode(1308240974);
         $source = array(
             'date' => '2011-06-16',
             'dateFormat' => 'Y-m-d',
@@ -344,10 +348,11 @@ class DateTimeConverterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Property\Exception\TypeConverterException
      */
     public function convertFromArrayThrowsExceptionForEmptyArray()
     {
+        $this->expectException(TypeConverterException::class);
+        $this->expectExceptionCode(1308003914);
         $this->converter->convertFrom(array(), 'DateTime', array(), null);
     }
 
index 1f9c18c..8db770a 100644 (file)
@@ -21,6 +21,10 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Property\TypeConverter;
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
 use TYPO3\CMS\Core\Tests\UnitTestCase;
+use TYPO3\CMS\Extbase\Property\Exception\DuplicateObjectException;
+use TYPO3\CMS\Extbase\Property\Exception\InvalidPropertyMappingConfigurationException;
+use TYPO3\CMS\Extbase\Property\Exception\InvalidTargetException;
+use TYPO3\CMS\Extbase\Property\Exception\TargetNotFoundException;
 use TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter;
 use TYPO3\CMS\Extbase\Tests\Unit\Property\TypeConverter\Fixtures\PersistentObjectEntityFixture;
 use TYPO3\CMS\Extbase\Tests\Unit\Property\TypeConverter\Fixtures\PersistentObjectFixture;
@@ -217,10 +221,11 @@ class PersistentObjectConverterTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Property\Exception\InvalidPropertyMappingConfigurationException
      */
     public function convertFromShouldThrowExceptionIfObjectNeedsToBeModifiedButConfigurationIsNotSet()
     {
+        $this->expectException(InvalidPropertyMappingConfigurationException::class);
+        $this->expectExceptionCode(1297932028);
         $identifier = '12345';
         $object = new \stdClass();
         $object->someProperty = 'asdf';
@@ -273,10 +278,11 @@ class PersistentObjectConverterTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Property\Exception\TargetNotFoundException
      */
     public function convertFromShouldReturnExceptionIfNoMatchingObjectWasFound()
     {
+        $this->expectException(TargetNotFoundException::class);
+        $this->expectExceptionCode(1297933823);
         $this->setupMockQuery(0, $this->never());
         $this->mockReflectionService->expects($this->never())->method('getClassSchema');
 
@@ -289,25 +295,27 @@ class PersistentObjectConverterTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Property\Exception\DuplicateObjectException
      */
     public function convertFromShouldThrowExceptionIfMoreThanOneObjectWasFound()
     {
+        $this->expectException(DuplicateObjectException::class);
+        // @TODO expectExceptionCode is 0
         $this->setupMockQuery(2, $this->never());
 
         $source = array(
             '__identity' => 666
         );
-        $this->mockPersistenceManager->expects($this->any())->method('getObjectByIdentifier')->with(666)->will($this->throwException(new \TYPO3\CMS\Extbase\Property\Exception\DuplicateObjectException));
+        $this->mockPersistenceManager->expects($this->any())->method('getObjectByIdentifier')->with(666)->will($this->throwException(new DuplicateObjectException));
         $this->converter->convertFrom($source, 'SomeType');
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Property\Exception\InvalidPropertyMappingConfigurationException
      */
     public function convertFromShouldThrowExceptionIfObjectNeedsToBeCreatedButConfigurationIsNotSet()
     {
+        $this->expectException(InvalidPropertyMappingConfigurationException::class);
+        // @TODO expectExceptionCode is 0
         $source = array(
             'foo' => 'bar'
         );
@@ -336,10 +344,11 @@ class PersistentObjectConverterTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Property\Exception\InvalidTargetException
      */
     public function convertFromShouldThrowExceptionIfPropertyOnTargetObjectCouldNotBeSet()
     {
+        $this->expectException(InvalidTargetException::class);
+        $this->expectExceptionCode(1297935345);
         $source = array(
             'propertyX' => 'bar'
         );
@@ -414,10 +423,11 @@ class PersistentObjectConverterTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Property\Exception\InvalidTargetException
      */
     public function convertFromShouldThrowExceptionIfRequiredConstructorParameterWasNotFound()
     {
+        $this->expectException(InvalidTargetException::class);
+        $this->expectExceptionCode(1268734872);
         $source = array(
             'propertyX' => 'bar'
         );
index 4364806..355dc8c 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Extbase\Reflection\Exception\PropertyNotAccessibleException;
 
 /**
  * Test case
@@ -68,28 +69,31 @@ class ObjectAccessTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Reflection\Exception\PropertyNotAccessibleException
      */
     public function getPropertyReturnsPropertyNotAccessibleExceptionForNotExistingPropertyIfForceDirectAccessIsTrue()
     {
+        $this->expectException(PropertyNotAccessibleException::class);
+        $this->expectExceptionCode(1302855001);
         $property = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getProperty($this->dummyObject, 'notExistingProperty', true);
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Reflection\Exception\PropertyNotAccessibleException
      */
     public function getPropertyReturnsThrowsExceptionIfPropertyDoesNotExist()
     {
+        $this->expectException(PropertyNotAccessibleException::class);
+        $this->expectExceptionCode(1263391473);
         \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getProperty($this->dummyObject, 'notExistingProperty');
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Reflection\Exception\PropertyNotAccessibleException
      */
     public function getPropertyReturnsThrowsExceptionIfArrayKeyDoesNotExist()
     {
+        $this->expectException(PropertyNotAccessibleException::class);
+        $this->expectExceptionCode(1263391473);
         \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getProperty(array(), 'notExistingProperty');
     }
 
@@ -104,19 +108,21 @@ class ObjectAccessTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function getPropertyThrowsExceptionIfThePropertyNameIsNotAString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1231178303);
         \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getProperty($this->dummyObject, new \ArrayObject());
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function setPropertyThrowsExceptionIfThePropertyNameIsNotAString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1231178878);
         \TYPO3\CMS\Extbase\Reflection\ObjectAccess::setProperty($this->dummyObject, new \ArrayObject(), 42);
     }
 
index be1e6be..b605542 100644 (file)
@@ -37,10 +37,11 @@ class TaskTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException Exception
      */
     public function executeCallsLogExceptionOnCaughtExceptionAndRethrowsException()
     {
+        $this->expectException(\Exception::class);
+        // @TODO expectExceptionCode is 0
         $this->taskExecutor->expects($this->once())->method('execute')->will($this->throwException(new \Exception()));
         $this->task->_set('taskExecutor', $this->taskExecutor);
         $this->task->expects($this->once())->method('logException');
index d0bcf7c..0cee1d1 100644 (file)
@@ -13,6 +13,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Security\Cryptography;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException;
+use TYPO3\CMS\Extbase\Security\Exception\InvalidHashException;
 
 /**
  * Test case
@@ -60,10 +62,11 @@ class HashServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException
      */
     public function generateHmacThrowsExceptionIfNoStringGiven()
     {
+        $this->expectException(InvalidArgumentForHashGenerationException::class);
+        $this->expectExceptionCode(1255069587);
         $hash = $this->hashService->generateHmac(null);
     }
 
@@ -89,10 +92,11 @@ class HashServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException
      */
     public function appendHmacThrowsExceptionIfNoStringGiven()
     {
+        $this->expectException(InvalidArgumentForHashGenerationException::class);
+        $this->expectExceptionCode(1255069587);
         $this->hashService->appendHmac(null);
     }
 
@@ -108,37 +112,41 @@ class HashServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException
      */
     public function validateAndStripHmacThrowsExceptionIfNoStringGiven()
     {
+        $this->expectException(InvalidArgumentForHashGenerationException::class);
+        $this->expectExceptionCode(1320829762);
         $this->hashService->validateAndStripHmac(null);
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException
      */
     public function validateAndStripHmacThrowsExceptionIfGivenStringIsTooShort()
     {
+        $this->expectException(InvalidArgumentForHashGenerationException::class);
+        $this->expectExceptionCode(1320830276);
         $this->hashService->validateAndStripHmac('string with less than 40 characters');
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Security\Exception\InvalidHashException
      */
     public function validateAndStripHmacThrowsExceptionIfGivenStringHasNoHashAppended()
     {
+        $this->expectException(InvalidHashException::class);
+        $this->expectExceptionCode(1320830018);
         $this->hashService->validateAndStripHmac('string with exactly a length 40 of chars');
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Security\Exception\InvalidHashException
      */
     public function validateAndStripHmacThrowsExceptionIfTheAppendedHashIsInvalid()
     {
+        $this->expectException(InvalidHashException::class);
+        $this->expectExceptionCode(1320830018);
         $this->hashService->validateAndStripHmac('some Stringac43682075d36592d4cb320e69ff0aa515886eab');
     }
 
index 3f7ec46..73fc214 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Service;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Extbase\Exception;
 
 /**
  * Test case
@@ -146,10 +147,11 @@ class ExtensionServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Exception
      */
     public function getPluginNameByActionThrowsExceptionIfMoreThanOnePluginMatches()
     {
+        $this->expectException(Exception::class);
+        $this->expectExceptionCode(1280825466);
         $this->mockConfigurationManager->expects($this->once())->method('getConfiguration')->with(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK)->will($this->returnValue(array('view' => array('pluginNamespace' => 'overridden_plugin_namespace'))));
         $this->extensionService->getPluginNameByAction('ExtensionName', 'ControllerName', 'otherAction');
     }
@@ -253,10 +255,11 @@ class ExtensionServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Exception
      */
     public function getTargetPidByPluginSignatureThrowsExceptionIfMoreThanOneTargetPidsWereFound()
     {
+        $this->expectException(Exception::class);
+        $this->expectExceptionCode(1280773643);
         $this->mockConfigurationManager->expects($this->once())->method('getConfiguration')->will($this->returnValue(array('view' => array('defaultPid' => 'auto'))));
         $GLOBALS['TSFE']->sys_page = $this->getMock(\TYPO3\CMS\Frontend\Page\PageRepository::class, array('enableFields'));
         $GLOBALS['TSFE']->sys_page->expects($this->once())->method('enableFields')->will($this->returnValue(' AND enable_fields'));
index 6f05521..7ba4f01 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\SignalSlot;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException;
+use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotReturnException;
 use TYPO3\CMS\Extbase\Tests\Unit\SignalSlot\Fixtures\OnlyClassNameSpecifiedFixture;
 use TYPO3\CMS\Extbase\Tests\Unit\SignalSlot\Fixtures\SlotMethodDoesNotExistFixture;
 
@@ -192,10 +194,11 @@ class DispatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotReturnException
      */
     public function dispatchThrowsAnExceptionIfTheSlotReturnsNonArray()
     {
+        $this->expectException(InvalidSlotReturnException::class);
+        $this->expectExceptionCode(1376683067);
         $this->signalSlotDispatcher->_set('isInitialized', true);
 
         $mockSlot = $this->getMock(\TYPO3\CMS\Extbase\Tests\Fixture\SlotFixture::class);
@@ -212,10 +215,11 @@ class DispatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotReturnException
      */
     public function dispatchThrowsAnExceptionIfTheSlotReturnsDifferentNumberOfItems()
     {
+        $this->expectException(InvalidSlotReturnException::class);
+        $this->expectExceptionCode(1376683066);
         $this->signalSlotDispatcher->_set('isInitialized', true);
 
         $mockSlot = $this->getMock(\TYPO3\CMS\Extbase\Tests\Fixture\SlotFixture::class);
@@ -232,10 +236,11 @@ class DispatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException
      */
     public function dispatchThrowsAnExceptionIfTheSpecifiedClassOfASlotIsUnknown()
     {
+        $this->expectException(InvalidSlotException::class);
+        $this->expectExceptionCode(1245673367);
         $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
         $mockObjectManager->expects($this->once())->method('isRegistered')->with('NonExistingClassName')->will($this->returnValue(false));
         $this->signalSlotDispatcher->_set('objectManager', $mockObjectManager);
@@ -246,10 +251,11 @@ class DispatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException
      */
     public function dispatchThrowsAnExceptionIfTheSpecifiedSlotMethodDoesNotExist()
     {
+        $this->expectException(InvalidSlotException::class);
+        $this->expectExceptionCode(1245673368);
         $slotClassName = SlotMethodDoesNotExistFixture::class;
         $mockSlot = new SlotMethodDoesNotExistFixture();
         $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
@@ -281,10 +287,11 @@ class DispatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function connectThrowsInvalidArgumentExceptionIfSlotMethodNameIsEmptyAndSlotClassNameIsNoClosure()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1229531659);
         $this->signalSlotDispatcher->connect('ClassA', 'emitSomeSignal', 'ClassB', '');
     }
 
@@ -319,10 +326,11 @@ class DispatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException
      */
     public function dispatchThrowsInvalidSlotExceptionIfObjectManagerOfSignalSlotDispatcherIsNotSet()
     {
+        $this->expectException(InvalidSlotException::class);
+        $this->expectExceptionCode(1298113624);
         $this->signalSlotDispatcher->_set('isInitialized', true);
         $this->signalSlotDispatcher->_set('objectManager', null);
         $this->signalSlotDispatcher->_set('slots', array('ClassA' => array('emitSomeSignal' => array(array()))));
index ca53b15..019ab92 100644 (file)
@@ -83,10 +83,11 @@ class ArrayUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function getValueByPathThrowsExceptionIfPathIsNoArrayOrString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1304950007);
         $array = array('Foo' => array('Bar' => array('Baz' => array(2 => 'the value'))));
         \TYPO3\CMS\Extbase\Utility\ArrayUtility::getValueByPath($array, null);
     }
@@ -173,30 +174,33 @@ class ArrayUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function setValueByPathThrowsExceptionIfPathIsNoArrayOrString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1305111499);
         $array = array('Foo' => array('Bar' => array('Baz' => array(2 => 'the value'))));
         \TYPO3\CMS\Extbase\Utility\ArrayUtility::setValueByPath($array, null, 'Some Value');
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function setValueByPathThrowsExceptionIfSubjectIsNoArray()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1306424308);
         $subject = 'foobar';
         \TYPO3\CMS\Extbase\Utility\ArrayUtility::setValueByPath($subject, 'foo', 'bar');
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function setValueByPathThrowsExceptionIfSubjectIsNoArrayAccess()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1306424308);
         $subject = new \stdClass();
         \TYPO3\CMS\Extbase\Utility\ArrayUtility::setValueByPath($subject, 'foo', 'bar');
     }
@@ -261,10 +265,11 @@ class ArrayUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function unsetValueByPathThrowsExceptionIfPathIsNoArrayOrString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1305111513);
         $array = array('Foo' => array('Bar' => array('Baz' => array(2 => 'the value'))));
         \TYPO3\CMS\Extbase\Utility\ArrayUtility::unsetValueByPath($array, null);
     }
index a8723d0..be98915 100644 (file)
@@ -113,11 +113,12 @@ class ExtensionUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      * @see \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin
      */
     public function configurePluginThrowsExceptionIfExtensionNameIsEmpty()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1239891990);
         \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin('', 'SomePlugin', array(
             'FirstController' => 'index'
         ));
@@ -125,11 +126,12 @@ class ExtensionUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      * @see \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin
      */
     public function configurePluginThrowsExceptionIfPluginNameIsEmpty()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1239891988);
         \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin('MyExtension', '', array(
             'FirstController' => 'index'
         ));
index c60bf88..6e290e1 100644 (file)
@@ -20,6 +20,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+use TYPO3\CMS\Extbase\Validation\Exception\NoSuchValidatorException;
 
 /**
  * Test case
@@ -105,10 +106,11 @@ class ConjunctionValidatorTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Validation\Exception\NoSuchValidatorException
      */
     public function removingANotExistingValidatorIndexThrowsException()
     {
+        $this->expectException(NoSuchValidatorException::class);
+        $this->expectExceptionCode(1207020177);
         $validatorConjunction = new \TYPO3\CMS\Extbase\Validation\Validator\ConjunctionValidator(array());
         $validator = $this->getMock(\TYPO3\CMS\Extbase\Validation\Validator\ValidatorInterface::class, array('validate', 'getOptions'));
         $validatorConjunction->removeValidator($validator);
index 49167f5..3c19c00 100644 (file)
@@ -20,6 +20,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator;
  *                                                                        *
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
+use TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationOptionsException;
 
 /**
  * Test case
@@ -156,10 +157,11 @@ class StringLengthValidatorTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationOptionsException
      */
     public function stringLengthValidatorThrowsAnExceptionIfMinLengthIsGreaterThanMaxLength()
     {
+        $this->expectException(InvalidValidationOptionsException::class);
+        $this->expectExceptionCode(1238107096);
         $options = array('minimum' => 101, 'maximum' => 100);
         $validator = $this->getMock($this->validatorClassName, array('addError', 'translateErrorMessage'), array($options));
         $validator->validate('1234567890');
index 2f42b6a..e11de39 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Validation;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationConfigurationException;
 use TYPO3\CMS\Extbase\Validation\Exception\NoSuchValidatorException;
 
 /**
@@ -279,10 +280,11 @@ class ValidatorResolverTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationConfigurationException
      */
     public function buildMethodArgumentsValidatorConjunctionsThrowsExceptionIfValidationAnnotationForNonExistingArgumentExists()
     {
+        $this->expectException(InvalidValidationConfigurationException::class);
+        $this->expectExceptionCode(1253172726);
         $mockObject = $this->getMock('stdClass', array('fooMethod'), array(), '', false);
         $methodParameters = array(
             'arg1' => array(