[TASK] Deprecated methods in unit tests 91/48091/4
authorAdrian Mot <adrian.mot@gmail.com>
Thu, 12 May 2016 08:32:40 +0000 (11:32 +0300)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 16 May 2016 11:43:44 +0000 (13:43 +0200)
- Use expectedException() and expectedExceptionCode() instead of
  deprecated setExpectedException()
- Fix a couple of incomplete tests in core/Http section, add some
  and slightly refactor a bit

Resolves: #76159
Releases: master
Change-Id: I3333f94494ce76601a61e4b5286cfef982867f8f
Reviewed-on: https://review.typo3.org/48091
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Adrian Mot <adrian.mot@gmail.com>
Tested-by: Adrian Mot <adrian.mot@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
46 files changed:
typo3/sysext/backend/Tests/Unit/Form/FormDataCompilerTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataGroup/FlexFormSegmentTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataGroup/InlineParentRecordTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataGroup/OnTheFlyTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataGroup/TcaDatabaseRecordTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataGroup/TcaInputPlaceholderRecordTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseEditRowTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseLanguageRowsTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabasePageLanguageOverlayRowsTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseRecordTypeValueTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseSystemLanguageRowsTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseUniqueUidNewRowTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseUserPermissionCheckTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/InitializeProcessedTcaTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaCheckboxItemsTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaColumnsProcessShowitemTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaFlexFetchTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaFlexPrepareTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaFlexProcessTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaGroupTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaInlineConfigurationTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaRadioItemsTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaRecordTitleTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectItemsTest.php
typo3/sysext/core/Tests/Unit/FormProtection/AbstractFormProtectionTest.php
typo3/sysext/core/Tests/Unit/Http/MessageTest.php
typo3/sysext/core/Tests/Unit/Http/RequestTest.php
typo3/sysext/core/Tests/Unit/Http/ResponseTest.php
typo3/sysext/core/Tests/Unit/Http/StreamTest.php
typo3/sysext/core/Tests/Unit/Http/UploadedFileTest.php
typo3/sysext/core/Tests/Unit/Http/UriTest.php
typo3/sysext/core/Tests/Unit/Imaging/IconFactoryTest.php
typo3/sysext/core/Tests/Unit/Resource/Driver/DriverRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/Driver/LocalDriverTest.php
typo3/sysext/core/Tests/Unit/Resource/Repository/AbstractRepositoryTest.php
typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php
typo3/sysext/core/Tests/Unit/Tree/TableConfiguration/TreeDataProviderFactoryTest.php
typo3/sysext/core/Tests/Unit/TypoScript/Parser/TypoScriptParserTest.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
typo3/sysext/core/Tests/Unit/Utility/VersionNumberUtilityTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/AbstractCompositeValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/AbstractValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/ValidatorResolverTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/DependencyUtilityTest.php
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/AbstractViewHelperTest.php
typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php

index 6764842..3cf32e7 100644 (file)
@@ -49,7 +49,8 @@ class FormDataCompilerTest extends UnitTestCase
         $input = [
             'foo' => 'bar',
         ];
-        $this->setExpectedException(\InvalidArgumentException::class, '', 1440601540);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1440601540);
         $this->subject->compile($input);
     }
 
@@ -61,7 +62,8 @@ class FormDataCompilerTest extends UnitTestCase
         $input = [
             'command' => 'unknownCommand',
         ];
-        $this->setExpectedException(\InvalidArgumentException::class, '', 1437653136);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1437653136);
         $this->subject->compile($input);
     }
 
@@ -73,7 +75,8 @@ class FormDataCompilerTest extends UnitTestCase
         $input = [
             'tableName' => '',
         ];
-        $this->setExpectedException(\InvalidArgumentException::class, '', 1437654409);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1437654409);
         $this->subject->compile($input);
     }
 
@@ -85,7 +88,8 @@ class FormDataCompilerTest extends UnitTestCase
         $input = [
             'vanillaUid' => 'foo123',
         ];
-        $this->setExpectedException(\InvalidArgumentException::class, '', 1437654247);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1437654247);
         $this->subject->compile($input);
     }
 
@@ -98,7 +102,8 @@ class FormDataCompilerTest extends UnitTestCase
             'command' => 'edit',
             'vanillaUid' => -100,
         ];
-        $this->setExpectedException(\InvalidArgumentException::class, '', 1437654332);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1437654332);
         $this->subject->compile($input);
     }
 
@@ -139,7 +144,8 @@ class FormDataCompilerTest extends UnitTestCase
     public function compileThrowsExceptionIfFormDataGroupDoesNotReturnArray()
     {
         $this->formDataGroupProphecy->compile(Argument::cetera())->willReturn(null);
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1446664764);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1446664764);
         $this->subject->compile([]);
     }
 
@@ -153,7 +159,8 @@ class FormDataCompilerTest extends UnitTestCase
             unset($result['tableName']);
             return $result;
         });
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1438079402);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438079402);
         $this->subject->compile([]);
     }
 
@@ -167,7 +174,8 @@ class FormDataCompilerTest extends UnitTestCase
             $result['newKey'] = 'newData';
             return $result;
         });
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1438079402);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438079402);
         $this->subject->compile([]);
     }
 }
index 2273110..4da71e4 100644 (file)
@@ -93,7 +93,8 @@ class FlexFormSegmentTest extends UnitTestCase
         );
         GeneralUtility::addInstance(\stdClass::class, $formDataProviderProphecy->reveal());
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1437906441);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1437906441);
 
         $this->subject->compile([]);
     }
index 7037d74..a94f266 100644 (file)
@@ -93,7 +93,8 @@ class InlineParentRecordTest extends UnitTestCase
         );
         GeneralUtility::addInstance(\stdClass::class, $formDataProviderProphecy->reveal());
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1444398947);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1444398947);
 
         $this->subject->compile([]);
     }
index b235e10..4ee18e0 100644 (file)
@@ -41,7 +41,8 @@ class OnTheFlyTest extends UnitTestCase
      */
     public function compileThrowsExceptionWithEmptyOnTheFlyList()
     {
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1441108674);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1441108674);
         $this->subject->compile([]);
     }
 
@@ -98,7 +99,8 @@ class OnTheFlyTest extends UnitTestCase
         ];
         $this->subject->setProviderList($providerList);
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1441108719);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1441108719);
         $this->subject->compile([]);
     }
 }
index 61a46bd..1d26648 100644 (file)
@@ -93,7 +93,8 @@ class TcaDatabaseRecordTest extends UnitTestCase
         );
         GeneralUtility::addInstance(\stdClass::class, $formDataProviderProphecy->reveal());
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1437906440);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1437906440);
 
         $this->subject->compile([]);
     }
index d94dd68..d5797e0 100644 (file)
@@ -93,7 +93,8 @@ class TcaInputPlaceholderRecordTest extends UnitTestCase
         );
         GeneralUtility::addInstance(\stdClass::class, $formDataProviderProphecy->reveal());
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1443986127);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1443986127);
 
         $this->subject->compile([]);
     }
index e273f60..5a10ebf 100644 (file)
@@ -83,7 +83,8 @@ class DatabaseEditRowTest extends UnitTestCase
         $this->dbProphecy->quoteStr($input['tableName'], $input['tableName'])->willReturn($input['tableName']);
         $this->dbProphecy->exec_SELECTgetSingleRow('*', 'tt_content', 'uid=' . $input['vanillaUid'])->willReturn($resultRow);
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1437663061);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1437663061);
 
         $this->subject->addData($input);
     }
@@ -99,7 +100,8 @@ class DatabaseEditRowTest extends UnitTestCase
             'vanillaUid' => -10,
         ];
 
-        $this->setExpectedException(\InvalidArgumentException::class, '', 1437656456);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1437656456);
 
         $this->subject->addData($input);
     }
@@ -115,7 +117,8 @@ class DatabaseEditRowTest extends UnitTestCase
             'vanillaUid' => 10,
         ];
 
-        $this->setExpectedException(\RuntimeException::class, '', 1437655862);
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1437655862);
 
         $this->subject->addData($input);
     }
