[TASK] Replace @expectedException with code wise test in ext:core 06/48506/7
authorJörg Bösche <typo3@joergboesche.de>
Wed, 8 Jun 2016 13:33:45 +0000 (15:33 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Wed, 8 Jun 2016 14:58:24 +0000 (16:58 +0200)
The patch replaces the @expectedException annotation with
the phpUnit code wise methods. On every expectedException test
we are especially take care to take the exception code in account.
Also refactoring array syntax and line formats.

Resolves: #76497
Releases: master
Change-Id: Idee1c94cb5940e6d11d62abdb0c6132e4d02e9bb
Reviewed-on: https://review.typo3.org/48506
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
58 files changed:
typo3/sysext/core/Tests/Functional/Database/DatabaseConnectionTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/ApcBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/FileBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/MemcachedBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/PdoBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/RedisBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/TransientMemoryBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/Typo3DatabaseBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/WincacheBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/XcacheBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/CacheManagerTest.php
typo3/sysext/core/Tests/Unit/Cache/Frontend/AbstractFrontendTest.php
typo3/sysext/core/Tests/Unit/Cache/Frontend/PhpFrontendTest.php
typo3/sysext/core/Tests/Unit/Cache/Frontend/StringFrontendTest.php
typo3/sysext/core/Tests/Unit/Cache/Frontend/VariableFrontendTest.php
typo3/sysext/core/Tests/Unit/Category/CategoryRegistryTest.php
typo3/sysext/core/Tests/Unit/Category/Collection/CategoryCollectionTest.php
typo3/sysext/core/Tests/Unit/Collection/RecordCollectionRepositoryTest.php
typo3/sysext/core/Tests/Unit/Configuration/ConfigurationManagerTest.php
typo3/sysext/core/Tests/Unit/Core/ApplicationContextTest.php
typo3/sysext/core/Tests/Unit/Core/ClassLoadingInformationGeneratorTest.php
typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php
typo3/sysext/core/Tests/Unit/Database/DatabaseConnectionTest.php
typo3/sysext/core/Tests/Unit/Database/PreparedStatementTest.php
typo3/sysext/core/Tests/Unit/Database/Query/BulkInsertTest.php
typo3/sysext/core/Tests/Unit/Database/Query/QueryBuilderTest.php
typo3/sysext/core/Tests/Unit/FormProtection/BackendFormProtectionTest.php
typo3/sysext/core/Tests/Unit/FormProtection/FormProtectionFactoryTest.php
typo3/sysext/core/Tests/Unit/Imaging/IconProvider/FontawesomeIconProviderTest.php
typo3/sysext/core/Tests/Unit/Imaging/IconRegistryTest.php
typo3/sysext/core/Tests/Unit/Locking/LockFactoryTest.php
typo3/sysext/core/Tests/Unit/Log/LogLevelTest.php
typo3/sysext/core/Tests/Unit/Log/LogRecordTest.php
typo3/sysext/core/Tests/Unit/Log/Processor/AbstractProcessorTest.php
typo3/sysext/core/Tests/Unit/Log/Writer/AbstractWriterTest.php
typo3/sysext/core/Tests/Unit/Log/Writer/DatabaseWriterTest.php
typo3/sysext/core/Tests/Unit/Mail/MailerTest.php
typo3/sysext/core/Tests/Unit/Package/DependencyResolverTest.php
typo3/sysext/core/Tests/Unit/Package/PackageManagerTest.php
typo3/sysext/core/Tests/Unit/Package/PackageTest.php
typo3/sysext/core/Tests/Unit/Page/PageRendererTest.php
typo3/sysext/core/Tests/Unit/RegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/Collection/FileCollectionRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/Driver/LocalDriverTest.php
typo3/sysext/core/Tests/Unit/Resource/FileReferenceTest.php
typo3/sysext/core/Tests/Unit/Resource/Index/ExtractorRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/Rendering/RendererRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php
typo3/sysext/core/Tests/Unit/Resource/TextExtraction/TextExtractorRegistryTest.php
typo3/sysext/core/Tests/Unit/Service/DependencyOrderingServiceTest.php
typo3/sysext/core/Tests/Unit/Tree/TableConfiguration/TreeDataProviderFactoryTest.php
typo3/sysext/core/Tests/Unit/Type/EnumerationTest.php
typo3/sysext/core/Tests/Unit/TypoScript/TemplateServiceTest.php
typo3/sysext/core/Tests/Unit/Utility/ArrayUtilityTest.php
typo3/sysext/core/Tests/Unit/Utility/ExtensionManagementUtilityTest.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
typo3/sysext/core/Tests/Unit/Utility/RootlineUtilityTest.php
typo3/sysext/core/Tests/Unit/Utility/StringUtilityTest.php

index 5e19608..d168593 100644 (file)
@@ -84,12 +84,14 @@ class DatabaseConnectionTest extends FunctionalTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
-     * @expectedExceptionMessage TYPO3 Fatal Error: Cannot connect to the current database, "Foo"!
      * @return void
      */
     public function selectDbReturnsFalse()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1270853883);
+        $this->expectExceptionMessage('TYPO3 Fatal Error: Cannot connect to the current database, "Foo"!');
+
         $this->subject->setDatabaseName('Foo');
         $this->assertFalse($this->subject->sql_select_db());
     }
@@ -170,10 +172,12 @@ class DatabaseConnectionTest extends FunctionalTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function connectDbThrowsExeptionsWhenNoDatabaseIsGiven()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1270853882);
+
         /** @var DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject|AccessibleObjectInterface $subject */
         $subject = $this->getAccessibleMock(DatabaseConnection::class, ['dummy'], [], '', false);
         $subject->connectDB();
index e6dfc24..344abe6 100644 (file)
@@ -44,7 +44,6 @@ class ApcBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function setThrowsExceptionIfNoFrontEndHasBeenSet()
     {
@@ -52,6 +51,9 @@ class ApcBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $data = 'Some data';
         $identifier = $this->getUniqueId('MyIdentifier');
         $backend->set($identifier, $data);
+
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1232986877);
     }
 
     /**
index da534f8..40a8bdc 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Backend;
 
 use org\bovigo\vfs\vfsStreamDirectory;
 use org\bovigo\vfs\vfsStreamWrapper;
+use TYPO3\CMS\Core\Cache\Exception\InvalidDataException;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -42,10 +43,12 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function setCacheDirectoryThrowsExceptionOnNonWritableDirectory()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1303669848);
+
         $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
 
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
@@ -182,10 +185,12 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception\InvalidDataException
      */
     public function setThrowsExceptionIfDataIsNotAString()
     {
+        $this->expectException(InvalidDataException::class);
+        $this->expectExceptionCode(1204481674);
+
         $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
 
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
@@ -454,10 +459,12 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      * @dataProvider invalidEntryIdentifiers
-     * @expectedException \InvalidArgumentException
      */
     public function setThrowsExceptionForInvalidIdentifier($identifier)
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1282073032);
+
         $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
@@ -471,10 +478,12 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      * @dataProvider invalidEntryIdentifiers
-     * @expectedException \InvalidArgumentException
      */
     public function getThrowsExceptionForInvalidIdentifier($identifier)
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1282073033);
+
         $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
@@ -488,22 +497,25 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      * @dataProvider invalidEntryIdentifiers
-     * @expectedException \InvalidArgumentException
      */
     public function hasThrowsExceptionForInvalidIdentifier($identifier)
     {
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1282073034);
 
+        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
         $backend->has($identifier);
     }
 
     /**
      * @test
      * @dataProvider invalidEntryIdentifiers
-     * @expectedException \InvalidArgumentException
      */
     public function removeThrowsExceptionForInvalidIdentifier($identifier)
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1282073035);
+
         $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
@@ -517,10 +529,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      * @dataProvider invalidEntryIdentifiers
-     * @expectedException \InvalidArgumentException
      */
     public function requireOnceThrowsExceptionForInvalidIdentifier($identifier)
     {
+
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1282073036);
+
         $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
index b4219cc..8160bd5 100644 (file)
@@ -44,10 +44,12 @@ class MemcachedBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function setThrowsExceptionIfNoFrontEndHasBeenSet()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1213115903);
+
         $backendOptions = array('servers' => array('localhost:11211'));
         $backend = new MemcachedBackend('Testing', $backendOptions);
         $backend->initializeObject();
@@ -58,10 +60,12 @@ class MemcachedBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function initializeObjectThrowsExceptionIfNoMemcacheServerIsConfigured()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1213115903);
+
         $backend = new MemcachedBackend('Testing');
         $backend->initializeObject();
     }
index 43d2ca5..11cab0a 100644 (file)
@@ -31,10 +31,12 @@ class PdoBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function setThrowsExceptionIfNoFrontEndHasBeenSet()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1259515600);
+
         $backend = new \TYPO3\CMS\Core\Cache\Backend\PdoBackend('Testing');
         $data = 'Some data';
         $identifier = 'MyIdentifier';
index 61bee0e..ecb4de4 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Backend;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Cache\Exception\InvalidDataException;
 
 /**
  * Testcase for the cache to redis backend
@@ -108,85 +109,105 @@ class RedisBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test Functional
-     * @expectedException \InvalidArgumentException
      */
     public function setDatabaseThrowsExceptionIfGivenDatabaseNumberIsNotAnInteger()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1279763057);
+
+
         $this->setUpBackend(array('database' => 'foo'));
     }
 
     /**
      * @test Functional
-     * @expectedException \InvalidArgumentException
      */
     public function setDatabaseThrowsExceptionIfGivenDatabaseNumberIsNegative()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1279763534);
+
         $this->setUpBackend(array('database' => -1));
     }
 
     /**
      * @test Functional
-     * @expectedException \InvalidArgumentException
      */
     public function setCompressionThrowsExceptionIfCompressionParameterIsNotOfTypeBoolean()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1289679153);
+
         $this->setUpBackend(array('compression' => 'foo'));
     }
 
     /**
      * @test Functional
-     * @expectedException \InvalidArgumentException
      */
     public function setCompressionLevelThrowsExceptionIfCompressionLevelIsNotInteger()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1289679154);
+
         $this->setUpBackend(array('compressionLevel' => 'foo'));
     }
 
     /**
      * @test Functional
-     * @expectedException \InvalidArgumentException
      */
     public function setCompressionLevelThrowsExceptionIfCompressionLevelIsNotBetweenMinusOneAndNine()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1289679155);
+
         $this->setUpBackend(array('compressionLevel' => 11));
     }
 
     /**
      * @test Functional
-     * @expectedException \InvalidArgumentException
      */
     public function setThrowsExceptionIfIdentifierIsNotAString()
     {
+
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1377006651);
+
         $this->setUpBackend();
         $this->backend->set(array(), 'data');
     }
 
     /**
      * @test Functional
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception\InvalidDataException
      */
     public function setThrowsExceptionIfDataIsNotAString()
     {
+        $this->expectException(InvalidDataException::class);
+        $this->expectExceptionCode(1279469941);
+
         $this->setUpBackend();
         $this->backend->set($this->getUniqueId('identifier'), array());
     }
 
     /**
      * @test Functional
-     * @expectedException \InvalidArgumentException
      */
     public function setThrowsExceptionIfLifetimeIsNegative()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1279487573);