@@ -133,7 +136,8 @@ class DatabaseEditRowTest extends UnitTestCase
         $this->dbProphecy->quoteStr(Argument::cetera())->willReturn($input['tableName']);
         $this->dbProphecy->exec_SELECTgetSingleRow(Argument::cetera())->willReturn(false);
 
-        $this->setExpectedException(DatabaseRecordException::class, '', 1437656081);
+        $this->expectException(DatabaseRecordException::class);
+        $this->expectExceptionCode(1437656081);
 
         $this->subject->addData($input);
     }
@@ -172,7 +176,8 @@ class DatabaseEditRowTest extends UnitTestCase
         $this->dbProphecy->quoteStr(Argument::cetera())->willReturn($input['tableName']);
         $this->dbProphecy->exec_SELECTgetSingleRow(Argument::cetera())->willReturn('invalid result data');
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1437656323);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1437656323);
 
         $this->subject->addData($input);
     }
index 4db4a07..8005a92 100644 (file)
@@ -98,7 +98,8 @@ class DatabaseLanguageRowsTest extends UnitTestCase
         $GLOBALS['TCA']['tt_content'] = array('foo');
         $this->dbProphecy->exec_SELECTgetSingleRow('*', 'tt_content', 'uid=23')->shouldBeCalled()->willReturn(null);
 
-        $this->setExpectedException(DatabaseDefaultLanguageException::class, '', 1438249426);
+        $this->expectException(DatabaseDefaultLanguageException::class);
+        $this->expectExceptionCode(1438249426);
 
         $this->subject->addData($input);
     }
index 65170d5..412071d 100644 (file)
@@ -51,7 +51,8 @@ class DatabasePageLanguageOverlayRowsTest extends UnitTestCase
     {
         $this->dbProphecy->exec_SELECTgetRows(Argument::cetera())->willReturn(null);
         $this->dbProphecy->sql_error(Argument::cetera())->willReturn(null);
-        $this->setExpectedException(\UnexpectedValueException::class,  '', 1440777705);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1440777705);
         $this->subject->addData(['effectivePid' => 1]);
     }
 
index 96d330b..a8d6056 100644 (file)
@@ -53,7 +53,8 @@ class DatabaseRecordTypeValueTest extends UnitTestCase
             ],
         ];
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1438185331);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438185331);
 
         $this->subject->addData($input);
     }
@@ -113,7 +114,8 @@ class DatabaseRecordTypeValueTest extends UnitTestCase
             ],
         ];
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1438183881);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438183881);
 
         $this->subject->addData($input);
     }
@@ -212,7 +214,8 @@ class DatabaseRecordTypeValueTest extends UnitTestCase
             ],
         ];
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1438185437);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438185437);
 
         $this->subject->addData($input);
     }
@@ -345,7 +348,8 @@ class DatabaseRecordTypeValueTest extends UnitTestCase
             ],
         ];
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1325862241);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1325862241);
 
         $this->subject->addData($input);
     }
@@ -376,7 +380,8 @@ class DatabaseRecordTypeValueTest extends UnitTestCase
             ],
         ];
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1438253614);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438253614);
 
         $this->subject->addData($input);
     }
index 916580c..31dac17 100644 (file)
@@ -70,7 +70,8 @@ class DatabaseSystemLanguageRowsTest extends UnitTestCase
     {
         $this->dbProphecy->exec_SELECTgetRows(Argument::cetera())->willReturn(null);
         $this->dbProphecy->sql_error(Argument::cetera())->willReturn(null);
-        $this->setExpectedException(\UnexpectedValueException::class,  '', 1438170741);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438170741);
         $this->subject->addData([]);
     }
 
index e715938..b9698ab 100644 (file)
@@ -58,7 +58,8 @@ class DatabaseUniqueUidNewRowTest extends UnitTestCase
             ],
         ];
 
-        $this->setExpectedException(\InvalidArgumentException::class, '', 1437991120);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1437991120);
 
         $this->subject->addData($input);
     }
index ca6c623..25c5a1f 100644 (file)
@@ -75,7 +75,8 @@ class DatabaseUserPermissionCheckTest extends UnitTestCase
         $this->beUserProphecy->isAdmin()->willReturn(false);
         $this->beUserProphecy->check('tables_modify', $input['tableName'])->willReturn(false);
 
-        $this->setExpectedException(AccessDeniedTableModifyException::class, '', 1437683248);
+        $this->expectException(AccessDeniedTableModifyException::class);
+        $this->expectExceptionCode(1437683248);
 
         $this->subject->addData($input);
     }
@@ -97,7 +98,8 @@ class DatabaseUserPermissionCheckTest extends UnitTestCase
         $this->beUserProphecy->check('tables_modify', $input['tableName'])->willReturn(true);
         $this->beUserProphecy->calcPerms(['pid' => 321])->willReturn(Permission::NOTHING);
 
-        $this->setExpectedException(AccessDeniedContentEditException::class, '', 1437679657);
+        $this->expectException(AccessDeniedContentEditException::class);
+        $this->expectExceptionCode(1437679657);
 
         $this->subject->addData($input);
     }
@@ -143,7 +145,8 @@ class DatabaseUserPermissionCheckTest extends UnitTestCase
         $this->beUserProphecy->check('tables_modify', $input['tableName'])->willReturn(true);
         $this->beUserProphecy->calcPerms($input['databaseRow'])->willReturn(Permission::NOTHING);
 
-        $this->setExpectedException(AccessDeniedPageEditException::class, '', 1437679336);
+        $this->expectException(AccessDeniedPageEditException::class);
+        $this->expectExceptionCode(1437679336);
 
         $this->subject->addData($input);
     }
@@ -214,7 +217,8 @@ class DatabaseUserPermissionCheckTest extends UnitTestCase
         $this->beUserProphecy->check('tables_modify', $input['tableName'])->willReturn(true);
         $this->beUserProphecy->recordEditAccessInternals($input['tableName'], Argument::cetera())->willReturn(true);
 
-        $this->setExpectedException(AccessDeniedRootNodeException::class, '', 1437679856);
+        $this->expectException(AccessDeniedRootNodeException::class);
+        $this->expectExceptionCode(1437679856);
 
         $this->subject->addData($input);
     }
@@ -238,7 +242,8 @@ class DatabaseUserPermissionCheckTest extends UnitTestCase
         $this->beUserProphecy->calcPerms($input['parentPageRow'])->willReturn(Permission::ALL);
         $this->beUserProphecy->recordEditAccessInternals($input['tableName'], Argument::cetera())->willReturn(false);
 
-        $this->setExpectedException(AccessDeniedEditInternalsException::class, '', 1437687404);
+        $this->expectException(AccessDeniedEditInternalsException::class);
+        $this->expectExceptionCode(1437687404);
 
         $this->subject->addData($input);
     }
@@ -261,7 +266,8 @@ class DatabaseUserPermissionCheckTest extends UnitTestCase
         $this->beUserProphecy->check('tables_modify', $input['tableName'])->willReturn(true);
         $this->beUserProphecy->calcPerms($input['parentPageRow'])->willReturn(Permission::NOTHING);
 
-        $this->setExpectedException(AccessDeniedContentEditException::class, '', 1437745759);
+        $this->expectException(AccessDeniedContentEditException::class);
+        $this->expectExceptionCode(1437745759);
 
         $this->subject->addData($input);
     }
@@ -284,7 +290,8 @@ class DatabaseUserPermissionCheckTest extends UnitTestCase
         $this->beUserProphecy->check('tables_modify', $input['tableName'])->willReturn(true);
         $this->beUserProphecy->calcPerms($input['parentPageRow'])->willReturn(Permission::NOTHING);
 
-        $this->setExpectedException(AccessDeniedPageNewException::class, '', 1437745640);
+        $this->expectException(AccessDeniedPageNewException::class);
+        $this->expectExceptionCode(1437745640);
 
         $this->subject->addData($input);
     }
@@ -314,7 +321,8 @@ class DatabaseUserPermissionCheckTest extends UnitTestCase
             }
         );
 
-        $this->setExpectedException(AccessDeniedHookException::class, '', 1437689705);
+        $this->expectException(AccessDeniedHookException::class);
+        $this->expectExceptionCode(1437689705);
 
         $this->subject->addData($input);
     }
@@ -433,7 +441,8 @@ class DatabaseUserPermissionCheckTest extends UnitTestCase
         $this->beUserProphecy->isAdmin()->willReturn(false);
         $this->beUserProphecy->check('tables_modify', $input['tableName'])->willReturn(true);
 
-        $this->setExpectedException(AccessDeniedRootNodeException::class, '', 1437745221);
+        $this->expectException(AccessDeniedRootNodeException::class);
+        $this->expectExceptionCode(1437745221);
 
         $this->subject->addData($input);
     }
index 5ea627a..afa3950 100644 (file)
@@ -45,7 +45,8 @@ class InitializeProcessedTcaTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1438594044);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438594044);
         $this->subject->addData($input);
     }
 
@@ -74,7 +75,8 @@ class InitializeProcessedTcaTest extends UnitTestCase
             'tableName' => 'aTable',
         ];
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1437914223);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1437914223);
 
         $this->subject->addData($input);
     }
@@ -88,7 +90,8 @@ class InitializeProcessedTcaTest extends UnitTestCase
             'tableName' => 'aTable',
         ];
         $GLOBALS['TCA'][$input['tableName']] = 'foo';
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1437914223);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1437914223);
 
         $this->subject->addData($input);
     }
index b875a6a..57bac6c 100644 (file)
@@ -101,7 +101,8 @@ class TcaCheckboxItemsTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1440499337);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1440499337);
         $this->subject->addData($input);
     }
 
@@ -126,7 +127,8 @@ class TcaCheckboxItemsTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1440499338);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1440499338);
         $this->subject->addData($input);
     }
 
index 7d47eea..88d59d0 100644 (file)
@@ -50,7 +50,8 @@ class TcaColumnsProcessShowitemTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1438614542);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438614542);
         $this->subject->addData($input);
     }
 
index ed430a6..5bfd96c 100644 (file)
@@ -226,7 +226,8 @@ class TcaFlexFetchTest extends UnitTestCase
             ],
         ];
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1440506893);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1440506893);
 
         $this->subject->addData($input);
     }
index f075a0d..c1bb14b 100644 (file)
@@ -60,7 +60,8 @@ class TcaFlexPrepareTest extends UnitTestCase
             ],
         ];
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1440676540);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1440676540);
 
         $this->subject->addData($input);
     }
index 4cf5c7e..4ea6ca5 100644 (file)
@@ -966,7 +966,8 @@ class TcaFlexProcessTest extends UnitTestCase
         $this->backendUserProphecy->isAdmin()->willReturn(true);
         $this->backendUserProphecy->checkLanguageAccess(Argument::cetera())->willReturn(true);
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1440685208);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1440685208);
 
         $this->subject->addData($input);
     }
@@ -1013,7 +1014,8 @@ class TcaFlexProcessTest extends UnitTestCase
         $this->backendUserProphecy->isAdmin()->willReturn(true);
         $this->backendUserProphecy->checkLanguageAccess(Argument::cetera())->willReturn(true);
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1440685208);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1440685208);
 
         $this->subject->addData($input);
     }
@@ -1185,7 +1187,8 @@ class TcaFlexProcessTest extends UnitTestCase
             'pageTsConfig' => [],
         ];
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1458745468);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1458745468);
 
         $this->subject->addData($input);
     }
@@ -1243,7 +1246,8 @@ class TcaFlexProcessTest extends UnitTestCase
             'pageTsConfig' => [],
         ];
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1458745712);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1458745712);
 
         $this->subject->addData($input);
     }
index a5ec422..a10957a 100644 (file)
@@ -89,7 +89,8 @@ class TcaGroupTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1438780511);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438780511);
         $this->subject->addData($input);
     }
 
index 7f2eebd..b5aa075 100644 (file)
@@ -76,7 +76,8 @@ class TcaInlineConfigurationTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1443793404);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1443793404);
         $this->subject->addData($input);
     }
 
@@ -214,7 +215,8 @@ class TcaInlineConfigurationTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1443829370);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1443829370);
         $this->subject->addData($input);
     }
 
@@ -240,7 +242,8 @@ class TcaInlineConfigurationTest extends UnitTestCase
             ],
         ];
         // not $globals definition for child here -> not localizable
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1443944274);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1443944274);
         $this->subject->addData($input);
     }
 
@@ -586,7 +589,8 @@ class TcaInlineConfigurationTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1444995464);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1444995464);
         $this->subject->addData($input);
     }
 
@@ -608,7 +612,8 @@ class TcaInlineConfigurationTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1444996537);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1444996537);
         $this->subject->addData($input);
     }
 
@@ -630,7 +635,8 @@ class TcaInlineConfigurationTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1444996537);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1444996537);
         $this->subject->addData($input);
     }
 
@@ -655,7 +661,8 @@ class TcaInlineConfigurationTest extends UnitTestCase
         $GLOBALS['TCA']['aForeignTableName']['columns']['aField']['config'] = [
             'type' => 'notSelectOrGroup',
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1444996537);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1444996537);
         $this->subject->addData($input);
     }
 
@@ -681,7 +688,8 @@ class TcaInlineConfigurationTest extends UnitTestCase
             'type' => 'group',
             'internal_type' => 'notDb'
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1444999130);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1444999130);
         $this->subject->addData($input);
     }
 
@@ -706,7 +714,8 @@ class TcaInlineConfigurationTest extends UnitTestCase
         $GLOBALS['TCA']['aForeignTableName']['columns']['aField']['config'] = [
             'type' => 'select',
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1445078627);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1445078627);
         $this->subject->addData($input);
     }
 
@@ -732,7 +741,8 @@ class TcaInlineConfigurationTest extends UnitTestCase
             'type' => 'group',
             'internal_type' => 'db',
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1445078628);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1445078628);
         $this->subject->addData($input);
     }
 
index 2e6efd8..2a1c5e4 100644 (file)
@@ -68,7 +68,8 @@ class TcaRadioItemsTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1438594829);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438594829);
         $this->subject->addData($input);
     }
 
@@ -121,7 +122,8 @@ class TcaRadioItemsTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1438607163);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438607163);
         $this->subject->addData($input);
     }
 
@@ -146,7 +148,8 @@ class TcaRadioItemsTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1438607164);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438607164);
         $this->subject->addData($input);
     }
 
@@ -171,7 +174,8 @@ class TcaRadioItemsTest extends UnitTestCase
                 ],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1438607165);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1438607165);
         $this->subject->addData($input);
     }
 
index 92ccd9f..0caec2b 100644 (file)
@@ -59,7 +59,8 @@ class TcaRecordTitleTest extends UnitTestCase
                 'ctrl' => [],
             ],
         ];
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1443706103);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1443706103);
         $this->subject->addData($input);
     }
 
index e884b40..f1494ca 100644 (file)
@@ -119,7 +119,8 @@ class TcaSelectItemsTest extends UnitTestCase
             ],
         ];
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1439288036);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1439288036);
 
         $this->subject->addData($input);
     }
@@ -230,7 +231,8 @@ class TcaSelectItemsTest extends UnitTestCase
             ],
         ];
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1439298496);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1439298496);
 
         $this->subject->addData($input);
     }
@@ -1561,7 +1563,8 @@ class TcaSelectItemsTest extends UnitTestCase
             ],
         ];
 
-        $this->setExpectedException(\UnexpectedValueException::class, '', 1439569743);
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1439569743);
 
         $this->subject->addData($input);
     }
index 5eb0a0a..f9e6ee7 100644 (file)
@@ -83,7 +83,8 @@ class AbstractFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function generateTokenFormForEmptyFormNameThrowsException()
     {
-        $this->setExpectedException('InvalidArgumentException', '$formName must not be empty.');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1294586643);
         $this->subject->generateToken('', 'edit', 'bar');
     }
 