+
         $this->setUpBackend();
         $this->backend->set($this->getUniqueId('identifier'), 'data', array(), -42);
     }
 
     /**
      * @test Functional
-     * @expectedException \InvalidArgumentException
      */
     public function setThrowsExceptionIfLifetimeIsNotNullOrAnInteger()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1279488008);
+
         $this->setUpBackend();
         $this->backend->set($this->getUniqueId('identifier'), 'data', array(), array());
     }
@@ -495,10 +516,12 @@ class RedisBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test Functional
-     * @expectedException \InvalidArgumentException
      */
     public function hasThrowsExceptionIfIdentifierIsNotAString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1377006653);
+
         $this->setUpBackend();
         $this->backend->has(array());
     }
@@ -526,10 +549,12 @@ class RedisBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test Functional
-     * @expectedException \InvalidArgumentException
      */
     public function getThrowsExceptionIfIdentifierIsNotAString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        //@todo Add exception code with redis extension
+
         $this->setUpBackend();
         $this->backend->get(array());
     }
@@ -564,10 +589,12 @@ class RedisBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test Functional
-     * @expectedException \InvalidArgumentException
      */
     public function removeThrowsExceptionIfIdentifierIsNotAString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1377006654);
+
         $this->setUpBackend();
         $this->backend->remove(array());
     }
@@ -652,10 +679,12 @@ class RedisBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test Functional
-     * @expectedException \InvalidArgumentException
      */
     public function findIdentifiersByTagThrowsExceptionIfTagIsNotAString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1377006655);
+
         $this->setUpBackend();
         $this->backend->findIdentifiersByTag(array());
     }
@@ -705,10 +734,12 @@ class RedisBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test Functional
-     * @expectedException \InvalidArgumentException
      */
     public function flushByTagThrowsExceptionIfTagIsNotAString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1377006656);
+
         $this->setUpBackend();
         $this->backend->flushByTag(array());
     }
index 9f89e57..a2ec6da 100644 (file)
@@ -22,11 +22,13 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Backend;
 class TransientMemoryBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 {
     /**
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      * @test
      */
     public function setThrowsExceptionIfNoFrontEndHasBeenSet()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1238244992);
+
         $backend = new \TYPO3\CMS\Core\Cache\Backend\TransientMemoryBackend('Testing');
         $data = 'Some data';
         $identifier = 'MyIdentifier';
index ce65515..65ed048 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Backend;
  * The TYPO3 project - inspiring people to share!
  */
 use Prophecy\Argument;
+use TYPO3\CMS\Core\Cache\Exception\InvalidDataException;
 use TYPO3\CMS\Core\Database\Connection;
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -62,10 +63,12 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function setThrowsExceptionIfFrontendWasNotSet()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1236518288);
+
         /** @var \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend|\PHPUnit_Framework_MockObject_MockObject $backend */
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, array('dummy'), array('Testing'));
         $backend->set('identifier', 'data');
@@ -73,10 +76,12 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception\InvalidDataException
      */
     public function setThrowsExceptionIfDataIsNotAString()
     {
+        $this->expectException(InvalidDataException::class);
+        $this->expectExceptionCode(1236518298);
+
         /** @var \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend|\PHPUnit_Framework_MockObject_MockObject $backend */
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, array('dummy'), array('Testing'));
         $this->setUpMockFrontendOfBackend($backend);
@@ -221,10 +226,12 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function getThrowsExceptionIfFrontendWasNotSet()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1236518288);
+
         /** @var \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend|\PHPUnit_Framework_MockObject_MockObject $backend */
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, array('dummy'), array('Testing'));
         $backend->get('identifier');
@@ -274,10 +281,12 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function hasThrowsExceptionIfFrontendWasNotSet()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1236518288);
+
         /** @var \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend|\PHPUnit_Framework_MockObject_MockObject $backend */
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, array('dummy'), array('Testing'));
         $backend->has('identifier');
@@ -326,10 +335,12 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function removeThrowsExceptionIfFrontendWasNotSet()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1236518288);
+
         /** @var \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend|\PHPUnit_Framework_MockObject_MockObject $backend */
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, array('dummy'), array('Testing'));
         $backend->remove('identifier');
@@ -367,10 +378,12 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function collectGarbageThrowsExceptionIfFrontendWasNotSet()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1236518288);
+
         /** @var \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend|\PHPUnit_Framework_MockObject_MockObject $backend */
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, array('dummy'), array('Testing'));
         $backend->collectGarbage();
@@ -430,10 +443,12 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function findIdentifiersByTagThrowsExceptionIfFrontendWasNotSet()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1236518288);
+
         /** @var \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend|\PHPUnit_Framework_MockObject_MockObject $backend */
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, array('dummy'), array('Testing'));
         $backend->findIdentifiersByTag('identifier');
@@ -468,10 +483,12 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function flushThrowsExceptionIfFrontendWasNotSet()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1236518288);
+
         /** @var \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend|\PHPUnit_Framework_MockObject_MockObject $backend */
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, array('dummy'), array('Testing'));
         $backend->flush();
@@ -502,10 +519,12 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function flushByTagThrowsExceptionIfFrontendWasNotSet()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        $this->expectExceptionCode(1236518288);
+
         /** @var \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend|\PHPUnit_Framework_MockObject_MockObject $backend */
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, array('dummy'), array('Testing'));
         $backend->flushByTag(array());
index e087e74..2cacdb7 100644 (file)
@@ -35,10 +35,12 @@ class WincacheBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function setThrowsExceptionIfNoFrontEndHasBeenSet()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        //@todo Add exception code with wincache extension
+
         $backend = new WincacheBackend('Testing');
         $data = 'Some data';
         $identifier = $this->getUniqueId('MyIdentifier');
index da0b068..49ac3e0 100644 (file)
@@ -38,10 +38,12 @@ class XcacheBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception
      */
     public function setThrowsExceptionIfNoFrontEndHasBeenSet()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
+        //@todo Add exception code with xcache extension
+
         $backend = new XcacheBackend('Testing');
         $data = 'Some data';
         $identifier = $this->getUniqueId('MyIdentifier');
index 6c909fe..6ba219e 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache;
 use TYPO3\CMS\Core\Cache\CacheManager;
 use TYPO3\CMS\Core\Cache\Exception\InvalidBackendException;
 use TYPO3\CMS\Core\Cache\Exception\InvalidCacheException;
+use TYPO3\CMS\Core\Cache\Exception\NoSuchCacheGroupException;
 use TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend;
 use TYPO3\CMS\Core\Tests\Unit\Cache\Fixtures\BackendConfigurationOptionFixture;
 use TYPO3\CMS\Core\Tests\Unit\Cache\Fixtures\BackendDefaultFixture;
@@ -38,10 +39,12 @@ class CacheManagerTest extends UnitTestCase
 {
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception\DuplicateIdentifierException
      */
     public function managerThrowsExceptionOnCacheRegistrationWithAlreadyExistingIdentifier()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception\DuplicateIdentifierException::class);
+        $this->expectExceptionCode(1203698223);
+
         $manager = new CacheManager();
         $cache1 = $this->getMock(AbstractFrontend::class, array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', false);
         $cache1->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('test'));
@@ -68,10 +71,12 @@ class CacheManagerTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
      */
     public function getCacheThrowsExceptionForNonExistingIdentifier()
     {
+        $this->expectException(\TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException::class);
+        $this->expectExceptionCode(1203699034);
+
         $manager = new CacheManager();
         $cache = $this->getMock(AbstractFrontend::class, array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', false);
         $cache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('someidentifier'));
@@ -127,20 +132,24 @@ class CacheManagerTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheGroupException
      */
     public function flushCachesInGroupThrowsExceptionForNonExistingGroup()
     {
+        $this->expectException(NoSuchCacheGroupException::class);
+        $this->expectExceptionCode(1390334120);
+
         $manager = new CacheManager();
         $manager->flushCachesInGroup('nonExistingGroup');
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheGroupException
      */
     public function flushCachesInGroupByTagThrowsExceptionForNonExistingGroup()
     {
+        $this->expectException(NoSuchCacheGroupException::class);
+        $this->expectExceptionCode(1390334120);
+
         $manager = new CacheManager();
         $manager->flushCachesInGroup('nonExistingGroup');
     }
index 647b475..dc281f5 100644 (file)
@@ -61,10 +61,12 @@ class AbstractFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function flushByTagRejectsInvalidTags()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1233057359);
+
         $identifier = 'someCacheIdentifier';
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface::class, array(), array(), '', false);
         $backend->expects($this->never())->method('flushByTag');
index 50da261..423febc 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Frontend;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Cache\Exception\InvalidDataException;
 
 /**
  * Testcase for the PHP source code cache frontend
@@ -23,10 +24,12 @@ class PhpFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 {
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function setChecksIfTheIdentifierIsValid()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1233057566);
+
         $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('isValidEntryIdentifier'), array(), '', false);
         $cache->expects($this->once())->method('isValidEntryIdentifier')->with('foo')->will($this->returnValue(false));
         $cache->set('foo', 'bar');
@@ -47,10 +50,12 @@ class PhpFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception\InvalidDataException
      */
     public function setThrowsInvalidDataExceptionOnNonStringValues()
     {
+        $this->expectException(InvalidDataException::class);
+        $this->expectExceptionCode(1264023824);
+
         $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, array('dummy'), array(), '', false);
         $cache->set('Foo-Bar', array());
     }
index 9573f15..34bf348 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Frontend;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Cache\Exception\InvalidDataException;
 
 /**
  * Testcase for the string cache frontend
@@ -22,11 +23,13 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Frontend;
 class StringFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 {
     /**
-     * @expectedException \InvalidArgumentException
      * @test
      */
     public function setChecksIfTheIdentifierIsValid()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1233057566);
+
         $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('isValidEntryIdentifier'), array(), '', false);
         $cache->expects($this->once())->method('isValidEntryIdentifier')->with('foo')->will($this->returnValue(false));
         $cache->set('foo', 'bar');
@@ -59,10 +62,12 @@ class StringFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Cache\Exception\InvalidDataException
      */
     public function setThrowsInvalidDataExceptionOnNonStringValues()
     {
+        $this->expectException(InvalidDataException::class);
+        $this->expectExceptionCode(1222808333);
+
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\StringFrontend('StringFrontend', $backend);
         $cache->set('StringCacheTest', array());
@@ -104,10 +109,12 @@ class StringFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function getByTagRejectsInvalidTags()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1233057772);
+
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface::class, array(), array(), '', false);
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\StringFrontend('StringFrontend', $backend);
         $cache->getByTag('SomeInvalid\\Tag');