index 3ac8b89..d57bb44 100644 (file)
@@ -203,7 +203,8 @@ class MessageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function testWithHeaderRaisesExceptionForInvalidNestedHeaderValue($value)
     {
-        $this->setExpectedException('InvalidArgumentException', 'Invalid header value');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717266);
         $message = $this->message->withHeader('X-Foo', [$value]);
     }
 
@@ -227,7 +228,8 @@ class MessageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function withHeaderRaisesExceptionForInvalidValueType($value)
     {
-        $this->setExpectedException('InvalidArgumentException', 'Invalid header value');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717266);
         $message = $this->message->withHeader('X-Foo', $value);
     }
 
@@ -236,7 +238,8 @@ class MessageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function withAddedHeaderRaisesExceptionForNonStringNonArrayValue($value)
     {
-        $this->setExpectedException('InvalidArgumentException', 'must be a string');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717267);
         $message = $this->message->withAddedHeader('X-Foo', $value);
     }
 
@@ -296,7 +299,7 @@ class MessageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function doesNotAllowCRLFInjectionWhenCallingWithHeader($name, $value)
     {
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException(\InvalidArgumentException::class);
         $this->message->withHeader($name, $value);
     }
 
@@ -306,7 +309,7 @@ class MessageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function doesNotAllowCRLFInjectionWhenCallingWithAddedHeader($name, $value)
     {
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException(\InvalidArgumentException::class);
         $this->message->withAddedHeader($name, $value);
     }
 }
index 4534db1..17c05c5 100644 (file)
@@ -66,7 +66,7 @@ class RequestTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructorRaisesExceptionForInvalidStream()
     {
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException(\InvalidArgumentException::class);
         new Request(['TOTALLY INVALID']);
     }
 
@@ -131,7 +131,8 @@ class RequestTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructorRaisesExceptionForInvalidUri($uri)
     {
-        $this->setExpectedException('InvalidArgumentException', 'Invalid URI');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717272);
         new Request($uri);
     }
 
@@ -145,7 +146,6 @@ class RequestTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             'false'      => [false],
             'int'        => [1],
             'float'      => [1.1],
-            'bad-string' => ['BOGUS-METHOD'],
             'array'      => [['POST']],
             'stdClass'   => [(object) ['method' => 'POST']],
         ];
@@ -155,13 +155,24 @@ class RequestTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      * @dataProvider invalidRequestMethodDataProvider
      * @test
      */
-    public function constructorRaisesExceptionForInvalidMethod($method)
+    public function constructorRaisesExceptionForInvalidMethodByType($method)
     {
-        $this->setExpectedException('InvalidArgumentException', 'Unsupported HTTP method');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717274);
         new Request(null, $method);
     }
 
     /**
+     * @test
+     */
+    public function constructorRaisesExceptionForInvalidMethodByString()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717275);
+        new Request(null, 'BOGUS-METHOD');
+    }
+
+    /**
      * @return array
      */
     public function invalidRequestBodyDataProvider()
@@ -182,7 +193,8 @@ class RequestTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructorRaisesExceptionForInvalidBody($body)
     {
-        $this->setExpectedException('InvalidArgumentException', 'stream');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717271);
         new Request(null, null, $body);
     }
 
@@ -301,7 +313,8 @@ class RequestTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function withRequestTargetCannotContainWhitespace()
     {
         $request = new Request();
-        $this->setExpectedException('InvalidArgumentException', 'Invalid request target');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717273);
         $request->withRequestTarget('foo bar baz');
     }
 
@@ -509,7 +522,7 @@ class RequestTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructorRaisesExceptionForHeadersWithCRLFVectors($name, $value)
     {
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException(\InvalidArgumentException::class);
         $request = new Request(null, null, 'php://memory', [$name => $value]);
     }
 }
index 38c903c..858d8e7 100644 (file)
@@ -74,7 +74,7 @@ class ResponseTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function testCannotSetInvalidStatusCode($code)
     {
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException(\InvalidArgumentException::class);
         $response = $this->response->withStatus($code);
     }
 
@@ -101,7 +101,7 @@ class ResponseTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function testConstructorRaisesExceptionForInvalidStream()
     {
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException(\InvalidArgumentException::class);
         new Response(['TOTALLY INVALID']);
     }
 
@@ -145,7 +145,8 @@ class ResponseTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function testConstructorRaisesExceptionForInvalidStatus($code)
     {
-        $this->setExpectedException('InvalidArgumentException', 'The given status code is not a valid HTTP status code.');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717278);
         new Response('php://memory', $code);
     }
 
@@ -170,7 +171,8 @@ class ResponseTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function testConstructorRaisesExceptionForInvalidBody($body)
     {
-        $this->setExpectedException('InvalidArgumentException', 'stream');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717277);
         new Response($body);
     }
 
@@ -224,7 +226,7 @@ class ResponseTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function cnstructorRaisesExceptionForHeadersWithCRLFVectors($name, $value)
     {
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException(\InvalidArgumentException::class);
         $request = new Response('php://memory', 200, [$name => $value]);
     }
 }
index 1a5de80..a4bc774 100644 (file)
@@ -97,7 +97,7 @@ class StreamTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructorRaisesExceptionWhenPassingInvalidStreamResource()
     {
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException(\InvalidArgumentException::class);
         $stream = new Stream(['  THIS WILL NOT WORK  ']);
     }
 
@@ -199,7 +199,8 @@ class StreamTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
         fseek($resource, 2);
         $stream->detach();
-        $this->setExpectedException('RuntimeException', 'No resource');
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1436717285);
         $stream->tell();
     }
 
@@ -318,7 +319,8 @@ class StreamTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $resource = fopen($fileName, 'wb+');
         $stream = new Stream($resource);
         $stream->detach();
-        $this->setExpectedException('RuntimeException', 'No resource');
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1436717287);
         $stream->seek(2);
     }
 
@@ -347,7 +349,8 @@ class StreamTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $resource = fopen($fileName, 'wb+');
         $stream = new Stream($resource);
         $stream->detach();
-        $this->setExpectedException('RuntimeException', 'No resource');
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1436717290);
         $stream->write('bar');
     }
 
@@ -376,7 +379,8 @@ class StreamTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $resource = fopen($fileName, 'r');
         $stream = new Stream($resource);
         $stream->detach();
-        $this->setExpectedException('RuntimeException', 'No resource');
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1436717292);
         $stream->read(4096);
     }
 
@@ -423,7 +427,6 @@ class StreamTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             'true'                => [true],
             'int'                 => [1],
             'float'               => [1.1],
-            'string-non-resource' => ['foo-bar-baz'],
             'array'               => [[fopen($fileName, 'r+')]],
             'object'              => [(object) ['resource' => fopen($fileName, 'r+')]],
         ];
@@ -433,15 +436,26 @@ class StreamTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      * @dataProvider invalidResourcesDataProvider
      * @test
      */
-    public function attachWithNonStringNonResourceRaisesException($resource)
+    public function attachWithNonStringNonResourceRaisesExceptionByType($resource)
     {
-        $this->setExpectedException('InvalidArgumentException', 'Invalid stream');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717297);
         $this->stream->attach($resource);
     }
 
     /**
      * @test
      */
+    public function attachWithNonStringNonResourceRaisesExceptionByString()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717296);
+        $this->stream->attach('foo-bar-baz');
+    }
+
+    /**
+     * @test
+     */
     public function attachWithResourceAttachesResource()
     {
         $fileName = PATH_site . 'typo3temp/var/tests/' . $this->getUniqueId('test_');
index 1c1146a..a5c32c1 100644 (file)
@@ -65,7 +65,7 @@ class UploadedFileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructorRaisesExceptionOnInvalidStreamOrFile($streamOrFile)
     {
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException(\InvalidArgumentException::class);
         new UploadedFile($streamOrFile, 0, UPLOAD_ERR_OK);
     }
 
@@ -91,7 +91,8 @@ class UploadedFileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructorRaisesExceptionOnInvalidSize($size)
     {
-        $this->setExpectedException('InvalidArgumentException', 'size');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717302);
         new UploadedFile(fopen('php://temp', 'wb+'), $size, UPLOAD_ERR_OK);
     }
 