index 0a1b208..dd6c8ee 100644 (file)
@@ -22,11 +22,13 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Frontend;
 class VariableFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 {
     /**
-     * @expectedException \InvalidArgumentException
      * @test
      */
     public function setChecksIfTheIdentifierIsValid()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1233057566);
+
         $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('isValidEntryIdentifier'), array(), '', false);
         $cache->expects($this->once())->method('isValidEntryIdentifier')->with('foo')->will($this->returnValue(false));
         $cache->set('foo', 'bar');
@@ -137,10 +139,12 @@ class VariableFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function getByTagRejectsInvalidTags()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1233058312);
+
         $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface::class, array(), array(), '', false);
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend('VariableFrontend', $backend);
         $cache->getByTag('SomeInvalid\Tag');
index 5d5cd49..73ef956 100644 (file)
@@ -76,41 +76,45 @@ class CategoryRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1369122038
      */
     public function doesAddThrowExceptionOnEmptyTablename()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1369122038);
+
         $this->subject->add('test_extension_a', '', 'categories');
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1397836158
      */
     public function doesAddThrowExceptionOnEmptyExtensionKey()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1397836158);
+
         $this->subject->add('', 'foo', 'categories');
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1369122038
      */
     public function doesAddThrowExceptionOnInvalidTablename()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1369122038);
+
         $this->subject->add('test_extension_a', array(), 'categories');
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1397836158
      */
     public function doesAddThrowExceptionOnInvalidExtensionKey()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1397836158);
+
         $this->subject->add(array(), 'foo', 'categories');
     }
 
index 487c665..ebc157a 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Category\Collection;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Category\Collection\CategoryCollection;
 
 /**
  * Test case for \TYPO3\CMS\Core\Category\Collection\CategoryCollection
@@ -21,12 +22,14 @@ class CategoryCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 {
     /**
      * @test
-     * @expectedException \RuntimeException
      * @covers \TYPO3\CMS\Core\Category\Collection\CategoryCollection::__construct
      * @return void
      */
     public function missingTableNameArgumentForObjectCategoryCollection()
     {
-        new \TYPO3\CMS\Core\Category\Collection\CategoryCollection();
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1341826168);
+
+        new CategoryCollection();
     }
 }
index d3b4778..030b67c 100644 (file)
@@ -88,10 +88,12 @@ class RecordCollectionRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function doesFindByUidThrowException()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1328646798);
+
         $testUid = rand(1, 1000);
         $this->databaseMock->expects($this->once())->method('exec_SELECTgetSingleRow')->will($this->returnCallback(array($this, 'getSingleRowCallback')));
         $this->getSingleRowCallbackReturnValue = array(
index efe65c1..3b8c10b 100644 (file)
@@ -47,10 +47,12 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function getDefaultConfigurationExecutesDefinedDefaultConfigurationFile()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1310203814);
+
         $defaultConfigurationFile = PATH_site . 'typo3temp/var/tests/' . $this->getUniqueId('defaultConfiguration');
         file_put_contents(
             $defaultConfigurationFile,
@@ -67,10 +69,11 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function getLocalConfigurationExecutesDefinedConfigurationFile()
     {
+        $this->expectException(\RuntimeException::class);
+
         $configurationFile = PATH_site . 'typo3temp/var/tests/' . $this->getUniqueId('localConfiguration');
         file_put_contents(
             $configurationFile,
@@ -486,10 +489,11 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function createLocalConfigurationFromFactoryConfigurationThrowsExceptionIfFileExists()
     {
+        $this->expectException(\RuntimeException::class);
+
         /** @var $subject \TYPO3\CMS\Core\Configuration\ConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
         $subject = $this->getAccessibleMock(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class, array('dummy'));
 
index 307db77..7e59cf6 100644 (file)
@@ -64,10 +64,12 @@ class ApplicationContextTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      * @dataProvider forbiddenContexts
-     * @expectedException \TYPO3\CMS\Core\Exception
      */
     public function constructorThrowsExceptionIfMainContextIsForbidden($forbiddenContext)
     {
+        $this->expectException(\TYPO3\CMS\Core\Exception::class);
+        $this->expectExceptionCode(1335436551);
+
         new ApplicationContext($forbiddenContext);
     }
 
index 06459cd..e0bc8e2 100644 (file)
@@ -26,11 +26,13 @@ class ClassLoadingInformationGeneratorTest extends UnitTestCase
 {
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Error\Exception
-     * @expectedExceptionCode 1444142481
      */
     public function buildClassAliasMapForPackageThrowsExceptionForWrongComposerManifestInformation()
     {
+
+        $this->expectException(\TYPO3\CMS\Core\Error\Exception::class);
+        $this->expectExceptionCode(1444142481);
+
         $packageMock = $this->createPackageMock([
             'extra' => [
                 'typo3/class-alias-loader' => [
@@ -49,11 +51,12 @@ class ClassLoadingInformationGeneratorTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Error\Exception
-     * @expectedExceptionCode 1422625075
      */
     public function buildClassAliasMapForPackageThrowsExceptionForWrongClassAliasMapFile()
     {
+        $this->expectException(\TYPO3\CMS\Core\Error\Exception::class);
+        $this->expectExceptionCode(1422625075);
+
         $packageMock = $this->createPackageMock([
             'extra' => [
                 'typo3/class-alias-loader' => [
index f90c9e0..3405d69 100644 (file)
@@ -340,12 +340,13 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     //
     /**
      * Tests whether a wrong interface on the 'checkModifyAccessList' hook throws an exception.
-     *
      * @test
-     * @expectedException \UnexpectedValueException
      */
     public function doesCheckModifyAccessListThrowExceptionOnWrongHookInterface()
     {
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1251892472);
+
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'][] = InvalidHookFixture::class;
         $this->subject->checkModifyAccessList('tt_content');
     }
index a14cf81..acdac77 100644 (file)
@@ -141,10 +141,12 @@ class DatabaseConnectionTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function listQueryThrowsExceptionIfValueContainsComma()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1294585862);
+
         /** @var DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject|AccessibleObjectInterface $subject */
         $subject = $this->getAccessibleMock(DatabaseConnection::class, ['quoteStr'], [], '', false);
         $subject->_set('isConnected', true);
index 432f5d7..f354465 100644 (file)
@@ -186,39 +186,48 @@ class PreparedStatementTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         return [
             'integer passed with param type NULL' => [
                 1,
-                PreparedStatement::PARAM_NULL
+                PreparedStatement::PARAM_NULL,
+                1282489834
             ],
             'string passed with param type NULL' => [
                 '1',
-                PreparedStatement::PARAM_NULL
+                PreparedStatement::PARAM_NULL,
+                1282489834
             ],
             'bool passed with param type NULL' => [
                 true,
-                PreparedStatement::PARAM_NULL
+                PreparedStatement::PARAM_NULL,
+                1282489834
             ],
             'NULL passed with param type INT' => [
                 null,
-                PreparedStatement::PARAM_INT
+                PreparedStatement::PARAM_INT,
+                1281868686
             ],
             'string passed with param type INT' => [
                 '1',
-                PreparedStatement::PARAM_INT
+                PreparedStatement::PARAM_INT,
+                1281868686
             ],
             'bool passed with param type INT' => [
                 true,
-                PreparedStatement::PARAM_INT
+                PreparedStatement::PARAM_INT,
+                1281868686
             ],
             'NULL passed with param type BOOL' => [
                 null,
-                PreparedStatement::PARAM_BOOL
+                PreparedStatement::PARAM_BOOL,
+                1281868687
             ],
             'string passed with param type BOOL' => [
                 '1',
-                PreparedStatement::PARAM_BOOL
+                PreparedStatement::PARAM_BOOL,
+                1281868687
             ],
             'integer passed with param type BOOL' => [
                 1,
-                PreparedStatement::PARAM_BOOL
+                PreparedStatement::PARAM_BOOL,
+                1281868687
             ]
         ];
     }
@@ -228,14 +237,17 @@ class PreparedStatementTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      * provided vor bindValue().
      *
      * @test
-     * @expectedException \InvalidArgumentException
      * @dataProvider invalidParameterTypesPassedToBindValueThrowsExceptionDataProvider
      * @param mixed $parameter Parameter to be replaced in the query
      * @param int $type Type of the parameter value
+     * @param int $exceptionCode Expected exception code
      * @return void
      */
-    public function invalidParameterTypesPassedToBindValueThrowsException($parameter, $type)
+    public function invalidParameterTypesPassedToBindValueThrowsException($parameter, $type, $exceptionCode)
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode($exceptionCode);
+
         $statement = $this->createPreparedStatement('');
         $statement->bindValue(1, $parameter, $type);
     }
@@ -281,7 +293,6 @@ class PreparedStatementTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      * Checks if an exception is thrown, if parameter have invalid marker named.
      *
      * @test
-     * @expectedException \InvalidArgumentException
      * @dataProvider passingInvalidMarkersThrowsExceptionDataProvider
      * @param string $query Query with unreplaced markers
      * @param array  $parameters Array of parameters to be replaced in the query
@@ -289,6 +300,9 @@ class PreparedStatementTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function passingInvalidMarkersThrowsException($query, $parameters)
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1395055513);
+
         $statement = $this->createPreparedStatement($query);
         $statement->bindValues($parameters);
     }
index 23c718e..2cb78c4 100644 (file)
@@ -60,11 +60,12 @@ class BulkInsertTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \LogicException
-     * @expectedExceptionMessage You need to add at least one set of values before generating the SQL.
      */
     public function getSQLWithoutSpecifiedValuesThrowsException()
     {
+        $this->expectException(\LogicException::class);
+        $this->expectExceptionMessage('You need to add at least one set of values before generating the SQL.');
+
         $query = new BulkInsertQuery($this->connection, $this->testTable);
 
         $query->getSQL();
@@ -149,7 +150,16 @@ class BulkInsertTest extends UnitTestCase
         $this->assertSame("INSERT INTO {$this->testTable} VALUES (), (?, ?), (?, ?, ?), (?, ?, ?)", (string)$query);
         $this->assertSame(['bar', 'baz', 'bar', 'baz', 'bloo', 'bar', 'baz', 'bloo'], $query->getParameters());
         $this->assertSame(
-            [null, Connection::PARAM_BOOL, Connection::PARAM_INT, null, Connection::PARAM_BOOL, null, Connection::PARAM_BOOL, Connection::PARAM_INT],
+            [
+                null,
+                Connection::PARAM_BOOL,
+                Connection::PARAM_INT,
+                null,
+                Connection::PARAM_BOOL,
+                null,
+                Connection::PARAM_BOOL,
+                Connection::PARAM_INT
+            ],
             $query->getParameterTypes()
         );
     }
@@ -271,47 +281,49 @@ class BulkInsertTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionMessage No value specified for column bar (index 0).
      */
     public function emptyInsertWithColumnSpecificationThrowsException()
     {
-        $query = new BulkInsertQuery($this->connection, $this->testTable, ['bar', 'baz']);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionMessage('No value specified for column bar (index 0).');
 
+        $query = new BulkInsertQuery($this->connection, $this->testTable, ['bar', 'baz']);
         $query->addValues([]);
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionMessage Multiple values specified for column baz (index 1).
      */
     public function insertWithColumnSpecificationAndMultipleValuesForColumnThrowsException()
     {
-        $query = new BulkInsertQuery($this->connection, $this->testTable, ['bar', 'baz']);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionMessage('Multiple values specified for column baz (index 1).');
 
+        $query = new BulkInsertQuery($this->connection, $this->testTable, ['bar', 'baz']);
         $query->addValues(['bar', 'baz', 'baz' => 666]);
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionMessage Multiple types specified for column baz (index 1).
      */
     public function insertWithColumnSpecificationAndMultipleTypesForColumnThrowsException()
     {
-        $query = new BulkInsertQuery($this->connection, $this->testTable, ['bar', 'baz']);
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionMessage('Multiple types specified for column baz (index 1).');
 
-        $query->addValues(['bar', 'baz'], [Connection::PARAM_INT, Connection::PARAM_INT, 'baz' => Connection::PARAM_STR]);
+        $query = new BulkInsertQuery($this->connection, $this->testTable, ['bar', 'baz']);
+        $query->addValues(['bar', 'baz'],
+            [Connection::PARAM_INT, Connection::PARAM_INT, 'baz' => Connection::PARAM_STR]);
     }
 
     /**
      * @test
-     * @expectedException \LogicException
-     * @expectedExceptionMessage You can only insert 10 rows in a single INSERT statement with platform "mock".
      */
     public function executeWithMaxInsertRowsPerStatementExceededThrowsException()
     {
+        $this->expectException(\LogicException::class);
+        $this->expectExceptionMessage('You can only insert 10 rows in a single INSERT statement with platform "mock".');
+
         /** @var \PHPUnit_Framework_MockObject_MockObject|BulkInsertQuery $subject */
         $subject = $this->getAccessibleMock(
             BulkInsertQuery::class,
index e94e0df..ae6509c 100644 (file)
@@ -335,10 +335,12 @@ class QueryBuilderTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function quoteIdentifiersForSelectWithInvalidAlias()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1461170686);
+
         $this->connection->quoteIdentifier(Argument::cetera())->will(
             function ($args) {
                 $platform = new MockPlatform();
index 84032d4..d7fc0cd 100644 (file)
@@ -94,11 +94,13 @@ class BackendFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     }
 
     /**
-     * @expectedException \UnexpectedValueException
      * @test
      */
     public function restoreSessionTokenFromRegistryThrowsExceptionIfSessionTokenIsEmpty()
     {
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1301827270);
+
         $this->subject->setSessionTokenFromRegistry();
     }
 
@@ -115,11 +117,12 @@ class BackendFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \Exception
-     * @expectedExceptionCode 1442592030
      */
     public function failingTokenValidationInvokesFailingTokenClosure()
     {
+        $this->expectException(\Exception::class);
+        $this->expectExceptionCode(1442592030);
+
         $this->subject->validateToken('foo', 'bar');
     }
 }
index a5102df..f6aae7e 100644 (file)
@@ -37,19 +37,23 @@ class FormProtectionFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /////////////////////////
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function getForNotExistingClassThrowsException()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1285352962);
+
         FormProtectionFactory::get('noSuchClass');
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function getForClassThatIsNoFormProtectionSubclassThrowsException()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1285353026);
+
         FormProtectionFactory::get(\TYPO3\CMS\Core\Tests\Unit\FormProtection\FormProtectionFactoryTest::class);
     }
 
index c70fa94..6ea8f3e 100644 (file)
@@ -62,22 +62,25 @@ class FontawesomeIconProviderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function wrongNamesDataProvider()
     {
         return [
-            'name with spaces' => ['name with spaces'],
-            'name with spaces and umlauts' => ['name with spaces äöü'],
-            'name umlauts' => ['häuser'],
-            'name with underscore' => ['name_with_underscore'],
-            'name is empty' => [''],
+            'name with spaces' => ['name with spaces', 1440754979],
+            'name with spaces and umlauts' => ['name with spaces äöü', 1440754979],
+            'name umlauts' => ['häuser', 1440754979],
+            'name with underscore' => ['name_with_underscore', 1440754979],
+            'name is empty' => ['', 1440754978],
         ];
     }
 
     /**
-     * @expectedException \InvalidArgumentException
      * @dataProvider wrongNamesDataProvider
      * @param string $name
+     * @param integer $expectedExceptionCode
      * @test
      */
-    public function prepareIconMarkupWithInvalidNameThrowsException($name)
+    public function prepareIconMarkupWithInvalidNameThrowsException($name, $expectedExceptionCode)
     {
-        $this->subject->prepareIconMarkup($this->icon, array('name' => $name));
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode($expectedExceptionCode);
+
+        $this->subject->prepareIconMarkup($this->icon, ['name' => $name]);
     }
 }
index c064ea4..6c7c823 100644 (file)
@@ -85,20 +85,24 @@ class IconRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     }
 
     /**
-     * @expectedException \InvalidArgumentException
      * @test
      */
     public function registerIconThrowsInvalidArgumentExceptionWithInvalidIconProvider()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1437425803);
+
         $this->subject->registerIcon($this->notRegisteredIconIdentifier, GeneralUtility::class);
     }
 
     /**
-     * @expectedException \TYPO3\CMS\Core\Exception
      * @test
      */
     public function getIconConfigurationByIdentifierThrowsExceptionWithUnregisteredIconIdentifier()
     {
+        $this->expectException(\TYPO3\CMS\Core\Exception::class);
+        $this->expectExceptionCode(1437425804);
+
         $this->subject->getIconConfigurationByIdentifier($this->notRegisteredIconIdentifier);
     }
 
index dc8d149..e3fbca8 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Locking;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Locking\Exception\LockCreateException;
 use TYPO3\CMS\Core\Locking\FileLockStrategy;
 use TYPO3\CMS\Core\Locking\LockFactory;
 use TYPO3\CMS\Core\Locking\LockingStrategyInterface;
@@ -50,11 +51,12 @@ class LockFactoryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1425990198
      */
     public function addLockingStrategyThrowsExceptionIfInterfaceIsNotImplemented()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1425990198);
+
         $this->mockFactory->addLockingStrategy(\stdClass::class);
     }
 
@@ -80,10 +82,12 @@ class LockFactoryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Locking\Exception\LockCreateException
      */
     public function getLockerThrowsExceptionIfNoMatchFound()
     {
+        $this->expectException(LockCreateException::class);
+        $this->expectExceptionCode(1425990190);
+
         $this->mockFactory->createLocker('id', 32);
     }
 }
index 1f01dff..2c50565 100644 (file)
@@ -61,10 +61,12 @@ class LogLevelTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      * @dataProvider isValidLevelThrowsExceptionOnInvalidLevelIfAskedToDoSoDataProvider
-     * @expectedException \Psr\Log\InvalidArgumentException
      */
     public function isValidLevelThrowsExceptionOnInvalidLevelIfAskedToDoSo($inputValue)
     {
+        $this->expectException(\Psr\Log\InvalidArgumentException::class);
+        $this->expectExceptionCode(1321637121);
+
         \TYPO3\CMS\Core\Log\LogLevel::validateLevel($inputValue);
     }
 
index 6f2353c..cbc498f 100644 (file)
@@ -96,10 +96,12 @@ class LogRecordTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \Psr\Log\InvalidArgumentException
      */
     public function setLevelValidatesLevel()
     {
+        $this->expectException(\Psr\Log\InvalidArgumentException::class);
+        $this->expectExceptionCode(1321637121);
+
         $record = $this->getRecord();
         $record->setLevel(100);
     }
index eb3990f..b8473d8 100644 (file)
@@ -13,6 +13,9 @@ namespace TYPO3\CMS\Core\Tests\Unit\Log\Processor;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Log\Exception\InvalidLogProcessorConfigurationException;
+use TYPO3\CMS\Core\Tests\Unit\Log\Fixtures\ProcessorFixture;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Test case
@@ -21,14 +24,16 @@ class AbstractProcessorTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 {
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Log\Exception\InvalidLogProcessorConfigurationException
      */
     public function processorRefusesInvalidConfigurationOptions()
     {
+        $this->expectException(InvalidLogProcessorConfigurationException::class);
+        $this->expectExceptionCode(1321696151);
+
         $invalidConfiguration = array(
             'foo' => 'bar'
         );
-        \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Tests\Unit\Log\Fixtures\ProcessorFixture::class, $invalidConfiguration);
+        GeneralUtility::makeInstance(ProcessorFixture::class, $invalidConfiguration);
     }
 
     /**
index 5a88429..78de5fe 100644 (file)
@@ -13,18 +13,22 @@ namespace TYPO3\CMS\Core\Tests\Unit\Log\Writer;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Log\Exception\InvalidLogWriterConfigurationException;
+use TYPO3\CMS\Core\Tests\UnitTestCase;
 
 /**
  * Test case
  */
-class AbstractWriterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
+class AbstractWriterTest extends UnitTestCase
 {
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Log\Exception\InvalidLogWriterConfigurationException
      */
     public function constructThrowsExceptionWithInvalidConfigurationOption()
     {
+        $this->expectException(InvalidLogWriterConfigurationException::class);
+        $this->expectExceptionCode(1321696152);
+
         $invalidConfiguration = array(
             'foo' => 'bar'
         );
index 0804c85..47031e2 100644 (file)
@@ -33,10 +33,12 @@ class DatabaseWriterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function writeLogThrowsExceptionIfDatabaseInsertFailed()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1345036334);
+
         $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
         $GLOBALS['TYPO3_DB']->expects($this->once())->method('exec_INSERTquery')->will($this->returnValue(false));
         /** @var \TYPO3\CMS\Core\Log\LogRecord|\PHPUnit_Framework_MockObject_MockObject $subject */
index 226fdee..8cf4ae6 100644 (file)
@@ -74,10 +74,12 @@ class MailerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      * @test
      * @param $settings
      * @dataProvider wrongConfigigurationProvider
-     * @expectedException \TYPO3\CMS\Core\Exception
      */
     public function wrongConfigigurationThrowsException($settings)
     {
+        $this->expectException(\TYPO3\CMS\Core\Exception::class);
+        $this->expectExceptionCode(1291068569);
+
         $this->subject->injectMailSettings($settings);
         $this->subject->__construct();
     }
index c33bf27..1dc3270 100644 (file)
@@ -61,7 +61,6 @@ class DependencyResolverTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \UnexpectedValueException
      */
     public function sortPackageStatesConfigurationByDependencyThrowsExceptionWhenCycleDetected()
     {
@@ -74,6 +73,9 @@ class DependencyResolverTest extends UnitTestCase
             ),
         );
 
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1381960494);
+
         /** @var DependencyResolver|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface $dependencyResolver */
         $dependencyResolver = $this->getAccessibleMock(DependencyResolver::class, array('findFrameworkPackages'));
         $dependencyResolver->injectDependencyOrderingService(new DependencyOrderingService());