@@ -119,7 +120,8 @@ class UploadedFileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructorRaisesExceptionOnInvalidErrorStatus($status)
     {
-        $this->setExpectedException('InvalidArgumentException', 'status');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717303);
         new UploadedFile(fopen('php://temp', 'wb+'), 0, $status);
     }
 
@@ -144,7 +146,8 @@ class UploadedFileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructorRaisesExceptionOnInvalidClientFilename($filename)
     {
-        $this->setExpectedException('InvalidArgumentException', 'filename');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717304);
         new UploadedFile(fopen('php://temp', 'wb+'), 0, UPLOAD_ERR_OK, $filename);
     }
 
@@ -154,7 +157,8 @@ class UploadedFileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructorRaisesExceptionOnInvalidClientMediaType($mediaType)
     {
-        $this->setExpectedException('InvalidArgumentException', 'media type');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717305);
         new UploadedFile(fopen('php://temp', 'wb+'), 0, UPLOAD_ERR_OK, 'foobar.baz', $mediaType);
     }
 
@@ -236,7 +240,8 @@ class UploadedFileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK);
 
         $this->tmpFile = $path;
-        $this->setExpectedException('InvalidArgumentException', 'path');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717307);
         $upload->moveTo($path);
     }
 
@@ -253,7 +258,8 @@ class UploadedFileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $upload->moveTo($to);
         $this->assertTrue(file_exists($to));
 
-        $this->setExpectedException('RuntimeException', 'moved');
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1436717308);
         $upload->moveTo($to);
     }
 
@@ -270,7 +276,8 @@ class UploadedFileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $upload->moveTo($to);
         $this->assertTrue(file_exists($to));
 
-        $this->setExpectedException('RuntimeException', 'moved');
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1436717306);
         $upload->getStream();
     }
 }
index 623a776..dfe8693 100644 (file)
@@ -127,15 +127,35 @@ class UriTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @return array
      */
-    public function invalidPortsDataProvider()
+    public function invalidPortsDataProviderType()
     {
         return [
             'null'      => [null],
-            'true'      => [true],
             'false'     => [false],
             'string'    => ['string'],
             'array'     => [[3000]],
             'object'    => [(object) [3000]],
+        ];
+    }
+
+    /**
+     * @dataProvider invalidPortsDataProviderType
+     * @test
+     */
+    public function withPortRaisesExceptionForInvalidPortsByType($port)
+    {
+        $uri = new Uri('https://user:pass@local.example.com:3001/foo?bar=baz#quz');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717324);
+        $uri->withPort($port);
+    }
+
+    /**
+     * @return array
+     */
+    public function invalidPortsDataProviderRange()
+    {
+        return [
             'zero'      => [0],
             'too-small' => [-1],
             'too-big'   => [65536],
@@ -143,12 +163,29 @@ class UriTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     }
 
     /**
-     * @dataProvider invalidPortsDataProvider
+     * @test
+     * @todo: Currently, boolean true is interpreted as 1 by canBeInterpretedAsInteger().
+     * @todo: This test shows that, but there is an inconsistency and maybe it would be better
+     * @todo: if the code would not accept 'true' as valid port but throw an exception instead.
+     * @todo: If that is changed, 'true' should be added to the 'invalid type' data provider above.
      */
-    public function withPortRaisesExceptionForInvalidPorts($port)
+    public function withPortAcceptsBooleanTrueAsPortOne()
     {
         $uri = new Uri('https://user:pass@local.example.com:3001/foo?bar=baz#quz');
-        $this->setExpectedException('InvalidArgumentException', 'Invalid port');
+        $new = $uri->withPort(true);
+        $this->assertNotSame($uri, $new);
+        $this->assertEquals(1, $new->getPort());
+    }
+
+    /**
+     * @dataProvider invalidPortsDataProviderRange
+     * @test
+     */
+    public function withPortRaisesExceptionForInvalidPortsByRange($port)
+    {
+        $uri = new Uri('https://user:pass@local.example.com:3001/foo?bar=baz#quz');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717326);
         $new = $uri->withPort($port);
     }
 
@@ -175,8 +212,6 @@ class UriTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             'false'    => [false],
             'array'    => [['/bar/baz']],
             'object'   => [(object) ['/bar/baz']],
-            'query'    => ['/bar/baz?bat=quz'],
-            'fragment' => ['/bar/baz#bat'],
         ];
     }
 
@@ -187,13 +222,36 @@ class UriTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function withPathRaisesExceptionForInvalidPaths($path)
     {
         $uri = new Uri('https://user:pass@local.example.com:3001/foo?bar=baz#quz');
-        $this->setExpectedException('InvalidArgumentException', 'Invalid path');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717328);
         $new = $uri->withPath($path);
     }
 
     /**
      * @test
      */
+    public function withPathRaisesExceptionForInvalidPathsWithQuery()
+    {
+        $uri = new Uri('https://user:pass@local.example.com:3001/foo?bar=baz#quz');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717330);
+        $new = $uri->withPath('/bar/baz?bat=quz');
+    }
+
+    /**
+     * @test
+     */
+    public function withPathRaisesExceptionForInvalidPathsWithFragment()
+    {
+        $uri = new Uri('https://user:pass@local.example.com:3001/foo?bar=baz#quz');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717332);
+        $new = $uri->withPath('/bar/baz#bat');
+    }
+
+    /**
+     * @test
+     */
     public function withQueryReturnsNewInstanceWithProvidedQuery()
     {
         $uri = new Uri('https://user:pass@local.example.com:3001/foo?bar=baz#quz');
@@ -214,7 +272,6 @@ class UriTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             'false'    => [false],
             'array'    => [['baz=bat']],
             'object'   => [(object) ['baz=bat']],
-            'fragment' => ['baz=bat#quz'],
         ];
     }
 
@@ -222,16 +279,28 @@ class UriTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      * @dataProvider invalidQueryStringsDataProvider
      * @test
      */
-    public function withQueryRaisesExceptionForInvalidQueryStrings($query)
+    public function withQueryRaisesExceptionForInvalidQueryStringsByType($query)
     {
         $uri = new Uri('https://user:pass@local.example.com:3001/foo?bar=baz#quz');
-        $this->setExpectedException('InvalidArgumentException', 'Query string');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717334);
         $new = $uri->withQuery($query);
     }
 
     /**
      * @test
      */
+    public function withQueryRaisesExceptionForInvalidQueryStringsByFragment()
+    {
+        $uri = new Uri('https://user:pass@local.example.com:3001/foo?bar=baz#quz');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717336);
+        $new = $uri->withQuery('baz=bat#quz');
+    }
+
+    /**
+     * @test
+     */
     public function withFragmentReturnsNewInstanceWithProvidedFragment()
     {
         $uri = new Uri('https://user:pass@local.example.com:3001/foo?bar=baz#quz');
@@ -332,7 +401,7 @@ class UriTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructorRaisesExceptionForNonStringURI($uri)
     {
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException(\InvalidArgumentException::class);
         new Uri($uri);
     }
 
@@ -341,7 +410,7 @@ class UriTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructorRaisesExceptionForSeriouslyMalformedURI()
     {
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException(\InvalidArgumentException::class);
         new Uri('http:///www.php-fig.org/');
     }
 
@@ -375,7 +444,8 @@ class UriTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructWithUnsupportedSchemeRaisesAnException($scheme)
     {
-        $this->setExpectedException('InvalidArgumentException', 'Unsupported scheme');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717338);
         $uri = new Uri($scheme . '://example.com');
     }
 
@@ -386,7 +456,8 @@ class UriTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function withSchemeUsingUnsupportedSchemeRaisesAnException($scheme)
     {
         $uri = new Uri('http://example.com');
-        $this->setExpectedException('InvalidArgumentException', 'Unsupported scheme');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1436717338);
         $uri->withScheme($scheme);
     }
 