index 1af88a5..29a48d7 100644 (file)
@@ -15,6 +15,8 @@ use org\bovigo\vfs\vfsStream;
 use TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend;
 use TYPO3\CMS\Core\Cache\Frontend\PhpFrontend;
 use TYPO3\CMS\Core\Package\DependencyResolver;
+use TYPO3\CMS\Core\Package\Exception\ProtectedPackageKeyException;
+use TYPO3\CMS\Core\Package\Exception\UnknownPackageException;
 use TYPO3\CMS\Core\Package\Package;
 use TYPO3\CMS\Core\Package\PackageManager;
 
@@ -90,10 +92,12 @@ class PackageManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Package\Exception\UnknownPackageException
      */
     public function getPackageThrowsExceptionOnUnknownPackage()
     {
+        $this->expectException(UnknownPackageException::class);
+        $this->expectExceptionCode(1166546734);
+
         $this->packageManager->getPackage('PrettyUnlikelyThatThisPackageExists');
     }
 
@@ -280,10 +284,12 @@ class PackageManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Package\Exception\ProtectedPackageKeyException
      */
     public function deactivatePackageThrowsAnExceptionIfPackageIsProtected()
     {
+        $this->expectException(ProtectedPackageKeyException::class);
+        $this->expectExceptionCode(1308662891);
+
         $package = $this->createPackage('Acme.YetAnotherTestPackage');
         $package->setProtected(true);
         $this->packageManager->expects($this->any())->method('sortActivePackagesByDependencies')->will($this->returnValue(array()));
@@ -292,20 +298,24 @@ class PackageManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Package\Exception\UnknownPackageException
      */
     public function deletePackageThrowsErrorIfPackageIsNotAvailable()
     {
+        $this->expectException(UnknownPackageException::class);
+        $this->expectExceptionCode(1166543253);
+
         $this->packageManager->expects($this->any())->method('sortActivePackagesByDependencies')->will($this->returnValue(array()));
         $this->packageManager->deletePackage('PrettyUnlikelyThatThisPackageExists');
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Package\Exception\ProtectedPackageKeyException
      */
     public function deletePackageThrowsAnExceptionIfPackageIsProtected()
     {
+        $this->expectException(ProtectedPackageKeyException::class);
+        $this->expectExceptionCode(1220722120);
+
         $package = $this->createPackage('Acme.YetAnotherTestPackage');
         $package->setProtected(true);
         $this->packageManager->deletePackage('Acme.YetAnotherTestPackage');
index 56b0897..1018b7f 100644 (file)
@@ -12,6 +12,8 @@ namespace TYPO3\CMS\Core\Tests\Unit\Package;
  *                                                                        */
 
 use org\bovigo\vfs\vfsStream;
+use TYPO3\CMS\Core\Package\Exception\InvalidPackageKeyException;
+use TYPO3\CMS\Core\Package\Exception\InvalidPackagePathException;
 use TYPO3\CMS\Core\Package\Package;
 use TYPO3\CMS\Core\Package\PackageManager;
 
@@ -30,10 +32,12 @@ class PackageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Package\Exception\InvalidPackagePathException
      */
     public function constructThrowsPackageDoesNotExistException()
     {
+        $this->expectException(InvalidPackagePathException::class);
+        $this->expectExceptionCode(1166631890);
+
         $packageManagerMock = $this->getMock(PackageManager::class);
         $packageManagerMock->expects($this->any())->method('isPackageKeyValid')->willReturn(true);
         new Package($packageManagerMock, 'Vendor.TestPackage', './ThisPackageSurelyDoesNotExist');
@@ -83,10 +87,12 @@ class PackageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      * @dataProvider invalidPackageKeys
-     * @expectedException \TYPO3\CMS\Core\Package\Exception\InvalidPackageKeyException
      */
     public function constructRejectsInvalidPackageKeys($packageKey)
     {
+        $this->expectException(InvalidPackageKeyException::class);
+        $this->expectExceptionCode(1217959511);
+
         $packagePath = 'vfs://Packages/' . str_replace('\\', '/', $packageKey) . '/';
         mkdir($packagePath, 0777, true);
 
index 3edcecb..1c3283f 100644 (file)
@@ -37,11 +37,13 @@ class PageRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     }
 
     /**
-     * @expectedException \UnexpectedValueException
      * @test
      */
     public function includingNotAvailableLocalJqueryVersionThrowsException()
     {
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1341505305);
+
         /** @var \TYPO3\CMS\Core\Page\PageRenderer|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface $subject */
         $subject = $this->getAccessibleMock(\TYPO3\CMS\Core\Page\PageRenderer::class, array('dummy'), array(), '', false);
         $subject->_set('availableLocalJqueryVersions', array('1.1.1'));
@@ -49,11 +51,13 @@ class PageRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     }
 
     /**
-     * @expectedException \UnexpectedValueException
      * @test
      */
     public function includingJqueryWithNonAlphnumericNamespaceThrowsException()
     {
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1341571604);
+
         /** @var \TYPO3\CMS\Core\Page\PageRenderer|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface $subject */
         $subject = $this->getAccessibleMock(\TYPO3\CMS\Core\Page\PageRenderer::class, array('dummy'), array(), '', false);
         $subject->loadJquery(null, null, '12sd.12fsd');
@@ -157,10 +161,12 @@ class PageRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function includeLanguageFileForInlineThrowsExceptionIfLangIsNotSet()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1284906026);
+
         /** @var \TYPO3\CMS\Core\Page\PageRenderer|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface $subject */
         $subject = $this->getAccessibleMock(\TYPO3\CMS\Core\Page\PageRenderer::class, array('dummy'), array(), '', false);
         $subject->_set('charSet', 'utf-8');
@@ -169,10 +175,12 @@ class PageRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function includeLanguageFileForInlineThrowsExceptionIfCharSetIsNotSet()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1284906026);
+
         /** @var \TYPO3\CMS\Core\Page\PageRenderer|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface $subject */
         $subject = $this->getAccessibleMock(\TYPO3\CMS\Core\Page\PageRenderer::class, array('dummy'), array(), '', false);
         $subject->_set('lang', 'default');
index f2c5a05..b77aca2 100644 (file)
@@ -36,19 +36,23 @@ class RegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function getThrowsExceptionForInvalidNamespacesUsingNoNamespace()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1249755131);
+
         $this->registry->get('', 'someKey');
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function getThrowsExceptionForInvalidNamespacesUsingTooShortNamespace()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1249755131);
+
         $this->registry->get('t', 'someKey');
     }
 
@@ -96,19 +100,23 @@ class RegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function setThrowsAnExceptionOnEmptyNamespace()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1249755131);
+
         $this->registry->set('', 'someKey', 'someValue');
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function setThrowsAnExceptionOnWrongNamespace()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1249755131);
+
         $this->registry->set('t', 'someKey', 'someValue');
     }
 
@@ -155,10 +163,12 @@ class RegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function removeThrowsAnExceptionOnWrongNamespace()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1249755131);
+
         $this->registry->remove('t', 'someKey');
     }
 
@@ -188,10 +198,12 @@ class RegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function removeAllByNamespaceThrowsAnExceptionOnWrongNamespace()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1249755131);
+
         $this->registry->removeAllByNamespace('');
     }
 
index 3e640a4..d2304be 100644 (file)
@@ -47,21 +47,23 @@ class FileCollectionRegistryTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\Bas
 
     /**
      * @test
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionCode 1391295613
      */
     public function registerFileCollectionClassThrowsExceptionIfClassDoesNotExist()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1391295613);
+
         $this->testSubject->registerFileCollectionClass($this->getUniqueId(), substr($this->getUniqueId(), 0, 30));
     }
 
     /**
      * @test
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionCode 1391295611
      */
     public function registerFileCollectionClassThrowsExceptionIfTypeIsTooLong()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1391295611);
+
         $className = get_class($this->getMockForAbstractClass(\TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection::class));
         $type = str_pad('', 40);
         $this->testSubject->registerFileCollectionClass($className, $type);
@@ -69,11 +71,12 @@ class FileCollectionRegistryTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\Bas
 
     /**
      * @test
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionCode 1391295643
      */
     public function registerFileCollectionClassThrowsExceptionIfTypeIsAlreadyRegistered()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1391295643);
+
         $className = get_class($this->getMockForAbstractClass(\TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection::class));
         $className2 = get_class($this->getMockForAbstractClass(\TYPO3\CMS\Core\Resource\Collection\StaticFileCollection::class));
         $this->testSubject->registerFileCollectionClass($className, 'foobar');
@@ -93,11 +96,12 @@ class FileCollectionRegistryTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\Bas
 
     /**
      * @test
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionCode 1391295644
      */
     public function getFileCollectionClassThrowsExceptionIfClassIsNotRegistered()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1391295644);
+
         $this->testSubject->getFileCollectionClass($this->getUniqueId());
     }
 
index ae22634..9584b9e 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource\Driver;
 
 use org\bovigo\vfs\vfsStream;
 use org\bovigo\vfs\vfsStreamWrapper;
+use TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException;
 use TYPO3\CMS\Core\Tests\FileStreamWrapper;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
@@ -1628,10 +1629,12 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException
      */
     public function sanitizeFileNameThrowsExceptionOnInvalidFileName()
     {
+        $this->expectException(InvalidFileNameException::class);
+        $this->expectExceptionCode(1320288991);
+
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'] = 1;
         $this->createDriver()->sanitizeFileName('');
     }
index d888c28..0d02dfa 100644 (file)
@@ -129,25 +129,27 @@ class FileReferenceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     }
 
     /**
-     * @param array $fileReferenceProperties
-     * @param array $originalFileProperties
-     * @param array $expectedMergedProperties
      * @test
      * @dataProvider propertiesDataProvider
-     * @expectedException \InvalidArgumentException
+     *
+     * @param array $fileReferenceProperties
+     * @param array $originalFileProperties
      */
     public function getPropertyThrowsExceptionForNotAvailableProperty($fileReferenceProperties, $originalFileProperties)
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1314226805);
+
         $fixture = $this->prepareFixture($fileReferenceProperties, $originalFileProperties);
         $fixture->getProperty($this->getUniqueId('nothingHere'));
     }
 
     /**
-     * @param array $fileReferenceProperties
-     * @param array $originalFileProperties
-     * @param array $expectedMergedProperties
      * @test
      * @dataProvider propertiesDataProvider
+     *
+     * @param array $fileReferenceProperties
+     * @param array $originalFileProperties
      */
     public function getPropertyDoesNotThrowExceptionForPropertyOnlyAvailableInOriginalFile($fileReferenceProperties, $originalFileProperties)
     {
@@ -156,15 +158,18 @@ class FileReferenceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     }
 
     /**
+     * @test
+     * @dataProvider propertiesDataProvider
+     *
      * @param array $fileReferenceProperties
      * @param array $originalFileProperties
      * @param array $expectedMergedProperties
-     * @test
-     * @dataProvider propertiesDataProvider
-     * @expectedException \InvalidArgumentException
      */
     public function getReferencePropertyThrowsExceptionForPropertyOnlyAvailableInOriginalFile($fileReferenceProperties, $originalFileProperties)
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1360684914);
+
         $fixture = $this->prepareFixture($fileReferenceProperties, $originalFileProperties);
         $fixture->getReferenceProperty('file_only_property');
     }
index e8c4de8..0cdfdb7 100644 (file)
@@ -37,11 +37,12 @@ class ExtractorRegistryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1422705270
      */
     public function registerExtractorClassThrowsExceptionIfClassDoesNotExist()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1422705270);
+
         $className = 'e1f9aa4e1cd3aa7ff05dcdccb117156a';
         $extractorRegistry = $this->getMockExtractorRegistry();
         $extractorRegistry->registerExtractionService($className);
@@ -49,11 +50,12 @@ class ExtractorRegistryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1422705271
      */
     public function registerExtractorClassThrowsExceptionIfClassDoesNotImplementRightInterface()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1422705271);
+
         $className = __CLASS__;
         $extractorRegistry = $this->getMockExtractorRegistry();
         $extractorRegistry->registerExtractionService($className);
index 9c40bbf..342a714 100644 (file)
@@ -56,22 +56,24 @@ class RendererRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1411840171
      */
     public function registerRendererClassThrowsExceptionIfClassDoesNotExist()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1411840171);
+
         $rendererRegistry = $this->getTestRendererRegistry();
         $rendererRegistry->registerRendererClass($this->getUniqueId());
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1411840172
      */
     public function registerRendererClassThrowsExceptionIfClassDoesNotImplementRightInterface()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1411840172);
+
         $className = __CLASS__;
         $rendererRegistry = $this->getTestRendererRegistry();
         $rendererRegistry->registerRendererClass($className);
index 791aac9..a74b06d 100644 (file)
@@ -682,10 +682,12 @@ class ResourceStorageTest extends BaseTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function deleteFolderThrowsExceptionIfFolderIsNotEmptyAndRecursiveDeleteIsDisabled()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1325952534);
+
         /** @var \TYPO3\CMS\Core\Resource\Folder|\PHPUnit_Framework_MockObject_MockObject $folderMock */
         $folderMock = $this->getMock(Folder::class, array(), array(), '', false);
         /** @var $mockedDriver \TYPO3\CMS\Core\Resource\Driver\AbstractDriver|\PHPUnit_Framework_MockObject_MockObject */
index 50b5909..2c1be5f 100644 (file)
@@ -59,22 +59,24 @@ class TextExtractorRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1422906893
      */
     public function registerTextExtractorThrowsExceptionIfClassDoesNotExist()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1422906893);
+
         $textExtractorRegistry = $this->getTextExtractorRegistry();
         $textExtractorRegistry->registerTextExtractor($this->getUniqueId());
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1422771427
      */
     public function registerTextExtractorThrowsExceptionIfClassDoesNotImplementRightInterface()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1422771427);
+
         $textExtractorRegistry = $this->getTextExtractorRegistry();
         $textExtractorRegistry->registerTextExtractor(__CLASS__);
     }