index caf05c7..9622f9c 100644 (file)
@@ -224,7 +224,7 @@ class IconFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getIconThrowsExceptionIfInvalidSizeIsGiven()
     {
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException(\InvalidArgumentException::class);
         $this->subject->getIcon($this->registeredIconIdentifier, 'foo')->render();
     }
 
index f4d3540..73b6e4a 100644 (file)
@@ -50,7 +50,8 @@ class DriverRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function registerDriverClassThrowsExceptionIfClassDoesNotExist()
     {
-        $this->setExpectedException('InvalidArgumentException', '', 1314979197);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1314979197);
         $this->subject->registerDriverClass($this->getUniqueId());
     }
 
@@ -59,7 +60,8 @@ class DriverRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function registerDriverClassThrowsExceptionIfShortnameIsAlreadyTakenByAnotherDriverClass()
     {
-        $this->setExpectedException('InvalidArgumentException', '', 1314979451);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1314979451);
         $className = get_class($this->getMockForAbstractClass(\TYPO3\CMS\Core\Resource\Driver\AbstractDriver::class));
         $className2 = get_class($this->getMockForAbstractClass(\TYPO3\CMS\Core\Resource\Driver\DriverInterface::class));
         $this->subject->registerDriverClass($className, 'foobar');
@@ -71,7 +73,8 @@ class DriverRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getDriverClassThrowsExceptionIfClassIsNotRegistered()
     {
-        $this->setExpectedException('InvalidArgumentException', '', 1314085990);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1314085990);
         $this->subject->getDriverClass($this->getUniqueId());
     }
 
index 904a693..ae22634 100644 (file)
@@ -430,7 +430,8 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase
      */
     public function addFileFailsIfFileIsInDriverStorage()
     {
-        $this->setExpectedException('InvalidArgumentException', '', 1314778269);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1314778269);
         $this->addToMount(array(
             'targetFolder' => array(
                 'file' => 'asdf'
@@ -655,7 +656,8 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase
      */
     public function getFileThrowsExceptionIfFileDoesNotExist()
     {
-        $this->setExpectedException('InvalidArgumentException', '', 1314516809);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1314516809);
         $subject = $this->createDriver();
         $subject->getFileInfoByIdentifier('/some/file/at/a/random/path');
     }
@@ -720,7 +722,8 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase
      */
     public function getFileListFailsIfDirectoryDoesNotExist()
     {
-        $this->setExpectedException('InvalidArgumentException', '', 1314349666);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1314349666);
         $this->addToMount(array('somefile' => ''));
         $subject = $this->createDriver();
         $subject->getFilesInFolder('somedir/');
@@ -744,7 +747,8 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase
         $this->addToMount($dirStructure);
         $subject = $this->createDriver();
         // the callback function will throw an exception used to check if it was called with correct $itemName
-        $this->setExpectedException('InvalidArgumentException', '$itemName', 1336159604);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1336159604);
         $subject->getFilesInFolder('/', 0, 0, false, $callback);
     }
 
@@ -867,7 +871,8 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase
      */
     public function getFolderListFailsIfDirectoryDoesNotExist()
     {
-        $this->setExpectedException('InvalidArgumentException', '', 1314349666);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1314349666);
         $subject = $this->createDriver();
         vfsStream::create(array($this->basedir => array('somefile' => '')));
         $subject->getFoldersInFolder('somedir/');
@@ -892,7 +897,8 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase
      */
     public function hashingWithUnsupportedAlgorithmFails()
     {
-        $this->setExpectedException('InvalidArgumentException', '', 1304964032);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1304964032);
         $subject = $this->createDriver();
         $subject->hash('/hashFile', $this->getUniqueId());
     }
@@ -1204,7 +1210,8 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase
      */
     public function renamingFilesFailsIfTargetFileExists()
     {
-        $this->setExpectedException(\TYPO3\CMS\Core\Resource\Exception\ExistingTargetFileNameException::class, '', 1320291063);
+        $this->expectException(\TYPO3\CMS\Core\Resource\Exception\ExistingTargetFileNameException::class);
+        $this->expectExceptionCode(1320291063);
         $this->addToMount(array(
             'targetFolder' => array('file' => '', 'newFile' => '')
         ));
@@ -1281,7 +1288,8 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase
      */
     public function renameFolderRevertsRenamingIfFilenameMapCannotBeCreated()
     {
-        $this->setExpectedException('\\RuntimeException', '', 1334160746);
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1334160746);
         $this->addToMount(array(
             'sourceFolder' => array(
                 'file' => 'asdfg'
@@ -1633,9 +1641,10 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase
      */
     public function applyFilterMethodsToDirectoryItemCallsFilterMethodIfClosure()
     {
-        $this->setExpectedException('Exception', 'I was called!');
+        $this->expectException(\Exception::class);
+        $this->expectExceptionCode(1463073434);
         $closure = function () {
-            throw new \Exception('I was called!');
+            throw new \Exception('I was called!', 1463073434);
         };
 
         $filterMethods = array(
index efcf192..e39f78a 100644 (file)
@@ -42,7 +42,8 @@ class AbstractRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function findByUidFailsIfUidIsString()
     {
-        $this->setExpectedException('InvalidArgumentException', '', 1316779798);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1316779798);
         $this->subject->findByUid('asdf');
     }
 
index c8bdeac..a286dbb 100644 (file)
@@ -327,7 +327,8 @@ class ResourceStorageTest extends BaseTestCase
     {
         /** @var Folder|\PHPUnit_Framework_MockObject_MockObject $mockedFolder */
         $mockedFolder = $this->getMock(Folder::class, array(), array(), '', false);
-        $this->setExpectedException('InvalidArgumentException', '', 1319552745);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1319552745);
         $this->prepareSubject(array());
         $this->subject->addFile('/some/random/file', $mockedFolder);
     }
@@ -716,7 +717,8 @@ class ResourceStorageTest extends BaseTestCase
      */
     public function createFolderThrowsExceptionIfParentFolderDoesNotExist()
     {
-        $this->setExpectedException('InvalidArgumentException', '', 1325689164);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1325689164);
         $mockedParentFolder = $this->getSimpleFolderMock('/someFolder/');
         $this->prepareSubject(array(), true);
         $mockedDriver = $this->createDriverMock(array(), $this->subject);
@@ -729,7 +731,8 @@ class ResourceStorageTest extends BaseTestCase
      */
     public function replaceFileFailsIfLocalFileDoesNotExist()
     {
-        $this->setExpectedException('InvalidArgumentException', '', 1325842622);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1325842622);
         $this->prepareSubject(array(), true);
         $mockedFile = $this->getSimpleFileMock('/someFile');
         $this->subject->replaceFile($mockedFile, PATH_site . $this->getUniqueId());
index e0c47f9..c5610ca 100644 (file)
@@ -112,7 +112,8 @@ class TreeDataProviderFactoryTest extends UnitTestCase
             ],
             'internal_type' => 'foo',
         ];
-        $this->setExpectedException(\RuntimeException::class, '', 1438875249);
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1438875249);
         $this->subject->getDataProvider($tcaConfiguration, 'foo', 'bar', array('uid' => 1));
     }
 }
index 48bf0fc..96bd068 100644 (file)
@@ -257,7 +257,8 @@ class TypoScriptParserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function executeValueModifierThrowsException($modifierName, $currentValue, $modifierArgument)
     {
-        $this->setExpectedException('InvalidArgumentException', 'The list "' . $currentValue . '" should be sorted numerically but contains a non-numeric value');
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1438191758);
         $this->typoScriptParser->_call('executeValueModifier', $modifierName, $modifierArgument, $currentValue);
     }
 
index dfda3d0..282433f 100644 (file)
@@ -2692,7 +2692,7 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $GLOBALS['T3_VAR']['callUserFunction'][$functionName]['method'] = 'minify';
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['minifyJavaScript'][] = $functionName;
         $minifyHookMock->expects($this->any())->method('minify')->will($this->returnCallback(array($this, 'minifyJavaScriptErroneousCallback')));