index 043217f..cb203ba 100644 (file)
@@ -663,11 +663,12 @@ class DependencyOrderingServiceTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \UnexpectedValueException
-     * @expectedExceptionCode 1381960494
      */
     public function calculateOrderDetectsCyclicGraph()
     {
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1381960494);
+
         (new DependencyOrderingService())->calculateOrder([
             1 => [
                 1 => false,
index c5610ca..9a5fea6 100644 (file)
@@ -32,11 +32,11 @@ class TreeDataProviderFactoryTest extends UnitTestCase
     protected function setUp()
     {
         $this->subject = new TreeDataProviderFactory();
-        $GLOBALS['TCA'] = array();
-        $GLOBALS['TCA']['foo'] = array();
-        $GLOBALS['TCA']['foo']['ctrl'] = array();
+        $GLOBALS['TCA'] = [];
+        $GLOBALS['TCA']['foo'] = [];
+        $GLOBALS['TCA']['foo']['ctrl'] = [];
         $GLOBALS['TCA']['foo']['ctrl']['label'] = 'labelFoo';
-        $GLOBALS['TCA']['foo']['columns'] = array();
+        $GLOBALS['TCA']['foo']['columns'] = [];
     }
 
     /**
@@ -44,46 +44,67 @@ class TreeDataProviderFactoryTest extends UnitTestCase
      */
     public function invalidConfigurationDataProvider()
     {
-        return array(
-            'Empty Configuration' => array(array()),
-            'File Configuration' => array(array(
-                'internal_type' => 'file',
-                'treeConfig' => array(),
-            )),
-            'Unknown Type' => array(array(
-                'internal_type' => 'foo',
-                'treeConfig' => array(),
-            )),
-            'No foreign table' => array(array(
-                'internal_type' => 'db',
-                'treeConfig' => array(),
-            )),
-            'No tree configuration' => array(array(
-                'internal_type' => 'db',
-                'foreign_table' => 'foo',
-            )),
-            'Tree configuration not array' => array(array(
-                'internal_type' => 'db',
-                'foreign_table' => 'foo',
-                'treeConfig' => 'bar',
-            )),
-            'Tree configuration missing childer and parent field' => array(array(
-                'internal_type' => 'db',
-                'foreign_table' => 'foo',
-                'treeConfig' => array(),
-            )),
-        );
+        return [
+            'Empty Configuration' => [[], 1288215890],
+            'File Configuration' => [
+                [
+                    'internal_type' => 'file',
+                    'treeConfig' => [],
+                ],
+                1288215891
+            ],
+            'Unknown Type' => [
+                [
+                    'internal_type' => 'foo',
+                    'treeConfig' => [],
+                ],
+                1288215892
+            ],
+            'No foreign table' => [
+                [
+                    'internal_type' => 'db',
+                    'treeConfig' => [],
+                ],
+                1288215888
+            ],
+            'No tree configuration' => [
+                [
+                    'internal_type' => 'db',
+                    'foreign_table' => 'foo',
+                ],
+                1288215890
+            ],
+            'Tree configuration not array' => [
+                [
+                    'internal_type' => 'db',
+                    'foreign_table' => 'foo',
+                    'treeConfig' => 'bar',
+                ],
+                1288215890
+            ],
+            'Tree configuration missing childer and parent field' => [
+                [
+                    'internal_type' => 'db',
+                    'foreign_table' => 'foo',
+                    'treeConfig' => [],
+                ],
+                1288215889
+            ],
+        ];
     }
 
     /**
      * @param array $tcaConfiguration
+     * @param string $expectedExceptionCode
      * @test
      * @dataProvider invalidConfigurationDataProvider
-     * @expectedException \InvalidArgumentException
      */
-    public function factoryThrowsExceptionIfInvalidConfigurationIsGiven(array $tcaConfiguration)
+    public function factoryThrowsExceptionIfInvalidConfigurationIsGiven(array $tcaConfiguration, $expectedExceptionCode)
     {
-        $this->subject->getDataProvider($tcaConfiguration, 'foo', 'bar', array('uid' => 1));
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode($expectedExceptionCode);
+
+        $this->subject->getDataProvider($tcaConfiguration, 'foo', 'bar', ['uid' => 1]);
     }
 
     /**
@@ -93,8 +114,11 @@ class TreeDataProviderFactoryTest extends UnitTestCase
     {
         $dataProviderMockClassName = TreeDataProviderFixture::class;
 
-        $tcaConfiguration = array('treeConfig' => array('dataProvider' => $dataProviderMockClassName), 'internal_type' => 'foo');
-        $dataProvider = $this->subject->getDataProvider($tcaConfiguration, 'foo', 'bar', array('uid' => 1));
+        $tcaConfiguration = [
+            'treeConfig' => ['dataProvider' => $dataProviderMockClassName],
+            'internal_type' => 'foo'
+        ];
+        $dataProvider = $this->subject->getDataProvider($tcaConfiguration, 'foo', 'bar', ['uid' => 1]);
 
         $this->assertInstanceOf($dataProviderMockClassName, $dataProvider);
     }
@@ -114,6 +138,6 @@ class TreeDataProviderFactoryTest extends UnitTestCase
         ];
         $this->expectException(\RuntimeException::class);
         $this->expectExceptionCode(1438875249);
-        $this->subject->getDataProvider($tcaConfiguration, 'foo', 'bar', array('uid' => 1));
+        $this->subject->getDataProvider($tcaConfiguration, 'foo', 'bar', ['uid' => 1]);
     }
 }
index bb8a2ff..7a6bcd0 100644 (file)
@@ -15,6 +15,8 @@ namespace TYPO3\CMS\Core\Tests\Unit\Type;
  */
 
 use TYPO3\CMS\Core\Tests\Unit\Type\Fixture\Enumeration;
+use TYPO3\CMS\Core\Type\Exception\InvalidEnumerationDefinitionException;
+use TYPO3\CMS\Core\Type\Exception\InvalidEnumerationValueException;
 
 /**
  * Test case
@@ -23,55 +25,67 @@ class EnumerationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 {
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Type\Exception\InvalidEnumerationValueException
      */
     public function constructorThrowsExceptionIfNoConstantsAreDefined()
     {
+        $this->expectException(InvalidEnumerationValueException::class);
+        $this->expectExceptionCode(1381512753);
+
         new Enumeration\MissingConstantsEnumeration();
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Type\Exception\InvalidEnumerationValueException
      */
     public function constructorThrowsExceptionIfInvalidValueIsRequested()
     {
+        $this->expectException(InvalidEnumerationValueException::class);
+        $this->expectExceptionCode(1381512761);
+
         new Enumeration\CompleteEnumeration('bar');
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Type\Exception\InvalidEnumerationValueException
      */
     public function loadValuesThrowsExceptionIfGivenValueIsNotAvailableInEnumeration()
     {
+        $this->expectException(InvalidEnumerationValueException::class);
+        $this->expectExceptionCode(1381512807);
+
         new Enumeration\MissingConstantsEnumeration(2);
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Type\Exception\InvalidEnumerationDefinitionException
      */
     public function loadValuesThrowsExceptionIfDisallowedTypeIsDefinedAsConstant()
     {
+        $this->expectException(InvalidEnumerationDefinitionException::class);
+        $this->expectExceptionCode(1381512797);
+
         new Enumeration\InvalidConstantEnumeration(1);
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Type\Exception\InvalidEnumerationValueException
      */
     public function loadValuesThrowsExceptionIfNoDefaultConstantIsDefinedAndNoValueIsGiven()
     {
+        $this->expectException(InvalidEnumerationValueException::class);
+        $this->expectExceptionCode(1381512753);
+
         new Enumeration\MissingDefaultEnumeration();
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Type\Exception\InvalidEnumerationDefinitionException
      */
     public function loadValuesThrowsExceptionIfValueIsDefinedMultipleTimes()
     {
+        $this->expectException(InvalidEnumerationDefinitionException::class);
+        $this->expectExceptionCode(1381512859);
+
         new Enumeration\DuplicateConstantValueEnumeration(1);
     }
 
@@ -127,10 +141,12 @@ class EnumerationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Core\Type\Exception\InvalidEnumerationValueException
      */
     public function setValueToAnInvalidValueThrowsException()
     {
+        $this->expectException(InvalidEnumerationValueException::class);
+        $this->expectExceptionCode(1381615295);
+
         $enumeration = $this->getAccessibleMock(
             \TYPO3\CMS\Core\Tests\Unit\Type\Fixture\Enumeration\CompleteEnumeration::class,
             array('dummy'),
index 5ed14d2..72e921b 100644 (file)
@@ -15,12 +15,13 @@ namespace TYPO3\CMS\Core\Tests\Unit\TypoScript;
  */
 
 use TYPO3\CMS\Core\Tests\Unit\Utility\AccessibleProxies\ExtensionManagementUtilityAccessibleProxy;
+use TYPO3\CMS\Core\Tests\UnitTestCase;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 
 /**
  * Testcase for \TYPO3\CMS\Core\TypoScript\TemplateService
  */
-class TemplateServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
+class TemplateServiceTest extends UnitTestCase
 {
     /**
      * @var \TYPO3\CMS\Core\TypoScript\TemplateService
@@ -151,7 +152,6 @@ class TemplateServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function updateRootlineDataWithInvalidNewRootlineThrowsException()
     {
@@ -165,6 +165,9 @@ class TemplateServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             1 => array('uid' => 2, 'title' => 'newTitle2'),
         );
 
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1370419654);
+
         $this->templateServiceMock->_set('rootLine', $originalRootline);
         $this->templateServiceMock->updateRootlineData($newInvalidRootline);
     }
index bb45b82..cbe8bed 100644 (file)
@@ -222,11 +222,13 @@ class ArrayUtilityTest extends UnitTestCase
     ///////////////////////
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function getValueByPathThrowsExceptionIfPathIsEmpty()
     {
-        ArrayUtility::getValueByPath(array(), '');
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1341397767);
+
+        ArrayUtility::getValueByPath([], '');
     }
 
     /**
@@ -285,12 +287,14 @@ class ArrayUtilityTest extends UnitTestCase
     /**
      * @test
      * @dataProvider getValueByPathInvalidPathDataProvider
-     * @expectedException \RuntimeException
      * @param array $array
      * @param string $path
      */
     public function getValueByPathThrowsExceptionIfPathNotExists(array $array, $path)
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1341397869);
+
         ArrayUtility::getValueByPath($array, $path);
     }
 
@@ -426,20 +430,24 @@ class ArrayUtilityTest extends UnitTestCase
     ///////////////////////
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function setValueByPathThrowsExceptionIfPathIsEmpty()
     {
-        ArrayUtility::setValueByPath(array(), '', null);
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1341406194);
+
+        ArrayUtility::setValueByPath([], '', null);
     }
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function setValueByPathThrowsExceptionIfPathIsNotAString()
     {
-        ArrayUtility::setValueByPath(array(), array('foo'), null);
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1341406402);
+
+        ArrayUtility::setValueByPath([], ['foo'], null);
     }
 
     /**
@@ -636,47 +644,57 @@ class ArrayUtilityTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function removeByPathThrowsExceptionIfPathIsEmpty()
     {
-        ArrayUtility::removeByPath(array(), '');
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1371757718);
+
+        ArrayUtility::removeByPath([], '');
     }
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function removeByPathThrowsExceptionIfPathIsNotAString()
     {
-        ArrayUtility::removeByPath(array(), array('foo'));
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1371757719);
+
+        ArrayUtility::removeByPath([], ['foo']);
     }
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function removeByPathThrowsExceptionWithEmptyPathSegment()
     {
-        $inputArray = array(
-            'foo' => array(
+        $inputArray = [
+            'foo' => [
                 'bar' => 42,
-            ),
-        );
+            ]
+        ];
+
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1371757720);
+
         ArrayUtility::removeByPath($inputArray, 'foo//bar');
     }
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function removeByPathThrowsExceptionIfPathDoesNotExistInArray()
     {
-        $inputArray = array(
-            'foo' => array(
+        $inputArray = [
+            'foo' => [
                 'bar' => 42,
-            ),
-        );
+            ]
+        ];
+
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1371758436);
+
         ArrayUtility::removeByPath($inputArray, 'foo/baz');
     }
 
@@ -939,11 +957,13 @@ class ArrayUtilityTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function sortArraysByKeyThrowsExceptionForNonExistingKey()
     {
-        ArrayUtility::sortArraysByKey(array(array('a'), array('a')), 'dummy');
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1373727309);
+
+        ArrayUtility::sortArraysByKey([['a'], ['a']], 'dummy');
     }
 
     ///////////////////////
@@ -990,15 +1010,18 @@ class ArrayUtilityTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function arrayExportThrowsExceptionIfObjectShouldBeExported()
     {
-        $array = array(
-            'foo' => array(
+        $array = [
+            'foo' => [
                 'bar' => new \stdClass()
-            )
-        );
+            ]
+        ];
+
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1342294987);
+
         ArrayUtility::arrayExport($array);
     }
 
index 7d1e21f..cb10847 100644 (file)
@@ -111,10 +111,12 @@ class ExtensionManagementUtilityTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \BadFunctionCallException
      */
     public function isLoadedThrowsExceptionIfExtensionIsNotLoaded()
     {
+        $this->expectException(\BadFunctionCallException::class);
+        $this->expectExceptionCode(1270853910);
+
         $this->assertFalse(ExtensionManagementUtility::isLoaded($this->getUniqueId('foobar'), true));
     }
 
@@ -123,10 +125,12 @@ class ExtensionManagementUtilityTest extends UnitTestCase
     ///////////////////////////////
     /**
      * @test
-     * @expectedException \BadFunctionCallException
      */
     public function extPathThrowsExceptionIfExtensionIsNotLoaded()
     {
+        $this->expectException(\BadFunctionCallException::class);
+        $this->expectExceptionCode(1365429656);
+
         $packageName = $this->getUniqueId('foo');
         /** @var PackageManager|\PHPUnit_Framework_MockObject_MockObject $packageManager */
         $packageManager = $this->getMock(PackageManager::class, array('isPackageActive'));
@@ -1084,57 +1088,69 @@ class ExtensionManagementUtilityTest extends UnitTestCase
     /////////////////////////////////////////
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function addTcaSelectItemThrowsExceptionIfTableIsNotOfTypeString()
     {
-        ExtensionManagementUtility::addTcaSelectItem(array(), 'foo', array());
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1303236963);
+
+        ExtensionManagementUtility::addTcaSelectItem([], 'foo', []);
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function addTcaSelectItemThrowsExceptionIfFieldIsNotOfTypeString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1303236964);
+
         ExtensionManagementUtility::addTcaSelectItem('foo', array(), array());
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function addTcaSelectItemThrowsExceptionIfRelativeToFieldIsNotOfTypeString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1303236965);
+
         ExtensionManagementUtility::addTcaSelectItem('foo', 'bar', array(), array());
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function addTcaSelectItemThrowsExceptionIfRelativePositionIsNotOfTypeString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1303236966);
+
         ExtensionManagementUtility::addTcaSelectItem('foo', 'bar', array(), 'foo', array());
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function addTcaSelectItemThrowsExceptionIfRelativePositionIsNotOneOfValidKeywords()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1303236967);
+
         ExtensionManagementUtility::addTcaSelectItem('foo', 'bar', array(), 'foo', 'not allowed keyword');
     }
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function addTcaSelectItemThrowsExceptionIfFieldIsNotFoundInTca()
     {
-        $GLOBALS['TCA'] = array();
-        ExtensionManagementUtility::addTcaSelectItem('foo', 'bar', array());
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1303237468);
+
+        $GLOBALS['TCA'] = [];
+        ExtensionManagementUtility::addTcaSelectItem('foo', 'bar', []);
     }
 
     /**
@@ -1269,10 +1285,12 @@ class ExtensionManagementUtilityTest extends UnitTestCase
     /////////////////////////////////////////
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function loadSingleExtLocalconfFilesRequiresExtLocalconfFileRegisteredInGlobalTypo3LoadedExt()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1340559079);
+
         $extensionName = $this->getUniqueId('foo');
         $packageManager = $this->createMockPackageManagerWithMockPackage($extensionName);
         $extLocalconfLocation = $packageManager->getPackage($extensionName)->getPackagePath() . 'ext_localconf.php';
@@ -1723,13 +1741,15 @@ class ExtensionManagementUtilityTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      * @dataProvider getExtensionVersionFaultyDataProvider
      * @param $key
      * @throws \TYPO3\CMS\Core\Package\Exception
      */
     public function getExtensionVersionForFaultyExtensionKeyThrowsException($key)
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1294586096);
+
         ExtensionManagementUtility::getExtensionVersion($key);
     }
 
@@ -1769,10 +1789,12 @@ class ExtensionManagementUtilityTest extends UnitTestCase
     /////////////////////////////////////////
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function loadExtensionThrowsExceptionIfExtensionIsLoaded()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1342345486);
+
         $extensionKey = $this->getUniqueId('test');
         $packageManager = $this->createMockPackageManagerWithMockPackage($extensionKey);
         ExtensionManagementUtility::setPackageManager($packageManager);
@@ -1784,10 +1806,12 @@ class ExtensionManagementUtilityTest extends UnitTestCase
     /////////////////////////////////////////
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function unloadExtensionThrowsExceptionIfExtensionIsNotLoaded()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1342345487);
+
         $packageName = $this->getUniqueId('foo');
         /** @var PackageManager|\PHPUnit_Framework_MockObject_MockObject $packageManager */
         $packageManager = $this->getMock(PackageManager::class, array('isPackageActive'));
@@ -1884,27 +1908,30 @@ class ExtensionManagementUtilityTest extends UnitTestCase
     public function addPluginSetsTcaCorrectlyForGivenExtKeyAsGlobal()
     {
         $extKey = 'indexed_search';
-        $GLOBALS['TYPO3_LOADED_EXT'] = array();
+        $GLOBALS['TYPO3_LOADED_EXT'] = [];
         $GLOBALS['TYPO3_LOADED_EXT'][$extKey]['ext_icon'] = 'foo.gif';
         $GLOBALS['_EXTKEY'] = $extKey;
-        $expectedTCA = array(
-            array(
+        $expectedTCA = [
+            [
                 'label',
                 $extKey,
                 'EXT:' . $extKey . '/foo.gif'
-            )
-        );
-        $GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['items'] = array();
-        ExtensionManagementUtility::addPlugin(array('label', $extKey));
+            ]
+        ];
+        $GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['items'] = [];
+        ExtensionManagementUtility::addPlugin(['label', $extKey]);
+
         $this->assertEquals($expectedTCA, $GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['items']);
     }
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function addPluginThrowsExceptionForMissingExtkey()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1404068038);
+
         ExtensionManagementUtility::addPlugin('test');
     }
 }