-        $this->setExpectedException('\\RuntimeException');
+        $this->expectException(\RuntimeException::class);
         GeneralUtilityMinifyJavaScriptFixture::minifyJavaScript('string to compress');
     }
 
index 13e3d55..322303b 100644 (file)
@@ -86,7 +86,8 @@ class VersionNumberUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function convertIntegerToVersionNumberConvertsOtherTypesAsIntegerToVersionNumber($version)
     {
-        $this->setExpectedException('\\InvalidArgumentException', '', 1334072223);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1334072223);
         VersionNumberUtility::convertIntegerToVersionNumber($version);
     }
 
index 2dc4bb9..0f7ffbb 100644 (file)
@@ -22,6 +22,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator;
  *                                                                        */
 
 use TYPO3\CMS\Core\Tests\UnitTestCase;
+use TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\Fixture\AbstractCompositeValidatorClass;
 
 /**
  * Testcase for the abstract base-class of composite-validators
@@ -40,7 +41,7 @@ class AbstractCompositeValidatorTest extends UnitTestCase
             'demoOption' => 42
         );
         $expectedOptions = $inputOptions;
-        $validator = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\Fixture\AbstractCompositeValidatorClass::class, array('dummy'), array($inputOptions));
+        $validator = $this->getAccessibleMock(AbstractCompositeValidatorClass::class, array('dummy'), array($inputOptions));
         $this->assertSame($expectedOptions, $validator->_get('options'));
     }
 
@@ -54,7 +55,7 @@ class AbstractCompositeValidatorTest extends UnitTestCase
             'requiredOption' => 666,
             'demoOption' => PHP_INT_MAX
         );
-        $validator = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\Fixture\AbstractCompositeValidatorClass::class, array('dummy'), array($inputOptions));
+        $validator = $this->getAccessibleMock(AbstractCompositeValidatorClass::class, array('dummy'), array($inputOptions));
         $this->assertSame($expectedOptions, $validator->_get('options'));
     }
 
@@ -64,8 +65,9 @@ class AbstractCompositeValidatorTest extends UnitTestCase
     public function validatorThrowsExceptionOnNotSupportedOptions()
     {
         $inputOptions = array('invalidoption' => 42);
-        $this->setExpectedException(\TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationOptionsException::class, '', 1339079804);
-        $validator = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\Fixture\AbstractCompositeValidatorClass::class, array('dummy'), array($inputOptions));
+        $this->expectException(\TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationOptionsException::class);
+        $this->expectExceptionCode(1339079804);
+        $validator = $this->getAccessibleMock(AbstractCompositeValidatorClass::class, array('dummy'), array($inputOptions));
     }
 
     /**
@@ -74,7 +76,8 @@ class AbstractCompositeValidatorTest extends UnitTestCase
     public function validatorThrowsExceptionOnMissingRequiredOptions()
     {
         $inputOptions = array();
-        $this->setExpectedException(\TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationOptionsException::class, '', 1339163922);
-        $validator = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\Fixture\AbstractCompositeValidatorClass::class, array('dummy'), array($inputOptions));
+        $this->expectException(\TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationOptionsException::class);
+        $this->expectExceptionCode(1339163922);
+        $validator = $this->getAccessibleMock(AbstractCompositeValidatorClass::class, array('dummy'), array($inputOptions));
     }
 }
index 087d987..ad4615b 100644 (file)
@@ -22,6 +22,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator;
  *                                                                        */
 
 use TYPO3\CMS\Core\Tests\UnitTestCase;
+use TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\Fixture\AbstractValidatorClass;
 
 /**
  * Testcase for the abstract base-class of validators
@@ -40,7 +41,7 @@ class AbstractValidatorTest extends UnitTestCase
             'demoOption' => 42
         );
         $expectedOptions = $inputOptions;
-        $validator = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\Fixture\AbstractValidatorClass::class, array('dummy'), array($inputOptions));
+        $validator = $this->getAccessibleMock(AbstractValidatorClass::class, array('dummy'), array($inputOptions));
         $this->assertSame($expectedOptions, $validator->_get('options'));
     }
 
@@ -54,7 +55,7 @@ class AbstractValidatorTest extends UnitTestCase
             'requiredOption' => 666,
             'demoOption' => PHP_INT_MAX
         );
-        $validator = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\Fixture\AbstractValidatorClass::class, array('dummy'), array($inputOptions));
+        $validator = $this->getAccessibleMock(AbstractValidatorClass::class, array('dummy'), array($inputOptions));
         $this->assertSame($expectedOptions, $validator->_get('options'));
     }
 
@@ -64,8 +65,9 @@ class AbstractValidatorTest extends UnitTestCase
     public function validatorThrowsExceptionOnNotSupportedOptions()
     {
         $inputOptions = array('invalidoption' => 42);
-        $this->setExpectedException(\TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationOptionsException::class, '', 1379981890);
-        $validator = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\Fixture\AbstractValidatorClass::class, array('dummy'), array($inputOptions));
+        $this->expectException(\TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationOptionsException::class);
+        $this->expectExceptionCode(1379981890);
+        $validator = $this->getAccessibleMock(AbstractValidatorClass::class, array('dummy'), array($inputOptions));
     }
 
     /**
@@ -74,7 +76,8 @@ class AbstractValidatorTest extends UnitTestCase
     public function validatorThrowsExceptionOnMissingRequiredOptions()
     {
         $inputOptions = array();
-        $this->setExpectedException(\TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationOptionsException::class, '', 1379981891);
-        $validator = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\Fixture\AbstractValidatorClass::class, array('dummy'), array($inputOptions));
+        $this->expectException(\TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationOptionsException::class);
+        $this->expectExceptionCode(1379981891);
+        $validator = $this->getAccessibleMock(AbstractValidatorClass::class, array('dummy'), array($inputOptions));
     }
 }
index bc97e25..2f42b6a 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Validation;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Extbase\Validation\Exception\NoSuchValidatorException;
+
 /**
  * Test case
  */
@@ -60,7 +62,8 @@ class ValidatorResolverTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $className = $this->getUniqueId('Foo');
         $validatorName = 'tx_foo:' . $className;
-        $this->setExpectedException(\TYPO3\CMS\Extbase\Validation\Exception\NoSuchValidatorException::class, '', 1365799920);
+        $this->expectException(NoSuchValidatorException::class);
+        $this->expectExceptionCode(1365799920);
         $this->validatorResolver->_call('resolveValidatorObjectName', $validatorName);
     }
 
@@ -74,7 +77,8 @@ class ValidatorResolverTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $realClassName = 'Tx_' . $extensionName . '_Validation_Validator_' . $className . 'Validator';
         $validatorName = $extensionName . ':' . $className;
         eval('class ' . $realClassName . '{}');
-        $this->setExpectedException(\TYPO3\CMS\Extbase\Validation\Exception\NoSuchValidatorException::class, '', 1365776838);
+        $this->expectException(NoSuchValidatorException::class);
+        $this->expectExceptionCode(1365776838);
         $this->validatorResolver->_call('resolveValidatorObjectName', $validatorName);
     }
 
@@ -102,7 +106,8 @@ class ValidatorResolverTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function resolveValidatorObjectNameThrowsNoSuchValidatorExceptionIfClassNotExists()
     {
         $className = $this->getUniqueId('Foo');
-        $this->setExpectedException(\TYPO3\CMS\Extbase\Validation\Exception\NoSuchValidatorException::class, '', 1365799920);
+        $this->expectException(NoSuchValidatorException::class);
+        $this->expectExceptionCode(1365799920);
         $this->validatorResolver->_call('resolveValidatorObjectName', $className);
     }
 
@@ -114,7 +119,8 @@ class ValidatorResolverTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $className = $this->getUniqueId('Foo_');
         $expectedValidatorName = $className . 'Validator';
         eval('class ' . $expectedValidatorName . '{}');
-        $this->setExpectedException(\TYPO3\CMS\Extbase\Validation\Exception\NoSuchValidatorException::class, '', 1365776838);
+        $this->expectException(NoSuchValidatorException::class);
+        $this->expectExceptionCode(1365776838);
         $this->validatorResolver->_call('resolveValidatorObjectName', $className);
     }
 