index a5b8322..1b00529 100644 (file)
@@ -1845,11 +1845,12 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      * @param string $hostNamePattern trusted hosts pattern
      * @test
      * @dataProvider hostnamesNotMatchingTrustedHostsConfigurationDataProvider
-     * @expectedException \UnexpectedValueException
-     * @expectedExceptionCode 1396795884
      */
     public function getIndpEnvForHostThrowsExceptionForNotAllowedHostnameValues($httpHost, $hostNamePattern)
     {
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1396795884);
+
         $_SERVER['HTTP_HOST'] = $httpHost;
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = $hostNamePattern;
         GeneralUtilityFixture::getIndpEnv('HTTP_HOST');
@@ -3263,28 +3264,34 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function mkdirDeepThrowsExceptionIfDirectoryCreationFails()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1170251401);
+
         GeneralUtility::mkdir_deep('http://localhost');
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function mkdirDeepThrowsExceptionIfBaseDirectoryIsNotOfTypeString()
     {
-        GeneralUtility::mkdir_deep(array());
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1303662955);
+
+        GeneralUtility::mkdir_deep([]);
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function mkdirDeepThrowsExceptionIfDeepDirectoryIsNotOfTypeString()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1303662956);
+
         GeneralUtility::mkdir_deep(PATH_site . 'typo3temp/foo', array());
     }
 
@@ -3904,55 +3911,67 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /////////////////////////////////////////////////////////////////////////////////////
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function makeInstanceWithEmptyClassNameThrowsException()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1288965219);
+
         GeneralUtility::makeInstance('');
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function makeInstanceWithNullClassNameThrowsException()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1288965219);
+
         GeneralUtility::makeInstance(null);
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function makeInstanceWithZeroStringClassNameThrowsException()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1288965219);
+
         GeneralUtility::makeInstance(0);
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function makeInstanceWithEmptyArrayThrowsException()
     {
-        GeneralUtility::makeInstance(array());
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1288965219);
+
+        GeneralUtility::makeInstance([]);
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function makeInstanceWithNonEmptyArrayThrowsException()
     {
-        GeneralUtility::makeInstance(array('foo'));
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1288965219);
+
+        GeneralUtility::makeInstance(['foo']);
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function makeInstanceWithBeginningSlashInClassNameThrowsException()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1420281366);
+
         GeneralUtility::makeInstance('\\TYPO3\\CMS\\Backend\\Controller\\BackendController');
     }
 
@@ -4027,20 +4046,24 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function setSingletonInstanceForEmptyClassNameThrowsException()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1288967479);
+
         $instance = $this->getMock(\TYPO3\CMS\Core\SingletonInterface::class);
         GeneralUtility::setSingletonInstance('', $instance);
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function setSingletonInstanceForClassThatIsNoSubclassOfProvidedClassThrowsException()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1288967686);
+
         $instance = $this->getMock(\TYPO3\CMS\Core\SingletonInterface::class, array('foo'));
         $singletonClassName = get_class($this->getMock(\TYPO3\CMS\Core\SingletonInterface::class));
         GeneralUtility::setSingletonInstance($singletonClassName, $instance);
@@ -4113,20 +4136,24 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function addInstanceForEmptyClassNameThrowsException()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1288967479);
+
         $instance = $this->getMock('foo');
         GeneralUtility::addInstance('', $instance);
     }
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function addInstanceForClassThatIsNoSubclassOfProvidedClassThrowsException()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1288967686);
+
         $instance = $this->getMock('foo', array('bar'));
         $singletonClassName = get_class($this->getMock('foo'));
         GeneralUtility::addInstance($singletonClassName, $instance);
@@ -4134,10 +4161,12 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \InvalidArgumentException
      */
     public function addInstanceWithSingletonInstanceThrowsException()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1288969325);
+
         $instance = $this->getMock(\TYPO3\CMS\Core\SingletonInterface::class);
         GeneralUtility::addInstance(get_class($instance), $instance);
     }
@@ -4431,10 +4460,14 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      * @dataProvider callUserFunctionInvalidParameterDataprovider
-     * @expectedException \InvalidArgumentException
+     * @param string $functionName
+     * @param integer $expectedException
      */
-    public function callUserFunctionWillThrowExceptionForInvalidParameters($functionName)
+    public function callUserFunctionWillThrowExceptionForInvalidParameters($functionName, $expectedException)
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode($expectedException);
+
         $inputData = array('foo' => 'bar');
         GeneralUtility::callUserFunction($functionName, $inputData, $this, 'user_', 2);
     }
@@ -4448,11 +4481,11 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function callUserFunctionInvalidParameterDataprovider()
     {
         return array(
-            'Function is not prefixed' => array('t3lib_divTest->calledUserFunction'),
-            'Class doesn\'t exists' => array('t3lib_divTest21345->user_calledUserFunction'),
-            'No method name' => array('t3lib_divTest'),
-            'No class name' => array('->user_calledUserFunction'),
-            'No function name' => array('')
+            'Function is not prefixed' => ['t3lib_divTest->calledUserFunction', 1294585866],
+            'Class doesn\'t exists' => ['t3lib_divTest21345->user_calledUserFunction', 1294585866],
+            'No method name' => ['t3lib_divTest', 1294585867],
+            'No class name' => ['->user_calledUserFunction', 1294585866],
+            'No function name' => ['', 1294585867]
         );
     }
 
index b0898b6..5c5051e 100644 (file)
@@ -95,10 +95,12 @@ class RootlineUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
      */
     public function processMountedPageWithNonMountedPageThrowsException()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1343464100);
+
         $this->subject->__construct(1, '1-99');
         $this->subject->_call('processMountedPage', array('uid' => 1), array('uid' => 99, 'doktype' => \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_DEFAULT));
     }
index 188ed9d..56ff978 100644 (file)
@@ -79,32 +79,34 @@ class StringUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function endsWithReturnsThrowsExceptionWithInvalidArgumentsDataProvider()
     {
-        return array(
-            'array is not part of string' => array('string', array()),
-            'NULL is not part of string' => array('string', null),
-            'empty string is not part of string' => array('string', ''),
-            'string is not part of array' => array(array(), 'string'),
-            'NULL is not part of array' => array(array(), null),
-            'string is not part of NULL' => array(null, 'string'),
-            'array is not part of NULL' => array(null, array()),
-            'integer is not part of NULL' => array(null, 0),
-            'empty string is not part of NULL' => array(null, ''),
-            'NULL is not part of empty string' => array('', null),
-            'FALSE is not part of empty string' => array('', false),
-            'empty string is not part of FALSE' => array(false, ''),
-            'empty string is not part of integer' => array(0, ''),
-            'string is not part of object' => array(new \stdClass(), 'foo'),
-            'object is not part of string' => array('foo', new \stdClass()),
-        );
+        return [
+            'array is not part of string' => ['string', [], 1347135545],
+            'NULL is not part of string' => ['string', null, 1347135545],
+            'empty string is not part of string' => ['string', '', 1347135545],
+            'string is not part of array' => [[], 'string', 1347135544],
+            'NULL is not part of array' => [[], null, 1347135544],
+            'string is not part of NULL' => [null, 'string', 1347135544],
+            'array is not part of NULL' => [null, [], 1347135544],
+            'integer is not part of NULL' => [null, 0, 1347135544],
+            'empty string is not part of NULL' => [null, '', 1347135544],
+            'NULL is not part of empty string' => ['', null, 1347135545],
+            'FALSE is not part of empty string' => ['', false, 1347135545],
+            'empty string is not part of FALSE' => [false, '', 1347135545],
+            'empty string is not part of integer' => [0, '', 1347135545],
+            'string is not part of object' => [new \stdClass(), 'foo', 1347135544],
+            'object is not part of string' => ['foo', new \stdClass(), 1347135545],
+        ];
     }
 
     /**
      * @test
      * @dataProvider endsWithReturnsThrowsExceptionWithInvalidArgumentsDataProvider
-     * @expectedException \InvalidArgumentException
      */
-    public function endsWithReturnsThrowsExceptionWithInvalidArguments($string, $part)
+    public function endsWithReturnsThrowsExceptionWithInvalidArguments($string, $part, $expectedException)
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode($expectedException);
+
         StringUtility::endsWith($string, $part);
     }
 
@@ -164,32 +166,39 @@ class StringUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function beginsWithReturnsInvalidArgumentDataProvider()
     {
-        return array(
-            'array is not part of string' => array('string', array()),
-            'NULL is not part of string' => array('string', null),
-            'empty string is not part of string' => array('string', ''),
-            'string is not part of array' => array(array(), 'string'),
-            'NULL is not part of array' => array(array(), null),
-            'string is not part of NULL' => array(null, 'string'),
-            'array is not part of NULL' => array(null, array()),
-            'integer is not part of NULL' => array(null, 0),
-            'empty string is not part of NULL' => array(null, ''),
-            'NULL is not part of empty string' => array('', null),
-            'FALSE is not part of empty string' => array('', false),
-            'empty string is not part of FALSE' => array(false, ''),
-            'empty string is not part of integer' => array(0, ''),
-            'string is not part of object' => array(new \stdClass(), 'foo'),
-            'object is not part of string' => array('foo', new \stdClass()),
-        );
+        return [
+            'array is not part of string' => ['string', [], 1347135547],
+            'NULL is not part of string' => ['string', null, 1347135547],
+            'empty string is not part of string' => ['string', '', 1347135547],
+            'string is not part of array' => [[], 'string', 1347135546],
+            'NULL is not part of array' => [[], null, 1347135546],
+            'string is not part of NULL' => [null, 'string', 1347135546],
+            'array is not part of NULL' => [null, [], 1347135546],
+            'integer is not part of NULL' => [null, 0, 1347135546],
+            'empty string is not part of NULL' => [null, '', 1347135546],
+            'NULL is not part of empty string' => ['', null, 1347135547],
+            'FALSE is not part of empty string' => ['', false, 1347135547],
+            'empty string is not part of FALSE' => [false, '', 1347135547],
+            'empty string is not part of integer' => [0, '', 1347135547],
+            'string is not part of object' => [new \stdClass(), 'foo', 1347135546],
+            'object is not part of string' => ['foo', new \stdClass(), 1347135547],
+        ];
     }
 
     /**
      * @test
      * @dataProvider beginsWithReturnsInvalidArgumentDataProvider
-     * @expectedException \InvalidArgumentException
+     *
+     * @param mixed $string
+     * @param mixed $part
+     * @param integer $expectedException
      */
-    public function beginsWithReturnsThrowsExceptionWithInvalidArguments($string, $part)
+
+    public function beginsWithReturnsThrowsExceptionWithInvalidArguments($string, $part, $expectedException)
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode($expectedException);
+
         StringUtility::beginsWith($string, $part);
     }