@@ -181,7 +187,8 @@ class ValidatorResolverTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $this->markTestSkipped('');
         $className = $this->getUniqueId('Test');
-        $this->setExpectedException(\TYPO3\CMS\Extbase\Validation\Exception\NoSuchValidatorException::class, '', 1365799920);
+        $this->expectException(NoSuchValidatorException::class);
+        $this->expectExceptionCode(1365799920);
         $this->validatorResolver->createValidator($className);
     }
 
index ac6ec63..3c50608 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Utility;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException;
+
 /**
  * Test for DependencyUtility
  *
@@ -45,7 +47,8 @@ class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $dependencyMock->setIdentifier('typo3');
         $dependencyUtility = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Utility\DependencyUtility::class, array('dummy'));
 
-        $this->setExpectedException(\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException::class, '', 1399144499);
+        $this->expectException(ExtensionManagerException::class);
+        $this->expectExceptionCode(1399144499);
         $dependencyUtility->_call('checkTypo3Dependency', $dependencyMock);
     }
 
@@ -62,7 +65,8 @@ class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $dependencyMock->setIdentifier('typo3');
         $dependencyUtility = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Utility\DependencyUtility::class, array('dummy'));
 
-        $this->setExpectedException(\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException::class, '', 1399144521);
+        $this->expectException(ExtensionManagerException::class);
+        $this->expectExceptionCode(1399144521);
         $dependencyUtility->_call('checkTypo3Dependency', $dependencyMock);
     }
 
@@ -77,7 +81,8 @@ class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $dependencyMock->setIdentifier('123');
         $dependencyUtility = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Utility\DependencyUtility::class, array('dummy'));
 
-        $this->setExpectedException(\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException::class, '', 1399144551);
+        $this->expectException(ExtensionManagerException::class);
+        $this->expectExceptionCode(1399144551);
         $dependencyUtility->_call('checkTypo3Dependency', $dependencyMock);
     }
 
@@ -141,7 +146,8 @@ class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $dependencyMock->setIdentifier('php');
         $dependencyUtility = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Utility\DependencyUtility::class, array('dummy'));
 
-        $this->setExpectedException(\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException::class, '', 1377977857);
+        $this->expectException(ExtensionManagerException::class);
+        $this->expectExceptionCode(1377977857);
         $dependencyUtility->_call('checkPhpDependency', $dependencyMock);
     }
 
@@ -158,7 +164,8 @@ class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $dependencyMock->setIdentifier('php');
         $dependencyUtility = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Utility\DependencyUtility::class, array('dummy'));
 
-        $this->setExpectedException(\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException::class, '', 1377977856);
+        $this->expectException(ExtensionManagerException::class);
+        $this->expectExceptionCode(1377977856);
         $dependencyUtility->_call('checkPhpDependency', $dependencyMock);
     }
 
@@ -173,7 +180,8 @@ class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $dependencyMock->setIdentifier('123');
         $dependencyUtility = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Utility\DependencyUtility::class, array('dummy'));
 
-        $this->setExpectedException(\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException::class, '', 1377977858);
+        $this->expectException(ExtensionManagerException::class);
+        $this->expectExceptionCode(1377977858);
         $dependencyUtility->_call('checkPhpDependency', $dependencyMock);
     }
 
index aa18389..91d028c 100644 (file)
@@ -93,7 +93,7 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $reflectionService->expects($this->once())->method('getMethodTagsValues')->willReturn(array());
         $fixture = $this->getAccessibleMock(TestViewHelper::class, array('render'));
         $fixture->injectReflectionService($reflectionService);
-        $this->setExpectedException(Exception::class);
+        $this->expectException(Exception::class);
         $this->callInaccessibleMethod($fixture, 'registerRenderMethodArguments');
     }
 
@@ -144,7 +144,7 @@ class AbstractViewHelperTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $fixture->setArguments($namedArguments);
         if ($expectsException) {
             $exception = new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception('test');
-            $this->setExpectedException(get_class($exception));
+            $this->expectException(get_class($exception));
             $fixture->expects($this->once())->method('render')->willThrowException($exception);
             $this->assertEquals('test', $this->callInaccessibleMethod($fixture, 'callRenderMethod'));
         } else {
index 450d585..10bc680 100644 (file)
@@ -106,7 +106,7 @@ class SilentConfigurationUpgradeServiceTest extends \TYPO3\CMS\Core\Tests\UnitTe
             ->method('setLocalConfigurationValueByPath')
             ->with($this->equalTo('BE/loginSecurityLevel'), $this->equalTo($setting));
 
-        $this->setExpectedException(RedirectException::class);
+        $this->expectException(RedirectException::class);
 
         $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);
 
@@ -143,7 +143,7 @@ class SilentConfigurationUpgradeServiceTest extends \TYPO3\CMS\Core\Tests\UnitTe
             ->method('removeLocalConfigurationKeysByPath')
             ->will($this->returnValueMap($currentLocalConfiguration));
 
-        $this->setExpectedException(RedirectException::class);
+        $this->expectException(RedirectException::class);
 
         $silentConfigurationUpgradeServiceInstance->_set('obsoleteLocalConfigurationSettings', $obsoleteLocalConfigurationSettings);
         $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);
@@ -225,7 +225,7 @@ class SilentConfigurationUpgradeServiceTest extends \TYPO3\CMS\Core\Tests\UnitTe
             ->method('setLocalConfigurationValueByPath')
             ->with($this->equalTo('EXT/extConf/saltedpasswords'), $this->equalTo($config));
 
-        $this->setExpectedException(RedirectException::class);
+        $this->expectException(RedirectException::class);
 
         $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);
 
@@ -270,7 +270,7 @@ class SilentConfigurationUpgradeServiceTest extends \TYPO3\CMS\Core\Tests\UnitTe
             ->method('setLocalConfigurationValueByPath')
             ->with($this->equalTo('EXT/extConf/saltedpasswords'), $this->equalTo($newConfig));
 
-        $this->setExpectedException(RedirectException::class);
+        $this->expectException(RedirectException::class);
 
         $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);
 
@@ -315,7 +315,7 @@ class SilentConfigurationUpgradeServiceTest extends \TYPO3\CMS\Core\Tests\UnitTe
             ->method('setLocalConfigurationValueByPath')
             ->with($this->equalTo('EXT/extConf/saltedpasswords'), $this->equalTo($newConfig));
 
-        $this->setExpectedException(RedirectException::class);
+        $this->expectException(RedirectException::class);
 
         $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);
 
@@ -388,7 +388,7 @@ class SilentConfigurationUpgradeServiceTest extends \TYPO3\CMS\Core\Tests\UnitTe
             ->method('setLocalConfigurationValueByPath')
             ->with($this->equalTo('SYS/encryptionKey'), $this->isType('string'));
 
-        $this->setExpectedException(RedirectException::class);
+        $this->expectException(RedirectException::class);
 
         $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);
 
@@ -533,7 +533,7 @@ class SilentConfigurationUpgradeServiceTest extends \TYPO3\CMS\Core\Tests\UnitTe
         }
 
         if ($localConfigurationNeedsUpdate) {
-            $this->setExpectedException(RedirectException::class);
+            $this->expectException(RedirectException::class);
         }
 
         $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);
@@ -580,7 +580,7 @@ class SilentConfigurationUpgradeServiceTest extends \TYPO3\CMS\Core\Tests\UnitTe
                 array(array('GFX/imagefile_ext' => 'gif,jpg,jpeg,png'))
             );
 
-        $this->setExpectedException(RedirectException::class);
+        $this->expectException(RedirectException::class);
 
         $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);
 
@@ -666,7 +666,7 @@ class SilentConfigurationUpgradeServiceTest extends \TYPO3\CMS\Core\Tests\UnitTe
                             'GFX/processor_effects' => -1))
             );
 
-        $this->setExpectedException(RedirectException::class);
+        $this->expectException(RedirectException::class);
 
         $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);